primitivus: do not display the presence/status dialog if the profile is not connected

This commit is contained in:
souliane 2014-03-25 17:26:31 +01:00
commit 13586ac57b

View file

@ -41,12 +41,16 @@ class StatusBar(urwid.Columns):
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)