Mercurial > libervia-backend
comparison frontends/wix/chat.py @ 76:8becde8a967c
MUC: added subject management
- plugin xep-0045: added roomNewSubject signal
- wix: added subject bar for group windows
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 30 Mar 2010 13:15:05 +1100 |
parents | 7322a41f8a8e |
children | 1ae680f9682e |
comparison
equal
deleted
inserted
replaced
75:7322a41f8a8e | 76:8becde8a967c |
---|---|
41 | 41 |
42 self.splitter = wx.SplitterWindow(self, -1) | 42 self.splitter = wx.SplitterWindow(self, -1) |
43 | 43 |
44 self.conv_panel = wx.Panel(self.splitter) | 44 self.conv_panel = wx.Panel(self.splitter) |
45 self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL) | 45 self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL) |
46 self.subjectBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_READONLY) | |
46 self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY) | 47 self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY) |
47 self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER) | 48 self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER) |
49 self.conv_panel.sizer.Add(self.subjectBox, flag=wx.EXPAND) | |
48 self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND) | 50 self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND) |
49 self.conv_panel.sizer.Add(self.textBox, flag=wx.EXPAND) | 51 self.conv_panel.sizer.Add(self.textBox, flag=wx.EXPAND) |
50 self.conv_panel.SetSizer(self.conv_panel.sizer) | 52 self.conv_panel.SetSizer(self.conv_panel.sizer) |
51 self.splitter.Initialize(self.conv_panel) | 53 self.splitter.Initialize(self.conv_panel) |
52 self.setType(self.type) | 54 self.setType(self.type) |
53 | 55 |
54 self.createMenus() | 56 self.__createMenus() |
55 | 57 |
56 #events | 58 #events |
57 self.Bind(wx.EVT_CLOSE, self.onClose, self) | 59 self.Bind(wx.EVT_CLOSE, self.onClose, self) |
58 self.Bind(wx.EVT_TEXT_ENTER, self.onEnterPressed, self.textBox) | 60 self.Bind(wx.EVT_TEXT_ENTER, self.onEnterPressed, self.textBox) |
59 | 61 |
81 | 83 |
82 def setType(self, type): | 84 def setType(self, type): |
83 QuickChat.setType(self, type) | 85 QuickChat.setType(self, type) |
84 if type is 'group' and not self.splitter.IsSplit(): | 86 if type is 'group' and not self.splitter.IsSplit(): |
85 self.__createPresents() | 87 self.__createPresents() |
88 self.subjectBox.Show() | |
86 elif type is 'one2one' and self.splitter.IsSplit(): | 89 elif type is 'one2one' and self.splitter.IsSplit(): |
87 self.splitter.Unsplit(self.present_panel) | 90 self.splitter.Unsplit(self.present_panel) |
88 del self.present_panel | 91 del self.present_panel |
92 else: | |
93 self.subjectBox.Hide() | |
89 | 94 |
90 def setPresents(self, nicks): | 95 def setPresents(self, nicks): |
91 """Set the users presents in the contact list for a group chat | 96 """Set the users presents in the contact list for a group chat |
92 @param nicks: list of nicknames | 97 @param nicks: list of nicknames |
93 """ | 98 """ |
113 if self.type != "group": | 118 if self.type != "group": |
114 error (_("[INTERNAL] trying to remove user for a non group chat window")) | 119 error (_("[INTERNAL] trying to remove user for a non group chat window")) |
115 return | 120 return |
116 self.present_panel.presents.remove(nick) | 121 self.present_panel.presents.remove(nick) |
117 | 122 |
123 def setSubject(self, subject): | |
124 """Set title for a group chat""" | |
125 debug(_("Setting subject to %s") % subject) | |
126 if self.type != "group": | |
127 error (_("[INTERNAL] trying to set subject for a non group chat window")) | |
128 return | |
129 self.subjectBox.SetValue(subject) | |
118 | 130 |
119 | 131 |
120 def createMenus(self): | 132 def __createMenus(self): |
121 info("Creating menus") | 133 info("Creating menus") |
122 actionMenu = wx.Menu() | 134 actionMenu = wx.Menu() |
123 actionMenu.Append(idSEND, _("&SendFile CTRL-s"),_(" Send a file to contact")) | 135 actionMenu.Append(idSEND, _("&SendFile CTRL-s"),_(" Send a file to contact")) |
124 menuBar = wx.MenuBar() | 136 menuBar = wx.MenuBar() |
125 menuBar.Append(actionMenu,_("&Action")) | 137 menuBar.Append(actionMenu,_("&Action")) |