def __init__(self, parent): self._init_ctrls(parent) # don't call Fit() here, or the frame becomes VERY small self.SetMinSize(self.GetSize()) # aero.make_full_glass(self) # fill the login info structure self._userinfo = {'usr': deobf(cfg.get('userid', 'u', u'')), 'psw': deobf(cfg.get('userid', 'p', u'')), 'typ': cfg.get('userid', 't', ''), }
def _init_ctrls(self, prnt): wx.Frame.__init__(self, prnt, wx.ID_ANY, _(u'教务信息查询'), size=WindowSize) self.SetMaxSize(WindowSize) self.SetMinSize(WindowSize) self.SetIcon(wx.IconFromBitmap(SHRIMP_ICON.GetBitmap())) # set background color to get some native feel on MSW if wx.Platform == '__WXMSW__': self.SetBackgroundColour(wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DFACE)) # MENU M=wx.Menu() M_Pref = M.Append(wx.ID_PREFERENCES, _(u'设置'), _(u'设置模块的各种参数')) M_exit = M.Append(wx.ID_EXIT, _(u'退出'), _(u'关闭本模块')) A=wx.Menu() A_about = A.Append(wx.ID_ABOUT, _(u'关于'), _(u'关于本模块')) MB=wx.MenuBar() MB.Append(M, _(u'程序')) MB.Append(A, _(u'关于')) self.SetMenuBar(MB) # LAYOUT order=self.GetOrder(0) # xenon add: enable tab traversal pnl = self.panelMain = wx.Panel(self, wx.ID_ANY, style=wx.EXPAND) wx.StaticText(pnl, label=_(u"账号"), pos=order(0)) self.dlN = wx.TextCtrl(pnl, pos=order(0, 35), size=(160, -1)) self.dlN.SetValue(deobf(cfg.get(_USERID_SECT, 'u', ''))) wx.StaticText(pnl, label=_(u'密码'), pos=order(1)) self.dlP = wx.TextCtrl(pnl, pos=order(0, 35), size=(160, -1), style=wx.TE_PASSWORD) self.dlP.SetValue(deobf(cfg.get(_USERID_SECT, 'p', ''))) self.btnShowCurricula = wx.Button(pnl, pos=order(1), label=_(u"查询个人课表")) self.btnShowScores = wx.Button(pnl, pos=order(0, 90), label=_(u"查询个人成绩")) # xenon add: to make the panel expand to fill the entire frame self.box = wx.BoxSizer() self.box.AddWindow(pnl) self.box.Layout() # FUNCTIONS self.Bind(wx.EVT_MENU, self.OnMenuPref, M_Pref) self.Bind(wx.EVT_MENU, self.OnMenuExit, M_exit) self.Bind(wx.EVT_MENU, self.OnMenuAbout, A_about) self.Bind(wx.EVT_BUTTON, self.OnKB, self.btnShowCurricula) self.Bind(wx.EVT_BUTTON, self.OnCJ, self.btnShowScores) self.Bind(wx.EVT_CLOSE, self.OnClose) # STATUS self.statusbar = ProgressStatusBar(self) self.SetStatusBar(self.statusbar) self.SetStatusText(_(u'准备就绪')) self.Show(True)