root/trunk/RBPrivate/Prototypes/ChatClient/LoginMediator.py

Revision 48, 1.1 kB (checked in by sholloway, 7 years ago)

Changes

Line 
1 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 #~ Imports
3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5 from wxPython import wx
6
7 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 #~ Definitions
9 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
11 class LoginMediator:
12     def __init__(self, node):
13         self.context = node.context
14
15     def Initialize(self):
16         wx.EVT_CLOSE(self.context.frame, self._doClose)
17         wx.EVT_BUTTON(self.OKButton, self.OKButton.GetId(), self.OnOK)
18         wx.EVT_BUTTON(self.CancelButton, self.CancelButton.GetId(), self.OnCancel)
19
20     def OnCancel(self, evt):
21         self.context.frame.Close()
22
23     def OnOK(self, evt):
24         self.context.Model.LoginToClient(self.ServerInput.GetValue(), self.UsernameInput.GetValue(), self.PasswordInput.GetValue(), self.ResourceInput.GetValue())
25         self.context.frame.Close()
26
27     def _doClose(self, evt=None):
28         wx.EVT_BUTTON(self.OKButton, self.OKButton.GetId(), None)
29         wx.EVT_BUTTON(self.CancelButton, self.CancelButton.GetId(), None)
30         del self.context
31         if evt: evt.Skip()
32
Note: See TracBrowser for help on using the browser.