# HG changeset patch # User souliane # Date 1384163084 -3600 # Node ID 30c01671e338219a93603c54e086d5cbd5e58704 # Parent 3df0c3634c2914e3853243f901ea9ba4fbe518ad browser_side: small changes for contact list and "add group" panel: - GenericContactList get a boolean argument "handleClick" to enable/disable the click handler at instanciation - textbox in "add group" panel can be accessed from outside diff -r 3df0c3634c29 -r 30c01671e338 browser_side/contact.py --- a/browser_side/contact.py Fri Nov 15 15:34:57 2013 +0100 +++ b/browser_side/contact.py Mon Nov 11 10:44:44 2013 +0100 @@ -50,7 +50,7 @@ class ContactLabel(DragLabel, HTML, ClickHandler): - def __init__(self, host, jid, name=None): + def __init__(self, host, jid, name=None, handleClick=True): HTML.__init__(self) self.host = host self.name = name or jid @@ -59,8 +59,9 @@ self._fill() self.setStyleName('contact') DragLabel.__init__(self, jid, "CONTACT") - ClickHandler.__init__(self) - self.addClickListener(self) + if handleClick: + ClickHandler.__init__(self) + self.addClickListener(self) def _fill(self): if self.waiting: @@ -107,10 +108,11 @@ the one that is displayed on the left side. Special features like popup menu panel or changing the contact states must be done in a sub-class.""" - def __init__(self, host): + def __init__(self, host, handleClick=False): VerticalPanel.__init__(self) self.host = host self.contacts = [] + self.handleClick = handleClick def add(self, jid, name=None, item_cb=None): if jid in self.contacts: @@ -121,7 +123,7 @@ break index += 1 self.contacts.insert(index, jid) - _item = ContactLabel(self.host, jid, name) + _item = ContactLabel(self.host, jid, name, handleClick=self.handleClick) DOM.setStyleAttribute(_item.getElement(), "cursor", "pointer") VerticalPanel.insert(self, _item, index) if item_cb is not None: @@ -154,7 +156,7 @@ """The contact list that is displayed on the left side.""" def __init__(self, host): - GenericContactList.__init__(self, host) + GenericContactList.__init__(self, host, handleClick=True) self.menu_entries = {"blog": {"title": "Public blog..."}} self.context_menu = PopupMenuPanel(entries=self.menu_entries, hide=self.contextMenuHide, diff -r 3df0c3634c29 -r 30c01671e338 browser_side/dialog.py --- a/browser_side/dialog.py Fri Nov 15 15:34:57 2013 +0100 +++ b/browser_side/dialog.py Mon Nov 11 10:44:44 2013 +0100 @@ -291,9 +291,9 @@ HorizontalPanel.__init__(self) self.groups = groups self.add(Label('Add group:')) - textbox = ExtTextBox(enter_cb=self.onGroupInput) - self.add(textbox) - self.add(Button("add", lambda sender: self.onGroupInput(textbox))) + self.textbox = ExtTextBox(enter_cb=self.onGroupInput) + self.add(self.textbox) + self.add(Button("add", lambda sender: self.onGroupInput(self.textbox))) self.cb = cb def onGroupInput(self, sender):