예제 #1
0
 def onSelectionChanged(self, models):
     if self._oldModels in [None, []]:
         for model in models:
             attr = Attribute(model)
             #force a read -> attr.read()
             attr.addListener(self)
         self._oldModels = models
     else:
         keptModels = []
         newModels = []
         for model in models:
             if model in self._oldModels:
                 keptModels.append(model)
             else:
                 newModels.append(model)
         for model in self._oldModels:
             if model not in newModels:
                 attr = Attribute(model)
                 attr.removeListener(self)
                 legend = attr.getNormalName()
                 print("Trying to remove ", legend)
                 self.removeCurve(legend, replot=False)
         for model in newModels:
             attr = Attribute(model)
             # attr.read()
             attr.addListener(self)
         self._oldModels = keptModels + newModels
예제 #2
0
 def onSelectionChanged(self, models):
     if self._oldModels in [None, []]:
         self._attrDict = {}
         for model in models:
             try:
                 attr = Attribute(model)
             except:
                 # old PyTango versions do not handle unicode
                 attr = Attribute(str(model))
             #force a read -> attr.read()
             attr.addListener(self)
             legend = qt.safe_str(attr.getNormalName())
             self._attrDict[legend] = attr
         self._oldModels = models
     else:
         keptModels = []
         newModels = []
         for model in models:
             if model in self._oldModels:
                 keptModels.append(model)
             else:
                 newModels.append(model)
         for model in self._oldModels:
             if model not in keptModels:
                 attr = Attribute(model)
                 attr.removeListener(self)
                 legend = qt.safe_str(attr.getNormalName())
                 if legend in self._attrDict:
                     del self._attrDict[legend]
                 print("Trying to remove ", legend)
                 self.removeCurve(legend, replot=False)
         for model in newModels:
             attr = Attribute(model)
             # attr.read()
             attr.addListener(self)
             legend = qt.safe_str(attr.getNormalName())
             self._attrDict[legend] = attr
         self._oldModels = keptModels + newModels
예제 #3
0
 def onSelectionChanged(self, models):
     if self._oldModels in [None, []]:
         self._attrDict = {}
         for model in models:
             try:
                 attr = Attribute(model)
             except:
                 # old PyTango versions do not handle unicode
                 attr = Attribute(str(model))
             #force a read -> attr.read()
             attr.addListener(self)
             legend = qt.safe_str(attr.getNormalName())
             self._attrDict[legend] = attr
         self._oldModels = models
     else:
         keptModels = []
         newModels = []
         for model in models:
             if model in self._oldModels:
                 keptModels.append(model)
             else:
                 newModels.append(model)
         for model in self._oldModels:
             if model not in keptModels:
                 attr = Attribute(model)
                 attr.removeListener(self)
                 legend = qt.safe_str(attr.getNormalName())
                 if legend in self._attrDict:
                     del self._attrDict[legend]
                 print("Trying to remove ", legend)
                 self.removeCurve(legend, replot=False)
         for model in newModels:
             attr = Attribute(model)
             # attr.read()
             attr.addListener(self)
             legend = qt.safe_str(attr.getNormalName())
             self._attrDict[legend] = attr
         self._oldModels = keptModels + newModels