comparison frontends/wix/param.py @ 70:8f2ed279784b

i18n - gettext support added in frontends - first draft of frontends french translation
author Goffi <goffi@goffi.org>
date Fri, 05 Mar 2010 20:33:10 +1100
parents a5b5fb5fc9fd
children 23caf1051099
comparison
equal deleted inserted replaced
69:86f1f7f6d332 70:8f2ed279784b
27 from logging import debug, info, error 27 from logging import debug, info, error
28 from tools.jid import JID 28 from tools.jid import JID
29 29
30 30
31 class Param(wx.Frame): 31 class Param(wx.Frame):
32 def __init__(self, host, title="Configuration"): 32 def __init__(self, host, title=_("Configuration")):
33 super(Param, self).__init__(None, title=title) 33 super(Param, self).__init__(None, title=title)
34 34
35 self.host = host 35 self.host = host
36 36
37 self.modified = {} # dict of modified data (i.e. what we have to save) 37 self.modified = {} # dict of modified data (i.e. what we have to save)
73 ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD) 73 ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD)
74 sizer.Add(label) 74 sizer.Add(label)
75 elif type=="button": 75 elif type=="button":
76 ctrl = wx.Button(panel, -1, value) 76 ctrl = wx.Button(panel, -1, value)
77 else: 77 else:
78 error("FIXME FIXME FIXME") #FIXME ! 78 error(_("FIXME FIXME FIXME")) #FIXME !
79 raise NotImplementedError 79 raise NotImplementedError
80 ctrl.param_id=(name, category) 80 ctrl.param_id=(name, category)
81 sizer.Add(ctrl, 1, flag=wx.EXPAND) 81 sizer.Add(ctrl, 1, flag=wx.EXPAND)
82 self.ctl_list[(name, category)] = ctrl 82 self.ctl_list[(name, category)] = ctrl
83 panel.sizer.Add(sizer, flag=wx.EXPAND) 83 panel.sizer.Add(sizer, flag=wx.EXPAND)
105 event.Skip() 105 event.Skip()
106 106
107 def onButtonClicked(self, event): 107 def onButtonClicked(self, event):
108 """Called when a paramated is modified""" 108 """Called when a paramated is modified"""
109 self.__save_parameters() 109 self.__save_parameters()
110 print "Button Clicked (%s/%s)" % event.GetEventObject().param_id
111 name, category = event.GetEventObject().param_id 110 name, category = event.GetEventObject().param_id
112 data = {"name":name, "category":category} 111 data = {"name":name, "category":category}
113 id = self.host.bridge.launchAction("button", data) 112 id = self.host.bridge.launchAction("button", data)
114 self.host.current_action_ids.add(id) 113 self.host.current_action_ids.add(id)
115 print "action id:",id
116 event.Skip() 114 event.Skip()
117 115
118 def __save_parameters(self): 116 def __save_parameters(self):
119 for param in self.modified: 117 for param in self.modified:
120 self.host.bridge.setParam(param[0], self.modified[param], param[1]) 118 self.host.bridge.setParam(param[0], self.modified[param], param[1])
121 self.modified.clear() 119 self.modified.clear()
122 120
123 def onClose(self, event): 121 def onClose(self, event):
124 """Close event: we have to save the params.""" 122 """Close event: we have to save the params."""
125 debug("close") 123 debug(_("close"))
126 #now we save the modifier params 124 #now we save the modifier params
127 self.__save_parameters() 125 self.__save_parameters()
128 126
129 self.MakeModal(False) 127 self.MakeModal(False)
130 event.Skip() 128 event.Skip()