Mercurial > lcfOS
diff python/apps/diagramitems.py @ 93:f7ec7517cabb
edits
author | windel |
---|---|
date | Mon, 24 Dec 2012 12:52:13 +0100 |
parents | 0c4bdbf0aead |
children |
line wrap: on
line diff
--- a/python/apps/diagramitems.py Sat Dec 15 23:56:26 2012 +0100 +++ b/python/apps/diagramitems.py Mon Dec 24 12:52:13 2012 +0100 @@ -176,7 +176,7 @@ class ResizeSelectionHandle(Handle): def __init__(self, position, block): - super(ResizeSelectionHandle, self).__init__(dx=6, parent=block) + super(ResizeSelectionHandle, self).__init__(dx=12, parent=block) self.position = position self.block = block if position in [Position.TOP_LEFT, Position.BOTTOM_RIGHT]: @@ -221,13 +221,6 @@ def editParameters(self): pd = ParameterDialog(self, self.window()) pd.exec_() - def mouseDoubleClickEvent(self, event): - #self.editParameters() - scene = self.scene() - if scene: - for view in scene.views(): - view.diagram = self.subModel - view.zoomAll() def newInputPort(self): names = [i.name for i in self.inputs + self.outputs] self.addInput(InputPort(uniqify('in', names), self)) @@ -360,15 +353,33 @@ self.subModel.containingBlock = self def setDict(self, d): self.subModel.Dict = d['submodel'] + def mouseDoubleClickEvent(self, event): + # descent into child diagram + #self.editParameters() + print('descent') + scene = self.scene() + if scene: + for view in scene.views(): + view.diagram = self.subModel + view.zoomAll() class DiagramScene(QGraphicsScene): """ A diagram scene consisting of blocks and connections """ + structureChanged = pyqtSignal() def __init__(self): super(DiagramScene, self).__init__() self.startedConnection = None blocks = property(lambda sel: [i for i in sel.items() if isinstance(i, Block)]) connections = property(lambda sel: [i for i in sel.items() if type(i) is Connection]) + def addItem(self, item): + super(DiagramScene, self).addItem(item) + if isinstance(item, Block): + self.structureChanged.emit() + def removeItem(self, item): + super(DiagramScene, self).removeItem(item) + if isinstance(item, Block): + self.structureChanged.emit() def setDict(self, d): for block in d['blocks']: b = Block()