Mercurial > libervia-backend
diff frontends/src/wix/main_window.py @ 736:6246eb6d64a0
frontends: define the constants with classes and inheritance instance of using __builtin__
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 23 Nov 2013 10:21:40 +0100 |
parents | f7878ad3c846 |
children | 378af36155c2 |
line wrap: on
line diff
--- a/frontends/src/wix/main_window.py Sun Nov 24 11:22:20 2013 +0100 +++ b/frontends/src/wix/main_window.py Sat Nov 23 10:21:40 2013 +0100 @@ -31,7 +31,7 @@ import os.path from sat.tools.jid import JID from logging import debug, info, warning, error -import sat_frontends.wix.constants +from sat_frontends.wix.constants import Const idCONNECT,\ idDISCONNECT,\ @@ -72,7 +72,7 @@ #ToolBar self.tools=self.CreateToolBar() - self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=[status[1] for status in const_STATUS], + self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=[status[1] for status in Const.PRESENCE], style=wx.CB_DROPDOWN | wx.CB_READONLY) self.tools.AddControl(self.statusBox) self.tools.AddSeparator() @@ -122,7 +122,7 @@ connectMenu.Append(idDISCONNECT, _("&Disconnect CTRL-d"),_(" Disconnect from the server")) connectMenu.Append(idPARAM,_("&Parameters"),_(" Configure the program")) connectMenu.AppendSeparator() - connectMenu.Append(idABOUT,_("A&bout"),_(" About %s") % APP_NAME) + connectMenu.Append(idABOUT, _("A&bout"), _(" About %s") % Const.APP_NAME) connectMenu.Append(idEXIT,_("E&xit"),_(" Terminate the program")) contactMenu = wx.Menu() contactMenu.Append(idADD_CONTACT, _("&Add contact"),_(" Add a contact to your list")) @@ -212,10 +212,10 @@ def setStatusOnline(self, online=True): """enable/disable controls, must be called when local user online status change""" if online: - self.SetStatusText(msgONLINE) + self.SetStatusText(Const.msgONLINE) self.tools.Enable() else: - self.SetStatusText(msgOFFLINE) + self.SetStatusText(Const.msgOFFLINE) self.tools.Disable() return @@ -351,7 +351,7 @@ self.bridge.disconnect(self.profile) def __updateStatus(self): - show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0] + show = filter(lambda x:x[1] == self.statusBox.GetValue(), Const.PRESENCE)[0][0] status = self.statusTxt.GetValue() self.bridge.setPresence(show=show, statuses={'default':status}, profile_key=self.profile) #FIXME: manage multilingual statuses @@ -367,15 +367,15 @@ def onAbout(self, e): about = wx.AboutDialogInfo() - about.SetName(APP_NAME) + about.SetName(Const.APP_NAME) about.SetVersion (unicode(self.bridge.getVersion())) about.SetCopyright(u"(C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson aka Goffi") about.SetDescription( _(u"%(name)s is a SàT (Salut à Toi) frontend\n"+ - u"%(name)s is based on WxPython, and is the standard graphic interface of SàT") % {'name':APP_NAME}) + u"%(name)s is based on WxPython, and is the standard graphic interface of SàT") % {'name': Const.APP_NAME}) about.SetWebSite(("http://www.goffi.org", "Goffi's non-hebdo (french)")) about.SetDevelopers([ "Goffi (Jérôme Poisson)"]) try: - with open(LICENCE_PATH,"r") as licence: + with open(Const.LICENCE_PATH, "r") as licence: about.SetLicence(''.join(licence.readlines())) except: pass