def OnInit(self): #frame = GoKuApp.LoginFrame(None, -1, _("Application Title")) from goku.models import server server.login("test1", "pass") frame = GoKuApp.MainFrame(None, -1, _("Application Title")) frame.app = self frame.Show(True) self.SetTopWindow(frame) frame.CenterOnScreen() return True
def OnLogin(self, e): username = self.inputs[0].GetValue() password = self.inputs[1].GetValue() from goku.models import server if not (username and password): wx.MessageBox(_('need username and password'), _('Error'), wx.ICON_ERROR) return else: code = server.login(username, password) if code == '0': self.show_main_frame() #self.Close() elif code == '1': wx.MessageBox(_('account not exist'), _('Error'), wx.ICON_ERROR) elif code == '2': wx.MessageBox(_('password error'), _('Error'), wx.ICON_ERROR) elif code == '-2': wx.MessageBox(_('need username and password'), _('Error'), wx.ICON_ERROR)