comparison browser_side/menu.py @ 210:3092f6b1710c

browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...) fix bug 15 fix bug 33
author souliane <souliane@mailoo.org>
date Fri, 06 Sep 2013 15:40:33 +0200
parents a50ce9c06e0e
children e830a0c60d32
comparison
equal deleted inserted replaced
209:4564c7bc06a7 210:3092f6b1710c
145 menu_games.addItem("Xiangqi", MenuCmd(self, "onXiangqiGame")) 145 menu_games.addItem("Xiangqi", MenuCmd(self, "onXiangqiGame"))
146 146
147 menu_help = MenuBar(vertical=True) 147 menu_help = MenuBar(vertical=True)
148 menu_help.addItem("Social contract", MenuCmd(self, "onSocialContract")) 148 menu_help.addItem("Social contract", MenuCmd(self, "onSocialContract"))
149 menu_help.addItem("About", MenuCmd(self, "onAbout")) 149 menu_help.addItem("About", MenuCmd(self, "onAbout"))
150 150
151 menu_settings = MenuBar(vertical=True) 151 menu_settings = MenuBar(vertical=True)
152 #menu_settings.addItem("Parameters", MenuCmd(self, "onParameters")) 152 menu_settings.addItem("Parameters", MenuCmd(self, "onParameters"))
153 menu_settings.addItem("Upload avatar", MenuCmd(self, "onAvatarUpload")) # XXX: temporary, will change when a full profile will be managed in SàT 153 menu_settings.addItem("Upload avatar", MenuCmd(self, "onAvatarUpload")) # XXX: temporary, will change when a full profile will be managed in SàT
154 154
155 menubar = LiberviaMenuBar() 155 menubar = LiberviaMenuBar()
156 156
157 for _name, _icon, _menu in [('General', 'home', menu_general), 157 for _name, _icon, _menu in [('General', 'home', menu_general),
218 self.host.bridge.call('addContact', None, edit.getText(), '', _dialog.getSelectedGroups() ) 218 self.host.bridge.call('addContact', None, edit.getText(), '', _dialog.getSelectedGroups() )
219 219
220 label = Label("new contact identifier (JID):") 220 label = Label("new contact identifier (JID):")
221 edit.setText('@libervia.org') 221 edit.setText('@libervia.org')
222 edit.setWidth('100%') 222 edit.setWidth('100%')
223 _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [], addContactCb) 223 _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [],
224 "Add", addContactCb)
224 _dialog.setHTML('Adding contact') 225 _dialog.setHTML('Adding contact')
225 _dialog.show() 226 _dialog.show()
226 227
227 def onUpdateContact(self): 228 def onUpdateContact(self):
228 _dialog = None 229 _dialog = None
241 _contacts_list.addItem(contact) 242 _contacts_list.addItem(contact)
242 _contacts_list.addChangeListener(onContactChange) 243 _contacts_list.addChangeListener(onContactChange)
243 _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex()) 244 _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
244 _selected_groups = self.host.contact_panel.getContactGroups(_jid) 245 _selected_groups = self.host.contact_panel.getContactGroups(_jid)
245 _dialog = dialog.GroupSelector([Label('Which contact do you want to update ?'), _contacts_list], 246 _dialog = dialog.GroupSelector([Label('Which contact do you want to update ?'), _contacts_list],
246 self.host.contact_panel.getGroups(), _selected_groups, updateContactCb) 247 self.host.contact_panel.getGroups(), _selected_groups,
248 "Update", updateContactCb)
247 _dialog.setHTML('Updating contact') 249 _dialog.setHTML('Updating contact')
248 _dialog.show() 250 _dialog.show()
249 251
250 def onRemoveContact(self): 252 def onRemoveContact(self):
251 _dialog = None 253 _dialog = None
327 body = XMLUI(self.host, xmlui) 329 body = XMLUI(self.host, xmlui)
328 _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE']) 330 _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE'])
329 body.setCloseCb(_dialog.close) 331 body.setCloseCb(_dialog.close)
330 _dialog.setSize('80%', '80%') 332 _dialog.setSize('80%', '80%')
331 _dialog.show() 333 _dialog.show()
332
333 self.host.bridge.call('getParamsUI', gotParams) 334 self.host.bridge.call('getParamsUI', gotParams)
334 335
335 def onAvatarUpload(self): 336 def onAvatarUpload(self):
336 body = AvatarUpload() 337 body = AvatarUpload()
337 _dialog = dialog.GenericDialog("Avatar upload", body, options=['NO_CLOSE']) 338 _dialog = dialog.GenericDialog("Avatar upload", body, options=['NO_CLOSE'])
338 body.setCloseCb(_dialog.close) 339 body.setCloseCb(_dialog.close)
339 _dialog.setSize('40%', '40%') 340 _dialog.setSize('40%', '40%')
340 341 _dialog.show()
341 _dialog.show()
342