class PickChannelsDialog(QDialog): def __init__(self, parent, channels, selected=None, title="Pick channels"): super().__init__(parent) self.setWindowTitle(title) if selected is None: selected = [] self.initial_selection = selected vbox = QVBoxLayout(self) self.channels = QListWidget() self.channels.insertItems(0, channels) self.channels.setSelectionMode(QListWidget.ExtendedSelection) for i in range(self.channels.count()): if self.channels.item(i).data(0) in selected: self.channels.item(i).setSelected(True) vbox.addWidget(self.channels) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.channels.itemSelectionChanged.connect(self.toggle_buttons) self.toggle_buttons() # initialize OK button state @Slot() def toggle_buttons(self): """Toggle OK button. """ selected = [item.data(0) for item in self.channels.selectedItems()] if selected != self.initial_selection: self.buttonbox.button(QDialogButtonBox.Ok).setEnabled(True) else: self.buttonbox.button(QDialogButtonBox.Ok).setEnabled(False)
def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(480, 150) self.buttonBox = QDialogButtonBox(Dialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setGeometry(QRect(0, 100, 461, 32)) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel) self.label = QLabel(Dialog) self.label.setObjectName(u"label") self.label.setGeometry(QRect(10, 20, 81, 16)) self.label_2 = QLabel(Dialog) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(240, 20, 57, 14)) self.key = QLineEdit(Dialog) self.key.setObjectName(u"key") self.key.setGeometry(QRect(10, 40, 211, 22)) font = QFont() font.setFamilies([u"Monospace"]) self.key.setFont(font) self.val = QLineEdit(Dialog) self.val.setObjectName(u"val") self.val.setGeometry(QRect(240, 40, 211, 22)) font1 = QFont() self.val.setFont(font1) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QMetaObject.connectSlotsByName(Dialog)
def _init_button_box(self) -> None: """Creates the lower control buttons at the bottom of the window.""" self._button_box = QDialogButtonBox() train_btn = self._button_box.addButton('Train &Model', QDialogButtonBox.ActionRole) refresh_btn = self._button_box.addButton('Refresh &Options', QDialogButtonBox.ActionRole) train_btn.clicked.connect(self._train_model) refresh_btn.clicked.connect(self._refresh_lists)
def createButtonBox(self): self.buttonBox = QDialogButtonBox() closeButton = self.buttonBox.addButton(QDialogButtonBox.Close) helpButton = self.buttonBox.addButton(QDialogButtonBox.Help) rotateWidgetsButton = self.buttonBox.addButton( "Rotate &Widgets", QDialogButtonBox.ActionRole) rotateWidgetsButton.clicked.connect(self.rotateWidgets) closeButton.clicked.connect(self.close) helpButton.clicked.connect(self.show_help)
def __init__(self, parent, events): super().__init__(parent) self.setWindowTitle("Create Epochs") grid = QGridLayout(self) label = QLabel("Events:") label.setAlignment(Qt.AlignTop) grid.addWidget(label, 0, 0, 1, 1) self.events = QListWidget() self.events.insertItems(0, unique(events[:, 2]).astype(str)) self.events.setSelectionMode(QListWidget.ExtendedSelection) grid.addWidget(self.events, 0, 1, 1, 2) grid.addWidget(QLabel("Interval around events:"), 1, 0, 1, 1) self.tmin = QDoubleSpinBox() self.tmin.setMinimum(-10000) self.tmin.setValue(-0.2) self.tmin.setSingleStep(0.1) self.tmin.setAlignment(Qt.AlignRight) self.tmax = QDoubleSpinBox() self.tmax.setMinimum(-10000) self.tmax.setValue(0.5) self.tmax.setSingleStep(0.1) self.tmax.setAlignment(Qt.AlignRight) grid.addWidget(self.tmin, 1, 1, 1, 1) grid.addWidget(self.tmax, 1, 2, 1, 1) self.baseline = QCheckBox("Baseline Correction:") self.baseline.setChecked(True) self.baseline.stateChanged.connect(self.toggle_baseline) grid.addWidget(self.baseline, 2, 0, 1, 1) self.a = QDoubleSpinBox() self.a.setMinimum(-10000) self.a.setValue(-0.2) self.a.setSingleStep(0.1) self.a.setAlignment(Qt.AlignRight) self.b = QDoubleSpinBox() self.b.setMinimum(-10000) self.b.setValue(0) self.b.setSingleStep(0.1) self.b.setAlignment(Qt.AlignRight) grid.addWidget(self.a, 2, 1, 1, 1) grid.addWidget(self.b, 2, 2, 1, 1) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) grid.addWidget(self.buttonbox, 3, 0, 1, -1) self.events.itemSelectionChanged.connect(self.toggle_ok) self.toggle_ok() grid.setSizeConstraint(QGridLayout.SetFixedSize)
def setup(self, dialog): dialog.resize(320, 132) dialog.setModal(True) dialog.setWindowTitle("Please Login to Continue") self.form_layout = QFormLayout(dialog) self.form_layout.setObjectName("formLayout") self.login_label = QLabel("Server requesting authentication", dialog) self.login_label.setObjectName("login_label") self.form_layout.setWidget(0, QFormLayout.SpanningRole, self.login_label) self.username_label = QLabel(dialog) self.username_label.setObjectName("username_label") self.form_layout.setWidget(1, QFormLayout.LabelRole, self.username_label) self.username = QLineEdit(dialog) self.username.setObjectName("username") self.username.setStatusTip("Enter your username.") self.form_layout.setWidget(1, QFormLayout.FieldRole, self.username) self.password_label = QLabel(dialog) self.password_label.setObjectName("password_label") self.form_layout.setWidget(2, QFormLayout.LabelRole, self.password_label) self.password = QLineEdit(dialog) self.password.setObjectName("password") self.password.setStatusTip("Enter your password.") self.password.setEchoMode(QLineEdit.PasswordEchoOnEdit) self.form_layout.setWidget(2, QFormLayout.FieldRole, self.password) self.save_username = QCheckBox("&Save username", dialog) self.save_username.setObjectName("save_username") self.form_layout.setWidget(3, QFormLayout.FieldRole, self.save_username) self.button_box = QDialogButtonBox(dialog) self.button_box.setObjectName("button_box") self.button_box.setOrientation(Qt.Horizontal) self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.form_layout.setWidget(4, QFormLayout.SpanningRole, self.button_box) self.button_box.accepted.connect(dialog.accept) self.button_box.rejected.connect(dialog.close) QMetaObject.connectSlotsByName(dialog)
def _init_button_box(self) -> None: """Creates the lower control buttons at the bottom of the window.""" self._button_box = QDialogButtonBox() ingest_btn = self._button_box.addButton('Get Data', QDialogButtonBox.ActionRole) self._delete_btn = self._button_box.addButton( 'Delete Dataset', QDialogButtonBox.ActionRole) refresh_btn = self._button_box.addButton('Refresh &Options', QDialogButtonBox.ActionRole) ingest_btn.clicked.connect(self._ingest) self._delete_btn.clicked.connect(self._delete) refresh_btn.clicked.connect(self._refresh_lists)
def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(500, 400) Dialog.setSizeGripEnabled(False) self.main_layout = QVBoxLayout(Dialog) self.main_layout.setObjectName(u"main_layout") self.scrollArea = QScrollArea(Dialog) self.scrollArea.setObjectName(u"scrollArea") self.scrollArea.setWidgetResizable(True) self.credits_list = QWidget() self.credits_list.setObjectName(u"credits_list") self.credits_list.setGeometry(QRect(0, 0, 480, 349)) self.credits_layout = QGridLayout(self.credits_list) self.credits_layout.setObjectName(u"credits_layout") self.version_label = QLabel(self.credits_list) self.version_label.setObjectName(u"version_label") self.version_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.credits_layout.addWidget(self.version_label, 0, 0, 1, 1) self.version = QLabel(self.credits_list) self.version.setObjectName(u"version") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.version.sizePolicy().hasHeightForWidth()) self.version.setSizePolicy(sizePolicy) self.credits_layout.addWidget(self.version, 0, 1, 1, 1) self.scrollArea.setWidget(self.credits_list) self.main_layout.addWidget(self.scrollArea) self.buttonBox = QDialogButtonBox(Dialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.main_layout.addWidget(self.buttonBox) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QMetaObject.connectSlotsByName(Dialog)
def __init__(self, parent, start, stop): super().__init__(parent) self.setWindowTitle("Crop data") vbox = QVBoxLayout(self) grid = QGridLayout() self.start_checkbox = QCheckBox("Start time:") self.start_checkbox.setChecked(True) self.start_checkbox.stateChanged.connect(self.toggle_start) grid.addWidget(self.start_checkbox, 0, 0) self._start = QDoubleSpinBox() self._start.setMaximum(999999) self._start.setValue(start) self._start.setDecimals(2) self._start.setSuffix(" s") grid.addWidget(self._start, 0, 1) self.stop_checkbox = QCheckBox("Stop time:") self.stop_checkbox.setChecked(True) self.stop_checkbox.stateChanged.connect(self.toggle_stop) grid.addWidget(self.stop_checkbox, 1, 0) self._stop = QDoubleSpinBox() self._stop.setMaximum(999999) self._stop.setValue(stop) self._stop.setDecimals(2) self._stop.setSuffix(" s") grid.addWidget(self._stop, 1, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
def setupUi(self, DemoDialog): if not DemoDialog.objectName(): DemoDialog.setObjectName(u"DemoDialog") DemoDialog.resize(400, 300) self.buttonBox = QDialogButtonBox(DemoDialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setGeometry(QRect(30, 240, 341, 32)) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.retranslateUi(DemoDialog) self.buttonBox.accepted.connect(DemoDialog.accept) self.buttonBox.rejected.connect(DemoDialog.reject) QMetaObject.connectSlotsByName(DemoDialog)
def __init__(self, win_name, scan, upper_level, lower_level): super(Dialog_Windowing, self).__init__() # Passing the current values if it is an existing option or empty if its a new one self.win_name = win_name self.setWindowIcon( QtGui.QIcon( resource_path("res/images/btn-icons/onkodicom_icon.png"))) self.scan = scan self.upper_level = upper_level self.lower_level = lower_level # Create the ui components for the inputs button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) self.name = QLineEdit() self.name.setText(self.win_name) self.scan_text = QLineEdit() self.scan_text.setText(self.scan) self.upper_level_text = QLineEdit() self.upper_level_text.setText(self.upper_level) self.lower_level_text = QLineEdit() self.lower_level_text.setText(self.lower_level) layout = QFormLayout(self) layout.addRow(QLabel("Window Name:"), self.name) layout.addRow(QLabel("Scan:"), self.scan_text) layout.addRow(QLabel("Upper Value:"), self.upper_level_text) layout.addRow(QLabel("Lower Value:"), self.lower_level_text) layout.addWidget(button_box) button_box.accepted.connect(self.accepting) button_box.rejected.connect(self.reject) self.setWindowTitle("Image Windowing")
def __init__(self): super(AboutDialog, self).__init__() self.resize(200, 200) # Label self.label = QLabel(self) self.label.setObjectName(u"label") self.label.setLineWidth(1) self.label.setTextFormat(Qt.RichText) # Image self.pixmap = QPixmap("Icons/about.png") self.image_label = QLabel() self.image_label.setPixmap(self.pixmap) # Buttons button = QDialogButtonBox.Ok self.buttonBox = QDialogButtonBox(button) self.buttonBox.accepted.connect(self.accept) # VBox for whole content self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.addWidget(self.label) self.verticalLayout.addWidget(self.image_label) self.verticalLayout.addWidget(self.buttonBox) # Texts self.text_ui()
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, dose, notes): super(Dialog_Dose, self).__init__() # Class variables self.dose = dose self.notes = notes self.setWindowIcon( QtGui.QIcon("res/images/btn-icons/onkodicom_icon.png")) buttonBox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) self.iso_dose = QLineEdit() self.iso_dose.setText(self.dose) self.iso_unit = QComboBox() self.iso_unit.addItems(["cGy", "%"]) self.iso_notes = QLineEdit() self.iso_notes.setText(self.notes) # Input dialog layout layout = QFormLayout(self) layout.addRow(QLabel("Isodose Level:"), self.iso_dose) layout.addRow(QLabel("Unit:"), self.iso_unit) layout.addRow(QLabel("Notes:"), self.iso_notes) layout.addWidget(buttonBox) buttonBox.accepted.connect(self.accepting) buttonBox.rejected.connect(self.reject) self.setWindowTitle("Isodose Levels")
def __init__(self, standard_name, fma_id, organ, url): super(Dialog_Organ, self).__init__() # Passing the current values if it is an existing option or empty if its a new one self.standard_name = standard_name self.setWindowIcon( QtGui.QIcon( resource_path("res/images/btn-icons/onkodicom_icon.png"))) self.fma_id = fma_id self.organ = organ self.url = url # Creating the UI components button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) self.standard_name_header = QLineEdit() self.standard_name_header.setText(self.standard_name) self.fma_id_header = QLineEdit() self.fma_id_header.setText(self.fma_id) self.organ_header = QLineEdit() self.organ_header.setText(self.organ) self.url_header = QLineEdit() self.url_header.setText(self.url) layout = QFormLayout(self) layout.addRow(QLabel("Standard Name:"), self.standard_name_header) layout.addRow(QLabel("FMA ID:"), self.fma_id_header) layout.addRow(QLabel("Organ:"), self.organ_header) layout.addRow(QLabel("Url:"), self.url_header) layout.addWidget(button_box) button_box.accepted.connect(self.accepting) button_box.rejected.connect(self.reject) self.setWindowTitle("Standard Organ Names")
def _create_button_box(self) -> QDialogButtonBox: """Creates the lower control buttons at the bottom of the window.""" button_box = QDialogButtonBox() self._predict_btn = button_box.addButton('Predict', QDialogButtonBox.ActionRole) self._delete_btn = button_box.addButton('Delete Model', QDialogButtonBox.ActionRole) refresh_btn = button_box.addButton('Refresh &Options', QDialogButtonBox.ActionRole) self._predict_btn.clicked.connect(self._predict) refresh_btn.clicked.connect(self._refresh_lists) self._delete_btn.clicked.connect(self._delete) return button_box
def __init__(self, parent, xml): super().__init__(parent) self.setWindowTitle("Information") tree = QTreeWidget() tree.setColumnCount(2) tree.setHeaderLabels(["Name", "Value"]) tree.setColumnWidth(0, 200) tree.setColumnWidth(1, 350) for stream in xml: header = xml[stream][2] header.tag = "Header" footer = xml[stream][6] footer.tag = "Footer" root = ETree.Element(f"Stream {stream}") root.extend([header, footer]) populate_tree(tree, root) tree.expandAll() vbox = QVBoxLayout(self) vbox.addWidget(tree) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) self.resize(650, 550)
def __init__(self, parent, compatibles, title="Append data"): super().__init__(parent) self.setWindowTitle(title) vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Source"), 0, 0, Qt.AlignCenter) grid.addWidget(QLabel("Destination"), 0, 2, Qt.AlignCenter) self.source = QListWidget(self) self.source.setAcceptDrops(True) self.source.setDragEnabled(True) self.source.setSelectionMode(QAbstractItemView.ExtendedSelection) self.source.setDefaultDropAction(Qt.DropAction.MoveAction) self.source.insertItems(0, [d["name"] for d in compatibles]) grid.addWidget(self.source, 1, 0) self.move_button = QPushButton("→") self.move_button.setEnabled(False) grid.addWidget(self.move_button, 1, 1, Qt.AlignHCenter) self.destination = QListWidget(self) self.destination.setAcceptDrops(True) self.destination.setDragEnabled(True) self.destination.setSelectionMode(QAbstractItemView.ExtendedSelection) self.destination.setDefaultDropAction(Qt.DropAction.MoveAction) grid.addWidget(self.destination, 1, 2) vbox.addLayout(grid) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) vbox.addWidget(self.buttonbox) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize) self.destination.model().rowsInserted.connect(self.toggle_ok_button) self.destination.model().rowsRemoved.connect(self.toggle_ok_button) self.source.itemSelectionChanged.connect(self.toggle_move_source) self.destination.itemSelectionChanged.connect( self.toggle_move_destination) self.move_button.clicked.connect(self.move) self.toggle_ok_button() self.toggle_move_source() self.toggle_move_destination()
class MontageDialog(QDialog): def __init__(self, parent, montages, selected=None): super().__init__(parent) self.setWindowTitle("Set montage") vbox = QVBoxLayout(self) self.montages = QListWidget() self.montages.insertItems(0, montages) self.montages.setSelectionMode(QListWidget.SingleSelection) if selected is not None: for i in range(self.montages.count()): if self.montages.item(i).data(0) == selected: self.montages.item(i).setSelected(True) vbox.addWidget(self.montages) hbox = QHBoxLayout() self.view_button = QPushButton("View") self.view_button.clicked.connect(self.view_montage) hbox.addWidget(self.view_button) hbox.addStretch() self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) hbox.addWidget(self.buttonbox) vbox.addLayout(hbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.montages.itemSelectionChanged.connect(self.toggle_buttons) self.toggle_buttons() # initialize OK and View buttons state @Slot() def toggle_buttons(self): """Toggle OK and View buttons. """ if self.montages.selectedItems(): self.buttonbox.button(QDialogButtonBox.Ok).setEnabled(True) self.view_button.setEnabled(True) else: self.buttonbox.button(QDialogButtonBox.Ok).setEnabled(False) self.view_button.setEnabled(False) def view_montage(self): name = self.montages.selectedItems()[0].data(0) montage = make_standard_montage(name) fig = montage.plot(show_names=True, show=False) win = fig.canvas.manager.window win.setWindowModality(Qt.WindowModal) win.setWindowTitle("Montage") win.statusBar().hide() # not necessary since matplotlib 3.3 fig.show()
def __init__(self): super(PatientWeightDialog, self).__init__() # Class variables self.patient_weight_message = "Patient weight is needed for SUV2ROI " self.patient_weight_message += "conversion.\nPlease enter patient " self.patient_weight_message += "weight in kg." # Get stylesheet if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" self.stylesheet = open(resource_path(self.stylesheet_path)).read() self.setWindowIcon( QtGui.QIcon("res/images/btn-icons/onkodicom_icon.png")) buttonBox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) self.patient_weight_message_label = QLabel(self.patient_weight_message) self.patient_weight_prompt = QLabel("Patient Weight:") self.patient_weight_entry = QLineEdit() self.text_font = QtGui.QFont() self.text_font.setPointSize(11) # Set button object names buttonBox.button(QDialogButtonBox.Ok).setProperty( "QPushButtonClass", "success-button") buttonBox.button(QDialogButtonBox.Cancel).setProperty( "QPushButtonClass", "fail-button") # Set stylesheets buttonBox.setStyleSheet(self.stylesheet) self.patient_weight_message_label.setFont(self.text_font) self.patient_weight_message_label.setStyleSheet(self.stylesheet) self.patient_weight_prompt.setMinimumHeight(36) self.patient_weight_prompt.setMargin(4) self.patient_weight_prompt.setFont(self.text_font) self.patient_weight_prompt.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter) self.patient_weight_prompt.setStyleSheet(self.stylesheet) self.patient_weight_entry.setStyleSheet(self.stylesheet) # Input dialog layout entry_layout = QFormLayout(self) entry_layout.addRow(self.patient_weight_message_label) entry_layout.addRow(self.patient_weight_prompt, self.patient_weight_entry) entry_layout.addWidget(buttonBox) buttonBox.accepted.connect(self.accepting) buttonBox.rejected.connect(self.rejecting) self.setWindowTitle("Enter Patient Weight")
def __init__(self, parent, title, message): super().__init__(parent) self.setWindowTitle(title) vbox = QVBoxLayout(self) label = QLabel(message) button = QDialogButtonBox(QDialogButtonBox.Cancel) button.rejected.connect(self.close) vbox.addWidget(label) vbox.addWidget(button)
def setupUi(self, UpdateQuotesDlg): if not UpdateQuotesDlg.objectName(): UpdateQuotesDlg.setObjectName(u"UpdateQuotesDlg") UpdateQuotesDlg.setWindowModality(Qt.ApplicationModal) UpdateQuotesDlg.resize(256, 107) self.gridLayout = QGridLayout(UpdateQuotesDlg) self.gridLayout.setObjectName(u"gridLayout") self.StartDateLbl = QLabel(UpdateQuotesDlg) self.StartDateLbl.setObjectName(u"StartDateLbl") self.gridLayout.addWidget(self.StartDateLbl, 0, 0, 1, 1) self.StartDateEdit = QDateEdit(UpdateQuotesDlg) self.StartDateEdit.setObjectName(u"StartDateEdit") self.StartDateEdit.setCalendarPopup(True) self.StartDateEdit.setTimeSpec(Qt.UTC) self.gridLayout.addWidget(self.StartDateEdit, 0, 1, 1, 1) self.buttonBox = QDialogButtonBox(UpdateQuotesDlg) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) self.gridLayout.addWidget(self.buttonBox, 2, 1, 1, 1) self.EndDateLbl = QLabel(UpdateQuotesDlg) self.EndDateLbl.setObjectName(u"EndDateLbl") self.gridLayout.addWidget(self.EndDateLbl, 1, 0, 1, 1) self.EndDateEdit = QDateEdit(UpdateQuotesDlg) self.EndDateEdit.setObjectName(u"EndDateEdit") self.EndDateEdit.setCalendarPopup(True) self.EndDateEdit.setTimeSpec(Qt.UTC) self.gridLayout.addWidget(self.EndDateEdit, 1, 1, 1, 1) self.retranslateUi(UpdateQuotesDlg) self.buttonBox.accepted.connect(UpdateQuotesDlg.accept) self.buttonBox.rejected.connect(UpdateQuotesDlg.reject) QMetaObject.connectSlotsByName(UpdateQuotesDlg)
def __init__(self, parent, rows, selected=None, disabled=None): super().__init__(parent) self.setWindowTitle("Select XDF Stream") self.model = QStandardItemModel() self.model.setHorizontalHeaderLabels( ["ID", "Name", "Type", "Channels", "Format", "Sampling Rate"]) for index, stream in enumerate(rows): items = [] for item in stream: tmp = QStandardItem() tmp.setData(item, Qt.DisplayRole) items.append(tmp) for item in items: item.setEditable(False) if disabled is not None and index in disabled: item.setFlags(Qt.NoItemFlags) self.model.appendRow(items) self.view = QTableView() self.view.setModel(self.model) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) if selected is not None: self.view.selectRow(selected) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) vbox = QVBoxLayout(self) vbox.addWidget(self.view) hbox = QHBoxLayout() self._effective_srate = QCheckBox("Use effective sampling rate") self._effective_srate.setChecked(True) hbox.addWidget(self._effective_srate) self._prefix_markers = QCheckBox("Prefix markers with stream ID") self._prefix_markers.setChecked(False) if not disabled: self._prefix_markers.setEnabled(False) hbox.addWidget(self._prefix_markers) vbox.addLayout(hbox) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(775, 650) self.view.setColumnWidth(0, 90) self.view.setColumnWidth(1, 200) self.view.setColumnWidth(2, 140)
def __init__(self, parent, group_data): super().__init__(parent) self.group_data = group_data self.tag = self.group_data.get('Tag') self.uuid = str(uuid4()) self.path = self.parent().path / 'img' self.name = QLineEdit(self.group_data.get('Name', '')) self.comments = QLineEdit(self.group_data.get('Comments', '')) self.button_box = QDialogButtonBox(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.button_box.accepted.connect(self.save) self.button_box.rejected.connect(self.reject) self.create_gui()
def __init__(self, parent=None): super(BlockingClient, self).__init__(parent) self.thread = FortuneThread() self.currentFortune = '' hostLabel = QLabel("&Server name:") portLabel = QLabel("S&erver port:") for ipAddress in QNetworkInterface.allAddresses(): if ipAddress != QHostAddress.LocalHost and ipAddress.toIPv4Address( ) != 0: break else: ipAddress = QHostAddress(QHostAddress.LocalHost) ipAddress = ipAddress.toString() self.hostLineEdit = QLineEdit(ipAddress) self.portLineEdit = QLineEdit() self.portLineEdit.setValidator(QIntValidator(1, 65535, self)) hostLabel.setBuddy(self.hostLineEdit) portLabel.setBuddy(self.portLineEdit) self.statusLabel = QLabel( "This example requires that you run the Fortune Server example as well." ) self.statusLabel.setWordWrap(True) self.getFortuneButton = QPushButton("Get Fortune") self.getFortuneButton.setDefault(True) self.getFortuneButton.setEnabled(False) quitButton = QPushButton("Quit") buttonBox = QDialogButtonBox() buttonBox.addButton(self.getFortuneButton, QDialogButtonBox.ActionRole) buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole) self.getFortuneButton.clicked.connect(self.requestNewFortune) quitButton.clicked.connect(self.close) self.hostLineEdit.textChanged.connect(self.enableGetFortuneButton) self.portLineEdit.textChanged.connect(self.enableGetFortuneButton) self.thread.newFortune.connect(self.showFortune) self.thread.error.connect(self.displayError) mainLayout = QGridLayout() mainLayout.addWidget(hostLabel, 0, 0) mainLayout.addWidget(self.hostLineEdit, 0, 1) mainLayout.addWidget(portLabel, 1, 0) mainLayout.addWidget(self.portLineEdit, 1, 1) mainLayout.addWidget(self.statusLabel, 2, 0, 1, 2) mainLayout.addWidget(buttonBox, 3, 0, 1, 2) self.setLayout(mainLayout) self.setWindowTitle("Blocking Fortune Client") self.portLineEdit.setFocus()
def __init__(self, parent, history): super().__init__(parent=parent) self.setWindowTitle("History") layout = QVBoxLayout() text = QPlainTextEdit() font = QFont() font.setFamily("monospace") font.setStyleHint(QFont.Monospace) text.setFont(font) highlighter = PythonHighlighter(text.document()) # noqa: F841 text.setReadOnly(True) text.setPlainText(history) layout.addWidget(text) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok) clipboardbutton = QPushButton("Copy to clipboard") buttonbox.addButton(clipboardbutton, QDialogButtonBox.ActionRole) clipboard = QGuiApplication.clipboard() clipboardbutton.clicked.connect( lambda: clipboard.setText(history + "\n")) layout.addWidget(buttonbox) self.setLayout(layout) buttonbox.accepted.connect(self.accept) self.resize(700, 500)
def __init__(self, parent, nchan, methods): super().__init__(parent) self.setWindowTitle("Run ICA") vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Method:"), 0, 0) self.method = QComboBox() self.method.addItems(methods) self.method.setCurrentIndex(0) self.method.currentIndexChanged.connect(self.toggle_options) grid.addWidget(self.method, 0, 1) self.extended_label = QLabel("Extended:") grid.addWidget(self.extended_label, 1, 0) self.extended = QCheckBox() self.extended.setChecked(True) grid.addWidget(self.extended, 1, 1) self.ortho_label = QLabel("Orthogonal:") grid.addWidget(self.ortho_label, 2, 0) self.ortho = QCheckBox() self.ortho.setChecked(False) grid.addWidget(self.ortho, 2, 1) if "Picard" not in methods: self.ortho_label.hide() self.ortho.hide() grid.addWidget(QLabel("Number of components:"), 3, 0) self.n_components = QSpinBox() self.n_components.setRange(0, nchan) self.n_components.setValue(nchan) self.n_components.setAlignment(Qt.AlignRight) grid.addWidget(self.n_components, 3, 1) grid.addWidget(QLabel("Exclude bad segments:"), 4, 0) self.exclude_bad_segments = QCheckBox() self.exclude_bad_segments.setChecked(True) grid.addWidget(self.exclude_bad_segments, 4, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize) self.toggle_options()
def setupUi(self, SelectAccountDlg): if not SelectAccountDlg.objectName(): SelectAccountDlg.setObjectName(u"SelectAccountDlg") SelectAccountDlg.resize(400, 141) self.verticalLayout = QVBoxLayout(SelectAccountDlg) self.verticalLayout.setObjectName(u"verticalLayout") self.DescriptionLbl = QLabel(SelectAccountDlg) self.DescriptionLbl.setObjectName(u"DescriptionLbl") self.verticalLayout.addWidget(self.DescriptionLbl) self.AccountWidget = AccountSelector(SelectAccountDlg) self.AccountWidget.setObjectName(u"AccountWidget") self.verticalLayout.addWidget(self.AccountWidget) self.ReuseAccount = QCheckBox(SelectAccountDlg) self.ReuseAccount.setObjectName(u"ReuseAccount") self.verticalLayout.addWidget(self.ReuseAccount) self.buttonBox = QDialogButtonBox(SelectAccountDlg) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout.addItem(self.verticalSpacer) self.retranslateUi(SelectAccountDlg) self.buttonBox.accepted.connect(SelectAccountDlg.close) QMetaObject.connectSlotsByName(SelectAccountDlg)
def __init__(self, parent, info, title="Channel Properties"): super().__init__(parent) self.setWindowTitle(title) self.model = QStandardItemModel(info["nchan"], 4) self.model.setHorizontalHeaderLabels(["#", "Label", "Type", "Bad"]) for index, ch in enumerate(info["chs"]): item = QStandardItem() item.setData(index, Qt.DisplayRole) item.setFlags(item.flags() & ~Qt.ItemIsEditable) self.model.setItem(index, 0, item) self.model.setItem(index, 1, QStandardItem(ch["ch_name"])) kind = channel_type(info, index).upper() self.model.setItem(index, 2, QStandardItem(str(kind))) bad = QStandardItem() bad.setData(ch["ch_name"] in info["bads"], Qt.UserRole) bad.setCheckable(True) bad.setEditable(False) checked = ch["ch_name"] in info["bads"] bad.setCheckState(Qt.Checked if checked else Qt.Unchecked) self.model.setItem(index, 3, bad) self.model.itemChanged.connect(bad_changed) self.proxymodel = MySortFilterProxyModel() self.proxymodel.setDynamicSortFilter(False) self.proxymodel.setSourceModel(self.model) self.view = QTableView() self.view.setModel(self.proxymodel) self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self.view)) self.view.setEditTriggers(QAbstractItemView.AllEditTriggers) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.NoSelection) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) vbox = QVBoxLayout(self) vbox.addWidget(self.view) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(475, 650) self.view.setColumnWidth(0, 70) self.view.setColumnWidth(1, 155) self.view.setColumnWidth(2, 90)
def __init__(self, parent, montages, selected=None): super().__init__(parent) self.setWindowTitle("Set montage") vbox = QVBoxLayout(self) self.montages = QListWidget() self.montages.insertItems(0, montages) self.montages.setSelectionMode(QListWidget.SingleSelection) if selected is not None: for i in range(self.montages.count()): if self.montages.item(i).data(0) == selected: self.montages.item(i).setSelected(True) vbox.addWidget(self.montages) hbox = QHBoxLayout() self.view_button = QPushButton("View") self.view_button.clicked.connect(self.view_montage) hbox.addWidget(self.view_button) hbox.addStretch() self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) hbox.addWidget(self.buttonbox) vbox.addLayout(hbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.montages.itemSelectionChanged.connect(self.toggle_buttons) self.toggle_buttons() # initialize OK and View buttons state