Beremiz_service.py
branchwxPython4
changeset 3307 eeec6e0ea269
parent 3282 725d3e9ac913
child 3426 c2c366964913
equal deleted inserted replaced
3306:841fb2ee1213 3307:eeec6e0ea269
   222         print("Wx unavailable !")
   222         print("Wx unavailable !")
   223         havewx = False
   223         havewx = False
   224 
   224 
   225     if havewx:
   225     if havewx:
   226         import re
   226         import re
       
   227         import wx.adv
   227 
   228 
   228         if wx.VERSION >= (3, 0, 0):
   229         if wx.VERSION >= (3, 0, 0):
   229             app = wx.App(redirect=False)
   230             app = wx.App(redirect=False)
   230         else:
   231         else:
   231             app = wx.PySimpleApp(redirect=False)
   232             app = wx.PySimpleApp(redirect=False)
   263                 return self.GetSizer().GetItem(1).GetWindow().GetValue()
   264                 return self.GetSizer().GetItem(1).GetWindow().GetValue()
   264 
   265 
   265             def SetTests(self, tests):
   266             def SetTests(self, tests):
   266                 self.Tests = tests
   267                 self.Tests = tests
   267 
   268 
   268         class BeremizTaskBarIcon(wx.TaskBarIcon):
   269         class BeremizTaskBarIcon(wx.adv.TaskBarIcon):
   269             TBMENU_START = wx.NewId()
   270             TBMENU_START = wx.NewId()
   270             TBMENU_STOP = wx.NewId()
   271             TBMENU_STOP = wx.NewId()
   271             TBMENU_CHANGE_NAME = wx.NewId()
   272             TBMENU_CHANGE_NAME = wx.NewId()
   272             TBMENU_CHANGE_PORT = wx.NewId()
   273             TBMENU_CHANGE_PORT = wx.NewId()
   273             TBMENU_CHANGE_INTERFACE = wx.NewId()
   274             TBMENU_CHANGE_INTERFACE = wx.NewId()
   275             TBMENU_WXINSPECTOR = wx.NewId()
   276             TBMENU_WXINSPECTOR = wx.NewId()
   276             TBMENU_CHANGE_WD = wx.NewId()
   277             TBMENU_CHANGE_WD = wx.NewId()
   277             TBMENU_QUIT = wx.NewId()
   278             TBMENU_QUIT = wx.NewId()
   278 
   279 
   279             def __init__(self, pyroserver):
   280             def __init__(self, pyroserver):
   280                 wx.TaskBarIcon.__init__(self)
   281                 wx.adv.TaskBarIcon.__init__(self)
   281                 self.pyroserver = pyroserver
   282                 self.pyroserver = pyroserver
   282                 # Set the image
   283                 # Set the image
   283                 self.UpdateIcon(None)
   284                 self.UpdateIcon(None)
   284 
   285 
   285                 # bind some events
   286                 # bind some events
   323                 if "wxMSW" in wx.PlatformInfo:
   324                 if "wxMSW" in wx.PlatformInfo:
   324                     img = img.Scale(16, 16)
   325                     img = img.Scale(16, 16)
   325                 elif "wxGTK" in wx.PlatformInfo:
   326                 elif "wxGTK" in wx.PlatformInfo:
   326                     img = img.Scale(22, 22)
   327                     img = img.Scale(22, 22)
   327                 # wxMac can be any size upto 128x128, so leave the source img alone....
   328                 # wxMac can be any size upto 128x128, so leave the source img alone....
   328                 icon = wx.IconFromBitmap(img.ConvertToBitmap())
   329                 icon = wx.Icon(img.ConvertToBitmap())
   329                 return icon
   330                 return icon
   330 
   331 
   331             def OnTaskBarStartPLC(self, evt):
   332             def OnTaskBarStartPLC(self, evt):
   332                 runtime.GetPLCObjectSingleton().StartPLC()
   333                 runtime.GetPLCObjectSingleton().StartPLC()
   333 
   334