Beremiz.py
changeset 23 e007d9d466d7
parent 22 9a0c535c3272
child 24 585d5b387b6a
equal deleted inserted replaced
22:9a0c535c3272 23:e007d9d466d7
   576                 statictext = wx.StaticText(id=-1, label="%s:"%element_infos["name"], 
   576                 statictext = wx.StaticText(id=-1, label="%s:"%element_infos["name"], 
   577                     name="%s_label"%element_infos["name"], parent=self.ParamsPanel, 
   577                     name="%s_label"%element_infos["name"], parent=self.ParamsPanel, 
   578                     pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
   578                     pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
   579                 boxsizer.AddWindow(statictext, 0, border=0, flag=wx.TOP|wx.LEFT|wx.BOTTOM)
   579                 boxsizer.AddWindow(statictext, 0, border=0, flag=wx.TOP|wx.LEFT|wx.BOTTOM)
   580                 id = wx.NewId()
   580                 id = wx.NewId()
   581                 min = -sys.maxint-1
   581                 scmin = -(2**31)
   582                 max = sys.maxint
   582                 scmax = 2**31-1
   583                 if "min" in element_infos["type"]:
   583                 if "min" in element_infos["type"]:
   584                     min = element_infos["type"]["min"]
   584                     scmin = element_infos["type"]["min"]
   585                 if "max" in element_infos["type"]:
   585                 if "max" in element_infos["type"]:
   586                     max = element_infos["type"]["max"]
   586                     scmax = element_infos["type"]["max"]
   587                 spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel, 
   587                 spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel, 
   588                     pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT, 
   588                     pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
   589                     min=min, max=max)
   589                 spinctrl.SetRange(scmin,scmax)
   590                 boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
   590                 boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
   591                 spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
   591                 spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
   592                 spinctrl.SetValue(element_infos["value"])
   592                 spinctrl.SetValue(element_infos["value"])
   593             elif element_infos["type"] == "element":
   593             elif element_infos["type"] == "element":
   594                 staticbox = wx.StaticBox(id=-1, label=element_infos["name"], 
   594                 staticbox = wx.StaticBox(id=-1, label=element_infos["name"], 
   616                         pos=wx.Point(0, 0), size=wx.Size(17, 25), style=0)
   616                         pos=wx.Point(0, 0), size=wx.Size(17, 25), style=0)
   617                     boxsizer.AddWindow(checkbox, 0, border=0, flag=0)
   617                     boxsizer.AddWindow(checkbox, 0, border=0, flag=0)
   618                     checkbox.Bind(wx.EVT_CHECKBOX, self.GetCheckBoxCallBackFunction(checkbox, element_path), id=id)
   618                     checkbox.Bind(wx.EVT_CHECKBOX, self.GetCheckBoxCallBackFunction(checkbox, element_path), id=id)
   619                     checkbox.SetValue(element_infos["value"])
   619                     checkbox.SetValue(element_infos["value"])
   620                 elif element_infos["type"] in ["unsignedLong", "long","integer"]:
   620                 elif element_infos["type"] in ["unsignedLong", "long","integer"]:
       
   621                     if element_infos["type"].startswith("unsigned"):
       
   622                         scmin = 0
       
   623                     else:
       
   624                         scmin = -(2**31)
       
   625                     scmax = 2**31-1
   621                     spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel, 
   626                     spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel, 
   622                         pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
   627                         pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
       
   628                     spinctrl.SetRange(scmin, scmax)
   623                     boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
   629                     boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
   624                     spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
   630                     spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
   625                     spinctrl.SetValue(element_infos["value"])
   631                     spinctrl.SetValue(element_infos["value"])
   626                 else:
   632                 else:
   627                     textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel, 
   633                     textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel,