diff frontends/src/primitivus/status.py @ 937:255e6953b2c3

primitivus: do not display the presence/status dialog if the profile is not connected
author souliane <souliane@mailoo.org>
date Tue, 25 Mar 2014 17:26:31 +0100
parents 1fe00f0c9a91
children aa15453ec54d
line wrap: on
line diff
--- a/frontends/src/primitivus/status.py	Tue Mar 25 14:57:38 2014 +0100
+++ b/frontends/src/primitivus/status.py	Tue Mar 25 17:26:31 2014 +0100
@@ -41,12 +41,16 @@
         urwid.connect_signal(self.status, 'click', self.onStatusClick)
 
     def onPresenceClick(self, sender=None):
+        if not self.host.bridge.isConnected(self.host.profile):
+            return
         options = [commonConst.PRESENCE[presence] for presence in commonConst.PRESENCE]
         list_widget = sat_widgets.GenericList(options=options, option_type=sat_widgets.ClickableText, on_click=self.onChange)
         decorated = sat_widgets.LabelLine(list_widget, sat_widgets.SurroundedText(_('Set your presence')))
         self.host.showPopUp(decorated)
 
     def onStatusClick(self, sender=None):
+        if not self.host.bridge.isConnected(self.host.profile):
+            return
         pop_up_widget = sat_widgets.InputDialog(_('Set your status'), _('New status'), default_txt=self.status.get_text(),
                                                 cancel_cb=lambda dummy: self.host.removePopUp, ok_cb=self.onChange)
         self.host.showPopUp(pop_up_widget)