diff 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
line wrap: on
line diff
--- a/frontends/wix/param.py	Sun Nov 08 00:11:00 2009 +0100
+++ b/frontends/wix/param.py	Sun Nov 08 01:49:08 2009 +0100
@@ -62,20 +62,28 @@
             type = param.getAttribute("type")
             value = param.getAttribute("value")
             sizer = wx.BoxSizer(wx.HORIZONTAL)
-            label=wx.StaticText(panel, -1, name+" ")
             if type=="string":
+                label=wx.StaticText(panel, -1, name+" ")
                 ctrl = wx.TextCtrl(panel, -1, value)
+                sizer.Add(label)
             elif type=="password":
+                label=wx.StaticText(panel, -1, name+" ")
                 ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD)
+                sizer.Add(label)
+            elif type=="button":
+                ctrl = wx.Button(panel, -1, value)
             else:
                 error("FIXME FIXME FIXME")  #FIXME !
                 raise NotImplementedError
             ctrl.param_id=(name, category)
-            sizer.Add(label)
             sizer.Add(ctrl, 1, flag=wx.EXPAND)
             panel.sizer.Add(sizer, flag=wx.EXPAND)
 
-            panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl)
+            if type=="string" or type=="password":
+                panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl)
+            elif type=="button":
+                panel.Bind(wx.EVT_BUTTON, self.onButtonClicked, ctrl)
+
         panel.SetSizer(panel.sizer)
         panel.SetAutoLayout(True)
         self.notebook.AddPage(panel, category)
@@ -86,6 +94,11 @@
         self.modified[event.GetEventObject().param_id]=event.GetString()
         event.Skip()
         
+    def onButtonClicked(self, event):
+        """Called when a paramated is modified"""
+        print "Button Clicked (%s/%s)" % event.GetEventObject().param_id#TODO: gof: appeler callback
+        #self.modified[event.GetEventObject().param_id]=event.GetString()
+        event.Skip()
 
     def onClose(self, event):
         """Close event: we have to save the params."""