Mercurial > libervia-web
comparison browser_side/panels.py @ 179:8475a29d7214
closing a group chat widget now leave the muc room (bug 11)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 26 Jan 2013 00:36:57 +0100 |
parents | 7a349be99a77 |
children | c0b78a3af06d |
comparison
equal
deleted
inserted
replaced
178:7a349be99a77 | 179:8475a29d7214 |
---|---|
112 self.host.bridge.call('getMassiveLastMblogs', _new_panel.massiveInsert, 'ALL', [], 10) | 112 self.host.bridge.call('getMassiveLastMblogs', _new_panel.massiveInsert, 'ALL', [], 10) |
113 else: | 113 else: |
114 return False | 114 return False |
115 if isinstance(self, LiberviaWidget): | 115 if isinstance(self, LiberviaWidget): |
116 self.host.unregisterWidget(self) | 116 self.host.unregisterWidget(self) |
117 self.onQuit() | |
117 if not isinstance(_new_panel, LiberviaWidget): | 118 if not isinstance(_new_panel, LiberviaWidget): |
118 print ('WARNING: droping an object which is not a class of LiberviaWidget') | 119 print ('WARNING: droping an object which is not a class of LiberviaWidget') |
119 _flextable = self.getParent() | 120 _flextable = self.getParent() |
120 _widgetspanel = _flextable.getParent().getParent() | 121 _widgetspanel = _flextable.getParent().getParent() |
121 row_idx, cell_idx = self._getCellAndRow(_flextable, event) | 122 row_idx, cell_idx = self._getCellAndRow(_flextable, event) |
181 | 182 |
182 def onClick(self, sender): | 183 def onClick(self, sender): |
183 self.host.select(self) | 184 self.host.select(self) |
184 | 185 |
185 def onClose(self, sender): | 186 def onClose(self, sender): |
187 """ Called when the close button is pushed """ | |
186 _widgetspanel = self._getWidgetsPanel() | 188 _widgetspanel = self._getWidgetsPanel() |
187 _widgetspanel.removeWidget(self) | 189 _widgetspanel.removeWidget(self) |
190 self.onQuit() | |
191 | |
192 def onQuit(self): | |
193 """ Called when the widget is actually ending """ | |
194 pass | |
188 | 195 |
189 def onSetting(self, sender): | 196 def onSetting(self, sender): |
190 widpanel = self._getWidgetsPanel() | 197 widpanel = self._getWidgetsPanel() |
191 row, col = widpanel.getIndex(self) | 198 row, col = widpanel.getIndex(self) |
192 body = VerticalPanel() | 199 body = VerticalPanel() |
681 self.occupants_list.clear() | 688 self.occupants_list.clear() |
682 AbsolutePanel.clear(self) | 689 AbsolutePanel.clear(self) |
683 | 690 |
684 class ChatPanel(LiberviaWidget): | 691 class ChatPanel(LiberviaWidget): |
685 | 692 |
686 def __init__(self, host, target, type='one2one'): | 693 def __init__(self, host, target, type_='one2one'): |
687 """Panel used for conversation (one 2 one or group chat) | 694 """Panel used for conversation (one 2 one or group chat) |
688 @param host: SatWebFrontend instance | 695 @param host: SatWebFrontend instance |
689 @param target: entity (JID) with who we have a conversation (contact's jid for one 2 one chat, or MUC room) | 696 @param target: entity (JID) with who we have a conversation (contact's jid for one 2 one chat, or MUC room) |
690 @param type: one2one for simple conversation, group for MUC""" | 697 @param type: one2one for simple conversation, group for MUC""" |
691 LiberviaWidget.__init__(self, host, target.bare, selectable = True) | 698 LiberviaWidget.__init__(self, host, target.bare, selectable = True) |
692 self.vpanel = VerticalPanel() | 699 self.vpanel = VerticalPanel() |
693 self.vpanel.setSize('100%','100%') | 700 self.vpanel.setSize('100%','100%') |
694 self.type = type | 701 self.type = type_ |
695 self.nick = None | 702 self.nick = None |
696 if not target: | 703 if not target: |
697 print "ERROR: Empty target !" | 704 print "ERROR: Empty target !" |
698 return | 705 return |
699 self.target = target | 706 self.target = target |
700 self.__body = AbsolutePanel() | 707 self.__body = AbsolutePanel() |
701 self.__body.setStyleName('chatPanel_body') | 708 self.__body.setStyleName('chatPanel_body') |
702 chat_area = HorizontalPanel() | 709 chat_area = HorizontalPanel() |
703 chat_area.setStyleName('chatArea') | 710 chat_area.setStyleName('chatArea') |
704 if type == 'group': | 711 if type_ == 'group': |
705 self.occupants_list = OccupantsList() | 712 self.occupants_list = OccupantsList() |
706 chat_area.add(self.occupants_list) | 713 chat_area.add(self.occupants_list) |
707 self.__body.add(chat_area) | 714 self.__body.add(chat_area) |
708 self.content = AbsolutePanel() | 715 self.content = AbsolutePanel() |
709 self.content.setStyleName('chatContent') | 716 self.content.setStyleName('chatContent') |
721 | 728 |
722 def doAttachChildren(self): | 729 def doAttachChildren(self): |
723 #We need to force the use of a panel subclass method here, else | 730 #We need to force the use of a panel subclass method here, else |
724 #the event will not propagate to children | 731 #the event will not propagate to children |
725 ScrollPanelWrapper.doAttachChildren(self)""" | 732 ScrollPanelWrapper.doAttachChildren(self)""" |
733 | |
734 def onQuit(self): | |
735 LiberviaWidget.onQuit(self) | |
736 if self.type == 'group': | |
737 self.host.bridge.call('mucLeave', None, self.target.bare) | |
738 | |
726 | 739 |
727 def setUserNick(self, nick): | 740 def setUserNick(self, nick): |
728 """Set the nick of the user, usefull for e.g. change the color of the user""" | 741 """Set the nick of the user, usefull for e.g. change the color of the user""" |
729 self.nick = nick | 742 self.nick = nick |
730 | 743 |