graphics/GraphicCommons.py
changeset 367 2fdf57d0ce51
parent 364 deee68313770
child 368 591ba4003d74
equal deleted inserted replaced
366:764a7584022c 367:2fdf57d0ce51
    21 #You should have received a copy of the GNU General Public
    21 #You should have received a copy of the GNU General Public
    22 #License along with this library; if not, write to the Free Software
    22 #License along with this library; if not, write to the Free Software
    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 import wx
    25 import wx
    26 import time
    26 from time import time as gettime
    27 from math import *
    27 from math import *
    28 from types import *
    28 from types import *
    29 
    29 
    30 #-------------------------------------------------------------------------------
    30 #-------------------------------------------------------------------------------
    31 #                               Common constants
    31 #                               Common constants
   226         self.DataProducer = producer
   226         self.DataProducer = producer
   227         self.Debug = debug
   227         self.Debug = debug
   228         
   228         
   229         self.DataConsumers = {}
   229         self.DataConsumers = {}
   230         
   230         
   231         self.LastRefreshTime = time.time()
   231         self.LastRefreshTime = gettime()
   232         
   232         
   233         if register_tick and debug:
   233         if register_tick and debug:
   234             self.DataProducer.SubscribeDebugIECVariable("__tick__", self)
   234             self.DataProducer.SubscribeDebugIECVariable("__tick__", self)
   235         
   235         
   236         self.RefreshTimer = wx.Timer(self, -1)
   236         self.RefreshTimer = wx.Timer(self, -1)
   266         self.RefreshNewData()
   266         self.RefreshNewData()
   267         event.Skip()
   267         event.Skip()
   268     
   268     
   269     def NewDataAvailable(self):
   269     def NewDataAvailable(self):
   270         self.Inhibit(True)
   270         self.Inhibit(True)
   271         current_time = time.time()
   271         current_time = gettime()
   272         if current_time - self.LastRefreshTime > REFRESH_PERIOD:
   272         if current_time - self.LastRefreshTime > REFRESH_PERIOD:
   273             self.LastRefreshTime = current_time
   273             self.LastRefreshTime = current_time
   274             wx.CallAfter(self.RefreshViewOnNewData)
   274             wx.CallAfter(self.RefreshViewOnNewData)
   275 
   275 
   276     def RefreshViewOnNewData(self):
   276     def RefreshViewOnNewData(self):