comparison cagou/plugins/plugin_wid_contact_list.py @ 250:ff1efdeff53f

core: notifs can now have a custom icon and be clickable: - new host.doAction method, to open a specific widget/target (chat only for now) - when adding a notif, symbol can now be specified - an action can be linked to a notification - notifs design improvments - plugins contact list and chat use the new doAction/notif action - if None is given as old widget in SwitchWidget, the new getWidgetToSwitch method is used to select one to switch.
author Goffi <goffi@goffi.org>
date Sat, 26 Jan 2019 20:24:48 +0100
parents 9e5f9f0cee48
children 520fd0f50233
comparison
equal deleted inserted replaced
249:5d69e4cab925 250:ff1efdeff53f
115 115
116 def do_item_action(self, touch): 116 def do_item_action(self, touch):
117 assert self.profile 117 assert self.profile
118 # XXX: for now clicking on an item launch the corresponding Chat widget 118 # XXX: for now clicking on an item launch the corresponding Chat widget
119 # behaviour should change in the future 119 # behaviour should change in the future
120 try: 120 G.host.doAction(u'chat', jid.JID(self.jid), [self.profile])
121 # FIXME: Q&D way to get chat plugin, should be replaced by a clean method
122 # in host
123 plg_infos = [p for p in G.host.getPluggedWidgets()
124 if 'chat' in p['import_name']][0]
125 except IndexError:
126 log.warning(u"No plugin widget found to display chat")
127 else:
128 factory = plg_infos['factory']
129 G.host.switchWidget(self, factory(plg_infos,
130 jid.JID(self.jid),
131 profiles=[self.profile]))
132 121
133 def getMenuChoices(self): 122 def getMenuChoices(self):
134 choices = [] 123 choices = []
135 choices.append(dict(text=_(u'delete'), 124 choices.append(dict(text=_(u'delete'),
136 index=len(choices)+1, 125 index=len(choices)+1,