diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2010-11-01 19:32:27 +0300 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2010-11-01 19:32:27 +0300 |
commit | ea0f12b2f577ce8f56205617480ee11d1b967056 (patch) | |
tree | b0a4a20d7296d16414cc6c83a236bd3418058019 /plugins | |
parent | ebde7d433395aabbd16e21df8bd2aa4b3be80b84 (diff) |
[whiteboard plugin] raise error when python-pygoocanvas is not installed
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/whiteboard/manifest.ini | 2 | ||||
-rw-r--r-- | plugins/whiteboard/plugin.py | 11 | ||||
-rw-r--r-- | plugins/whiteboard/whiteboard_widget.py | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/plugins/whiteboard/manifest.ini b/plugins/whiteboard/manifest.ini index 309d372f7..a9f67085e 100644 --- a/plugins/whiteboard/manifest.ini +++ b/plugins/whiteboard/manifest.ini @@ -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 <asterix@lagaule.org> homepage = www.gajim.org diff --git a/plugins/whiteboard/plugin.py b/plugins/whiteboard/plugin.py index 4251d353d..60aa896d2 100644 --- a/plugins/whiteboard/plugin.py +++ b/plugins/whiteboard/plugin.py @@ -31,6 +31,7 @@ Whiteboard plugin. 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_session import JingleSession 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 @@ class WhiteboardPlugin(GajimPlugin): @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 @@ class WhiteboardPlugin(GajimPlugin): @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 @@ class WhiteboardPlugin(GajimPlugin): @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 @@ class WhiteboardPlugin(GajimPlugin): @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 --git a/plugins/whiteboard/whiteboard_widget.py b/plugins/whiteboard/whiteboard_widget.py index f47835f83..30b00dfd3 100644 --- a/plugins/whiteboard/whiteboard_widget.py +++ b/plugins/whiteboard/whiteboard_widget.py @@ -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 |