34 import os, re, platform, sys, time, traceback, getopt, commands |
34 import os, re, platform, sys, time, traceback, getopt, commands |
35 |
35 |
36 from plugger import PluginsRoot |
36 from plugger import PluginsRoot |
37 |
37 |
38 from wxPopen import wxPopen3 |
38 from wxPopen import wxPopen3 |
|
39 |
|
40 CWD = os.path.split(os.path.realpath(__file__))[0] |
39 |
41 |
40 class LogPseudoFile: |
42 class LogPseudoFile: |
41 """ Base class for file like objects to facilitate StdOut for the Shell.""" |
43 """ Base class for file like objects to facilitate StdOut for the Shell.""" |
42 def __init__(self, output = None): |
44 def __init__(self, output = None): |
43 self.red_white = wx.TextAttr("RED", "WHITE") |
45 self.red_white = wx.TextAttr("RED", "WHITE") |
309 self.PluginChilds = wx.Choice(id=ID_BEREMIZPLUGINCHILDS, |
311 self.PluginChilds = wx.Choice(id=ID_BEREMIZPLUGINCHILDS, |
310 name='PluginChilds', parent=self.LeftPanel, pos=wx.Point(0, 0), |
312 name='PluginChilds', parent=self.LeftPanel, pos=wx.Point(0, 0), |
311 size=wx.Size(-1, -1), style=0) |
313 size=wx.Size(-1, -1), style=0) |
312 |
314 |
313 if wx.VERSION < (2, 8, 0): |
315 if wx.VERSION < (2, 8, 0): |
314 self.AddButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Add.png')), |
316 self.AddButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')), |
315 name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
317 name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
316 size=wx.Size(32, 32), style=wx.NO_BORDER) |
318 size=wx.Size(32, 32), style=wx.NO_BORDER) |
317 else: |
319 else: |
318 self.AddButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Add.png')), |
320 self.AddButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Add.png')), |
319 name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
321 name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
320 size=wx.Size(32, 32), style=wx.NO_BORDER) |
322 size=wx.Size(32, 32), style=wx.NO_BORDER) |
321 |
323 |
322 self.AddButton.SetToolTipString("Add a plugin of the type selected") |
324 self.AddButton.SetToolTipString("Add a plugin of the type selected") |
323 self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButton, |
325 self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButton, |
324 id=ID_BEREMIZADDBUTTON) |
326 id=ID_BEREMIZADDBUTTON) |
325 |
327 |
326 if wx.VERSION < (2, 8, 0): |
328 if wx.VERSION < (2, 8, 0): |
327 self.DeleteButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Delete.png')), |
329 self.DeleteButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete.png')), |
328 name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
330 name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
329 size=wx.Size(32, 32), style=wx.NO_BORDER) |
331 size=wx.Size(32, 32), style=wx.NO_BORDER) |
330 else: |
332 else: |
331 self.DeleteButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Delete.png')), |
333 self.DeleteButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join(CWD, 'images', 'Delete.png')), |
332 name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
334 name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0), |
333 size=wx.Size(32, 32), style=wx.NO_BORDER) |
335 size=wx.Size(32, 32), style=wx.NO_BORDER) |
334 self.DeleteButton.SetToolTipString("Delete the current selected plugin") |
336 self.DeleteButton.SetToolTipString("Delete the current selected plugin") |
335 self.DeleteButton.Bind(wx.EVT_BUTTON, self.OnDeleteButton, |
337 self.DeleteButton.Bind(wx.EVT_BUTTON, self.OnDeleteButton, |
336 id=ID_BEREMIZDELETEBUTTON) |
338 id=ID_BEREMIZDELETEBUTTON) |
374 self.LogConsole = wx.TextCtrl(id=ID_BEREMIZLOGCONSOLE, value='', |
376 self.LogConsole = wx.TextCtrl(id=ID_BEREMIZLOGCONSOLE, value='', |
375 name='LogConsole', parent=self, pos=wx.Point(0, 0), |
377 name='LogConsole', parent=self, pos=wx.Point(0, 0), |
376 size=wx.Size(0, 0), style=wx.TE_MULTILINE|wx.TE_RICH2) |
378 size=wx.Size(0, 0), style=wx.TE_MULTILINE|wx.TE_RICH2) |
377 self.AUIManager.AddPane(self.LogConsole, wx.aui.AuiPaneInfo().Caption("Log Console").Bottom().Layer(0).BestSize(wx.Size(800, 200)).CloseButton(False)) |
379 self.AUIManager.AddPane(self.LogConsole, wx.aui.AuiPaneInfo().Caption("Log Console").Bottom().Layer(0).BestSize(wx.Size(800, 200)).CloseButton(False)) |
378 |
380 |
|
381 self._init_sizers() |
|
382 |
|
383 if wx.VERSION >= (2, 8, 0): |
379 self.AUIManager.Update() |
384 self.AUIManager.Update() |
380 |
|
381 self._init_sizers() |
|
382 |
385 |
383 def __init__(self, parent, projectOpen): |
386 def __init__(self, parent, projectOpen): |
384 self._init_ctrls(parent) |
387 self._init_ctrls(parent) |
385 |
388 |
386 self.Log = LogPseudoFile(self.LogConsole) |
389 self.Log = LogPseudoFile(self.LogConsole) |
547 if "method" in plugin_infos: |
550 if "method" in plugin_infos: |
548 id = wx.NewId() |
551 id = wx.NewId() |
549 if "bitmap" in plugin_infos: |
552 if "bitmap" in plugin_infos: |
550 if wx.VERSION < (2, 8, 0): |
553 if wx.VERSION < (2, 8, 0): |
551 button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, |
554 button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, |
552 bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], |
555 bitmap=wx.Bitmap(os.path.join(CWD, plugin_infos["bitmap"])), label=plugin_infos["name"], |
553 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
556 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
554 else: |
557 else: |
555 button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel, |
558 button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel, |
556 bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], |
559 bitmap=wx.Bitmap(os.path.join(CWD, plugin_infos["bitmap"])), label=plugin_infos["name"], |
557 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
560 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
558 |
561 |
559 else: |
562 else: |
560 button = wx.Button(id=id, label=plugin_infos["name"], |
563 button = wx.Button(id=id, label=plugin_infos["name"], |
561 name=plugin_infos["name"], parent=self.RightPanel, |
564 name=plugin_infos["name"], parent=self.RightPanel, |
572 if "method" in plugin_infos: |
575 if "method" in plugin_infos: |
573 id = wx.NewId() |
576 id = wx.NewId() |
574 if "bitmap" in plugin_infos: |
577 if "bitmap" in plugin_infos: |
575 if wx.VERSION < (2, 8, 0): |
578 if wx.VERSION < (2, 8, 0): |
576 button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, |
579 button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, |
577 bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], |
580 bitmap=wx.Bitmap(os.path.join(CWD, plugin_infos["bitmap"])), label=plugin_infos["name"], |
578 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
581 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
579 else: |
582 else: |
580 button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel, |
583 button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel, |
581 bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], |
584 bitmap=wx.Bitmap(os.path.join(CWD, plugin_infos["bitmap"])), label=plugin_infos["name"], |
582 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
585 name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER) |
583 else: |
586 else: |
584 button = wx.Button(id=id, label=plugin_infos["name"], |
587 button = wx.Button(id=id, label=plugin_infos["name"], |
585 name=plugin_infos["name"], parent=self.RightPanel, |
588 name=plugin_infos["name"], parent=self.RightPanel, |
586 pos=wx.Point(0, 0), style=wx.BU_EXACTFIT) |
589 pos=wx.Point(0, 0), style=wx.BU_EXACTFIT) |