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 __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, 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): 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) -> None: super().__init__() # member self.pathname_line = PathLine() self.checkbox_save_to_file = QCheckBox("Save to File") self.t_button_open_filedialog = create_tool_button( is_text_beside_icon=True) self.t_button_step_mode = create_tool_button(fixed_width=250) self.t_button_cycle_mode = create_tool_button(fixed_width=250) self.t_button_only_lcr_mode = create_tool_button(fixed_width=250) self.t_button_lcr_state = create_tool_button(fixed_width=250) self.spinbox_interval = QSpinBox() self.group_save = QGroupBox("Save") self.group_mode = QGroupBox("Mode") self.group_lcr_state = QGroupBox("LCR Meter") self.group_measure_interval = QGroupBox("Measurement Interval") # setup self.spinbox_interval.setRange(1, 100000) self.checkbox_save_to_file.setEnabled(False) # setup layout f_layout_save = QFormLayout() f_layout_save.addRow("File Path", self.pathname_line) f_layout_save.addWidget(self.t_button_open_filedialog) f_layout_save.addRow(self.checkbox_save_to_file) self.group_save.setLayout(f_layout_save) v_layout_mode = AVBoxLayout() v_layout_mode.addWidget(self.t_button_step_mode) v_layout_mode.addWidget(self.t_button_cycle_mode) v_layout_mode.addWidget(self.t_button_only_lcr_mode) v_layout_mode.setAlignment(Qt.AlignHCenter) self.group_mode.setLayout(v_layout_mode) v_layout_lcr_state = AVBoxLayout() v_layout_lcr_state.addWidget(self.t_button_lcr_state) v_layout_lcr_state.setAlignment(Qt.AlignHCenter) self.group_lcr_state.setLayout(v_layout_lcr_state) f_layout_repeat = QFormLayout() f_layout_repeat.addRow("Interval", add_unit(self.spinbox_interval, "msec")) self.group_measure_interval.setLayout(f_layout_repeat) v_layout = AVBoxLayout(self) v_layout.addWidget(self.group_save) v_layout.addWidget(self.group_mode) v_layout.addWidget(self.group_lcr_state) v_layout.addWidget(self.group_measure_interval)
def __init__(self, standard_name, volume_name): super(Dialog_Volume, 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.volume_name = volume_name # Creating the UI components self.setWindowIcon( QtGui.QIcon( resource_path("res/images/btn-icons/onkodicom_icon.png"))) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) self.standard_name_text = QLineEdit() self.standard_name_text.setText(self.standard_name) self.volume = QLineEdit() self.volume.setText(self.volume_name) layout = QFormLayout(self) layout.addRow(QLabel("Standard Name:"), self.standard_name_text) layout.addRow(QLabel("Volume Name:"), self.volume) layout.addWidget(button_box) button_box.accepted.connect(self.accepting) button_box.rejected.connect(self.reject) self.setWindowTitle("Standard Volume Names")
def __init__(self): super().__init__() self.setWindowTitle('嵌套布局示例') # 全局布局(1个):水平 wlayout = QHBoxLayout() # 局部布局(4个):水平、竖直、网格、表单 hlayout = QHBoxLayout() vlayout = QVBoxLayout() glayout = QGridLayout() formlayout = QFormLayout() # 局部布局添加部件(例如:按钮) hlayout.addWidget(QPushButton(str(1))) hlayout.addWidget(QPushButton(str(2))) vlayout.addWidget(QPushButton(str(3))) vlayout.addWidget(QPushButton(str(4))) glayout.addWidget(QPushButton(str(5)), 0, 0) glayout.addWidget(QPushButton(str(6)), 0, 1) glayout.addWidget(QPushButton(str(7)), 1, 0) glayout.addWidget(QPushButton(str(8)), 1, 1) formlayout.addWidget(QPushButton(str(9))) formlayout.addWidget(QPushButton(str(10))) formlayout.addWidget(QPushButton(str(11))) formlayout.addWidget(QPushButton(str(12))) # 准备四个部件 hwg = QWidget() vwg = QWidget() gwg = QWidget() fwg = QWidget() # 四个部件设置局部布局 hwg.setLayout(hlayout) vwg.setLayout(vlayout) gwg.setLayout(glayout) fwg.setLayout(formlayout) # 四个部件加至全局布局 wlayout.addWidget(hwg) wlayout.addWidget(vwg) wlayout.addWidget(gwg) wlayout.addWidget(fwg) # 窗体本体设置全局布局 self.setLayout(wlayout)
self._action_disconnect_lcr if self._lcrmeter_status. is_connecting else self._action_connect_lcr) self._stage_t_btn_connect.setDefaultAction( self._action_disconnect_stage_controller if self. _stage_controller_status.is_connecting else self. _action_connect_stage_controller) self._lcr_combobox_port.currentTextChanged.connect( self._lcrmeter_port_changed) self._stage_combobox_port.currentTextChanged.connect( self._stage_controller_port_changed) # setup layout f_layout_lcr = QFormLayout() f_layout_lcr.addRow("Port", self._lcr_combobox_port) f_layout_lcr.addRow("Baudrate", self._lcr_combobox_baudrate) f_layout_lcr.addWidget(self._lcr_t_btn_connect) group_lcr = QGroupBox("LCRMeter") group_lcr.setLayout(f_layout_lcr) f_layout_stage = QFormLayout() f_layout_stage.addRow("Port ", self._stage_combobox_port) f_layout_stage.addWidget(self._stage_t_btn_connect) group_stage = QGroupBox("Linear Stage") group_stage.setLayout(f_layout_stage) v_layout = AVBoxLayout(self) v_layout.addWidget(group_lcr) v_layout.addWidget(group_stage) self.setMinimumWidth(500)