comparison frontends/wix/param.py @ 21:633c5ed65701

parameters: new button type (not finished)
author Goffi <goffi@goffi.org>
date Sun, 08 Nov 2009 01:49:08 +0100
parents 6928e3cb73a8
children bb72c29f3432
comparison
equal deleted inserted replaced
20:fc8c202cda87 21:633c5ed65701
60 for param in cat_dom.documentElement.getElementsByTagName("param"): 60 for param in cat_dom.documentElement.getElementsByTagName("param"):
61 name = param.getAttribute("name") 61 name = param.getAttribute("name")
62 type = param.getAttribute("type") 62 type = param.getAttribute("type")
63 value = param.getAttribute("value") 63 value = param.getAttribute("value")
64 sizer = wx.BoxSizer(wx.HORIZONTAL) 64 sizer = wx.BoxSizer(wx.HORIZONTAL)
65 label=wx.StaticText(panel, -1, name+" ")
66 if type=="string": 65 if type=="string":
66 label=wx.StaticText(panel, -1, name+" ")
67 ctrl = wx.TextCtrl(panel, -1, value) 67 ctrl = wx.TextCtrl(panel, -1, value)
68 sizer.Add(label)
68 elif type=="password": 69 elif type=="password":
70 label=wx.StaticText(panel, -1, name+" ")
69 ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD) 71 ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD)
72 sizer.Add(label)
73 elif type=="button":
74 ctrl = wx.Button(panel, -1, value)
70 else: 75 else:
71 error("FIXME FIXME FIXME") #FIXME ! 76 error("FIXME FIXME FIXME") #FIXME !
72 raise NotImplementedError 77 raise NotImplementedError
73 ctrl.param_id=(name, category) 78 ctrl.param_id=(name, category)
74 sizer.Add(label)
75 sizer.Add(ctrl, 1, flag=wx.EXPAND) 79 sizer.Add(ctrl, 1, flag=wx.EXPAND)
76 panel.sizer.Add(sizer, flag=wx.EXPAND) 80 panel.sizer.Add(sizer, flag=wx.EXPAND)
77 81
78 panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl) 82 if type=="string" or type=="password":
83 panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl)
84 elif type=="button":
85 panel.Bind(wx.EVT_BUTTON, self.onButtonClicked, ctrl)
86
79 panel.SetSizer(panel.sizer) 87 panel.SetSizer(panel.sizer)
80 panel.SetAutoLayout(True) 88 panel.SetAutoLayout(True)
81 self.notebook.AddPage(panel, category) 89 self.notebook.AddPage(panel, category)
82 cat_dom.unlink() 90 cat_dom.unlink()
83 91
84 def onTextChanged(self, event): 92 def onTextChanged(self, event):
85 """Called when a paramated is modified""" 93 """Called when a paramated is modified"""
86 self.modified[event.GetEventObject().param_id]=event.GetString() 94 self.modified[event.GetEventObject().param_id]=event.GetString()
87 event.Skip() 95 event.Skip()
88 96
97 def onButtonClicked(self, event):
98 """Called when a paramated is modified"""
99 print "Button Clicked (%s/%s)" % event.GetEventObject().param_id#TODO: gof: appeler callback
100 #self.modified[event.GetEventObject().param_id]=event.GetString()
101 event.Skip()
89 102
90 def onClose(self, event): 103 def onClose(self, event):
91 """Close event: we have to save the params.""" 104 """Close event: we have to save the params."""
92 debug("close") 105 debug("close")
93 #now we save the modifier params 106 #now we save the modifier params