graphics/GraphicCommons.py
changeset 887 d3c6c4ab8b28
parent 880 781ced3c0aef
child 897 3cd39bc7dbad
equal deleted inserted replaced
886:ace92afe9100 887:d3c6c4ab8b28
   317     def __del__(self):
   317     def __del__(self):
   318         self.DataProducer = None
   318         self.DataProducer = None
   319         self.DeleteDataConsumers()
   319         self.DeleteDataConsumers()
   320         if self.LastRefreshTimer is not None:
   320         if self.LastRefreshTimer is not None:
   321             self.LastRefreshTimer.Stop()
   321             self.LastRefreshTimer.Stop()
       
   322         if self.HasAcquiredLock:
       
   323             DEBUG_REFRESH_LOCK.release()
   322     
   324     
   323     def SetDataProducer(self, producer):
   325     def SetDataProducer(self, producer):
   324         if self.RegisterTick and self.Debug:
   326         if self.RegisterTick and self.Debug:
   325             if producer is not None:
   327             if producer is not None:
   326                 producer.SubscribeDebugIECVariable("__tick__", self)
   328                 producer.SubscribeDebugIECVariable("__tick__", self)
   350         if iec_path is not None:
   352         if iec_path is not None:
   351             self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer)
   353             self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer)
   352     
   354     
   353     def GetDataType(self, iec_path):
   355     def GetDataType(self, iec_path):
   354         if self.DataProducer is not None:
   356         if self.DataProducer is not None:
   355             return self.DataProducer.GetDebugIECVariableType(iec_path)
   357             infos = self.DataProducer.GetInstanceInfos(iec_path)
       
   358             if infos is not None:
       
   359                 return infos["type"]
       
   360             return self.DataProducer.GetDebugIECVariableType(iec_path.upper())
   356         return None
   361         return None
       
   362     
       
   363     def IsNumType(self, data_type):
       
   364         return self.DataProducer.IsNumType(data_type)
   357     
   365     
   358     def ForceDataValue(self, iec_path, value):
   366     def ForceDataValue(self, iec_path, value):
   359         if self.DataProducer is not None:
   367         if self.DataProducer is not None:
   360             self.DataProducer.ForceDebugIECVariable(iec_path, value)
   368             self.DataProducer.ForceDebugIECVariable(iec_path, value)
   361     
   369     
   388         self.TimerAccessLock.acquire()
   396         self.TimerAccessLock.acquire()
   389         if self.LastRefreshTimer is not None:
   397         if self.LastRefreshTimer is not None:
   390             self.LastRefreshTimer.cancel()
   398             self.LastRefreshTimer.cancel()
   391             self.LastRefreshTimer=None
   399             self.LastRefreshTimer=None
   392         self.TimerAccessLock.release()
   400         self.TimerAccessLock.release()
   393         if not self.Inhibited:
   401         if self.IsShown() and not self.Inhibited:
   394             current_time = gettime()
   402             current_time = gettime()
   395             if current_time - self.LastRefreshTime > REFRESH_PERIOD and DEBUG_REFRESH_LOCK.acquire(False):
   403             if current_time - self.LastRefreshTime > REFRESH_PERIOD and DEBUG_REFRESH_LOCK.acquire(False):
   396                 self.AccessLock.acquire()
   404                 self.AccessLock.acquire()
   397                 self.HasAcquiredLock = True
   405                 self.HasAcquiredLock = True
   398                 self.AccessLock.release()
   406                 self.AccessLock.release()