def __init__(self, diagram, node, session): """ Initialize the node properties dialog. :type diagram: Diagram :type node: AbstractNode :type session: Session """ super().__init__(diagram, node, session) meta = diagram.project.meta(node.type(), node.text()) self.urlLabel = QtWidgets.QLabel(self) self.urlLabel.setFont(Font('Roboto', 12)) self.urlLabel.setText('URL') self.urlField = StringField(self) self.urlField.setFixedWidth(300) self.urlField.setFont(Font('Roboto', 12)) self.urlField.setValue(meta.get(K_URL, '')) self.descriptionLabel = QtWidgets.QLabel(self) self.descriptionLabel.setFont(Font('Roboto', 12)) self.descriptionLabel.setText('Description') self.descriptionField = TextField(self) self.descriptionField.setFixedSize(300, 160) self.descriptionField.setFont(Font('Roboto', 12)) self.descriptionField.setValue(meta.get(K_DESCRIPTION, '')) self.generalLayout.addRow(self.urlLabel, self.urlField) self.generalLayout.addRow(self.descriptionLabel, self.descriptionField) ############################################# # LABEL TAB ################################# self.textLabel = QtWidgets.QLabel(self) self.textLabel.setFont(Font('Roboto', 12)) self.textLabel.setText('Text') self.textField = StringField(self) self.textField.setFixedWidth(300) self.textField.setFont(Font('Roboto', 12)) self.textField.setValue(self.node.text()) self.refactorLabel = QtWidgets.QLabel(self) self.refactorLabel.setFont(Font('Roboto', 12)) self.refactorLabel.setText('Refactor') self.refactorField = CheckBox(self) self.refactorField.setFont(Font('Roboto', 12)) self.refactorField.setChecked(False) if node.type() in {Item.AttributeNode, Item.ConceptNode, Item.RoleNode}: if node.special() is not None: self.refactorField.setEnabled(False) self.labelWidget = QtWidgets.QWidget() self.labelLayout = QtWidgets.QFormLayout(self.labelWidget) self.labelLayout.addRow(self.textLabel, self.textField) self.labelLayout.addRow(self.refactorLabel, self.refactorField) self.mainWidget.addTab(self.labelWidget, 'Label')
def __init__(self, scene, node, parent=None): """ Initialize the predicate node properties dialog. :type scene: DiagramScene :type node: AbstractNode :type parent: QWidget """ super().__init__(scene, node, parent) meta = scene.meta.metaFor(node.item, node.text()) self.urlField = StringField(self.generalWidget) self.urlField.setFixedWidth(300) self.urlField.setValue(meta.url) self.descriptionField = TextField(self.generalWidget) self.descriptionField.setFixedSize(300, 160) self.descriptionField.setValue(meta.description) self.generalLayout.addRow('URL', self.urlField) self.generalLayout.addRow('Description', self.descriptionField)
def __init__(self, item, name, current, importing, parent=None): """ Initialize the project dialog. :type item: Item :type name: str :type current: str :type importing: str :type parent: QWidget """ super().__init__(parent) self.item = item self.name = name ############################################# # LEFT SIDE ################################# widget = QtWidgets.QLabel(self) widget.setAlignment(QtCore.Qt.AlignCenter) widget.setFont(Font('Roboto', 14, bold=True, capitalization=Font.AllUppercase)) widget.setObjectName('current_title') widget.setText('Current') self.addWidget(widget) widget = TextField(self) widget.setFixedSize(300, 200) widget.setFocusPolicy(QtCore.Qt.NoFocus) widget.setFont(Font('Roboto', 12)) widget.setObjectName('current_documentation') widget.setReadOnly(True) widget.setValue(current) self.addWidget(widget) widget = PHCQPushButton(self) widget.setAutoDefault(False) widget.setDefault(False) widget.setProperty('class', 'flat blue') widget.setFixedWidth(32) widget.setIcon(QtGui.QIcon(':/icons/24/ic_keyboard_arrow_right_black')) widget.setIconSize(QtCore.QSize(24, 24)) widget.setObjectName('pick_current_button') widget.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) connect(widget.clicked, self.doPickDocumentation) self.addWidget(widget) # widget = QtWidgets.QLabel(self) # widget.setFixedSize(QtCore.QSize(24, 24)) # widget.setPixmap(QtGui.QIcon(':/icons/24/ic_compare_arrows_black').pixmap(24)) # widget.setObjectName('compare_arrows_current_icon') # self.addWidget(widget) ############################################# # MIDDLE SIDE ################################# widget = QtWidgets.QLabel(self) widget.setAlignment(QtCore.Qt.AlignCenter) widget.setFont(Font('Roboto', 14, bold=True, capitalization=Font.AllUppercase)) widget.setObjectName('final_title') widget.setText('Final') self.addWidget(widget) widget = TextField(self) widget.setFixedSize(300, 200) widget.setFont(Font('Roboto', 12)) widget.setObjectName('final_documentation') self.addWidget(widget) ############################################# # RIGHT SIDE ################################# widget = QtWidgets.QLabel(self) widget.setAlignment(QtCore.Qt.AlignCenter) widget.setFont(Font('Roboto', 14, bold=True, capitalization=Font.AllUppercase)) widget.setObjectName('importing_title') widget.setText('Importing') self.addWidget(widget) widget = TextField(self) widget.setFixedSize(300, 200) widget.setFocusPolicy(QtCore.Qt.NoFocus) widget.setFont(Font('Roboto', 12)) widget.setObjectName('importing_documentation') widget.setReadOnly(True) widget.setValue(importing) self.addWidget(widget) widget = PHCQPushButton(self) widget.setAutoDefault(False) widget.setDefault(False) widget.setProperty('class', 'flat blue') widget.setFixedWidth(32) widget.setIcon(QtGui.QIcon(':/icons/24/ic_keyboard_arrow_left_black')) widget.setIconSize(QtCore.QSize(24, 24)) widget.setObjectName('pick_importing_button') widget.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) connect(widget.clicked, self.doPickDocumentation) self.addWidget(widget) # widget = QtWidgets.QLabel(self) # widget.setFixedSize(QtCore.QSize(24, 24)) # widget.setPixmap(QtGui.QIcon(':/icons/24/ic_compare_arrows_black').pixmap(24)) # widget.setObjectName('compare_arrows_importing_icon') # self.addWidget(widget) ############################################# # CONFIRMATION AREA ################################# widget = QtWidgets.QDialogButtonBox(QtCore.Qt.Horizontal, self) widget.addButton(QtWidgets.QDialogButtonBox.Ok) widget.addButton(QtWidgets.QDialogButtonBox.Abort) widget.setContentsMargins(0, 4, 0, 0) widget.setFont(Font('Roboto', 12)) widget.setObjectName('confirmation_box') connect(widget.accepted, self.accept) connect(widget.rejected, self.reject) self.addWidget(widget) ############################################# # SETUP DIALOG LAYOUT ################################# gridWidget = QtWidgets.QWidget(self) gridLayout = QtWidgets.QGridLayout(gridWidget) gridLayout.setContentsMargins(0, 0, 0, 0) gridLayout.addWidget(self.widget('current_title'), 0, 0) gridLayout.addWidget(self.widget('current_documentation'), 1, 0) gridLayout.addWidget(self.widget('final_title'), 0, 2) gridLayout.addWidget(self.widget('final_documentation'), 1, 2) gridLayout.addWidget(self.widget('importing_title'), 0, 4) gridLayout.addWidget(self.widget('importing_documentation'), 1, 4) # gridLayout.addWidget(self.widget('compare_arrows_current_icon'), 0, 1, QtCore.Qt.AlignCenter) # gridLayout.addWidget(self.widget('compare_arrows_importing_icon'), 0, 3, QtCore.Qt.AlignCenter) gridLayout.addWidget(self.widget('pick_current_button'), 1, 1) gridLayout.addWidget(self.widget('pick_importing_button'), 1, 3) mainLayout = QtWidgets.QVBoxLayout() mainLayout.addWidget(gridWidget) mainLayout.addWidget(self.widget('confirmation_box')) mainLayout.setContentsMargins(10, 10, 10, 10) self.setLayout(mainLayout) self.setFixedSize(self.sizeHint()) self.setFont(Font('Roboto', 12)) self.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy')) self.setWindowTitle("Resolve documentation conflict for {0} '{1}'...".format(self.item.shortName, self.name))