comparison browser_side/list_manager.py @ 348:83454ba70a9c

browser_side: added a method setVisible to ListManager
author souliane <souliane@mailoo.org>
date Wed, 12 Feb 2014 14:51:13 +0100
parents ce5b33f499c5
children a71fcc27f231
comparison
equal deleted inserted replaced
347:f1ba38043d78 348:83454ba70a9c
36 36
37 from base_panels import PopupMenuPanel 37 from base_panels import PopupMenuPanel
38 38
39 39
40 # HTML content for the removal button (image or text) 40 # HTML content for the removal button (image or text)
41 REMOVE_BUTTON = '<span class="richTextRemoveIcon">x</span>' 41 REMOVE_BUTTON = '<span class="recipientRemoveIcon">x</span>'
42 42
43 # Item to be considered for an empty list box selection. 43 # Item to be considered for an empty list box selection.
44 # Could be whatever which doesn't look like a JID or a group name. 44 # Could be whatever which doesn't look like a JID or a group name.
45 EMPTY_SELECTION_ITEM = "" 45 EMPTY_SELECTION_ITEM = ""
46 46
139 139
140 if hasattr(self, "popup_menu"): 140 if hasattr(self, "popup_menu"):
141 # this is done if self.registerPopupMenuPanel has been called yet 141 # this is done if self.registerPopupMenuPanel has been called yet
142 self.popup_menu.registerClickSender(button) 142 self.popup_menu.registerClickSender(button)
143 143
144 def _refresh(self): 144 def _refresh(self, visible=True):
145 """Set visible the sub-panels that are non optional or non empty, hide the rest.""" 145 """Set visible the sub-panels that are non optional or non empty, hide the rest."""
146 for key in self.__children: 146 for key in self.__children:
147 self.setContactPanelVisible(key, False) 147 self.setContactPanelVisible(key, False)
148 if not visible:
149 return
148 _map = self.getContacts() 150 _map = self.getContacts()
149 for key in _map: 151 for key in _map:
150 if len(_map[key]) > 0 or not self.__keys_dict[key]["optional"]: 152 if len(_map[key]) > 0 or not self.__keys_dict[key]["optional"]:
151 self.setContactPanelVisible(key, True) 153 self.setContactPanelVisible(key, True)
154
155 def setVisible(self, visible):
156 self._refresh(visible)
152 157
153 def setContactPanelVisible(self, key, visible=True, sender=None): 158 def setContactPanelVisible(self, key, visible=True, sender=None):
154 """Do not remove the "sender" param as it is needed for the context menu.""" 159 """Do not remove the "sender" param as it is needed for the context menu."""
155 self.__children[key]["button"].setVisible(visible) 160 self.__children[key]["button"].setVisible(visible)
156 self.__children[key]["panel"].setVisible(visible) 161 self.__children[key]["panel"].setVisible(visible)