more minor cleanup
authorEdouard Tisserant
Sun, 18 Jan 2015 20:38:34 +0100
changeset 1431 df59be5afb08
parent 1430 754fa90c8b27
child 1432 8872223a675b
more minor cleanup
controls/DebugVariablePanel/DebugVariablePanel.py
editors/DebugViewer.py
editors/Viewer.py
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Sun Jan 18 19:41:27 2015 +0100
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Sun Jan 18 20:38:34 2015 +0100
@@ -319,7 +319,7 @@
         if self.DataProducer is not None:
             self.SetTickTime(self.DataProducer.GetTicktime())
     
-    def RefreshNewData(self, *args, **kwargs):
+    def RefreshNewData(self):
         """
         Called to refresh Panel according to values received by variables
         Can receive any parameters (not used here)
@@ -329,9 +329,9 @@
             self.HasNewData = False
             self.RefreshView()
         
-        DebugViewer.RefreshNewData(self, *args, **kwargs)
-    
-    def NewDataAvailable(self, ticks, *args, **kwargs):
+        DebugViewer.RefreshNewData(self)
+    
+    def NewDataAvailable(self, ticks):
         """
         Called by DataProducer for each tick captured or by panel to refresh
         graphs
@@ -363,14 +363,14 @@
             self.RefreshView()
             
         else:
-            DebugViewer.NewDataAvailable(self, ticks, *args, **kwargs)
+            DebugViewer.NewDataAvailable(self, ticks)
     
     def ForceRefresh(self):
         """
         Called to force refresh of graphs
         """
         self.Force = True
-        wx.CallAfter(self.NewDataAvailable, None, True)
+        wx.CallAfter(self.NewDataAvailable, None)
     
     def SetCursorTick(self, cursor_tick):
         """
--- a/editors/DebugViewer.py	Sun Jan 18 19:41:27 2015 +0100
+++ b/editors/DebugViewer.py	Sun Jan 18 20:38:34 2015 +0100
@@ -246,7 +246,7 @@
         if self.DataProducer is not None:
             self.DataProducer.ReleaseDebugIECVariable(iec_path)
     
-    def NewDataAvailable(self, ticks, *args, **kwargs):
+    def NewDataAvailable(self, ticks):
         """
         Called by DataProducer for each tick captured
         @param tick: PLC tick captured
@@ -267,19 +267,19 @@
             # two refresh has expired
             if gettime() - self.LastRefreshTime > REFRESH_PERIOD and \
                DEBUG_REFRESH_LOCK.acquire(False):
-                self.StartRefreshing(*args, **kwargs)
+                self.StartRefreshing()
             
             # If common lock wasn't acquired for any reason, restart last
             # refresh timer
             else:
-                self.StartLastRefreshTimer(*args, **kwargs)
+                self.StartLastRefreshTimer()
         
         # In the case that DebugViewer isn't visible on screen and has already
         # acquired common refresh lock, reset DebugViewer
         elif not self.IsShown() and self.HasAcquiredLock:
             DebugViewer.RefreshNewData(self)
     
-    def ShouldRefresh(self, *args, **kwargs):
+    def ShouldRefresh(self):
         """
         Callback function called when last refresh timer expired
         All parameters are passed to refresh function
@@ -289,13 +289,13 @@
             
             # Try to acquire common refresh lock
             if DEBUG_REFRESH_LOCK.acquire(False):
-                self.StartRefreshing(*args, **kwargs)
+                self.StartRefreshing()
             
             # Restart last refresh timer if common refresh lock acquired failed
             else:
-                self.StartLastRefreshTimer(*args, **kwargs)
-    
-    def StartRefreshing(self, *args, **kwargs):
+                self.StartLastRefreshTimer()
+    
+    def StartRefreshing(self):
         """
         Called to initiate a refresh of DebugViewer
         All parameters are passed to refresh function
@@ -311,9 +311,9 @@
         self.Inhibit(True)
         
         # Initiate DebugViewer refresh
-        wx.CallAfter(self.RefreshNewData, *args, **kwargs)
-    
-    def StartLastRefreshTimer(self, *args, **kwargs):
+        wx.CallAfter(self.RefreshNewData)
+    
+    def StartLastRefreshTimer(self):
         """
         Called to start last refresh timer for the minimum time between 2
         refresh
@@ -321,11 +321,11 @@
         """
         self.TimerAccessLock.acquire()
         self.LastRefreshTimer = Timer(
-            REFRESH_PERIOD, self.ShouldRefresh, args, kwargs)
+            REFRESH_PERIOD, self.ShouldRefresh)
         self.LastRefreshTimer.start()
         self.TimerAccessLock.release()
     
-    def RefreshNewData(self, *args, **kwargs):
+    def RefreshNewData(self):
         """
         Called to refresh DebugViewer according to values received by data
         consumers
--- a/editors/Viewer.py	Sun Jan 18 19:41:27 2015 +0100
+++ b/editors/Viewer.py	Sun Jan 18 20:38:34 2015 +0100
@@ -1114,7 +1114,7 @@
         self.ElementRefreshList.append(element)
         self.ElementRefreshList_lock.release()
 
-    def NewDataAvailable(self, ticks, *args, **kwargs):
+    def NewDataAvailable(self, ticks):
         if self.IsShown():
             refresh_rect = None
             self.ElementRefreshList_lock.acquire()