From 86598900afd14e0cbbd2abcac02ae8c992a6277b Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sat, 22 Sep 2007 14:50:25 +0000 Subject: add basic support for printer thanx to Jason Whitlark add support for different kind of message (error, warning, info) fix emacs encoding settings git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@141 3be567f1-68ff-0310-b24a-ad7cc433fd2f --- plugins/Makefile.am | 11 +++++++++-- plugins/printer.py.in | 28 ++++++++++++++++++++++++++++ src/modules/pluginutils.py | 8 ++++++-- tools/exec_wrapper.in | 2 +- 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 plugins/printer.py.in diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 77b9028..898d5cc 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -5,14 +5,16 @@ plugins = \ nautilus.py.in \ xvncviewer.py.in \ obby.py.in \ - ekiga.py.in + ekiga.py.in \ + printer.py.in plugins_DATA = \ gconfterminal.py \ nautilus.py \ xvncviewer.py \ obby.py \ - ekiga.py + ekiga.py \ + printer.py gconfterminal.py: gconfterminal.py.in sed \ @@ -39,6 +41,11 @@ ekiga.py: ekiga.py.in -e 's,@toolsdir\@,$(TOOLSDIR),g' \ $< > $@ +printer.py: printer.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + EXTRA_DIST = $(plugins) CLEANFILES = $(plugins_DATA) diff --git a/plugins/printer.py.in b/plugins/printer.py.in new file mode 100644 index 0000000..02fdffe --- /dev/null +++ b/plugins/printer.py.in @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# -*- python -*- +# Copyright (C) 2007 by Jason Whitlark +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +from sdapplet.pluginutils import * + +class plugin_printer: + def __init__(self): + self.service_type = ["_ipp._tcp", "_pdl-datastream._tcp", "_printer._tcp"] + self.author = "Jason Whitlark" + self.description = "Direct user to printer configuration applet" + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + msg = """Detected printers can be configured via the System->Administration->Printing menu""" + message(msg) + +def load(): + return plugin_printer() diff --git a/src/modules/pluginutils.py b/src/modules/pluginutils.py index f1e0ea4..d775b38 100644 --- a/src/modules/pluginutils.py +++ b/src/modules/pluginutils.py @@ -1,4 +1,4 @@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # -*- python -*- # Copyright (C) 2005 by Sebastien Estienne # @@ -18,8 +18,12 @@ import gtk pygtk.require('2.0') def error_msg(msg): + message(msg, "error") + +def message(msg, type="info"): + msg_type = eval("gtk.MESSAGE_%s" % type.upper()) d = gtk.MessageDialog(parent=None, flags=gtk.DIALOG_MODAL, - type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) + type=msg_type, buttons=gtk.BUTTONS_OK) d.set_markup(msg) d.show_all() d.run() diff --git a/tools/exec_wrapper.in b/tools/exec_wrapper.in index c9d85ac..ea74e4a 100644 --- a/tools/exec_wrapper.in +++ b/tools/exec_wrapper.in @@ -1,5 +1,5 @@ #!@PYTHON@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # -*- python -*- # Copyright (C) 2006 by Sebastien Estienne # -- cgit