comparison browser_side/panels.py @ 255:da0487f0a2e7

browser_side: small changes to prepare the contact group manager: - group and contact lists are sorted - avoid adding empty group in the "Add group" panel - allow to show/hide the contact panel from another class
author souliane <souliane@mailoo.org>
date Sat, 09 Nov 2013 15:31:39 +0100
parents c24715dcd2f6
children 533d68585866
comparison
equal deleted inserted replaced
254:28d3315a8003 255:da0487f0a2e7
112 def addKey(self, key): 112 def addKey(self, key):
113 return 113 return
114 #self.getCompletionItems().completions.append(key) 114 #self.getCompletionItems().completions.append(key)
115 115
116 def removeKey(self, key): 116 def removeKey(self, key):
117 return
118 # TODO: investigate why AutoCompleteTextBox doesn't work here,
119 # maybe it can work on a TextBox but no TextArea. Remove addKey
120 # and removeKey methods if they don't serve anymore.
117 try: 121 try:
118 self.getCompletionItems().completions.remove(key) 122 self.getCompletionItems().completions.remove(key)
119 except KeyError: 123 except KeyError:
120 print "WARNING: trying to remove an unknown key" 124 print "WARNING: trying to remove an unknown key"
121 125
888 status = host.status_panel 892 status = host.status_panel
889 893
890 # contacts 894 # contacts
891 self._contacts = HorizontalPanel() 895 self._contacts = HorizontalPanel()
892 self._contacts.addStyleName('globalLeftArea') 896 self._contacts.addStyleName('globalLeftArea')
893 contacts_switch = Button(u'«', self._contactsSwitch) 897 self.contacts_switch = Button(u'«', self._contactsSwitch)
894 contacts_switch.addStyleName('contactsSwitch') 898 self.contacts_switch.addStyleName('contactsSwitch')
895 self._contacts.add(contacts_switch) 899 self._contacts.add(self.contacts_switch)
896 self._contacts.add(self.host.contact_panel) 900 self._contacts.add(self.host.contact_panel)
897 901
898 # tabs 902 # tabs
899 self.tab_panel = base_widget.MainTabPanel(host) 903 self.tab_panel = base_widget.MainTabPanel(host)
900 self.discuss_panel = base_widget.WidgetsPanel(self.host, locked=True) 904 self.discuss_panel = base_widget.WidgetsPanel(self.host, locked=True)
914 self.add(self._hpanel) 918 self.add(self._hpanel)
915 919
916 self.setWidth("100%") 920 self.setWidth("100%")
917 Window.addWindowResizeListener(self) 921 Window.addWindowResizeListener(self)
918 922
919 def _contactsSwitch(self, btn): 923 def _contactsSwitch(self, btn=None):
920 """ (Un)hide contacts panel """ 924 """ (Un)hide contacts panel """
925 if btn is None:
926 btn = self.contacts_switch
921 cpanel = self.host.contact_panel 927 cpanel = self.host.contact_panel
922 cpanel.setVisible(not cpanel.getVisible()) 928 cpanel.setVisible(not cpanel.getVisible())
923 btn.setText(u"«" if cpanel.getVisible() else u"»") 929 btn.setText(u"«" if cpanel.getVisible() else u"»")
924 self.host.resize() 930 self.host.resize()
925 931