Beremiz.py
changeset 217 f3eb35df4d87
parent 214 b4531bf9bdb3
child 218 71fddab24be9
equal deleted inserted replaced
216:11124e129a28 217:f3eb35df4d87
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
    25 __version__ = "$Revision$"
    25 __version__ = "$Revision$"
    26 
    26 
    27 import os, sys, getopt, wx
    27 import os, sys, getopt, wx
    28 
    28 import tempfile
    29 CWD = os.path.split(os.path.realpath(__file__))[0]
    29 import shutil
       
    30 from signal import SIGKILL
       
    31 
       
    32 _local_path = os.path.split(os.path.realpath(__file__))[0]
       
    33 def Bpath(*args):
       
    34     return os.path.join(_local_path,*args)
    30 
    35 
    31 if __name__ == '__main__':
    36 if __name__ == '__main__':
    32     def usage():
    37     def usage():
    33         print "\nUsage of Beremiz.py :"
    38         print "\nUsage of Beremiz.py :"
    34         print "\n   %s [Projectpath]\n"%sys.argv[0]
    39         print "\n   %s [Projectpath]\n"%sys.argv[0]
    54         projectOpen = None
    59         projectOpen = None
    55     
    60     
    56     app = wx.PySimpleApp()
    61     app = wx.PySimpleApp()
    57     wx.InitAllImageHandlers()
    62     wx.InitAllImageHandlers()
    58     
    63     
    59     bmp = wx.Image(os.path.join(CWD,"images","splash.png")).ConvertToBitmap()
    64     bmp = wx.Image(Bpath("images","splash.png")).ConvertToBitmap()
    60     splash=wx.SplashScreen(bmp,wx.SPLASH_CENTRE_ON_SCREEN, 1000, None)
    65     splash=wx.SplashScreen(bmp,wx.SPLASH_CENTRE_ON_SCREEN, 1000, None)
    61     wx.Yield()
    66     wx.Yield()
    62 
    67 
    63 import wx.lib.buttons, wx.lib.statbmp
    68 import wx.lib.buttons, wx.lib.statbmp
    64 import types, time, re, platform, time, traceback, commands
    69 import types, time, re, platform, time, traceback, commands
    65 from plugger import PluginsRoot
    70 from plugger import PluginsRoot
       
    71 from wxPopen import ProcessLogger
    66 
    72 
    67 base_folder = os.path.split(sys.path[0])[0]
    73 base_folder = os.path.split(sys.path[0])[0]
    68 sys.path.append(base_folder)
    74 sys.path.append(base_folder)
    69 from docutils import *
    75 from docutils import *
    70 
    76 
   128     def __init__(self, parent, ID, bitmapname,
   134     def __init__(self, parent, ID, bitmapname,
   129                  pos = wx.DefaultPosition, size = wx.DefaultSize,
   135                  pos = wx.DefaultPosition, size = wx.DefaultSize,
   130                  style = 0,
   136                  style = 0,
   131                  name = "genstatbmp"):
   137                  name = "genstatbmp"):
   132         
   138         
   133         bitmappath = os.path.join(CWD, "images", bitmapname)
   139         bitmappath = Bpath( "images", bitmapname)
   134         if os.path.isfile(bitmappath):
   140         if os.path.isfile(bitmappath):
   135             bitmap = wx.Bitmap(bitmappath)
   141             bitmap = wx.Bitmap(bitmappath)
   136         else:
   142         else:
   137             bitmap = None
   143             bitmap = None
   138         wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, bitmap,
   144         wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, bitmap,
   352     def __init__(self, parent, projectOpen):
   358     def __init__(self, parent, projectOpen):
   353         self._init_ctrls(parent)
   359         self._init_ctrls(parent)
   354         
   360         
   355         self.Log = LogPseudoFile(self.LogConsole)
   361         self.Log = LogPseudoFile(self.LogConsole)
   356         
   362         
       
   363 #        self.local_runtime = ProcessLogger(self.Log,
       
   364 #                                           "bash -c 'while true; do echo coucou; sleep 1; done'")
       
   365         self.local_runtime_tmpdir = tempfile.mkdtemp()
       
   366         self.local_runtime = ProcessLogger(self.Log,
       
   367                                            "%s %s -i localhost %s"%(sys.executable,
       
   368                                                        Bpath("Beremiz_service.py"),
       
   369                                                        self.local_runtime_tmpdir))
       
   370         
   357         # Add beremiz's icon in top left corner of the frame
   371         # Add beremiz's icon in top left corner of the frame
   358         self.SetIcon(wx.Icon(os.path.join(CWD, "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
   372         self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
   359         
   373         
   360         self.PluginRoot = PluginsRoot(self, self.Log)
   374         self.PluginRoot = PluginsRoot(self, self.Log)
   361         self.DisableEvents = False
   375         self.DisableEvents = False
   362         
   376         
   363         self.PluginInfos = {}
   377         self.PluginInfos = {}
   395             infos = self.PluginRoot.ShowError(self.Log,
   409             infos = self.PluginRoot.ShowError(self.Log,
   396                                               (int(first_line), int(first_column)), 
   410                                               (int(first_line), int(first_column)), 
   397                                               (int(last_line), int(last_column)))
   411                                               (int(last_line), int(last_column)))
   398 		
   412 		
   399     def OnCloseFrame(self, event):
   413     def OnCloseFrame(self, event):
       
   414         # shutdown local runtime
       
   415         self.local_runtime.kill(SIGKILL)
       
   416         # clear temp dir
       
   417         shutil.rmtree(self.local_runtime_tmpdir)
       
   418         
   400         if self.PluginRoot.HasProjectOpened():
   419         if self.PluginRoot.HasProjectOpened():
   401             if self.PluginRoot.runningPLC is not None:
       
   402                 wx.MessageBox("Please stop any running PLC before closing")
       
   403                 event.Veto()
       
   404                 return
       
   405             if self.PluginRoot.ProjectTestModified():
   420             if self.PluginRoot.ProjectTestModified():
   406                 dialog = wx.MessageDialog(self, "There are changes, do you want to save?", "Close Application", wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
   421                 dialog = wx.MessageDialog(self,
       
   422                                           "Save changes ?",
       
   423                                           "Close Application", 
       
   424                                           wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
   407                 answer = dialog.ShowModal()
   425                 answer = dialog.ShowModal()
   408                 dialog.Destroy()
   426                 dialog.Destroy()
   409                 if answer == wx.ID_YES:
   427                 if answer == wx.ID_YES:
   410                     self.PluginRoot.SaveProject()
   428                     self.PluginRoot.SaveProject()
   411                     event.Skip()
   429                     event.Skip()
   477             st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   495             st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
   478             st.SetLabel(self.PluginRoot.GetProjectName())
   496             st.SetLabel(self.PluginRoot.GetProjectName())
   479             plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER)
   497             plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER)
   480             
   498             
   481             addbutton_id = wx.NewId()
   499             addbutton_id = wx.NewId()
   482             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')),
   500             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Add.png')),
   483                   name='AddPluginButton', parent=plcwindow, pos=wx.Point(0, 0),
   501                   name='AddPluginButton', parent=plcwindow, pos=wx.Point(0, 0),
   484                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   502                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   485             addbutton.SetToolTipString("Add a sub plugin")
   503             addbutton.SetToolTipString("Add a sub plugin")
   486             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id)
   504             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(self.PluginRoot), id=addbutton_id)
   487             plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   505             plcwindowsizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   507             
   525             
   508             if not self.PluginInfos[self.PluginRoot]["middle_visible"]:
   526             if not self.PluginInfos[self.PluginRoot]["middle_visible"]:
   509                 paramswindow.Hide()
   527                 paramswindow.Hide()
   510             
   528             
   511             minimizebutton_id = wx.NewId()
   529             minimizebutton_id = wx.NewId()
   512             minimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=minimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Maximize.png')),
   530             minimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=minimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Maximize.png')),
   513                   name='MinimizeButton', parent=plcwindow, pos=wx.Point(0, 0),
   531                   name='MinimizeButton', parent=plcwindow, pos=wx.Point(0, 0),
   514                   size=wx.Size(24, 24), style=wx.NO_BORDER)
   532                   size=wx.Size(24, 24), style=wx.NO_BORDER)
   515             make_genbitmaptogglebutton_flat(minimizebutton)
   533             make_genbitmaptogglebutton_flat(minimizebutton)
   516             minimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Minimize.png')))
   534             minimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Minimize.png')))
   517             plcwindowbuttonsizer.AddWindow(minimizebutton, 0, border=5, flag=wx.ALL)
   535             plcwindowbuttonsizer.AddWindow(minimizebutton, 0, border=5, flag=wx.ALL)
   518             
   536             
   519 #            if len(self.PluginRoot.PlugChildsTypes) > 0:
   537 #            if len(self.PluginRoot.PlugChildsTypes) > 0:
   520 #                addsizer = self.GenerateAddButtonSizer(self.PluginRoot, plcwindow)
   538 #                addsizer = self.GenerateAddButtonSizer(self.PluginRoot, plcwindow)
   521 #                plcwindowbuttonsizer.AddSizer(addsizer, 0, border=0, flag=0)
   539 #                plcwindowbuttonsizer.AddSizer(addsizer, 0, border=0, flag=0)
   573             msizer = wx.FlexGridSizer(cols=1)
   591             msizer = wx.FlexGridSizer(cols=1)
   574         for plugin_method in plugin.PluginMethods:
   592         for plugin_method in plugin.PluginMethods:
   575             if "method" in plugin_method and plugin_method.get("shown",True):
   593             if "method" in plugin_method and plugin_method.get("shown",True):
   576                 id = wx.NewId()
   594                 id = wx.NewId()
   577                 button = GenBitmapTextButton(id=id, parent=parent,
   595                 button = GenBitmapTextButton(id=id, parent=parent,
   578                     bitmap=wx.Bitmap(os.path.join(CWD, "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], 
   596                     bitmap=wx.Bitmap(Bpath( "%s.png"%plugin_method.get("bitmap", os.path.join("images", "Unknown")))), label=plugin_method["name"], 
   579                     name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER)
   597                     name=plugin_method["name"], pos=wx.DefaultPosition, style=wx.NO_BORDER)
   580                 button.SetToolTipString(plugin_method["tooltip"])
   598                 button.SetToolTipString(plugin_method["tooltip"])
   581                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   599                 button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, plugin_method["method"]), id=id)
   582                 #hack to force size to mini
   600                 #hack to force size to mini
   583                 if not plugin_method.get("enabled",True):
   601                 if not plugin_method.get("enabled",True):
   666 
   684 
   667         rolesizer = wx.BoxSizer(wx.HORIZONTAL)
   685         rolesizer = wx.BoxSizer(wx.HORIZONTAL)
   668         leftsizer.AddSizer(rolesizer, 0, border=0, flag=wx.GROW|wx.RIGHT)
   686         leftsizer.AddSizer(rolesizer, 0, border=0, flag=wx.GROW|wx.RIGHT)
   669 
   687 
   670         enablebutton_id = wx.NewId()
   688         enablebutton_id = wx.NewId()
   671         enablebutton = wx.lib.buttons.GenBitmapToggleButton(id=enablebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Disabled.png')),
   689         enablebutton = wx.lib.buttons.GenBitmapToggleButton(id=enablebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Disabled.png')),
   672               name='EnableButton', parent=leftwindow, size=wx.Size(16, 16), pos=wx.Point(0, 0), style=0)#wx.NO_BORDER)
   690               name='EnableButton', parent=leftwindow, size=wx.Size(16, 16), pos=wx.Point(0, 0), style=0)#wx.NO_BORDER)
   673         enablebutton.SetToolTipString("Enable/Disable this plugin")
   691         enablebutton.SetToolTipString("Enable/Disable this plugin")
   674         make_genbitmaptogglebutton_flat(enablebutton)
   692         make_genbitmaptogglebutton_flat(enablebutton)
   675         enablebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Enabled.png')))
   693         enablebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Enabled.png')))
   676         enablebutton.SetToggle(plugin.MandatoryParams[1].getEnabled())
   694         enablebutton.SetToggle(plugin.MandatoryParams[1].getEnabled())
   677         def toggleenablebutton(event):
   695         def toggleenablebutton(event):
   678             res = self.SetPluginParamsAttribute(plugin, "BaseParams.Enabled", enablebutton.GetToggle())
   696             res = self.SetPluginParamsAttribute(plugin, "BaseParams.Enabled", enablebutton.GetToggle())
   679             enablebutton.SetToggle(res)
   697             enablebutton.SetToggle(res)
   680             event.Skip()
   698             event.Skip()
   698         updownsizer = wx.BoxSizer(wx.VERTICAL)
   716         updownsizer = wx.BoxSizer(wx.VERTICAL)
   699         iecsizer.AddSizer(updownsizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   717         iecsizer.AddSizer(updownsizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   700 
   718 
   701         if plugin_IECChannel > 0:
   719         if plugin_IECChannel > 0:
   702             ieccdownbutton_id = wx.NewId()
   720             ieccdownbutton_id = wx.NewId()
   703             ieccdownbutton = wx.lib.buttons.GenBitmapButton(id=ieccdownbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'IECCDown.png')),
   721             ieccdownbutton = wx.lib.buttons.GenBitmapButton(id=ieccdownbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'IECCDown.png')),
   704                   name='IECCDownButton', parent=leftwindow, pos=wx.Point(0, 0),
   722                   name='IECCDownButton', parent=leftwindow, pos=wx.Point(0, 0),
   705                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   723                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   706             ieccdownbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel - 1), id=ieccdownbutton_id)
   724             ieccdownbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel - 1), id=ieccdownbutton_id)
   707             updownsizer.AddWindow(ieccdownbutton, 0, border=0, flag=wx.ALIGN_LEFT)
   725             updownsizer.AddWindow(ieccdownbutton, 0, border=0, flag=wx.ALIGN_LEFT)
   708 
   726 
   709         ieccupbutton_id = wx.NewId()
   727         ieccupbutton_id = wx.NewId()
   710         ieccupbutton = wx.lib.buttons.GenBitmapTextButton(id=ieccupbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'IECCUp.png')),
   728         ieccupbutton = wx.lib.buttons.GenBitmapTextButton(id=ieccupbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'IECCUp.png')),
   711               name='IECCUpButton', parent=leftwindow, pos=wx.Point(0, 0),
   729               name='IECCUpButton', parent=leftwindow, pos=wx.Point(0, 0),
   712               size=wx.Size(16, 16), style=wx.NO_BORDER)
   730               size=wx.Size(16, 16), style=wx.NO_BORDER)
   713         ieccupbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel + 1), id=ieccupbutton_id)
   731         ieccupbutton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(plugin, plugin_IECChannel + 1), id=ieccupbutton_id)
   714         updownsizer.AddWindow(ieccupbutton, 0, border=0, flag=wx.ALIGN_LEFT)
   732         updownsizer.AddWindow(ieccupbutton, 0, border=0, flag=wx.ALIGN_LEFT)
   715 
   733 
   716         adddeletesizer = wx.BoxSizer(wx.VERTICAL)
   734         adddeletesizer = wx.BoxSizer(wx.VERTICAL)
   717         iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   735         iecsizer.AddSizer(adddeletesizer, 0, border=5, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
   718 
   736 
   719         deletebutton_id = wx.NewId()
   737         deletebutton_id = wx.NewId()
   720         deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete.png')),
   738         deletebutton = wx.lib.buttons.GenBitmapButton(id=deletebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Delete.png')),
   721               name='DeletePluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   739               name='DeletePluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   722               size=wx.Size(16, 16), style=wx.NO_BORDER)
   740               size=wx.Size(16, 16), style=wx.NO_BORDER)
   723         deletebutton.SetToolTipString("Delete this plugin")
   741         deletebutton.SetToolTipString("Delete this plugin")
   724         deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id)
   742         deletebutton.Bind(wx.EVT_BUTTON, self.GetDeleteButtonFunction(plugin), id=deletebutton_id)
   725         adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   743         adddeletesizer.AddWindow(deletebutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   726 
   744 
   727         if len(plugin.PlugChildsTypes) > 0:
   745         if len(plugin.PlugChildsTypes) > 0:
   728             addbutton_id = wx.NewId()
   746             addbutton_id = wx.NewId()
   729             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')),
   747             addbutton = wx.lib.buttons.GenBitmapButton(id=addbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Add.png')),
   730                   name='AddPluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   748                   name='AddPluginButton', parent=leftwindow, pos=wx.Point(0, 0),
   731                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   749                   size=wx.Size(16, 16), style=wx.NO_BORDER)
   732             addbutton.SetToolTipString("Add a sub plugin")
   750             addbutton.SetToolTipString("Add a sub plugin")
   733             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id)
   751             addbutton.Bind(wx.EVT_BUTTON, self.Gen_AddPluginMenu(plugin), id=addbutton_id)
   734             adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   752             adddeletesizer.AddWindow(addbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER)
   735         
   753         
   736         expandbutton_id = wx.NewId()
   754         expandbutton_id = wx.NewId()
   737         expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'plus.png')),
   755         expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'plus.png')),
   738               name='ExpandButton', parent=leftwindow, pos=wx.Point(0, 0),
   756               name='ExpandButton', parent=leftwindow, pos=wx.Point(0, 0),
   739               size=wx.Size(13, 13), style=wx.NO_BORDER)
   757               size=wx.Size(13, 13), style=wx.NO_BORDER)
   740         expandbutton.labelDelta = 0
   758         expandbutton.labelDelta = 0
   741         expandbutton.SetBezelWidth(0)
   759         expandbutton.SetBezelWidth(0)
   742         expandbutton.SetUseFocusIndicator(False)
   760         expandbutton.SetUseFocusIndicator(False)
   743         expandbutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'minus.png')))
   761         expandbutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'minus.png')))
   744         expandbutton.SetToggle(self.PluginInfos[plugin]["expanded"])
   762         expandbutton.SetToggle(self.PluginInfos[plugin]["expanded"])
   745             
   763             
   746         if len(self.PluginInfos[plugin]["children"]) > 0:
   764         if len(self.PluginInfos[plugin]["children"]) > 0:
   747             def togglebutton(event):
   765             def togglebutton(event):
   748                 if expandbutton.GetToggle():
   766                 if expandbutton.GetToggle():
   765         tc.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(tc, plugin, "BaseParams.Name"), id=tc_id)
   783         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)
   784         iecsizer.AddWindow(tc, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
   767        
   785        
   768 
   786 
   769         leftminimizebutton_id = wx.NewId()
   787         leftminimizebutton_id = wx.NewId()
   770         leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'ShowVars.png')),
   788         leftminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=leftminimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'ShowVars.png')),
   771               name='MinimizeButton', parent=leftwindow, pos=wx.Point(0, 0),
   789               name='MinimizeButton', parent=leftwindow, pos=wx.Point(0, 0),
   772               size=wx.Size(24, 24), style=wx.NO_BORDER)
   790               size=wx.Size(24, 24), style=wx.NO_BORDER)
   773         make_genbitmaptogglebutton_flat(leftminimizebutton)
   791         make_genbitmaptogglebutton_flat(leftminimizebutton)
   774         leftminimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'HideVars.png')))
   792         leftminimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'HideVars.png')))
   775         leftminimizebutton.SetToggle(self.PluginInfos[plugin]["left_visible"])
   793         leftminimizebutton.SetToggle(self.PluginInfos[plugin]["left_visible"])
   776         def toggleleftwindow(event):
   794         def toggleleftwindow(event):
   777             if leftminimizebutton.GetToggle():
   795             if leftminimizebutton.GetToggle():
   778                 leftwindowsizer.Show(1)
   796                 leftwindowsizer.Show(1)
   779             else:
   797             else:
   827         
   845         
   828         if not self.PluginInfos[plugin]["middle_visible"]:
   846         if not self.PluginInfos[plugin]["middle_visible"]:
   829             paramswindow.Hide()
   847             paramswindow.Hide()
   830         
   848         
   831         middleminimizebutton_id = wx.NewId()
   849         middleminimizebutton_id = wx.NewId()
   832         middleminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=middleminimizebutton_id, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Maximize.png')),
   850         middleminimizebutton = wx.lib.buttons.GenBitmapToggleButton(id=middleminimizebutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'Maximize.png')),
   833               name='MinimizeButton', parent=middlewindow, pos=wx.Point(0, 0),
   851               name='MinimizeButton', parent=middlewindow, pos=wx.Point(0, 0),
   834               size=wx.Size(24, 24), style=wx.NO_BORDER)
   852               size=wx.Size(24, 24), style=wx.NO_BORDER)
   835         make_genbitmaptogglebutton_flat(middleminimizebutton)
   853         make_genbitmaptogglebutton_flat(middleminimizebutton)
   836         middleminimizebutton.SetBitmapSelected(wx.Bitmap(os.path.join(CWD, 'images', 'Minimize.png')))
   854         middleminimizebutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'Minimize.png')))
   837         middleminimizebutton.SetToggle(self.PluginInfos[plugin]["middle_visible"])
   855         middleminimizebutton.SetToggle(self.PluginInfos[plugin]["middle_visible"])
   838         middleparamssizer.AddWindow(middleminimizebutton, 0, border=5, flag=wx.ALL)
   856         middleparamssizer.AddWindow(middleminimizebutton, 0, border=5, flag=wx.ALL)
   839         
   857         
   840 #        rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1))
   858 #        rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1))
   841 #        rightwindow.SetBackgroundColour(wx.Colour(240,240,240))
   859 #        rightwindow.SetBackgroundColour(wx.Colour(240,240,240))
  1175     
  1193     
  1176     def OnSaveLogMenu(self, event):
  1194     def OnSaveLogMenu(self, event):
  1177         event.Skip()
  1195         event.Skip()
  1178     
  1196     
  1179     def OnBeremizMenu(self, event):
  1197     def OnBeremizMenu(self, event):
  1180         open_pdf(os.path.join(CWD, "doc", "manual_beremiz.pdf"))
  1198         open_pdf(Bpath( "doc", "manual_beremiz.pdf"))
  1181         event.Skip()
  1199         event.Skip()
  1182     
  1200     
  1183     def OnAboutMenu(self, event):
  1201     def OnAboutMenu(self, event):
  1184         OpenHtmlFrame(self,"About Beremiz", os.path.join(CWD, "doc","about.html"), wx.Size(550, 500))
  1202         OpenHtmlFrame(self,"About Beremiz", Bpath("doc","about.html"), wx.Size(550, 500))
  1185         event.Skip()
  1203         event.Skip()
  1186     
  1204     
  1187     def OnAddButton(self, event):
  1205     def OnAddButton(self, event):
  1188         PluginType = self.PluginChilds.GetStringSelection()
  1206         PluginType = self.PluginChilds.GetStringSelection()
  1189         if PluginType != "":
  1207         if PluginType != "":