Beremiz.py
changeset 422 76aebe92fd5f
parent 417 a895ae50b737
child 426 3f285782ac9b
equal deleted inserted replaced
421:c9ec111ad275 422:76aebe92fd5f
   639             
   639             
   640         self.PLCConfigMainSizer.Layout()
   640         self.PLCConfigMainSizer.Layout()
   641         self.RefreshScrollBars()
   641         self.RefreshScrollBars()
   642         self.Thaw()
   642         self.Thaw()
   643 
   643 
   644     normal_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"])
       
   645     mouseover_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=True, faceName = faces["helv"])
       
   646     def GenerateMethodButtonSizer(self, plugin, parent, horizontal = True):
   644     def GenerateMethodButtonSizer(self, plugin, parent, horizontal = True):
       
   645         normal_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"])
       
   646         mouseover_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=True, faceName = faces["helv"])
   647         if horizontal:
   647         if horizontal:
   648             msizer = wx.FlexGridSizer(cols=len(plugin.PluginMethods))
   648             msizer = wx.FlexGridSizer(cols=len(plugin.PluginMethods))
   649         else:
   649         else:
   650             msizer = wx.FlexGridSizer(cols=1)
   650             msizer = wx.FlexGridSizer(cols=1)
   651         for plugin_method in plugin.PluginMethods:
   651         for plugin_method in plugin.PluginMethods:
   653                 id = wx.NewId()
   653                 id = wx.NewId()
   654                 label = plugin_method["name"]
   654                 label = plugin_method["name"]
   655                 button = GenBitmapTextButton(id=id, parent=parent,
   655                 button = GenBitmapTextButton(id=id, parent=parent,
   656                     bitmap=wx.Bitmap(Bpath( "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=label, 
   656                     bitmap=wx.Bitmap(Bpath( "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=label, 
   657                     name=label, pos=wx.DefaultPosition, style=wx.NO_BORDER)
   657                     name=label, pos=wx.DefaultPosition, style=wx.NO_BORDER)
   658                 button.SetFont(self.normal_bt_font)
   658                 button.SetFont(normal_bt_font)
   659                 button.SetToolTipString(plugin_method["tooltip"])
   659                 button.SetToolTipString(plugin_method["tooltip"])
   660                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   660                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   661                 # a fancy underline on mouseover
   661                 # a fancy underline on mouseover
   662                 def setFontStyle(b, s):
   662                 def setFontStyle(b, s):
   663                     def fn(event):
   663                     def fn(event):
   664                         b.SetFont(s)
   664                         b.SetFont(s)
   665                         b.Refresh()
   665                         b.Refresh()
   666                         event.Skip()
   666                         event.Skip()
   667                     return fn
   667                     return fn
   668                 button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, self.mouseover_bt_font))
   668                 button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font))
   669                 button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, self.normal_bt_font))
   669                 button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font))
   670                 #hack to force size to mini
   670                 #hack to force size to mini
   671                 if not plugin_method.get("enabled",True):
   671                 if not plugin_method.get("enabled",True):
   672                     button.Disable()
   672                     button.Disable()
   673                 msizer.AddWindow(button, 0, border=0, flag=wx.ALIGN_CENTER)
   673                 msizer.AddWindow(button, 0, border=0, flag=wx.ALIGN_CENTER)
   674         return msizer
   674         return msizer