Beremiz.py
changeset 197 a50b5fa04c57
parent 193 ca6ad333aa80
child 199 aa5f43bafad4
equal deleted inserted replaced
196:93d06827e31b 197:a50b5fa04c57
   461             st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   461             st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   462             st.SetLabel(self.PluginRoot.GetProjectName())
   462             st.SetLabel(self.PluginRoot.GetProjectName())
   463             plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER)
   463             plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER)
   464             
   464             
   465             addbutton_id = wx.NewId()
   465             addbutton_id = wx.NewId()
   466             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add16x16.png')),
   466             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')),
   467                   name='AddBusButton', parent=plcwindow, pos=wx.Point(0, 0),
   467                   name='AddPluginButton', parent=plcwindow, pos=wx.Point(0, 0),
   468                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   468                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   469             addbutton.SetToolTipString("Add a sub plugin")
   469             addbutton.SetToolTipString("Add a sub plugin")
   470             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id)
   470             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id)
   471             plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   471             plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   472     
   472     
   536 #        else:
   536 #        else:
   537 #            addsizer = wx.FlexGridSizer(cols=1)
   537 #            addsizer = wx.FlexGridSizer(cols=1)
   538 #        for name, XSDClass, help in plugin.PlugChildsTypes:
   538 #        for name, XSDClass, help in plugin.PlugChildsTypes:
   539 #            addbutton_id = wx.NewId()
   539 #            addbutton_id = wx.NewId()
   540 #            addbutton = wx.lib.buttons.GenButton(id=addbutton_id, label="Add %s"%help,
   540 #            addbutton = wx.lib.buttons.GenButton(id=addbutton_id, label="Add %s"%help,
   541 #                  name='AddBusButton', parent=parent, pos=wx.Point(0, 0),
   541 #                  name='AddPluginButton', parent=parent, pos=wx.Point(0, 0),
   542 #                  style=wx.NO_BORDER)
   542 #                  style=wx.NO_BORDER)
   543 #            font = addbutton.GetFont()
   543 #            font = addbutton.GetFont()
   544 #            font.SetUnderlined(True)
   544 #            font.SetUnderlined(True)
   545 #            addbutton.SetFont(font)
   545 #            addbutton.SetFont(font)
   546 #            addbutton._GetLabelSize = gen_textbutton_GetLabelSize(addbutton)
   546 #            addbutton._GetLabelSize = gen_textbutton_GetLabelSize(addbutton)
   557             msizer = wx.FlexGridSizer(cols=1)
   557             msizer = wx.FlexGridSizer(cols=1)
   558         for plugin_method in plugin.PluginMethods:
   558         for plugin_method in plugin.PluginMethods:
   559             if "method" in plugin_method:
   559             if "method" in plugin_method:
   560                 id = wx.NewId()
   560                 id = wx.NewId()
   561                 button = GenBitmapTextButton(id=id, parent=parent,
   561                 button = GenBitmapTextButton(id=id, parent=parent,
   562                     bitmap=wx.Bitmap(os.path.join(CWD, "%s24x24.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], 
   562                     bitmap=wx.Bitmap(os.path.join(CWD, "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], 
   563                     name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER)
   563                     name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER)
   564                 button.SetToolTipString(plugin_method["tooltip"])
   564                 button.SetToolTipString(plugin_method["tooltip"])
   565                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   565                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   566                 #hack to force size to mini
   566                 #hack to force size to mini
   567                 if not plugin_method.get("enabled",True):
   567                 if not plugin_method.get("enabled",True):
   699 
   699 
   700         adddeletesizer = wx.BoxSizer(wx.VERTICAL)
   700         adddeletesizer = wx.BoxSizer(wx.VERTICAL)
   701         iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   701         iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   702 
   702 
   703         deletebutton_id = wx.NewId()
   703         deletebutton_id = wx.NewId()
   704         deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete16x16.png')),
   704         deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete.png')),
   705               name='DeleteBusButton', parent=leftwindow, pos=wx.Point(0, 0),
   705               name='DeletePluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   706               size=wx.Size(16, 16), style=wx.NO_BORDER)
   706               size=wx.Size(16, 16), style=wx.NO_BORDER)
   707         deletebutton.SetToolTipString("Delete this plugin")
   707         deletebutton.SetToolTipString("Delete this plugin")
   708         deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id)
   708         deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id)
   709         adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   709         adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   710 
   710 
   711         if len(plugin.PlugChildsTypes) > 0:
   711         if len(plugin.PlugChildsTypes) > 0:
   712             addbutton_id = wx.NewId()
   712             addbutton_id = wx.NewId()
   713             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add16x16.png')),
   713             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')),
   714                   name='AddBusButton', parent=leftwindow, pos=wx.Point(0, 0),
   714                   name='AddPluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   715                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   715                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   716             addbutton.SetToolTipString("Add a sub plugin")
   716             addbutton.SetToolTipString("Add a sub plugin")
   717             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id)
   717             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id)
   718             adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   718             adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   719         
   719