Adding support for extracting Common_Ticktime from VARIABLES.csv
authorlaurent
Wed, 25 Jan 2012 01:23:44 +0100
changeset 670 fb03cb6da95c
parent 669 472469f4d5ad
child 672 f97f207d027b
Adding support for extracting Common_Ticktime from VARIABLES.csv
plugger.py
plugins/python/PythonEditor.py
--- a/plugger.py	Tue Jan 24 21:39:26 2012 +0100
+++ b/plugger.py	Wed Jan 25 01:23:44 2012 +0100
@@ -1287,6 +1287,7 @@
         self._ProgramList = None
         self._VariablesList = None
         self._IECPathToIdx = {}
+        self._Ticktime = 0
         self.TracedIECPath = []
 
     def GetIECProgramsAndVariables(self):
@@ -1341,6 +1342,11 @@
                     IEC_path=attrs["IEC_path"]
                     Idx=int(attrs["num"])
                     self._IECPathToIdx[IEC_path]=(Idx, attrs["type"])
+                
+                # third section contains ticktime
+                if len(ListGroup) > 2:
+                    self._Ticktime = int(ListGroup[2][0]) 
+                
             except Exception,e:
                 self.logger.write_error(_("Cannot open/parse VARIABLES.csv!\n"))
                 self.logger.write_error(traceback.format_exc())
@@ -1763,6 +1769,9 @@
                         function(*(cargs + args), **kwargs)
                 # This will block thread if more than one call is waiting
 
+    def GetTicktime(self):
+        return self._Ticktime
+
     def DebugThreadProc(self):
         """
         This thread waid PLC debug data, and dispatch them to subscribers
--- a/plugins/python/PythonEditor.py	Tue Jan 24 21:39:26 2012 +0100
+++ b/plugins/python/PythonEditor.py	Wed Jan 25 01:23:44 2012 +0100
@@ -238,7 +238,7 @@
         self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
     
     def __del__(self):
-        self.Controler.OnCloseEditor()
+        self.Controler.OnCloseEditor(self)
     
     def GetTitle(self):
         fullname = self.Controler.PlugFullName()