def inspectDisplay(self, display): self.display = display # Get the subset of visibles that are paths. self.paths = ObjectList() self.visibles = display.selection() for visible in self.visibles: if visible.isPath(): self.paths.append(visible) if len(self.paths) == 0: self._flowToLabel.Hide() self._flowToCheckBox.Hide() self._sizer.Hide(self._flowFromBoxSizer, True) dispatcher.connect(self.refreshGUI, ('set', 'defaultFlowColor'), self.display) dispatcher.connect(self.refreshGUI, ('set', 'defaultFlowSpread'), self.display) else: self._flowToLabel.Show() self._flowToCheckBox.Show() self._sizer.Show(self._flowFromBoxSizer, True) for path in self.paths: for attributeName in [ 'flowTo', 'flowToColor', 'flowToSpread', 'flowFrom', 'flowFromColor', 'flowFromSpread' ]: dispatcher.connect(self.refreshGUI, ('set', attributeName), visible) self.refreshGUI()
def inspectDisplay(self, display): # Object inspectors are supposed to work purely at the network/biological layer so they don't need to know what the display is. self.display = display self.objects = ObjectList() self.updatingObjects = False for visible in display.selection(): if visible.client.__class__ == self.__class__.objectClass(): self.objects.append(visible.client) dispatcher.connect(self.nameChanged, ('set', 'name'), visible.client) for attributePath in self.inspectedAttributes(): if '.' in attributePath: (subObject, attribute) = attributePath.split('.') object = getattr(visible.client, subObject) else: object = visible.client attribute = attributePath dispatcher.connect(self.inspectedAttributeChanged, ('set', attribute), object) # Set the icon image = self.objects[0].__class__.image() if image == None: pass else: scaledImage = image.Rescale(32, 32, wx.IMAGE_QUALITY_HIGH) self.iconField.SetBitmap(wx.BitmapFromImage(scaledImage)) self.populateNameField() self.populateObjectSizer() self._window.Layout()
def willBeClosed(self): for visible in self.visibles: for attributeName in [ 'color', 'opacity', 'shape', 'texture', 'weight' ]: dispatcher.disconnect(self.refreshGUI, ('set', attributeName), visible) self.visibles = ObjectList()