frontends: set and retrieve your own presence and status
This commit is contained in:
parent
f5dd3f2265
commit
4d393d47c0
1 changed files with 145 additions and 22 deletions
|
|
@ -76,7 +76,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
style=wx.CB_DROPDOWN | wx.CB_READONLY)
|
||||
self.tools.AddControl(self.statusBox)
|
||||
self.tools.AddSeparator()
|
||||
self.statusTxt=wx.TextCtrl(self.tools, -1, style = wx.TE_PROCESS_ENTER)
|
||||
self.statusTxt = wx.TextCtrl(self.tools, -1, style=wx.TE_PROCESS_ENTER)
|
||||
self.tools.AddControl(self.statusTxt)
|
||||
self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt)
|
||||
|
|
@ -209,11 +209,20 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
data = [answer_data] if answer_data else []
|
||||
answer_cb(True if (answer == wx.ID_YES or answer == wx.ID_OK) else False, *data)
|
||||
|
||||
def setStatusOnline(self, online=True):
|
||||
def setStatusOnline(self, online=True, show="", statuses={}):
|
||||
"""enable/disable controls, must be called when local user online status change"""
|
||||
if online:
|
||||
self.SetStatusText(Const.msgONLINE)
|
||||
self.tools.Enable()
|
||||
try:
|
||||
presence = [x for x in Const.PRESENCE if x[0] == show][0][1]
|
||||
self.statusBox.SetValue(presence)
|
||||
except (TypeError, IndexError):
|
||||
pass
|
||||
try:
|
||||
self.statusTxt.SetValue(statuses['default'])
|
||||
except (TypeError, KeyError):
|
||||
pass
|
||||
else:
|
||||
self.SetStatusText(Const.msgOFFLINE)
|
||||
self.tools.Disable()
|
||||
|
|
@ -351,9 +360,9 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
self.bridge.disconnect(self.profile)
|
||||
|
||||
def __updateStatus(self):
|
||||
show = filter(lambda x:x[1] == self.statusBox.GetValue(), Const.PRESENCE)[0][0]
|
||||
status = self.statusTxt.GetValue()
|
||||
self.bridge.setPresence(show=show, statuses={'default':status}, profile_key=self.profile) #FIXME: manage multilingual statuses
|
||||
show = [x for x in Const.PRESENCE if x[1] == self.statusBox.GetValue()][0][0]
|
||||
status = self.statusTxt.GetValue()
|
||||
self.bridge.setPresence(show=show, statuses={'default': status}, profile_key=self.profile) #FIXME: manage multilingual statuses
|
||||
|
||||
def onStatusChange(self, e):
|
||||
debug(_("Status change request"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue