--- a/Beremiz.py Fri Oct 09 17:52:00 2009 +0200
+++ b/Beremiz.py Thu Oct 15 10:11:07 2009 +0200
@@ -377,7 +377,7 @@
self._init_beremiz_sizers()
- def __init__(self, parent, projectOpen, buildpath, debug=True):
+ def __init__(self, parent, projectOpen=None, buildpath=None, plugin_root=None, debug=True): IDEFrame.__init__(self, parent, debug)
self.Config = wx.ConfigBase.Get()
@@ -403,8 +403,11 @@
self.ShowErrorMessage(result)
+ self.PluginRoot = plugin_root + self.Controler = plugin_root + if plugin_root is not None: + self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) # Add beremiz's icon in top left corner of the frame
self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
--- a/plugger.py Fri Oct 09 17:52:00 2009 +0200
+++ b/plugger.py Thu Oct 15 10:11:07 2009 +0200
@@ -485,7 +485,7 @@
# Ask to his parent to remove it
self.PlugParent._doRemoveChild(self)
- def PlugAddChild(self, PlugName, PlugType):
+ def PlugAddChild(self, PlugName, PlugType, IEC_Channel=0): Create the plugins that may be added as child to this node self
@param PlugType: string desining the plugin class name (get name from PlugChildsTypes)
@@ -554,7 +554,7 @@
# If plugin do not have corresponding file/dirs - they will be created on Save
- _self.FindNewIEC_Channel(0)
+ _self.FindNewIEC_Channel(IEC_Channel) # Call the plugin real __init__
if getattr(PlugClass, "__init__", None):
PlugClass.__init__(_self)
@@ -742,8 +742,7 @@
PLCControler.__init__(self)
self.MandatoryParams = None
+ self.SetAppFrame(frame, logger) @@ -755,11 +754,6 @@
self.ResetIECProgramsAndVariables()
- # Timer to pull PLC status
- ID_STATUSTIMER = wx.NewId()
- self.StatusTimer = wx.Timer(self.AppFrame, ID_STATUSTIMER)
- self.AppFrame.Bind(wx.EVT_TIMER, self.PullPLCStatusProc, self.StatusTimer)
#This method are not called here... but in NewProject and OpenProject
#self._AddParamsMembers()
@@ -785,6 +779,25 @@
+ def SetAppFrame(self, frame, logger): + self.StatusTimer = None + # Timer to pull PLC status + ID_STATUSTIMER = wx.NewId() + self.StatusTimer = wx.Timer(self.AppFrame, ID_STATUSTIMER) + self.AppFrame.Bind(wx.EVT_TIMER, self.PullPLCStatusProc, self.StatusTimer) + def ResetAppFrame(self, logger): + if self.AppFrame is not None: + self.AppFrame.Unbind(wx.EVT_TIMER, self.StatusTimer) + self.StatusTimer = None def PluginLibraryFilePath(self):
return os.path.join(os.path.split(__file__)[0], "pous.xml")
@@ -910,8 +923,8 @@
self.ClearPluggedChilds()
- self.AppFrame.Unbind(wx.EVT_TIMER, self.StatusTimer)
+ self.ResetAppFrame(None) if not self.SaveXMLFile():
self.SaveXMLFile(os.path.join(self.ProjectPath, 'plc.xml'))