class InclusionEdgeInfo(EdgeInfo): """ This class implements the information box for inclusion edges. """ def __init__(self, mainwindow, parent=None): """ Initialize the inclusion edge information box. :type mainwindow: MainWindow :type parent: QWidget """ super().__init__(mainwindow, parent) self.completeKey = Key('Complete', self) parent = Parent(self) self.completeBox = CheckBox(parent) self.completeBox.setCheckable(True) connect(self.completeBox.clicked, self.mainwindow.toggleEdgeComplete) self.generalLayout.addRow(self.completeKey, parent) def updateData(self, edge): """ Fetch new information and fill the widget with data. :type edge: AbstractEdge """ super().updateData(edge) self.completeBox.setChecked(edge.complete)
class AttributeNodeInfo(EditableNodeInfo): """ This class implements the information box for the Attribute node. """ def __init__(self, mainwindow, parent=None): """ Initialize the Attribute node information box. """ super().__init__(mainwindow, parent) self.functKey = Key('Funct.', self) functParent = Parent(self) self.functBox = CheckBox(functParent) self.functBox.setCheckable(True) self.functBox.setProperty('attribute', 'functional') connect(self.functBox.clicked, self.flagChanged) self.predPropLayout.addRow(self.functKey, functParent) @pyqtSlot() def flagChanged(self): """ Executed whenever one of the property fields changes. """ node = self.node scene = node.scene() sender = self.sender() checked = sender.isChecked() attribute = sender.property('attribute') name = '{}set {} {} property'.format('un' if checked else '', node.shortname, attribute) data = { 'attribute': attribute, 'undo': getattr(node, attribute), 'redo': checked } scene.undostack.push(CommandSetProperty(scene, node, data, name)) def updateData(self, node): """ Fetch new information and fill the widget with data. :type node: AbstractNode """ super().updateData(node) self.functBox.setChecked(node.functional)
class AttributeNodeInfo(EditableNodeInfo): """ This class implements the information box for the Attribute node. """ def __init__(self, mainwindow, parent=None): """ Initialize the Attribute node information box. """ super().__init__(mainwindow, parent) self.functKey = Key('Funct.', self) functParent = Parent(self) self.functBox = CheckBox(functParent) self.functBox.setCheckable(True) self.functBox.setProperty('attribute', 'functional') connect(self.functBox.clicked, self.flagChanged) self.predPropLayout.addRow(self.functKey, functParent) @pyqtSlot() def flagChanged(self): """ Executed whenever one of the property fields changes. """ node = self.node scene = node.scene() sender = self.sender() checked = sender.isChecked() attribute = sender.property('attribute') name = '{}set {} {} property'.format('un' if checked else '', node.shortname, attribute) data = {'attribute': attribute, 'undo': getattr(node, attribute), 'redo': checked} scene.undostack.push(CommandSetProperty(scene, node, data, name)) def updateData(self, node): """ Fetch new information and fill the widget with data. :type node: AbstractNode """ super().updateData(node) self.functBox.setChecked(node.functional)
class RoleNodeInfo(EditableNodeInfo): """ This class implements the information box for the Role node. """ def __init__(self, mainwindow, parent=None): """ Initialize the Role node information box. """ super().__init__(mainwindow, parent) self.functKey = Key('Funct.', self) functParent = Parent(self) self.functBox = CheckBox(functParent) self.functBox.setCheckable(True) self.functBox.setProperty('attribute', 'functional') connect(self.functBox.clicked, self.flagChanged) self.invFunctKey = Key('Inv. Funct.', self) invFunctParent = Parent(self) self.invFunctBox = CheckBox(invFunctParent) self.invFunctBox.setCheckable(True) self.invFunctBox.setProperty('attribute', 'inverseFunctional') connect(self.invFunctBox.clicked, self.flagChanged) self.asymmetricKey = Key('Asymmetric', self) asymmetricParent = Parent(self) self.asymmetricBox = CheckBox(asymmetricParent) self.asymmetricBox.setCheckable(True) self.asymmetricBox.setProperty('attribute', 'asymmetric') connect(self.asymmetricBox.clicked, self.flagChanged) self.irreflexiveKey = Key('Irreflexive', self) irreflexiveParent = Parent(self) self.irreflexiveBox = CheckBox(irreflexiveParent) self.irreflexiveBox.setCheckable(True) self.irreflexiveBox.setProperty('attribute', 'irreflexive') connect(self.irreflexiveBox.clicked, self.flagChanged) self.reflexiveKey = Key('Reflexive', self) reflexiveParent = Parent(self) self.reflexiveBox = CheckBox(reflexiveParent) self.reflexiveBox.setCheckable(True) self.reflexiveBox.setProperty('attribute', 'reflexive') connect(self.reflexiveBox.clicked, self.flagChanged) self.symmetricKey = Key('Symmetric', self) symmetricParent = Parent(self) self.symmetricBox = CheckBox(symmetricParent) self.symmetricBox.setCheckable(True) self.symmetricBox.setProperty('attribute', 'symmetric') connect(self.symmetricBox.clicked, self.flagChanged) self.transitiveKey = Key('Transitive', self) transitiveParent = Parent(self) self.transitiveBox = CheckBox(transitiveParent) self.transitiveBox.setCheckable(True) self.transitiveBox.setProperty('attribute', 'transitive') connect(self.transitiveBox.clicked, self.flagChanged) self.predPropLayout.addRow(self.functKey, functParent) self.predPropLayout.addRow(self.invFunctKey, invFunctParent) self.predPropLayout.addRow(self.asymmetricKey, asymmetricParent) self.predPropLayout.addRow(self.irreflexiveKey, irreflexiveParent) self.predPropLayout.addRow(self.reflexiveKey, reflexiveParent) self.predPropLayout.addRow(self.symmetricKey, symmetricParent) self.predPropLayout.addRow(self.transitiveKey, transitiveParent) @pyqtSlot() def flagChanged(self): """ Executed whenever one of the property fields changes. """ node = self.node scene = node.scene() sender = self.sender() checked = sender.isChecked() attribute = sender.property('attribute') prop = RE_CAMEL_SPACE.sub('\g<1> \g<2>', attribute).lower() name = '{}set {} {} property'.format('un' if checked else '', node.shortname, prop) data = { 'attribute': attribute, 'undo': getattr(node, attribute), 'redo': checked } scene.undostack.push(CommandSetProperty(scene, node, data, name)) def updateData(self, node): """ Fetch new information and fill the widget with data. :type node: AbstractNode """ super().updateData(node) self.functBox.setChecked(node.functional) self.invFunctBox.setChecked(node.inverseFunctional) self.asymmetricBox.setChecked(node.asymmetric) self.irreflexiveBox.setChecked(node.irreflexive) self.reflexiveBox.setChecked(node.reflexive) self.symmetricBox.setChecked(node.symmetric) self.transitiveBox.setChecked(node.transitive)
class RoleNodeInfo(EditableNodeInfo): """ This class implements the information box for the Role node. """ def __init__(self, mainwindow, parent=None): """ Initialize the Role node information box. """ super().__init__(mainwindow, parent) self.functKey = Key('Funct.', self) functParent = Parent(self) self.functBox = CheckBox(functParent) self.functBox.setCheckable(True) self.functBox.setProperty('attribute', 'functional') connect(self.functBox.clicked, self.flagChanged) self.invFunctKey = Key('Inv. Funct.', self) invFunctParent = Parent(self) self.invFunctBox = CheckBox(invFunctParent) self.invFunctBox.setCheckable(True) self.invFunctBox.setProperty('attribute', 'inverseFunctional') connect(self.invFunctBox.clicked, self.flagChanged) self.asymmetricKey = Key('Asymmetric', self) asymmetricParent = Parent(self) self.asymmetricBox = CheckBox(asymmetricParent) self.asymmetricBox.setCheckable(True) self.asymmetricBox.setProperty('attribute', 'asymmetric') connect(self.asymmetricBox.clicked, self.flagChanged) self.irreflexiveKey = Key('Irreflexive', self) irreflexiveParent = Parent(self) self.irreflexiveBox = CheckBox(irreflexiveParent) self.irreflexiveBox.setCheckable(True) self.irreflexiveBox.setProperty('attribute', 'irreflexive') connect(self.irreflexiveBox.clicked, self.flagChanged) self.reflexiveKey = Key('Reflexive', self) reflexiveParent = Parent(self) self.reflexiveBox = CheckBox(reflexiveParent) self.reflexiveBox.setCheckable(True) self.reflexiveBox.setProperty('attribute', 'reflexive') connect(self.reflexiveBox.clicked, self.flagChanged) self.symmetricKey = Key('Symmetric', self) symmetricParent = Parent(self) self.symmetricBox = CheckBox(symmetricParent) self.symmetricBox.setCheckable(True) self.symmetricBox.setProperty('attribute', 'symmetric') connect(self.symmetricBox.clicked, self.flagChanged) self.transitiveKey = Key('Transitive', self) transitiveParent = Parent(self) self.transitiveBox = CheckBox(transitiveParent) self.transitiveBox.setCheckable(True) self.transitiveBox.setProperty('attribute', 'transitive') connect(self.transitiveBox.clicked, self.flagChanged) self.predPropLayout.addRow(self.functKey, functParent) self.predPropLayout.addRow(self.invFunctKey, invFunctParent) self.predPropLayout.addRow(self.asymmetricKey, asymmetricParent) self.predPropLayout.addRow(self.irreflexiveKey, irreflexiveParent) self.predPropLayout.addRow(self.reflexiveKey, reflexiveParent) self.predPropLayout.addRow(self.symmetricKey, symmetricParent) self.predPropLayout.addRow(self.transitiveKey, transitiveParent) @pyqtSlot() def flagChanged(self): """ Executed whenever one of the property fields changes. """ node = self.node scene = node.scene() sender = self.sender() checked = sender.isChecked() attribute = sender.property('attribute') prop = RE_CAMEL_SPACE.sub('\g<1> \g<2>', attribute).lower() name = '{}set {} {} property'.format('un' if checked else '', node.shortname, prop) data = {'attribute': attribute, 'undo': getattr(node, attribute), 'redo': checked} scene.undostack.push(CommandSetProperty(scene, node, data, name)) def updateData(self, node): """ Fetch new information and fill the widget with data. :type node: AbstractNode """ super().updateData(node) self.functBox.setChecked(node.functional) self.invFunctBox.setChecked(node.inverseFunctional) self.asymmetricBox.setChecked(node.asymmetric) self.irreflexiveBox.setChecked(node.irreflexive) self.reflexiveBox.setChecked(node.reflexive) self.symmetricBox.setChecked(node.symmetric) self.transitiveBox.setChecked(node.transitive)