def __init__(self, win, title, name): super(ATPreferencesDialog, self).__init__(win) self.fields = {} self.result = False self.setWindowTitle(title) self.vbox = Qt.QVBoxLayout(self) self.vbox.addWidget(Qt.QLabel(T(name))) self.box = Qt.QGroupBox(self) self.form = Qt.QFormLayout(self.box) buttonbox = Qt.QDialogButtonBox() buttonbox.setGeometry(Qt.QRect(150, 250, 341, 32)) buttonbox.setOrientation(QtCore.Qt.Horizontal) buttonbox.setStandardButtons(Qt.QDialogButtonBox.Cancel | Qt.QDialogButtonBox.Ok) buttonbox.setObjectName("buttonBox") buttonbox.setWindowTitle(title) self.vbox.addWidget(self.box) self.vbox.addWidget(buttonbox) self.vbox.setStretch(2, 0) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # self.setWindowModality(Qt.ApplicationModal) buttonbox.accepted.connect(self.on_accept) buttonbox.rejected.connect(self.on_reject) # QtCore.QMetaObject.connectSlotsByName(Dialog) self.adjustSize() self.setMinimumWidth(600) self.setSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.MinimumExpanding)
def __init__(self, win, title, name, w, h): super(ImageResizeDialog, self).__init__(win) self.w = w self.h = h self.keepaspect = True self.aspect = float(w) / float(h) self.result = False self.setWindowTitle(title) self.vbox = Qt.QVBoxLayout(self) self.vbox.addWidget(Qt.QLabel(T(name))) self.box = Qt.QGroupBox(self) self.form = Qt.QFormLayout(self.box) buttonbox = Qt.QDialogButtonBox() buttonbox.setGeometry(Qt.QRect(150, 250, 341, 32)) buttonbox.setOrientation(QtCore.Qt.Horizontal) buttonbox.setStandardButtons(Qt.QDialogButtonBox.Cancel | Qt.QDialogButtonBox.Ok) buttonbox.setWindowTitle(title) self.vbox.addWidget(self.box) self.vbox.addWidget(buttonbox) self.vbox.setStretch(2, 0) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # self.setWindowModality(QtCore.QCoreApplication) self.setModal(True) self.ww = Qt.QSpinBox() self.ww.setMinimum(16) self.ww.setMaximum(0xffff) self.ww.setValue(self.w) self.ww.valueChanged.connect(self.on_changed_width) self.form.addRow(T("Width"), self.ww) self.ww.setFocus() self.wh = Qt.QSpinBox() self.ww.setMinimum(16) self.wh.setMaximum(0xffff) self.wh.setValue(self.h) self.wh.valueChanged.connect(self.on_changed_height) self.form.addRow(T("Height"), self.wh) widget = Qt.QCheckBox() widget.setChecked(True) widget.stateChanged.connect(self.on_changed_aspect) self.form.addRow(T("Keep aspect"), widget) buttonbox.accepted.connect(self.on_accept) buttonbox.rejected.connect(self.on_reject) # QtCore.QMetaObject.connectSlotsByName(Dialog) self.adjustSize() self.setMinimumWidth(600) self.setSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.MinimumExpanding)
def __init__(self, win): super(NewDocumentDialog, self).__init__(win) self.result = False self.fields = dict() self.setWindowTitle(T("New document")) self.vbox = Qt.QVBoxLayout(self) self.box = Qt.QGroupBox(self) self.form = Qt.QFormLayout(self.box) buttonbox = Qt.QDialogButtonBox() buttonbox.setGeometry(Qt.QRect(150, 250, 341, 32)) buttonbox.setOrientation(QtCore.Qt.Horizontal) buttonbox.setStandardButtons(Qt.QDialogButtonBox.Cancel | Qt.QDialogButtonBox.Ok) # buttonbox.setWindowTitle(T("New project")) self.vbox.addWidget(self.box) self.vbox.addWidget(buttonbox) self.vbox.setStretch(2, 0) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # self.setWindowModality(Qt.Q ApplicationModal) buttonbox.accepted.connect(self.on_accept) buttonbox.rejected.connect(self.on_reject) # QtCore.QMetaObject.connectSlotsByName(Dialog) self.adjustSize() self.setMinimumWidth(600) self.setSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.MinimumExpanding) inputwidget = Qt.QLineEdit(self) inputwidget.textChanged.connect(self.on_changed_name) self.form.addRow(T("Document name"), inputwidget) inputwidget.setFocus() inputwidget = Qt.QComboBox(self) inputwidget.addItems(Editor.EditorTypesList()) inputwidget.currentTextChanged.connect(self.on_changed_type) self.fields['type'] = inputwidget.currentText() self.form.addRow(T("Document type"), inputwidget) self.adjustSize()