Beremiz.py
changeset 214 b4531bf9bdb3
parent 203 cb9901076a21
child 217 f3eb35df4d87
equal deleted inserted replaced
213:d8dc1e51c3bf 214:b4531bf9bdb3
   759         iecsizer.AddWindow(expandbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
   759         iecsizer.AddWindow(expandbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
   760         
   760         
   761         tc_id = wx.NewId()
   761         tc_id = wx.NewId()
   762         tc = wx.TextCtrl(leftwindow, tc_id, size=wx.Size(150, 25), style=wx.NO_BORDER)
   762         tc = wx.TextCtrl(leftwindow, tc_id, size=wx.Size(150, 25), style=wx.NO_BORDER)
   763         tc.SetFont(wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   763         tc.SetFont(wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   764         tc.SetValue(plugin.MandatoryParams[1].getName())
   764         tc.ChangeValue(plugin.MandatoryParams[1].getName())
   765         tc.Bind(wx.EVT_KILL_FOCUS, self.GetTextCtrlCallBackFunction(tc, plugin, "BaseParams.Name"), id=tc_id)
   765         tc.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(tc, plugin, "BaseParams.Name"), id=tc_id)
   766         iecsizer.AddWindow(tc, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
   766         iecsizer.AddWindow(tc, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
   767        
   767        
   768 
   768 
   769         leftminimizebutton_id = wx.NewId()
   769         leftminimizebutton_id = wx.NewId()
   770         leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'ShowVars.png')),
   770         leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'ShowVars.png')),
   957         return OnChoiceContentChanged
   957         return OnChoiceContentChanged
   958     
   958     
   959     def GetTextCtrlCallBackFunction(self, textctrl, plugin, path):
   959     def GetTextCtrlCallBackFunction(self, textctrl, plugin, path):
   960         def OnTextCtrlChanged(event):
   960         def OnTextCtrlChanged(event):
   961             res = self.SetPluginParamsAttribute(plugin, path, textctrl.GetValue())
   961             res = self.SetPluginParamsAttribute(plugin, path, textctrl.GetValue())
   962             textctrl.SetValue(res)
   962             if res != textctrl.GetValue():
       
   963                 textctrl.ChangeValue(res)
   963             event.Skip()
   964             event.Skip()
   964         return OnTextCtrlChanged
   965         return OnTextCtrlChanged
   965     
   966     
   966     def GetCheckBoxCallBackFunction(self, chkbx, plugin, path):
   967     def GetCheckBoxCallBackFunction(self, chkbx, plugin, path):
   967         def OnCheckBoxChanged(event):
   968         def OnCheckBoxChanged(event):
  1079                         spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, plugin, element_path), id=id)
  1080                         spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, plugin, element_path), id=id)
  1080                     else:
  1081                     else:
  1081                         textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=parent, 
  1082                         textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=parent, 
  1082                             pos=wx.Point(0, 0), size=wx.Size(150, 25), style=0)#wx.TE_PROCESS_ENTER)
  1083                             pos=wx.Point(0, 0), size=wx.Size(150, 25), style=0)#wx.TE_PROCESS_ENTER)
  1083                         boxsizer.AddWindow(textctrl, 0, border=0, flag=0)
  1084                         boxsizer.AddWindow(textctrl, 0, border=0, flag=0)
  1084                         textctrl.SetValue(str(element_infos["value"]))
  1085                         textctrl.ChangeValue(str(element_infos["value"]))
  1085                         textctrl.Bind(wx.EVT_KILL_FOCUS, self.GetTextCtrlCallBackFunction(textctrl, plugin, element_path))
  1086                         textctrl.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(textctrl, plugin, element_path))
  1086             first = False
  1087             first = False
  1087     
  1088     
  1088     def OnNewProjectMenu(self, event):
  1089     def OnNewProjectMenu(self, event):
  1089         defaultpath = self.PluginRoot.GetProjectPath()
  1090         defaultpath = self.PluginRoot.GetProjectPath()
  1090         if not defaultpath:
  1091         if not defaultpath: