comparison frontends/wix/main_window.py @ 1:a06a151fc31f

Disconnect first draft
author Goffi <goffi@goffi.org>
date Sun, 18 Oct 2009 23:20:45 +0200
parents c4bc297b82f0
children 37153f3a3dc1
comparison
equal deleted inserted replaced
0:c4bc297b82f0 1:a06a151fc31f
34 34
35 35
36 msgOFFLINE = "offline" 36 msgOFFLINE = "offline"
37 msgONLINE = "online" 37 msgONLINE = "online"
38 idCONNECT = 1 38 idCONNECT = 1
39 idEXIT = 2 39 idDISCONNECT = 2
40 idPARAM = 3 40 idEXIT = 3
41 idADD_CONTACT = 4 41 idPARAM = 4
42 idREMOVE_CONTACT = 5 42 idADD_CONTACT = 5
43 idREMOVE_CONTACT = 6
43 const_DEFAULT_GROUP = "Unclassed" 44 const_DEFAULT_GROUP = "Unclassed"
44 const_STATUS = {"Online":"", 45 const_STATUS = {"Online":"",
45 "Want to discuss":"chat", 46 "Want to discuss":"chat",
46 "AFK":"away", 47 "AFK":"away",
47 "Do Not Disturb":"dnd", 48 "Do Not Disturb":"dnd",
188 189
189 def createMenus(self): 190 def createMenus(self):
190 info("Creating menus") 191 info("Creating menus")
191 connectMenu = wx.Menu() 192 connectMenu = wx.Menu()
192 connectMenu.Append(idCONNECT, "&Connect CTRL-c"," Connect to the server") 193 connectMenu.Append(idCONNECT, "&Connect CTRL-c"," Connect to the server")
194 connectMenu.Append(idDISCONNECT, "&Disconnect CTRL-d"," Disconnect from the server")
193 connectMenu.Append(idPARAM,"&Parameters"," Configure the program") 195 connectMenu.Append(idPARAM,"&Parameters"," Configure the program")
194 connectMenu.AppendSeparator() 196 connectMenu.AppendSeparator()
195 connectMenu.Append(idEXIT,"E&xit"," Terminate the program") 197 connectMenu.Append(idEXIT,"E&xit"," Terminate the program")
196 contactMenu = wx.Menu() 198 contactMenu = wx.Menu()
197 contactMenu.Append(idADD_CONTACT, "&Add contact"," Add a contact to your list") 199 contactMenu.Append(idADD_CONTACT, "&Add contact"," Add a contact to your list")
201 menuBar.Append(contactMenu,"&Contacts") 203 menuBar.Append(contactMenu,"&Contacts")
202 self.SetMenuBar(menuBar) 204 self.SetMenuBar(menuBar)
203 205
204 #events 206 #events
205 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) 207 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest)
208 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest)
206 wx.EVT_MENU(self, idPARAM, self.onParam) 209 wx.EVT_MENU(self, idPARAM, self.onParam)
207 wx.EVT_MENU(self, idEXIT, self.onExit) 210 wx.EVT_MENU(self, idEXIT, self.onExit)
208 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) 211 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact)
209 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) 212 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact)
210 213
314 self.chat_wins[jid].Show() 317 self.chat_wins[jid].Show()
315 318
316 def onConnectRequest(self, e): 319 def onConnectRequest(self, e):
317 self.bridge.connect() 320 self.bridge.connect()
318 321
322 def onDisconnectRequest(self, e):
323 self.bridge.disconnect()
324
319 def __updateStatus(self): 325 def __updateStatus(self):
320 show = const_STATUS[self.statusBox.GetValue()] 326 show = const_STATUS[self.statusBox.GetValue()]
321 status = self.statusTxt.GetValue() 327 status = self.statusTxt.GetValue()
322 self.bridge.setPresence(show=show, status=status) 328 self.bridge.setPresence(show=show, status=status)
323 329