changeset fc3ba8a03e40 in /home/hg/repos/gajim details:http://hg.gajim.org/gajim?cmd=changeset;node=fc3ba8a03e40 description: [whiteboard plugin] raise error when python-pygoocanvas is not installed
diffstat: plugins/whiteboard/manifest.ini | 2 +- plugins/whiteboard/plugin.py | 11 ++++++++++- plugins/whiteboard/whiteboard_widget.py | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diffs (83 lines): diff -r a06742cb90de -r fc3ba8a03e40 plugins/whiteboard/manifest.ini --- a/plugins/whiteboard/manifest.ini Mon Nov 01 14:35:32 2010 +0100 +++ b/plugins/whiteboard/manifest.ini Mon Nov 01 17:32:27 2010 +0100 @@ -2,6 +2,6 @@ name: Whiteboard short_name: whiteboard version: 0.1 -description: Shows a whiteboard in chat. +description: Shows a whiteboard in chat. python-pygoocanvas is required. authors = Yann Leboulanger <[email protected]> homepage = www.gajim.org diff -r a06742cb90de -r fc3ba8a03e40 plugins/whiteboard/plugin.py --- a/plugins/whiteboard/plugin.py Mon Nov 01 14:35:32 2010 +0100 +++ b/plugins/whiteboard/plugin.py Mon Nov 01 17:32:27 2010 +0100 @@ -31,6 +31,7 @@ from common import helpers from common import gajim from plugins import GajimPlugin +from plugins.plugin import GajimPluginException from plugins.helpers import log_calls, log import common.xmpp import gtk @@ -40,7 +41,7 @@ from common.jingle_content import JingleContent from common.jingle_transport import JingleTransport, TransportType import dialogs -from whiteboard_widget import Whiteboard +from whiteboard_widget import Whiteboard, HAS_GOOCANVAS from common import xmpp from common import caps_cache @@ -81,6 +82,8 @@ @log_calls('WhiteboardPlugin') def activate(self): + if not HAS_GOOCANVAS: + raise GajimPluginException('python-pygoocanvas is missing!') if NS_JINGLE_SXE not in gajim.gajim_common_features: gajim.gajim_common_features.append(NS_JINGLE_SXE) if NS_SXE not in gajim.gajim_common_features: @@ -155,6 +158,8 @@ @log_calls('WhiteboardPlugin') def _nec_jingle_received(self, obj): + if not HAS_GOOCANVAS: + return content_types = set(c[0] for c in obj.contents) if 'xhtml' not in content_types: return @@ -163,6 +168,8 @@ @log_calls('WhiteboardPlugin') def _nec_jingle_connected(self, obj): + if not HAS_GOOCANVAS: + return account = obj.conn.name ctrl = (gajim.interface.msg_win_mgr.get_control(obj.fjid, account) or gajim.interface.msg_win_mgr.get_control(obj.jid, account)) @@ -185,6 +192,8 @@ @log_calls('WhiteboardPlugin') def _nec_raw_message(self, obj): + if not HAS_GOOCANVAS: + return if obj.stanza.getTag('sxe', namespace=NS_SXE): account = obj.conn.name diff -r a06742cb90de -r fc3ba8a03e40 plugins/whiteboard/whiteboard_widget.py --- a/plugins/whiteboard/whiteboard_widget.py Mon Nov 01 14:35:32 2010 +0100 +++ b/plugins/whiteboard/whiteboard_widget.py Mon Nov 01 17:32:27 2010 +0100 @@ -20,7 +20,11 @@ import gtk import gtkgui_helpers -import goocanvas +try: + import goocanvas + HAS_GOOCANVAS = True +except: + HAS_GOOCANVAS = False from common.xmpp import Node from common import gajim from common import i18n _______________________________________________ Commits mailing list [email protected] http://lists.gajim.org/cgi-bin/listinfo/commits
