def __init__(self, parent, appdata): super(SessionInfos, self).__init__(parent) self.appdata = appdata self.setWindowTitle( 'Information for the session' ) self.setFixedSize(250, 300) self.buttonBox = QDialogButtonBox( self ) self.buttonBox.setOrientation( Qt.Horizontal ) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel|QDialogButtonBox.Ok ) labelcombo = QLabel( 'Breathing Zone:' ) self.breathzone = QComboBox() self.breathzone.addItem( '', '' ) self.breathzone.addItem( 'Abdominal', 1 ) self.breathzone.addItem( 'Thoracic', 2 ) self.breathzone.move(10, 10) labelnote = QLabel( 'Note:' ) self.note = QTextEdit() layout = QVBoxLayout() layout.addWidget( self.create_SessionType_Group() ) layout.addWidget( labelcombo ) layout.addWidget( self.breathzone ) layout.addWidget( labelnote ) layout.addWidget( self.note ) layout.addWidget( self.buttonBox ) self.setLayout( layout ) self.buttonBox.accepted.connect( self.accept ) self.buttonBox.rejected.connect( self.reject )
def install_button_layout(self): """ Install standard buttons (OK, Cancel) in dialog button box layout (:py:attr:`guiqwt.plot.CurveDialog.button_layout`) This method may be overriden to customize the button box """ bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) self.button_layout.addWidget(bbox) self.button_box = bbox
def install_button_layout(self): bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) self.button_list += [bbox.button(QDialogButtonBox.Ok)] self.button_layout = QHBoxLayout() self.button_layout.addStretch() self.button_layout.addWidget(bbox) vlayout = self.layout() vlayout.addSpacing(10) vlayout.addLayout(self.button_layout)
def install_button_layout(self): bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()")) self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()")) self.button_list += [bbox.button(QDialogButtonBox.Ok)] self.button_layout = QHBoxLayout() self.button_layout.addStretch() self.button_layout.addWidget(bbox) vlayout = self.layout() vlayout.addSpacing(10) vlayout.addLayout(self.button_layout)
def __init__(self, parent=None, **kwargs): QDialog.__init__(self) layout = QVBoxLayout() self.tdms_widget = TdmsChannelSelectWidget(parent=self, **kwargs) layout.addWidget(self.tdms_widget) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) self.setLayout(layout)
def __init__(self, instance, icon='', parent=None, apply=None, wordwrap=True, size=None): QDialog.__init__(self, parent) self.wordwrap = wordwrap self.apply_func = apply self.layout = QVBoxLayout() if instance.get_comment(): label = QLabel(instance.get_comment()) label.setWordWrap(wordwrap) self.layout.addWidget(label) self.instance = instance self.edit_layout = [] self.setup_instance(instance) if apply is not None: apply_button = QDialogButtonBox.Apply else: apply_button = QDialogButtonBox.NoButton bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | apply_button) self.bbox = bbox bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) bbox.clicked.connect(self.button_clicked) self.layout.addWidget(bbox) self.setLayout(self.layout) if parent is None: if not isinstance(icon, QIcon): icon = get_icon(icon, default="guidata.svg") self.setWindowIcon(icon) self.setModal(True) self.setWindowTitle(instance.get_title()) if size is not None: if isinstance(size, QSize): self.resize(size) else: self.resize(*size)
def install_button_layout(self): #install new button on the ImageDialog ResetButton = QPushButton("Reset Seg.") ResetButton.setDefault(False) ResetPointsButton = QPushButton("Delete all Points") ResetPointsButton.setDefault(False) ResetRectangleButton = QPushButton("Delete all Rectangle") ResetRectangleButton.setDefault(False) buttonBox = QDialogButtonBox() buttonBox.addButton(ResetButton, QDialogButtonBox.ActionRole) buttonBox.addButton(ResetPointsButton, QDialogButtonBox.ActionRole) buttonBox.addButton(ResetRectangleButton, QDialogButtonBox.ActionRole) #Define event according to button pressed ResetButton.clicked.connect(self.reset_seg) ResetPointsButton.clicked.connect(self.reset_pts) ResetRectangleButton.clicked.connect(self.reset_rec) self.button_layout.addWidget(buttonBox)
def __init__(self, parent, new_size, old_size, text="", keep_original_size=False): QDialog.__init__(self, parent) intfunc = lambda tup: [int(val) for val in tup] if intfunc(new_size) == intfunc(old_size): self.keep_original_size = True else: self.keep_original_size = keep_original_size self.width, self.height = new_size self.old_width, self.old_height = old_size self.ratio = self.width/self.height layout = QVBoxLayout() self.setLayout(layout) formlayout = QFormLayout() layout.addLayout(formlayout) if text: label = QLabel(text) label.setAlignment(Qt.AlignHCenter) formlayout.addRow(label) self.w_edit = w_edit = QLineEdit(self) w_valid = QIntValidator(w_edit) w_valid.setBottom(1) w_edit.setValidator(w_valid) self.h_edit = h_edit = QLineEdit(self) h_valid = QIntValidator(h_edit) h_valid.setBottom(1) h_edit.setValidator(h_valid) zbox = QCheckBox(_("Original size"), self) formlayout.addRow(_("Width (pixels)"), w_edit) formlayout.addRow(_("Height (pixels)"), h_edit) formlayout.addRow('', zbox) formlayout.addRow(_("Original size:"), QLabel("%d x %d" % old_size)) self.z_label = QLabel() formlayout.addRow(_("Zoom factor:"), self.z_label) # Button box self.bbox = bbox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) layout.addWidget(bbox) self.w_edit.setText(str(self.width)) self.h_edit.setText(str(self.height)) self.update_widgets() self.setWindowTitle(_("Resize")) w_edit.textChanged.connect(self.width_changed) h_edit.textChanged.connect(self.height_changed) zbox.toggled.connect(self.toggled_no_zoom) zbox.setChecked(self.keep_original_size)