def load_game_list(self, game_layout: QGridLayout): while game_layout.count(): child = game_layout.takeAt(0) if child.widget(): child.widget().deleteLater() games = self.all_displays all_entries = iter_entry_points('zero_play.game_display') filtered_entries = self.filter_games(all_entries) for game_entry in filtered_entries: display_class = game_entry.load() display: GameDisplay = display_class() self.destroyed.connect(display.close) # type: ignore display.game_ended.connect(self.on_game_ended) # type: ignore games.append(display) games.sort(key=attrgetter('start_state.game_name')) column_count = math.ceil(math.sqrt(len(games))) for i, display in enumerate(games): row = i // column_count column = i % column_count game_name = display.start_state.game_name game_button = QPushButton(game_name) game_button.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) game_button.clicked.connect( partial( self.show_game, # type: ignore display)) game_layout.addWidget(game_button, row, column) self.ui.history_game.addItem(game_name, userData=display) if display.rules_path is not None: game_rules_action = self.ui.menu_rules.addAction(game_name) game_rules_action.triggered.connect( partial(self.on_rules, display))
def __init__(self, db: SqlDB): super().__init__() self.setWidgetResizable(True) self.db = db self.icons = Icons() base = QWidget(self) base.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.setWidget(base) grid = QGridLayout() base.setLayout(grid) row = 0 # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ # TEST Label test = QLabel('TEST') test.setStyleSheet( "QLabel {font-size:14pt; padding: 0 2px; background: #ddf;}") test.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) grid.addWidget(test, row, 0, 1, 2) row += 1 # --------------------------------------------------------------------- # SUPPLIER dump lab_dump_supplier = QLabel('DUMP table supplier') lab_dump_supplier.setStyleSheet( "QLabel {font-size:10pt; padding: 0 2px;}") but_dump_supplier = QPushButton() but_dump_supplier.setIcon(QIcon(self.icons.PLAY)) but_dump_supplier.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) but_dump_supplier.clicked.connect(self.on_click_dump_supplier) grid.addWidget(lab_dump_supplier, row, 0) grid.addWidget(but_dump_supplier, row, 1) row += 1 # --------------------------------------------------------------------- # PART dump lab_dump_part = QLabel('DUMP table part') lab_dump_part.setStyleSheet("QLabel {font-size:10pt; padding: 0 2px;}") but_dump_part = QPushButton() but_dump_part.setIcon(QIcon(self.icons.PLAY)) but_dump_part.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) but_dump_part.clicked.connect(self.on_click_dump_part) grid.addWidget(lab_dump_part, row, 0) grid.addWidget(but_dump_part, row, 1) row += 1
def initUI(self): vbox = QVBoxLayout() btn = QPushButton('Dialog', self) btn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) btn.move(20, 20) vbox.addWidget(btn) btn.clicked.connect(self.show_dialog) self.lbl = QLabel('Knowledge only matters', self) self.lbl.move(130, 20) vbox.addWidget(self.lbl) self.setLayout(vbox) self.setGeometry(300, 300, 250, 250) self.setWindowTitle("Font dialog")
def createEditor(self, parent, option, index): editor = QFrame(parent) layout = QHBoxLayout(editor) text = QLineEdit(parent=editor) button = QPushButton(QIcon(":/icons/edit-white-48dp.svg"), "", parent=editor) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) editor.setLayout(layout) text.setFrame(False) text.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) layout.addWidget(text) layout.addWidget(button) button.clicked.connect(self.edit_dialog) return editor
def create_seed_ratio_grid(self): self.scroll_widget = QWidget() self.scroll_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.seedRatioGrid = QGridLayout() self.seed_ratio_buttons = [] self.num_columns = 4 self.num_rows = 8 for row in range(0, self.num_rows): for column in range(0, self.num_columns): idx = row * self.num_columns + column new_button = QPushButton() new_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) new_button.setFixedSize(80, 20) sp = new_button.sizePolicy() sp.setRetainSizeWhenHidden(True) new_button.setSizePolicy(sp) new_button.clicked.connect( lambda state=True, x=idx: self.seed_button_pushed(x)) self.seed_ratio_buttons.append(new_button) self.seedRatioGrid.addWidget(new_button, row, column) self.scroll_widget.setLayout(self.seedRatioGrid) self.seedRatios.setWidget(self.scroll_widget)
def __init__(self, db: SqlDB): super().__init__() self.setWidgetResizable(True) self.db = db self.icons = Icons() base = QWidget(self) base.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.setWidget(base) grid = QGridLayout() base.setLayout(grid) row = 0 # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ # SPC Label test = QLabel('SPC data') test.setStyleSheet( "QLabel {font-size:14pt; padding: 0 2px; background: #ddf;}") test.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) grid.addWidget(test, row, 0, 1, 2) row += 1 # --------------------------------------------------------------------- # Excel file read lab_dump_supplier = QLabel('Excel data uploader') lab_dump_supplier.setStyleSheet( "QLabel {font-size:10pt; padding: 0 2px;}") but_dump_supplier = QPushButton() but_dump_supplier.setIcon(QIcon(self.icons.EXCEL)) but_dump_supplier.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) but_dump_supplier.setStatusTip('read SPC Excel file') #but_dump_supplier.clicked.connect(self.on_click_dump_supplier) grid.addWidget(lab_dump_supplier, row, 0) grid.addWidget(but_dump_supplier, row, 1) row += 1
def _init_ui(self): hbox = QVBoxLayout() self.setLayout(hbox) self.label = QLabel() self.label.setText(f"Turn {self.game_state.turn.value}") f: QtGui.QFont = self.label.font() f.setPixelSize(50) self.label.setFont(f) hbox.addWidget(self.label, alignment=Qt.AlignCenter) self.grid = QGridLayout() hbox.addLayout(self.grid) for y in range(0, GAME_SZIE): for x in range(0, GAME_SZIE): button = QPushButton() button.setText(self.game_state.get(x, y).value) f: QtGui.QFont = button.font() f.setPixelSize(50) button.setFont(f) button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) button.clicked.connect( self.get_tile_clicked_listener(button, x, y)) self.grid.addWidget(button, y, x)
class Ui_Form(object): def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(600, 500) Form.setStyleSheet(u"QWidget#Form{\n" " background-color: rgb(225, 243, 254);\n" "}") self.verticalLayout_2 = QVBoxLayout(Form) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setSpacing(6) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.lineEdit_headers_path = HeaderFileQLineEdit(Form) self.lineEdit_headers_path.setObjectName(u"lineEdit_headers_path") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_headers_path.sizePolicy().hasHeightForWidth()) self.lineEdit_headers_path.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_headers_path) self.pushButton_select = QPushButton(Form) self.pushButton_select.setObjectName(u"pushButton_select") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.pushButton_select.sizePolicy().hasHeightForWidth()) self.pushButton_select.setSizePolicy(sizePolicy1) self.pushButton_select.setMaximumSize(QSize(16777215, 40)) self.horizontalLayout_2.addWidget(self.pushButton_select) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName(u"horizontalLayout") self.textEdit_headers_content = HeadersQTextEdit(Form) self.textEdit_headers_content.setObjectName( u"textEdit_headers_content") self.horizontalLayout.addWidget(self.textEdit_headers_content) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(u"verticalLayout") self.pushButton_save = QPushButton(Form) self.pushButton_save.setObjectName(u"pushButton_save") sizePolicy1.setHeightForWidth( self.pushButton_save.sizePolicy().hasHeightForWidth()) self.pushButton_save.setSizePolicy(sizePolicy1) self.pushButton_save.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_save) self.pushButton_add = QPushButton(Form) self.pushButton_add.setObjectName(u"pushButton_add") sizePolicy1.setHeightForWidth( self.pushButton_add.sizePolicy().hasHeightForWidth()) self.pushButton_add.setSizePolicy(sizePolicy1) self.pushButton_add.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_add) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2.addLayout(self.horizontalLayout) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.listWidget_headers_key = QListWidget(Form) self.listWidget_headers_key.setObjectName(u"listWidget_headers_key") self.horizontalLayout_3.addWidget(self.listWidget_headers_key) self.listWidget_headers_value = QListWidget(Form) self.listWidget_headers_value.setObjectName( u"listWidget_headers_value") self.horizontalLayout_3.addWidget(self.listWidget_headers_value) self.horizontalLayout_3.setStretch(0, 1) self.horizontalLayout_3.setStretch(1, 4) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.verticalLayout_2.setStretch(0, 1) self.verticalLayout_2.setStretch(1, 3) self.verticalLayout_2.setStretch(2, 6) self.retranslateUi(Form) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, Form): Form.setWindowTitle( QCoreApplication.translate("Form", u"headers editor", None)) self.lineEdit_headers_path.setPlaceholderText( QCoreApplication.translate("Form", u"headers.json", None)) #if QT_CONFIG(tooltip) self.pushButton_select.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>load headers.json file</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_select.setText( QCoreApplication.translate("Form", u"select", None)) #if QT_CONFIG(tooltip) self.pushButton_save.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>save to headers.json</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_save.setText( QCoreApplication.translate("Form", u"save", None)) #if QT_CONFIG(tooltip) self.pushButton_add.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>add a group of header key-value</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_add.setText( QCoreApplication.translate("Form", u"add", None))
class UIFirstTimeWelcomeWindow(object): configured = QtCore.Signal(str) # the ui constructor function def setup_ui(self, first_time_welcome_window_instance): self.filepath = "" if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" window_icon = QtGui.QIcon() window_icon.addPixmap( QtGui.QPixmap(resource_path("res/images/icon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) # adding icon first_time_welcome_window_instance.setObjectName( "FirstTimeWelcomeWindowInstance") first_time_welcome_window_instance.setWindowIcon(window_icon) first_time_welcome_window_instance.setFixedSize(840, 530) # Create a vertical layout to manage layout in a vertical manner self.window_vertical_layout_box = QVBoxLayout() self.window_vertical_layout_box.setObjectName( "FirstTimeWelcomeWindowInstanceVerticalLayoutBox") # Create a horizontal box to hold the Onko logo & welcome message self.first_time_welcome_logo_message_horizontal_box = QHBoxLayout() self.first_time_welcome_logo_message_horizontal_box.setObjectName( "FirstTimeWelcomeLogoMessageBox") # Set up the Logo Holder self.logo_holder = QtWidgets.QHBoxLayout() self.first_time_welcome_logo = QtWidgets.QLabel() self.first_time_welcome_logo.setPixmap( QtGui.QPixmap(resource_path("res/images/image.png"))) self.first_time_welcome_logo.setScaledContents(True) self.first_time_welcome_logo.setObjectName( "FirstTimeWelcomeWindowLogo") self.first_time_welcome_logo.setFixedSize(240, 130) self.logo_holder.addWidget(self.first_time_welcome_logo) self.first_time_welcome_logo_message_horizontal_box.addLayout( self.logo_holder) # Create a vertical box to hold the welcome message self.first_time_welcome_message_vertical_box = QVBoxLayout() self.first_time_welcome_message_vertical_box.setObjectName( "FirstTimeWelcomeWindowWelcomeMessage") # Set up the Label self.first_time_welcome_message_label = QtWidgets.QLabel() self.first_time_welcome_message_label.setObjectName( "FirstTimeWelcomeWindowLabel") self.first_time_welcome_message_label.setAlignment(Qt.AlignLeft) self.first_time_welcome_message_vertical_box.addWidget( self.first_time_welcome_message_label) # Set up the Slogan self.first_time_welcome_message_slogan = QtWidgets.QLabel() self.first_time_welcome_message_slogan.setObjectName( "FirstTimeWelcomeWindowSlogan") self.first_time_welcome_message_slogan.setAlignment(Qt.AlignLeft) self.first_time_welcome_message_slogan.setWordWrap(True) self.first_time_welcome_message_vertical_box.addWidget( self.first_time_welcome_message_slogan) self.first_time_welcome_message_slogan_widget = QWidget() self.first_time_welcome_message_slogan_widget.setLayout( self.first_time_welcome_message_vertical_box) self.first_time_welcome_logo_message_horizontal_box.addWidget( self.first_time_welcome_message_slogan_widget) self.first_time_welcome_logo_message_widget = QWidget() self.first_time_welcome_logo_message_widget.setLayout( self.first_time_welcome_logo_message_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_welcome_logo_message_widget) # Create a label to prompt the user to enter the path to the default directory self.first_time_welcome_default_dir_prompt = QtWidgets.QLabel() self.first_time_welcome_default_dir_prompt.setObjectName( "FirstTimeWelcomeWindowPrompt") self.first_time_welcome_default_dir_prompt.setAlignment(Qt.AlignLeft) self.window_vertical_layout_box.addWidget( self.first_time_welcome_default_dir_prompt) # Create a horizontal box to hold the input box for the directory and the choose button self.first_time_welcome_input_horizontal_box = QHBoxLayout() self.first_time_welcome_input_horizontal_box.setObjectName( "FirstTimeWelcomeWindowInputHorizontalBox") # Create a textbox to contain the path to the default directory self.first_time_welcome_input_box = UIFirstTimeUserDragAndDropEvent( self) self.first_time_welcome_input_box.setObjectName( "FirstTimeWelcomeWindowInputBox") self.first_time_welcome_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.first_time_welcome_input_horizontal_box.addWidget( self.first_time_welcome_input_box) # Create a choose button to open the file dialog self.first_time_welcome_choose_button = QPushButton() self.first_time_welcome_choose_button.setObjectName( "FirstTimeWelcomeWindowChooseButton") self.first_time_welcome_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.first_time_welcome_choose_button.resize( self.first_time_welcome_choose_button.sizeHint().width(), self.first_time_welcome_input_box.height()) self.first_time_welcome_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.first_time_welcome_input_horizontal_box.addWidget( self.first_time_welcome_choose_button) self.first_time_welcome_choose_button.clicked.connect( self.choose_button_clicked) # Create a widget to hold the input field self.first_time_welcome_input_widget = QWidget() self.first_time_welcome_input_horizontal_box.setStretch(0, 4) self.first_time_welcome_input_widget.setLayout( self.first_time_welcome_input_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_welcome_input_widget) self.window_vertical_layout_box.addStretch(1) # Create widgets for the clinical data CSV file path self.clinical_data_csv_dir_label = QtWidgets.QLabel() self.clinical_data_csv_dir_label.setObjectName("ClinicalDataCSVPrompt") self.clinical_data_csv_dir_label.setAlignment(Qt.AlignLeft) self.window_vertical_layout_box.addWidget( self.clinical_data_csv_dir_label) # Create a horizontal box to hold the input box for the # directory and the choose button self.clinical_data_csv_horizontal_box = QHBoxLayout() self.clinical_data_csv_horizontal_box.setObjectName( "ClinicalDataCSVHorizontalBox") # Create a textbox to contain the path to the default directory self.clinical_data_csv_input_box = \ UIFirstTimeUserDragAndDropEvent(self) self.clinical_data_csv_input_box.setObjectName( "ClinicalDataCSVInputBox") self.clinical_data_csv_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.clinical_data_csv_horizontal_box.addWidget( self.clinical_data_csv_input_box) # Create a choose button to open the file dialog self.clinical_data_csv_choose_button = QPushButton() self.clinical_data_csv_choose_button.setObjectName( "ClinicalDataCSVChooseButton") self.clinical_data_csv_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.clinical_data_csv_choose_button.resize( self.clinical_data_csv_choose_button.sizeHint().width(), self.clinical_data_csv_input_box.height()) self.clinical_data_csv_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.clinical_data_csv_horizontal_box.addWidget( self.clinical_data_csv_choose_button) self.clinical_data_csv_choose_button.clicked.connect( self.change_clinical_data_csv_button_clicked) # Create a widget to hold the input field self.clinical_data_input_widget = QWidget() self.clinical_data_csv_horizontal_box.setStretch(0, 4) self.clinical_data_input_widget.setLayout( self.clinical_data_csv_horizontal_box) self.window_vertical_layout_box.addWidget( self.clinical_data_input_widget) self.window_vertical_layout_box.addStretch(1) # Create a horizontal box to hold the Skip and Confirm button self.first_time_window_configure_actions_horizontal_box = QHBoxLayout() self.first_time_window_configure_actions_horizontal_box.setObjectName( "FirstTimeWelcomeWindowConfigureActionsHorizontalBox") self.first_time_window_configure_actions_horizontal_box.addStretch(1) # Add a button to skip the configuration setting self.skip_button = QPushButton() self.skip_button.setObjectName("SkipButton") self.skip_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.skip_button.resize(self.skip_button.sizeHint().width(), self.skip_button.sizeHint().height()) self.skip_button.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.skip_button.setProperty("QPushButtonClass", "fail-button") self.first_time_window_configure_actions_horizontal_box.addWidget( self.skip_button) # Add a button to save the default directory self.save_dir_button = QPushButton() self.save_dir_button.setObjectName("SaveDirButton") self.save_dir_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.save_dir_button.resize(self.save_dir_button.sizeHint().width(), self.save_dir_button.sizeHint().height()) self.save_dir_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.save_dir_button.clicked.connect(self.save_options) self.save_dir_button.setProperty("QPushButtonClass", "success-button") self.first_time_window_configure_actions_horizontal_box.addWidget( self.save_dir_button) # Create a widget to house all of the actions button for first-time window self.first_time_window_configure_actions_widget = QWidget() self.first_time_window_configure_actions_widget.setLayout( self.first_time_window_configure_actions_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_window_configure_actions_widget) self.first_time_window_instance_central_widget = QWidget() self.first_time_window_instance_central_widget.setLayout( self.window_vertical_layout_box) first_time_welcome_window_instance.setCentralWidget( self.first_time_window_instance_central_widget) # Set the current stylesheet to the instance and connect it back to the caller through slot _stylesheet = open(resource_path(self.stylesheet_path)).read() first_time_welcome_window_instance.setStyleSheet(_stylesheet) self.retranslate_ui(first_time_welcome_window_instance) QtCore.QMetaObject.connectSlotsByName( first_time_welcome_window_instance) # this function inserts all the text in the first time page def retranslate_ui(self, first_time_welcome_window_instance): _translate = QtCore.QCoreApplication.translate first_time_welcome_window_instance.setWindowTitle( _translate("FirstTimeWelcomeWindowInstance", "OnkoDICOM - First-time User Setting")) self.first_time_welcome_message_label.setText( _translate("FirstTimeWelcomeWindowInstance", "Welcome to OnkoDICOM!")) self.first_time_welcome_message_slogan.setText( _translate( "FirstTimeWelcomeWindowInstance", "OnkoDICOM - the solution for producing data for analysis from your oncology plans and scans." )) self.first_time_welcome_default_dir_prompt.setText( _translate( "FirstTimeWelcomeWindowInstance", "Choose the path of the default directory containing all DICOM files:" )) self.first_time_welcome_input_box.setPlaceholderText( _translate( "FirstTimeWelcomeWindowInstance", "Enter DICOM Files Path (For example, C:\path\\to\your\DICOM\Files)" )) self.first_time_welcome_choose_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Choose")) # Clinical data CSV widgets self.clinical_data_csv_dir_label.setText( _translate( "FirstTimeWelcomeWindowInstance", "Choose the CSV file containing patient clinical data:")) self.clinical_data_csv_input_box.setPlaceholderText( _translate("FirstTimeWelcomeWindowInstance", "Enter CSV File Path (for example, C:\CSV\\file.csv)")) self.clinical_data_csv_choose_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Choose")) self.save_dir_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Confirm")) self.skip_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Skip")) def save_options(self): """ Saves options selected in the first time welcome window. """ self.filepath = self.first_time_welcome_input_box.text() self.csv_path = self.clinical_data_csv_input_box.text() if self.filepath == "" and self.csv_path == "": QMessageBox.about(self, "Unable to proceed", "No directories selected.") elif not os.path.exists(self.filepath) or not \ os.path.exists(self.csv_path): QMessageBox.about(self, "Unable to proceed", "Directories do not exist") else: config = Configuration() try: config.update_default_directory(self.filepath) # Update CSV path if it exists if self.csv_path != "" and os.path.exists(self.csv_path): config.update_clinical_data_csv_dir(self.csv_path) except SqlError: config.set_up_config_db() QMessageBox.critical( self, "Config file error", "Failed to access configuration file.\nPlease try again.") else: self.configured.emit(self.filepath) def choose_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user and loads all files and subdirectories. """ # Get folder path from pop up dialog box self.filepath = QtWidgets.QFileDialog.getExistingDirectory( None, 'Select default directory...', '') self.first_time_welcome_input_box.setText(self.filepath) def change_clinical_data_csv_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user. """ # Get folder path from pop up dialog box self.csv_path = QtWidgets.QFileDialog.getOpenFileName( None, "Open Clinical Data File", "", "CSV data files (*.csv)")[0] if len(self.csv_path) > 0: self.clinical_data_csv_input_box.setText(self.csv_path)
class Window(QMainWindow): def __init__(self): QMainWindow.__init__(self) # Title and dimensions self.setWindowTitle("Patterns detection") self.setGeometry(0, 0, 800, 500) # Main menu bar self.menu = self.menuBar() self.menu_file = self.menu.addMenu("File") exit = QAction("Exit", self, triggered=qApp.quit) self.menu_file.addAction(exit) self.menu_about = self.menu.addMenu("&About") about = QAction("About Qt", self, shortcut=QKeySequence(QKeySequence.HelpContents), triggered=qApp.aboutQt) self.menu_about.addAction(about) # Create a label for the display camera self.label = QLabel(self) self.label.setFixedSize(640, 480) # Thread in charge of updating the image self.th = Thread(self) self.th.finished.connect(self.close) self.th.updateFrame.connect(self.setImage) # Model group self.group_model = QGroupBox("Trained model") self.group_model.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) model_layout = QHBoxLayout() self.combobox = QComboBox() for xml_file in os.listdir(cv2.data.haarcascades): if xml_file.endswith(".xml"): self.combobox.addItem(xml_file) model_layout.addWidget(QLabel("File:"), 10) model_layout.addWidget(self.combobox, 90) self.group_model.setLayout(model_layout) # Buttons layout buttons_layout = QHBoxLayout() self.button1 = QPushButton("Start") self.button2 = QPushButton("Stop/Close") self.button1.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button2.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) buttons_layout.addWidget(self.button2) buttons_layout.addWidget(self.button1) right_layout = QHBoxLayout() right_layout.addWidget(self.group_model, 1) right_layout.addLayout(buttons_layout, 1) # Main layout layout = QVBoxLayout() layout.addWidget(self.label) layout.addLayout(right_layout) # Central widget widget = QWidget(self) widget.setLayout(layout) self.setCentralWidget(widget) # Connections self.button1.clicked.connect(self.start) self.button2.clicked.connect(self.kill_thread) self.button2.setEnabled(False) self.combobox.currentTextChanged.connect(self.set_model) @Slot() def set_model(self, text): self.th.set_file(text) @Slot() def kill_thread(self): print("Finishing...") self.button2.setEnabled(False) self.button1.setEnabled(True) self.th.cap.release() cv2.destroyAllWindows() self.status = False self.th.terminate() # Give time for the thread to finish time.sleep(1) @Slot() def start(self): print("Starting...") self.button2.setEnabled(True) self.button1.setEnabled(False) self.th.set_file(self.combobox.currentText()) self.th.start() @Slot(QImage) def setImage(self, image): self.label.setPixmap(QPixmap.fromImage(image))
class CsgoBindGenerator(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("CS:GO Bind Generator") self.setFixedSize(1700, 500) self.centralWidget = QWidget(self) self.setCentralWidget(self.centralWidget) self.layout = QGridLayout(self.centralWidget) self.centralWidget.setLayout(self.layout) self.create_GUI() def create_GUI(self) -> None: self.commands_display = QTextEdit(self) font = self.commands_display.font() font.setPointSize(10) self.commands_display.setFont(font) self.commands_display.setReadOnly(True) place_holder: str = "1. Choose Action | 2. Pick a Key to be Bound | 3. Select a Gun/Equipment" self.commands_display.setPlaceholderText(place_holder) self.f1 = QPushButton(self.centralWidget) self.f2 = QPushButton(self.centralWidget) self.f3 = QPushButton(self.centralWidget) self.f4 = QPushButton(self.centralWidget) self.f5 = QPushButton(self.centralWidget) self.f6 = QPushButton(self.centralWidget) self.f7 = QPushButton(self.centralWidget) self.f8 = QPushButton(self.centralWidget) self.f9 = QPushButton(self.centralWidget) self.f10 = QPushButton(self.centralWidget) self.f11 = QPushButton(self.centralWidget) self.f12 = QPushButton(self.centralWidget) self.acute = QPushButton(self.centralWidget) self.one = QPushButton(self.centralWidget) self.two = QPushButton(self.centralWidget) self.three = QPushButton(self.centralWidget) self.four = QPushButton(self.centralWidget) self.five = QPushButton(self.centralWidget) self.six = QPushButton(self.centralWidget) self.seven = QPushButton(self.centralWidget) self.eight = QPushButton(self.centralWidget) self.nine = QPushButton(self.centralWidget) self.zero = QPushButton(self.centralWidget) self.minus = QPushButton(self.centralWidget) self.equal = QPushButton(self.centralWidget) self.backspace = QPushButton(self.centralWidget) self.tab = QPushButton(self.centralWidget) self.q = QPushButton(self.centralWidget) self.w = QPushButton(self.centralWidget) self.e = QPushButton(self.centralWidget) self.r = QPushButton(self.centralWidget) self.t = QPushButton(self.centralWidget) self.y = QPushButton(self.centralWidget) self.u = QPushButton(self.centralWidget) self.i = QPushButton(self.centralWidget) self.o = QPushButton(self.centralWidget) self.p = QPushButton(self.centralWidget) self.open_bracket = QPushButton(self.centralWidget) self.closed_bracket = QPushButton(self.centralWidget) self.backslash = QPushButton(self.centralWidget) self.capslock = QPushButton(self.centralWidget) self.a = QPushButton(self.centralWidget) self.s = QPushButton(self.centralWidget) self.d = QPushButton(self.centralWidget) self.f = QPushButton(self.centralWidget) self.g = QPushButton(self.centralWidget) self.h = QPushButton(self.centralWidget) self.j = QPushButton(self.centralWidget) self.k = QPushButton(self.centralWidget) self.l = QPushButton(self.centralWidget) self.semicolon = QPushButton(self.centralWidget) self.apostrophe = QPushButton(self.centralWidget) self.enter = QPushButton(self.centralWidget) self.left_shift = QPushButton(self.centralWidget) self.z = QPushButton(self.centralWidget) self.x = QPushButton(self.centralWidget) self.c = QPushButton(self.centralWidget) self.v = QPushButton(self.centralWidget) self.b = QPushButton(self.centralWidget) self.n = QPushButton(self.centralWidget) self.m = QPushButton(self.centralWidget) self.comma = QPushButton(self.centralWidget) self.dot = QPushButton(self.centralWidget) self.slash = QPushButton(self.centralWidget) self.right_shift = QPushButton(self.centralWidget) self.left_ctrl = QPushButton(self.centralWidget) self.right_alt = QPushButton(self.centralWidget) self.space = QPushButton(self.centralWidget) self.left_alt = QPushButton(self.centralWidget) self.right_ctrl = QPushButton(self.centralWidget) self.insert = QPushButton(self.centralWidget) self.home = QPushButton(self.centralWidget) self.pgup = QPushButton(self.centralWidget) self.delete = QPushButton(self.centralWidget) self.end = QPushButton(self.centralWidget) self.pgdn = QPushButton(self.centralWidget) self.uparrow = QPushButton(self.centralWidget) self.leftarrow = QPushButton(self.centralWidget) self.downarrow = QPushButton(self.centralWidget) self.rightarrow = QPushButton(self.centralWidget) self.numlock = QPushButton(self.centralWidget) self.kp_slash = QPushButton(self.centralWidget) self.kp_multiply = QPushButton(self.centralWidget) self.kp_minus = QPushButton(self.centralWidget) self.kp_home = QPushButton(self.centralWidget) self.kp_uparrow = QPushButton(self.centralWidget) self.kp_pgup = QPushButton(self.centralWidget) self.kp_plus = QPushButton(self.centralWidget) self.kp_plus.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.kp_leftarrow = QPushButton(self.centralWidget) self.kp_five = QPushButton(self.centralWidget) self.kp_rightarrow = QPushButton(self.centralWidget) self.kp_end = QPushButton(self.centralWidget) self.kp_downarrow = QPushButton(self.centralWidget) self.kp_pgdn = QPushButton(self.centralWidget) self.kp_enter = QPushButton(self.centralWidget) self.kp_enter.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.kp_insert = QPushButton(self.centralWidget) self.kp_delete = QPushButton(self.centralWidget) self.buy = QPushButton(self.centralWidget) self.buy.setStyleSheet("QPushButton" "{" "font-size: 17px;" "}") self.buy.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.hand_switch = QPushButton(self.centralWidget) self.clear_decals = QPushButton(self.centralWidget) self.bind_grenade = QPushButton(self.centralWidget) self.voice_mute = QPushButton(self.centralWidget) self.bomb_drop = QPushButton(self.centralWidget) self.copy = QPushButton(self.centralWidget) self.reset = QPushButton(self.centralWidget) self.ak47 = QPushButton(self.centralWidget) self.ak47.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.m4s = QPushButton(self.centralWidget) self.m4s.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.aug = QPushButton(self.centralWidget) self.sg = QPushButton(self.centralWidget) self.awp = QPushButton(self.centralWidget) self.ssg = QPushButton(self.centralWidget) self.famas = QPushButton(self.centralWidget) self.galil = QPushButton(self.centralWidget) self.mac10 = QPushButton(self.centralWidget) self.mp9 = QPushButton(self.centralWidget) self.mp7 = QPushButton(self.centralWidget) self.ump = QPushButton(self.centralWidget) self.bizon = QPushButton(self.centralWidget) self.p90 = QPushButton(self.centralWidget) self.mp5 = QPushButton(self.centralWidget) self.xm = QPushButton(self.centralWidget) self.sawedoff = QPushButton(self.centralWidget) self.mag7 = QPushButton(self.centralWidget) self.p250 = QPushButton(self.centralWidget) self.cz75 = QPushButton(self.centralWidget) self.tec9 = QPushButton(self.centralWidget) self.fiveseven = QPushButton(self.centralWidget) self.deagle = QPushButton(self.centralWidget) self.revolver = QPushButton(self.centralWidget) self.nade = QPushButton(self.centralWidget) self.flash = QPushButton(self.centralWidget) self.double_flash = QPushButton(self.centralWidget) self.smoke = QPushButton(self.centralWidget) self.molotov = QPushButton(self.centralWidget) self.inc_grenade = QPushButton(self.centralWidget) self.vest = QPushButton(self.centralWidget) self.vest.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.vest_helmet = QPushButton(self.centralWidget) self.vest_helmet.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.defuse_kit = QPushButton(self.centralWidget) self.mouse3 = QPushButton(self.centralWidget) self.mouse3.setStyleSheet("margin-top: 25px;" "margin-bottom: 10px;") self.mouse4 = QPushButton(self.centralWidget) self.mouse4.setStyleSheet("margin-top: 25px;" "margin-bottom: 10px;") self.mouse5 = QPushButton(self.centralWidget) self.mouse5.setStyleSheet("margin-top: 25px;" "margin-bottom: 10px;") self.f1.setText("F1") self.f2.setText("F2") self.f3.setText("F3") self.f4.setText("F4") self.f5.setText("F5") self.f6.setText("F6") self.f7.setText("F7") self.f8.setText("F8") self.f9.setText("F9") self.f10.setText("F10") self.f11.setText("F11") self.f12.setText("F12") self.acute.setText("`") self.one.setText("1") self.two.setText("2") self.three.setText("3") self.four.setText("4") self.five.setText("5") self.six.setText("6") self.seven.setText("7") self.eight.setText("8") self.nine.setText("9") self.zero.setText("0") self.minus.setText("-") self.equal.setText("=") self.backspace.setText("Backspace") self.tab.setText("TAB") self.q.setText("Q") self.w.setText("W") self.e.setText("E") self.r.setText("R") self.t.setText("T") self.y.setText("Y") self.u.setText("U") self.i.setText("I") self.o.setText("O") self.p.setText("P") self.open_bracket.setText("[") self.closed_bracket.setText("]") self.backslash.setText("\\") self.capslock.setText("Caps Lock") self.a.setText("A") self.s.setText("S") self.d.setText("D") self.f.setText("F") self.g.setText("G") self.h.setText("H") self.j.setText("J") self.k.setText("K") self.l.setText("L") self.semicolon.setText(";") self.apostrophe.setText("'") self.enter.setText("Enter") self.left_shift.setText("Shift") self.z.setText("Z") self.x.setText("X") self.c.setText("C") self.v.setText("V") self.b.setText("B") self.n.setText("N") self.m.setText("M") self.comma.setText(",") self.dot.setText(".") self.slash.setText("/") self.right_shift.setText("Shift") self.left_ctrl.setText("Ctrl") self.left_alt.setText("Alt") self.space.setText("Space") self.right_alt.setText("Alt") self.right_ctrl.setText("Ctrl") self.insert.setText("Insert") self.home.setText("Home") self.pgup.setText("PgUp") self.delete.setText("Del") self.end.setText("End") self.pgdn.setText("PgDn") self.uparrow.setText("↑") self.leftarrow.setText("←") self.downarrow.setText("↓") self.rightarrow.setText("→") self.numlock.setText("Num Lock") self.kp_slash.setText("/") self.kp_multiply.setText("*") self.kp_minus.setText("-") self.kp_home.setText("7") self.kp_uparrow.setText("8") self.kp_pgup.setText("9") self.kp_plus.setText("+") self.kp_leftarrow.setText("4") self.kp_five.setText("5") self.kp_rightarrow.setText("6") self.kp_end.setText("1") self.kp_downarrow.setText("2") self.kp_pgdn.setText("3") self.kp_enter.setText("Enter") self.kp_insert.setText("0") self.kp_delete.setText(".") self.buy.setText("BUY") self.bind_grenade.setText("Bind Grenades") self.voice_mute.setText("Mute Voice Chat") self.bomb_drop.setText("Bomb Drop") self.reset.setText("RESET") self.clear_decals.setText("Clear Decals") self.hand_switch.setText("Switch Hands") self.copy.setText("Copy to Clipboard") self.mouse3.setText("Mouse 3") self.mouse4.setText("Mouse 4") self.mouse5.setText("Mouse 5") self.ak47.setText("AK-47") self.m4s.setText("M4A4/1-S") self.aug.setText("AUG") self.sg.setText("SG 553") self.awp.setText("AWP") self.galil.setText("Galil AR") self.famas.setText("FAMAS") self.ssg.setText("SSG 08") self.mac10.setText("MAC-10") self.mp9.setText("MP9") self.mp7.setText("MP7") self.bizon.setText("PP-Bizon") self.p90.setText("P90") self.ump.setText("UMP-45") self.mp5.setText("MP5-SD") self.mag7.setText("MAG-7") self.sawedoff.setText("Sawed-Off") self.xm.setText("XM1014") self.p250.setText("P250") self.cz75.setText("CZ75-Auto") self.fiveseven.setText("Five-SeveN") self.tec9.setText("Tec-9") self.deagle.setText("Desert Eagle") self.revolver.setText("R8 Revolver") self.vest.setText("Kevlar Vest") self.vest_helmet.setText(f"Kevlar\n +\nHelmet") self.defuse_kit.setText("Defuse Kit") self.flash.setText("Flash") self.double_flash.setText("2x Flash") self.nade.setText("Grenade") self.smoke.setText("Smoke") self.inc_grenade.setText("INC-Grenade") self.molotov.setText("Molotov") self.layout.addWidget(self.commands_display, 0, 5, 5, 7) self.layout.addWidget(self.bind_grenade, 0, 0, 1, 2) self.layout.addWidget(self.bomb_drop, 1, 0, 1, 2) self.layout.addWidget(self.voice_mute, 2, 0, 1, 2) self.layout.addWidget(self.hand_switch, 3, 0, 1, 2) self.layout.addWidget(self.clear_decals, 4, 0, 1, 2) self.layout.addWidget(self.buy, 0, 3, 2, 2) self.layout.addWidget(self.reset, 3, 3, 1, 2) self.layout.addWidget(self.copy, 4, 3, 1, 2) self.layout.addWidget(self.ak47, 0, 12, 2, 1) self.layout.addWidget(self.m4s, 0, 13, 2, 1) self.layout.addWidget(self.vest, 2, 12, 2, 1) self.layout.addWidget(self.vest_helmet, 2, 13, 2, 1) self.layout.addWidget(self.defuse_kit, 4, 12) self.layout.addWidget(self.double_flash, 4, 13) self.layout.addWidget(self.flash, 0, 14) self.layout.addWidget(self.smoke, 1, 14) self.layout.addWidget(self.nade, 2, 14) self.layout.addWidget(self.inc_grenade, 3, 14) self.layout.addWidget(self.molotov, 4, 14) self.layout.addWidget(self.awp, 0, 15) self.layout.addWidget(self.deagle, 1, 15) self.layout.addWidget(self.aug, 0, 16) self.layout.addWidget(self.sg, 1, 16) self.layout.addWidget(self.famas, 3, 16) self.layout.addWidget(self.galil, 2, 16) self.layout.addWidget(self.ssg, 4, 16) self.layout.addWidget(self.fiveseven, 0, 17) self.layout.addWidget(self.tec9, 1, 17) self.layout.addWidget(self.cz75, 3, 17) self.layout.addWidget(self.p250, 2, 17) self.layout.addWidget(self.revolver, 4, 17) self.layout.addWidget(self.mac10, 0, 18) self.layout.addWidget(self.mp9, 1, 18) self.layout.addWidget(self.mp7, 2, 18) self.layout.addWidget(self.ump, 3, 18) self.layout.addWidget(self.p90, 4, 18) self.layout.addWidget(self.mp5, 0, 19) self.layout.addWidget(self.bizon, 1, 19) self.layout.addWidget(self.mag7, 2, 19) self.layout.addWidget(self.sawedoff, 3, 19) self.layout.addWidget(self.xm, 4, 19) self.layout.addWidget(self.mouse3, 5, 7) self.layout.addWidget(self.mouse4, 5, 8) self.layout.addWidget(self.mouse5, 5, 9) self.layout.addWidget(self.f1, 6, 0) self.layout.addWidget(self.f2, 6, 1) self.layout.addWidget(self.f3, 6, 2) self.layout.addWidget(self.f4, 6, 3) self.layout.addWidget(self.f5, 6, 4) self.layout.addWidget(self.f6, 6, 5) self.layout.addWidget(self.f7, 6, 6) self.layout.addWidget(self.f8, 6, 7) self.layout.addWidget(self.f9, 6, 8) self.layout.addWidget(self.f10, 6, 9) self.layout.addWidget(self.f11, 6, 10) self.layout.addWidget(self.f12, 6, 11) self.layout.addWidget(self.acute, 7, 0) self.layout.addWidget(self.one, 7, 1) self.layout.addWidget(self.two, 7, 2) self.layout.addWidget(self.three, 7, 3) self.layout.addWidget(self.four, 7, 4) self.layout.addWidget(self.five, 7, 5) self.layout.addWidget(self.six, 7, 6) self.layout.addWidget(self.seven, 7, 7) self.layout.addWidget(self.eight, 7, 8) self.layout.addWidget(self.nine, 7, 9) self.layout.addWidget(self.zero, 7, 10) self.layout.addWidget(self.minus, 7, 11) self.layout.addWidget(self.equal, 7, 12) self.layout.addWidget(self.backspace, 7, 13) self.layout.addWidget(self.insert, 7, 14) self.layout.addWidget(self.home, 7, 15) self.layout.addWidget(self.pgup, 7, 16) self.layout.addWidget(self.numlock, 7, 17) self.layout.addWidget(self.kp_slash, 7, 18) self.layout.addWidget(self.kp_multiply, 7, 19) self.layout.addWidget(self.kp_minus, 7, 20) self.layout.addWidget(self.tab, 8, 0) self.layout.addWidget(self.q, 8, 1) self.layout.addWidget(self.w, 8, 2) self.layout.addWidget(self.e, 8, 3) self.layout.addWidget(self.r, 8, 4) self.layout.addWidget(self.t, 8, 5) self.layout.addWidget(self.y, 8, 6) self.layout.addWidget(self.u, 8, 7) self.layout.addWidget(self.i, 8, 8) self.layout.addWidget(self.o, 8, 9) self.layout.addWidget(self.p, 8, 10) self.layout.addWidget(self.open_bracket, 8, 11) self.layout.addWidget(self.closed_bracket, 8, 12) self.layout.addWidget(self.backslash, 8, 13) self.layout.addWidget(self.delete, 8, 14) self.layout.addWidget(self.end, 8, 15) self.layout.addWidget(self.pgdn, 8, 16) self.layout.addWidget(self.kp_home, 8, 17) self.layout.addWidget(self.kp_uparrow, 8, 18) self.layout.addWidget(self.kp_pgup, 8, 19) self.layout.addWidget(self.kp_plus, 8, 20, 2, 1) self.layout.addWidget(self.capslock, 9, 0) self.layout.addWidget(self.a, 9, 1) self.layout.addWidget(self.s, 9, 2) self.layout.addWidget(self.d, 9, 3) self.layout.addWidget(self.f, 9, 4) self.layout.addWidget(self.g, 9, 5) self.layout.addWidget(self.h, 9, 6) self.layout.addWidget(self.j, 9, 7) self.layout.addWidget(self.k, 9, 8) self.layout.addWidget(self.l, 9, 9) self.layout.addWidget(self.semicolon, 9, 10) self.layout.addWidget(self.apostrophe, 9, 11) self.layout.addWidget(self.enter, 9, 12, 1, 2) self.layout.addWidget(self.kp_leftarrow, 9, 17) self.layout.addWidget(self.kp_five, 9, 18) self.layout.addWidget(self.kp_rightarrow, 9, 19) self.layout.addWidget(self.left_shift, 10, 0, 1, 2) self.layout.addWidget(self.z, 10, 2) self.layout.addWidget(self.x, 10, 3) self.layout.addWidget(self.c, 10, 4) self.layout.addWidget(self.v, 10, 5) self.layout.addWidget(self.b, 10, 6) self.layout.addWidget(self.n, 10, 7) self.layout.addWidget(self.m, 10, 8) self.layout.addWidget(self.comma, 10, 9) self.layout.addWidget(self.dot, 10, 10) self.layout.addWidget(self.slash, 10, 11) self.layout.addWidget(self.right_shift, 10, 12, 1, 2) self.layout.addWidget(self.uparrow, 10, 15) self.layout.addWidget(self.kp_end, 10, 17) self.layout.addWidget(self.kp_downarrow, 10, 18) self.layout.addWidget(self.kp_pgdn, 10, 19) self.layout.addWidget(self.kp_enter, 10, 20, 2, 1) self.layout.addWidget(self.left_ctrl, 11, 0) self.layout.addWidget(self.left_alt, 11, 2) self.layout.addWidget(self.space, 11, 3, 1, 7) self.layout.addWidget(self.right_alt, 11, 10) self.layout.addWidget(self.right_ctrl, 11, 13) self.layout.addWidget(self.leftarrow, 11, 14) self.layout.addWidget(self.downarrow, 11, 15) self.layout.addWidget(self.rightarrow, 11, 16) self.layout.addWidget(self.kp_insert, 11, 17, 1, 2) self.layout.addWidget(self.kp_delete, 11, 19) self.f1.clicked.connect(lambda: self.key_clicked('"f1"')) self.f2.clicked.connect(lambda: self.key_clicked('"f2"')) self.f3.clicked.connect(lambda: self.key_clicked('"f3"')) self.f4.clicked.connect(lambda: self.key_clicked('"f4"')) self.f5.clicked.connect(lambda: self.key_clicked('"f5"')) self.f6.clicked.connect(lambda: self.key_clicked('"f6"')) self.f7.clicked.connect(lambda: self.key_clicked('"f7"')) self.f8.clicked.connect(lambda: self.key_clicked('"f8"')) self.f9.clicked.connect(lambda: self.key_clicked('"f9"')) self.f10.clicked.connect(lambda: self.key_clicked('"f10"')) self.f11.clicked.connect(lambda: self.key_clicked('"f11"')) self.f12.clicked.connect(lambda: self.key_clicked('"f12"')) self.acute.clicked.connect(lambda: self.key_clicked('"`"')) self.one.clicked.connect(lambda: self.key_clicked('"1"')) self.two.clicked.connect(lambda: self.key_clicked('"2"')) self.three.clicked.connect(lambda: self.key_clicked('"3"')) self.four.clicked.connect(lambda: self.key_clicked('"4"')) self.five.clicked.connect(lambda: self.key_clicked('"5"')) self.six.clicked.connect(lambda: self.key_clicked('"6"')) self.seven.clicked.connect(lambda: self.key_clicked('"7"')) self.eight.clicked.connect(lambda: self.key_clicked('"8"')) self.nine.clicked.connect(lambda: self.key_clicked('"9"')) self.zero.clicked.connect(lambda: self.key_clicked('"0"')) self.minus.clicked.connect(lambda: self.key_clicked('"-"')) self.equal.clicked.connect(lambda: self.key_clicked('"="')) self.backspace.clicked.connect(lambda: self.key_clicked('"backspace"')) self.insert.clicked.connect(lambda: self.key_clicked('"ins"')) self.home.clicked.connect(lambda: self.key_clicked('"home"')) self.pgup.clicked.connect(lambda: self.key_clicked('"pgup"')) self.numlock.clicked.connect(lambda: self.key_clicked('"numlock"')) self.kp_slash.clicked.connect(lambda: self.key_clicked('"kp_slash"')) self.kp_multiply.clicked.connect( lambda: self.key_clicked('"kp_multiply"')) self.kp_minus.clicked.connect(lambda: self.key_clicked('"kp_minus"')) self.tab.clicked.connect(lambda: self.key_clicked('"tab"')) self.q.clicked.connect(lambda: self.key_clicked('"q"')) self.w.clicked.connect(lambda: self.key_clicked('"w"')) self.e.clicked.connect(lambda: self.key_clicked('"e"')) self.r.clicked.connect(lambda: self.key_clicked('"r"')) self.t.clicked.connect(lambda: self.key_clicked('"t"')) self.y.clicked.connect(lambda: self.key_clicked('"y"')) self.u.clicked.connect(lambda: self.key_clicked('"u"')) self.i.clicked.connect(lambda: self.key_clicked('"i"')) self.o.clicked.connect(lambda: self.key_clicked('"o"')) self.p.clicked.connect(lambda: self.key_clicked('"p"')) self.open_bracket.clicked.connect(lambda: self.key_clicked('"["')) self.closed_bracket.clicked.connect(lambda: self.key_clicked('"]"')) self.backspace.clicked.connect(lambda: self.key_clicked('"\\"')) self.delete.clicked.connect(lambda: self.key_clicked('"del"')) self.end.clicked.connect(lambda: self.key_clicked('"End"')) self.pgdn.clicked.connect(lambda: self.key_clicked('"pgdn"')) self.kp_home.clicked.connect(lambda: self.key_clicked('"kp_home"')) self.kp_uparrow.clicked.connect( lambda: self.key_clicked('"kp_uparrow"')) self.kp_pgup.clicked.connect(lambda: self.key_clicked('"kp_pgup"')) self.kp_plus.clicked.connect(lambda: self.key_clicked('"kp_plus"')) self.capslock.clicked.connect(lambda: self.key_clicked('"capslock"')) self.a.clicked.connect(lambda: self.key_clicked('"a"')) self.s.clicked.connect(lambda: self.key_clicked('"s"')) self.d.clicked.connect(lambda: self.key_clicked('"d"')) self.f.clicked.connect(lambda: self.key_clicked('"f"')) self.g.clicked.connect(lambda: self.key_clicked('"g"')) self.h.clicked.connect(lambda: self.key_clicked('"h"')) self.j.clicked.connect(lambda: self.key_clicked('"j"')) self.k.clicked.connect(lambda: self.key_clicked('"k"')) self.l.clicked.connect(lambda: self.key_clicked('"l"')) self.semicolon.clicked.connect(lambda: self.key_clicked('"semicolon"')) self.apostrophe.clicked.connect(lambda: self.key_clicked('"' '"')) self.enter.clicked.connect(lambda: self.key_clicked('"enter"')) self.kp_leftarrow.clicked.connect( lambda: self.key_clicked('"kp_leftarrow"')) self.kp_five.clicked.connect(lambda: self.key_clicked('"kp_5"')) self.kp_rightarrow.clicked.connect( lambda: self.key_clicked('"kp_rightarrow"')) self.left_shift.clicked.connect(lambda: self.key_clicked('"shift"')) self.z.clicked.connect(lambda: self.key_clicked('"z"')) self.x.clicked.connect(lambda: self.key_clicked('"x"')) self.c.clicked.connect(lambda: self.key_clicked('"c"')) self.v.clicked.connect(lambda: self.key_clicked('"v"')) self.b.clicked.connect(lambda: self.key_clicked('"b"')) self.n.clicked.connect(lambda: self.key_clicked('"n"')) self.m.clicked.connect(lambda: self.key_clicked('"m"')) self.comma.clicked.connect(lambda: self.key_clicked('","')) self.dot.clicked.connect(lambda: self.key_clicked('"."')) self.slash.clicked.connect(lambda: self.key_clicked('"/"')) self.right_shift.clicked.connect(lambda: self.key_clicked('"shift"')) self.uparrow.clicked.connect(lambda: self.key_clicked('"uparrow"')) self.kp_end.clicked.connect(lambda: self.key_clicked('"kp_end"')) self.kp_downarrow.clicked.connect( lambda: self.key_clicked('"kp_downarrow"')) self.kp_pgdn.clicked.connect(lambda: self.key_clicked('"kp_pgdn"')) self.kp_enter.clicked.connect(lambda: self.key_clicked('"kp_enter"')) self.left_ctrl.clicked.connect(lambda: self.key_clicked('"ctrl"')) self.left_alt.clicked.connect(lambda: self.key_clicked('"alt"')) self.space.clicked.connect(lambda: self.key_clicked('"space"')) self.right_alt.clicked.connect(lambda: self.key_clicked('"alt"')) self.right_ctrl.clicked.connect(lambda: self.key_clicked('"ctrl"')) self.leftarrow.clicked.connect(lambda: self.key_clicked('"leftarrow"')) self.downarrow.clicked.connect(lambda: self.key_clicked('"downarrow"')) self.rightarrow.clicked.connect( lambda: self.key_clicked('"rightarrow"')) self.kp_insert.clicked.connect(lambda: self.key_clicked('"kp_ins"')) self.kp_delete.clicked.connect(lambda: self.key_clicked('"kp_del"')) self.mouse3.clicked.connect(lambda: self.key_clicked('"mouse3"')) self.mouse4.clicked.connect(lambda: self.key_clicked('"mouse4"')) self.mouse5.clicked.connect(lambda: self.key_clicked('"mouse5"')) self.buy.clicked.connect(self.buy_clicked) self.reset.clicked.connect(self.reset_clicked) self.bomb_drop.clicked.connect(self.bomb_drop_clicked) self.clear_decals.clicked.connect(self.clear_decals_clicked) self.bind_grenade.clicked.connect(self.bind_grenade_clicked) self.voice_mute.clicked.connect(self.voice_mute_clicked) self.hand_switch.clicked.connect(self.hand_switch_clicked) self.copy.clicked.connect(self.copy_clicked) self.ak47.clicked.connect( lambda: self.gear_clicked('"buy ak47; buy m4a1";')) self.m4s.clicked.connect( lambda: self.gear_clicked('"buy m4a1; buy ak47";')) self.vest.clicked.connect(lambda: self.gear_clicked('"buy vest";')) self.vest_helmet.clicked.connect( lambda: self.gear_clicked('"buy vesthelm";')) self.defuse_kit.clicked.connect( lambda: self.gear_clicked('"buy defuser";')) self.double_flash.clicked.connect( lambda: self.gear_clicked('"buy flashbang; buy flashbang";')) self.flash.clicked.connect( lambda: self.gear_clicked('"buy flashbang";')) self.smoke.clicked.connect( lambda: self.gear_clicked('"buy smokegrenade";')) self.nade.clicked.connect( lambda: self.gear_clicked('"buy hegrenade";')) self.inc_grenade.clicked.connect( lambda: self.gear_clicked('"buy incgrenade; buy molotov";')) self.molotov.clicked.connect( lambda: self.gear_clicked('"buy molotov; buy incgrenade";')) self.awp.clicked.connect(lambda: self.gear_clicked('"buy awp";')) self.deagle.clicked.connect( lambda: self.gear_clicked('"buy deagle; buy revolver";')) self.aug.clicked.connect( lambda: self.gear_clicked('"buy aug; buy sg556";')) self.sg.clicked.connect( lambda: self.gear_clicked('"buy sg556; buy aug";')) self.galil.clicked.connect( lambda: self.gear_clicked('"buy galilar; buy famas";')) self.famas.clicked.connect( lambda: self.gear_clicked('"buy famas; buy galilar";')) self.ssg.clicked.connect(lambda: self.gear_clicked('"buy ssg08";')) self.fiveseven.clicked.connect( lambda: self.gear_clicked('"buy fiveseven; buy tec9";')) self.tec9.clicked.connect( lambda: self.gear_clicked('"buy tec9; buy fiveseven";')) self.p250.clicked.connect(lambda: self.gear_clicked('"buy p250";')) self.cz75.clicked.connect( lambda: self.gear_clicked('"buy fiveseven; buy tec9";')) self.revolver.clicked.connect( lambda: self.gear_clicked('"buy revolver; buy deagle";')) self.mac10.clicked.connect( lambda: self.gear_clicked('"buy mac10; buy mp9";')) self.mp9.clicked.connect( lambda: self.gear_clicked('"buy mp9; buy mac10";')) self.mp7.clicked.connect(lambda: self.gear_clicked('"buy mp7";')) self.ump.clicked.connect(lambda: self.gear_clicked('"buy ump";')) self.p90.clicked.connect(lambda: self.gear_clicked('"buy p90";')) self.mp5.clicked.connect(lambda: self.gear_clicked('"buy mp7";')) self.bizon.clicked.connect(lambda: self.gear_clicked('"buy bizon";')) self.mag7.clicked.connect( lambda: self.gear_clicked('"buy mag7; buy sawedoff";')) self.sawedoff.clicked.connect( lambda: self.gear_clicked('"buy sawedoff; buy mag7";')) self.xm.clicked.connect(lambda: self.gear_clicked('"buy xm1014"`')) #------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------ self.command: str = "" self.bind: Union[NoneType, bool] = None self.action: Union[NoneType, str] = None self.grenade_keys: tuple = (self.flash, self.smoke, self.nade, self.inc_grenade, self.molotov) #self.bound_keys: list = () #TODO bound keys #------------------------------------------------------------------------------------------ def buy_clicked(self) -> None: self.action = "buy" def key_clicked(self, key_value: str) -> None: if self.action and not self.bind: if self.action == "buy": self.command += f"bind { key_value } " self.bind = True elif self.action == "bind_grenade": self.command += f"bind { key_value} " self.bind = True for key in self.grenade_keys: key.setStyleSheet("background-color: #3f3f3f;") elif self.action == "bomb_drop": self.command += f'bind { key_value } "use weapon_knife; use weapon_c4; drop; slot1";\n' self.commands_display.setText(self.command) self.action = None elif self.action == "voice_mute": self.command += f"bindtoggle { key_value } voice_enable;\n" self.commands_display.setText(self.command) self.action = None elif self.action == "hand_switch": self.command += f'bind { key_value } "toggle cl_righthand 0 1";\n' self.commands_display.setText(self.command) self.action = None elif self.action == "clear_decals": self.command += f"bind { key_value } r_cleardecals;\n" self.commands_display.setText(self.command) self.action = None else: pass def gear_clicked(self, key_value: str) -> None: if self.action and self.bind: if self.action == "buy": self.command += f"{ key_value }\n" self.commands_display.setText(self.command) self.action = None self.bind = None elif self.action == "bind_grenade": new_key_value = key_value.replace("buy ", "use weapon_") self.command += f"{ new_key_value }\n" self.commands_display.setText(self.command) self.action = None self.bind = None for key in self.grenade_keys: key.setStyleSheet("background-color: #2F2F2F;") else: pass #------------------------------------------------------------------------------------------ def bind_grenade_clicked(self) -> None: self.action = "bind_grenade" def bomb_drop_clicked(self) -> None: self.action = "bomb_drop" def voice_mute_clicked(self) -> None: self.action = "voice_mute" def hand_switch_clicked(self) -> None: self.action = "hand_switch" def clear_decals_clicked(self) -> None: self.action = "clear_decals" def copy_clicked(self) -> None: QApplication.clipboard().setText(self.command.replace("\n", " ")) def reset_clicked(self) -> None: self.commands_display.setText("") self.command = "" self.action = None self.bind = None self.action = None for key in self.grenade_keys: key.setStyleSheet("background-color: #2F2F2F;")
class StepsData(QWidget): ui: QWidget loader: QUiLoader addStepsBtn: QPushButton removeStepBtn: QPushButton stepUpBtn: QPushButton stepDownBtn: QPushButton def __init__(self, parent: None | QWidget = None): super(StepsData, self).__init__(parent) self.load_ui() self.setup_ui() def load_ui(self): self.loader = QUiLoader(self) uifile = QFile(os.path.dirname(__file__) / Path("steps.ui")) self.ui = self.loader.load(uifile, parentWidget=self) uifile.close() self.setup_ui() def load_data(self): self.widgets: List[str] = self.loader.availableWidgets() self.layouts: List[str] = self.loader.availableLayouts() for widgetName in self.loader.availableWidgets(): self.loader.createWidget(widgetName, parent=self, name="") def setup_ui(self): if not self.objectName(): self.setObjectName(u"stepsListView") self.resize(400, 300) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName(u"verticalLayout") self.opsTabs = QTabWidget(self) self.opsTabs.setObjectName(u"opsTabs") self.opsTabs.setEnabled(True) self.opsTabs.setMaximumSize(QSize(410, 16777215)) self.stepsTab = QWidget() self.stepsTab.setObjectName(u"stepsTab") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.stepsTab.sizePolicy().hasHeightForWidth()) self.stepsTab.setSizePolicy(sizePolicy) self.stepsTab.setMinimumSize(QSize(200, 278)) self.stepsTab.setAutoFillBackground(False) self.verticalLayout_2 = QVBoxLayout(self.stepsTab) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(-1, 11, -1, -1) self.stepsTreeWidget = QTreeWidget(self.stepsTab) self.stepsTreeWidget.setObjectName(u"stepsTreeWidget") self.verticalLayout_2.addWidget(self.stepsTreeWidget) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.stepDownBtn = QPushButton(self.stepsTab) self.stepDownBtn.setObjectName(u"stepDownBtn") self.horizontalLayout_3.addWidget(self.stepDownBtn) self.stepUpBtn = QPushButton(self.stepsTab) self.stepUpBtn.setObjectName(u"stepUpBtn") self.horizontalLayout_3.addWidget(self.stepUpBtn) self.removeStepBtn = QPushButton(self.stepsTab) self.removeStepBtn.setObjectName(u"removeStepBtn") self.horizontalLayout_3.addWidget(self.removeStepBtn) self.addStepBtn = QPushButton(self.stepsTab) self.addStepBtn.setObjectName(u"addStepBtn") self.horizontalLayout_3.addWidget(self.addStepBtn) self.runBtn = QPushButton(self.stepsTab) self.runBtn.setObjectName(u"runBtn") sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.runBtn.sizePolicy().hasHeightForWidth()) self.runBtn.setSizePolicy(sizePolicy1) self.runBtn.setMinimumSize(QSize(0, 0)) font = QFont() font.setBold(False) self.runBtn.setFont(font) self.runBtn.setCheckable(False) self.runBtn.setFlat(False) self.horizontalLayout_3.addWidget(self.runBtn) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.opsTabs.addTab(self.stepsTab, "") self.optionsTab = QWidget() self.optionsTab.setObjectName(u"optionsTab") self.optionsTab.setAutoFillBackground(True) self.verticalLayout_17 = QVBoxLayout(self.optionsTab) self.verticalLayout_17.setObjectName(u"verticalLayout_17") self.stepOptionsTreeWidget = QTreeWidget(self.optionsTab) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, r"1") self.stepOptionsTreeWidget.setHeaderItem(__qtreewidgetitem) self.stepOptionsTreeWidget.setObjectName(u"stepOptionsTreeWidget") self.verticalLayout_17.addWidget(self.stepOptionsTreeWidget) self.opsTabs.addTab(self.optionsTab, "") self.templatesTab = QWidget() self.templatesTab.setObjectName(u"templatesTab") self.verticalLayout_19 = QVBoxLayout(self.templatesTab) self.verticalLayout_19.setObjectName(u"verticalLayout_19") self.treeWidget = QTreeWidget(self.templatesTab) __qtreewidgetitem1 = QTreeWidgetItem() __qtreewidgetitem1.setText(0, r"1") self.treeWidget.setHeaderItem(__qtreewidgetitem1) self.treeWidget.setObjectName(u"treeWidget") self.verticalLayout_19.addWidget(self.treeWidget) self.opsTabs.addTab(self.templatesTab, "") self.verticalLayout.addWidget(self.opsTabs) # self.retranslateUi() self.opsTabs.setCurrentIndex(0) self.setWindowTitle("stepsListView") QMetaObject.connectSlotsByName(self) self.stepUpBtn.setText("Up") self.stepDownBtn.setText("Down")
class Ui_Form(object): def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(400, 300) self.verticalLayout = QVBoxLayout(Form) self.verticalLayout.setObjectName(u"verticalLayout") self.opsTabs = QTabWidget(Form) self.opsTabs.setObjectName(u"opsTabs") self.opsTabs.setEnabled(True) self.opsTabs.setMaximumSize(QSize(410, 16777215)) self.stepsTab = QWidget() self.stepsTab.setObjectName(u"stepsTab") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stepsTab.sizePolicy().hasHeightForWidth()) self.stepsTab.setSizePolicy(sizePolicy) self.stepsTab.setMinimumSize(QSize(200, 278)) self.stepsTab.setAutoFillBackground(False) self.verticalLayout_2 = QVBoxLayout(self.stepsTab) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(-1, 11, -1, -1) self.stepsTreeWidget = QTreeWidget(self.stepsTab) self.stepsTreeWidget.setObjectName(u"stepsTreeWidget") self.verticalLayout_2.addWidget(self.stepsTreeWidget) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.stepDownBtn = QPushButton(self.stepsTab) self.stepDownBtn.setObjectName(u"stepDownBtn") self.horizontalLayout_3.addWidget(self.stepDownBtn) self.stepUpBtn = QPushButton(self.stepsTab) self.stepUpBtn.setObjectName(u"stepUpBtn") self.horizontalLayout_3.addWidget(self.stepUpBtn) self.removeStepBtn = QPushButton(self.stepsTab) self.removeStepBtn.setObjectName(u"removeStepBtn") self.horizontalLayout_3.addWidget(self.removeStepBtn) self.addStepBtn = QPushButton(self.stepsTab) self.addStepBtn.setObjectName(u"addStepBtn") self.horizontalLayout_3.addWidget(self.addStepBtn) self.runBtn = QPushButton(self.stepsTab) self.runBtn.setObjectName(u"runBtn") sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.runBtn.sizePolicy().hasHeightForWidth()) self.runBtn.setSizePolicy(sizePolicy1) self.runBtn.setMinimumSize(QSize(0, 0)) font = QFont() font.setBold(False) self.runBtn.setFont(font) self.runBtn.setCheckable(False) self.runBtn.setFlat(False) self.horizontalLayout_3.addWidget(self.runBtn) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.opsTabs.addTab(self.stepsTab, "") self.optionsTab = QWidget() self.optionsTab.setObjectName(u"optionsTab") self.optionsTab.setAutoFillBackground(True) self.verticalLayout_17 = QVBoxLayout(self.optionsTab) self.verticalLayout_17.setObjectName(u"verticalLayout_17") self.stepOptionsTreeWidget = QTreeWidget(self.optionsTab) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, u"1") self.stepOptionsTreeWidget.setHeaderItem(__qtreewidgetitem) self.stepOptionsTreeWidget.setObjectName(u"stepOptionsTreeWidget") self.verticalLayout_17.addWidget(self.stepOptionsTreeWidget) self.opsTabs.addTab(self.optionsTab, "") self.templatesTab = QWidget() self.templatesTab.setObjectName(u"templatesTab") self.verticalLayout_19 = QVBoxLayout(self.templatesTab) self.verticalLayout_19.setObjectName(u"verticalLayout_19") self.treeWidget = QTreeWidget(self.templatesTab) __qtreewidgetitem1 = QTreeWidgetItem() __qtreewidgetitem1.setText(0, u"1") self.treeWidget.setHeaderItem(__qtreewidgetitem1) self.treeWidget.setObjectName(u"treeWidget") self.verticalLayout_19.addWidget(self.treeWidget) self.opsTabs.addTab(self.templatesTab, "") self.verticalLayout.addWidget(self.opsTabs) self.retranslateUi(Form) self.opsTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, Form): Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None)) ___qtreewidgetitem = self.stepsTreeWidget.headerItem() ___qtreewidgetitem.setText( 2, QCoreApplication.translate("Form", u"Target", None)) ___qtreewidgetitem.setText( 1, QCoreApplication.translate("Form", u"Operation", None)) ___qtreewidgetitem.setText( 0, QCoreApplication.translate("Form", u"#", None)) self.stepDownBtn.setText(QCoreApplication.translate( "Form", u"<", None)) self.stepUpBtn.setText(QCoreApplication.translate("Form", u">", None)) self.removeStepBtn.setText( QCoreApplication.translate("Form", u"-", None)) self.addStepBtn.setText(QCoreApplication.translate("Form", u"+", None)) self.runBtn.setText(QCoreApplication.translate("Form", u"Run", None)) self.opsTabs.setTabText( self.opsTabs.indexOf(self.stepsTab), QCoreApplication.translate("Form", u"Steps", None)) self.opsTabs.setTabText( self.opsTabs.indexOf(self.optionsTab), QCoreApplication.translate("Form", u"Options", None)) self.opsTabs.setTabText( self.opsTabs.indexOf(self.templatesTab), QCoreApplication.translate("Form", u"Templates", None))
class UIOpenPatientWindow(object): patient_info_initialized = QtCore.Signal(object) def setup_ui(self, open_patient_window_instance): if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) open_patient_window_instance.setObjectName("OpenPatientWindowInstance") open_patient_window_instance.setWindowIcon(window_icon) open_patient_window_instance.resize(840, 530) # Create a vertical box for containing the other elements and layouts self.open_patient_window_instance_vertical_box = QVBoxLayout() self.open_patient_window_instance_vertical_box.setObjectName( "OpenPatientWindowInstanceVerticalBox") # Create a label to prompt the user to enter the path to the directory that contains the DICOM files self.open_patient_directory_prompt = QLabel() self.open_patient_directory_prompt.setObjectName( "OpenPatientDirectoryPrompt") self.open_patient_directory_prompt.setAlignment(Qt.AlignLeft) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_prompt) # Create a horizontal box to hold the input box for the directory and the choose button self.open_patient_directory_input_horizontal_box = QHBoxLayout() self.open_patient_directory_input_horizontal_box.setObjectName( "OpenPatientDirectoryInputHorizontalBox") # Create a textbox to contain the path to the directory that contains the DICOM files self.open_patient_directory_input_box = UIOpenPatientWindowDragAndDropEvent( self) self.open_patient_directory_input_box.setObjectName( "OpenPatientDirectoryInputBox") self.open_patient_directory_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_directory_input_box.returnPressed.connect( self.scan_directory_for_patient) self.open_patient_directory_input_horizontal_box.addWidget( self.open_patient_directory_input_box) # Create a choose button to open the file dialog self.open_patient_directory_choose_button = QPushButton() self.open_patient_directory_choose_button.setObjectName( "OpenPatientDirectoryChooseButton") self.open_patient_directory_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_directory_choose_button.resize( self.open_patient_directory_choose_button.sizeHint().width(), self.open_patient_directory_input_box.height()) self.open_patient_directory_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_directory_input_horizontal_box.addWidget( self.open_patient_directory_choose_button) self.open_patient_directory_choose_button.clicked.connect( self.choose_button_clicked) # Create a widget to hold the input fields self.open_patient_directory_input_widget = QWidget() self.open_patient_directory_input_horizontal_box.setStretch(0, 4) self.open_patient_directory_input_widget.setLayout( self.open_patient_directory_input_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_input_widget) # Create a horizontal box to hold the stop button and direction to the user on where to select the patient self.open_patient_appear_prompt_and_stop_horizontal_box = QHBoxLayout() self.open_patient_appear_prompt_and_stop_horizontal_box.setObjectName( "OpenPatientAppearPromptAndStopHorizontalBox") # Create a label to show direction on where the files will appear self.open_patient_directory_appear_prompt = QLabel() self.open_patient_directory_appear_prompt.setObjectName( "OpenPatientDirectoryAppearPrompt") self.open_patient_directory_appear_prompt.setAlignment(Qt.AlignLeft) self.open_patient_appear_prompt_and_stop_horizontal_box.addWidget( self.open_patient_directory_appear_prompt) self.open_patient_appear_prompt_and_stop_horizontal_box.addStretch(1) # Create a button to stop searching self.open_patient_window_stop_button = QPushButton() self.open_patient_window_stop_button.setObjectName( "OpenPatientWindowStopButton") self.open_patient_window_stop_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_stop_button.resize( self.open_patient_window_stop_button.sizeHint().width(), self.open_patient_window_stop_button.sizeHint().height()) self.open_patient_window_stop_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_stop_button.clicked.connect( self.stop_button_clicked) self.open_patient_window_stop_button.setProperty( "QPushButtonClass", "fail-button") self.open_patient_window_stop_button.setVisible( False) # Button doesn't show until a search commences self.open_patient_appear_prompt_and_stop_horizontal_box.addWidget( self.open_patient_window_stop_button) # Create a widget to hold the layout self.open_patient_appear_prompt_and_stop_widget = QWidget() self.open_patient_appear_prompt_and_stop_widget.setLayout( self.open_patient_appear_prompt_and_stop_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_appear_prompt_and_stop_widget) # Create a tree view list to list out all patients in the directory selected above self.open_patient_window_patients_tree = QTreeWidget() self.open_patient_window_patients_tree.setObjectName( "OpenPatientWindowPatientsTree") self.open_patient_window_patients_tree.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_patients_tree.resize( self.open_patient_window_patients_tree.sizeHint().width(), self.open_patient_window_patients_tree.sizeHint().height()) self.open_patient_window_patients_tree.setHeaderHidden(False) self.open_patient_window_patients_tree.setHeaderLabels([""]) self.open_patient_window_patients_tree.itemChanged.connect( self.tree_item_changed) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_window_patients_tree) self.last_patient = None # Create a label to show what would happen if they select the patient self.open_patient_directory_result_label = QtWidgets.QLabel() self.open_patient_directory_result_label.setObjectName( "OpenPatientDirectoryResultLabel") self.open_patient_directory_result_label.setAlignment(Qt.AlignLeft) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_result_label) # Create a horizontal box to hold the Cancel and Open button self.open_patient_window_patient_open_actions_horizontal_box = QHBoxLayout( ) self.open_patient_window_patient_open_actions_horizontal_box.setObjectName( "OpenPatientWindowPatientOpenActionsHorizontalBox") self.open_patient_window_patient_open_actions_horizontal_box.addStretch( 1) # Add a button to go back/exit from the application self.open_patient_window_exit_button = QPushButton() self.open_patient_window_exit_button.setObjectName( "OpenPatientWindowExitButton") self.open_patient_window_exit_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_exit_button.resize( self.open_patient_window_stop_button.sizeHint().width(), self.open_patient_window_stop_button.sizeHint().height()) self.open_patient_window_exit_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_exit_button.clicked.connect( self.exit_button_clicked) self.open_patient_window_exit_button.setProperty( "QPushButtonClass", "fail-button") self.open_patient_window_patient_open_actions_horizontal_box.addWidget( self.open_patient_window_exit_button) # Add a button to confirm opening of the patient self.open_patient_window_confirm_button = QPushButton() self.open_patient_window_confirm_button.setObjectName( "OpenPatientWindowConfirmButton") self.open_patient_window_confirm_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_confirm_button.resize( self.open_patient_window_confirm_button.sizeHint().width(), self.open_patient_window_confirm_button.sizeHint().height()) self.open_patient_window_confirm_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_confirm_button.setDisabled(True) self.open_patient_window_confirm_button.clicked.connect( self.confirm_button_clicked) self.open_patient_window_confirm_button.setProperty( "QPushButtonClass", "success-button") self.open_patient_window_patient_open_actions_horizontal_box.addWidget( self.open_patient_window_confirm_button) # Create a widget to house all of the actions button for open patient window self.open_patient_window_patient_open_actions_widget = QWidget() self.open_patient_window_patient_open_actions_widget.setLayout( self.open_patient_window_patient_open_actions_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_window_patient_open_actions_widget) # Set the vertical box fourth element, the tree view, to stretch out as far as possible self.open_patient_window_instance_vertical_box.setStretch( 3, 4) # Stretch the treeview out as far as possible self.open_patient_window_instance_central_widget = QWidget() self.open_patient_window_instance_central_widget.setObjectName( "OpenPatientWindowInstanceCentralWidget") self.open_patient_window_instance_central_widget.setLayout( self.open_patient_window_instance_vertical_box) # Create threadpool for multithreading self.threadpool = QThreadPool() print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount()) # Create interrupt event for stopping the directory search self.interrupt_flag = threading.Event() # Bind all texts into the buttons and labels self.retranslate_ui(open_patient_window_instance) # Set the central widget, ready for display open_patient_window_instance.setCentralWidget( self.open_patient_window_instance_central_widget) # Set the current stylesheet to the instance and connect it back to the caller through slot _stylesheet = open(resource_path(self.stylesheet_path)).read() open_patient_window_instance.setStyleSheet(_stylesheet) QtCore.QMetaObject.connectSlotsByName(open_patient_window_instance) def retranslate_ui(self, open_patient_window_instance): _translate = QtCore.QCoreApplication.translate open_patient_window_instance.setWindowTitle( _translate("OpenPatientWindowInstance", "OnkoDICOM - Select Patient")) self.open_patient_directory_prompt.setText( _translate( "OpenPatientWindowInstance", "Choose the path of the folder containing DICOM files to load Patient's details:" )) self.open_patient_directory_input_box.setPlaceholderText( _translate( "OpenPatientWindowInstance", "Enter DICOM Files Path (For example, C:\path\\to\your\DICOM\Files)" )) self.open_patient_directory_choose_button.setText( _translate("OpenPatientWindowInstance", "Choose")) self.open_patient_directory_appear_prompt.setText( _translate( "OpenPatientWindowInstance", "Patient File directory shown below once file path chosen. Please select the file(s) you want to open:" )) self.open_patient_directory_result_label.setText( "The selected directory(s) above will be opened in the OnkoDICOM program." ) self.open_patient_window_stop_button.setText( _translate("OpenPatientWindowInstance", "Stop Search")) self.open_patient_window_exit_button.setText( _translate("OpenPatientWindowInstance", "Exit")) self.open_patient_window_confirm_button.setText( _translate("OpenPatientWindowInstance", "Confirm")) def exit_button_clicked(self): QCoreApplication.exit(0) def scan_directory_for_patient(self): # Reset tree view header and last patient self.open_patient_window_patients_tree.setHeaderLabels([""]) self.last_patient = None self.filepath = self.open_patient_directory_input_box.text() # Proceed if a folder was selected if self.filepath != "": # Update the QTreeWidget to reflect data being loaded # First, clear the widget of any existing data self.open_patient_window_patients_tree.clear() # Next, update the tree widget self.open_patient_window_patients_tree.addTopLevelItem( QTreeWidgetItem(["Loading selected directory..."])) # The choose button is disabled until the thread finishes executing self.open_patient_directory_choose_button.setEnabled(False) # Reveals the Stop Search button for the duration of the search self.open_patient_window_stop_button.setVisible(True) # The interrupt flag is then un-set if a previous search has been stopped. self.interrupt_flag.clear() # Then, create a new thread that will load the selected folder worker = Worker(DICOMDirectorySearch.get_dicom_structure, self.filepath, self.interrupt_flag, progress_callback=True) worker.signals.result.connect(self.on_search_complete) worker.signals.progress.connect(self.search_progress) # Execute the thread self.threadpool.start(worker) def choose_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user and loads all files and subdirectories. """ # Get folder path from pop up dialog box self.filepath = QtWidgets.QFileDialog.getExistingDirectory( None, 'Select patient folder...', '') self.open_patient_directory_input_box.setText(self.filepath) self.scan_directory_for_patient() def stop_button_clicked(self): self.interrupt_flag.set() def search_progress(self, progress_update): """ Current progress of the file search. """ self.open_patient_window_patients_tree.clear() self.open_patient_window_patients_tree.addTopLevelItem( QTreeWidgetItem([ "Loading selected directory... (%s files searched)" % progress_update ])) def on_search_complete(self, dicom_structure): """ Executes once the directory search is complete. :param dicom_structure: DICOMStructure object constructed by the directory search. """ self.open_patient_directory_choose_button.setEnabled(True) self.open_patient_window_stop_button.setVisible(False) self.open_patient_window_patients_tree.clear() if dicom_structure is None: # dicom_structure will be None if function was interrupted. return for patient_item in dicom_structure.get_tree_items_list(): self.open_patient_window_patients_tree.addTopLevelItem( patient_item) if len(dicom_structure.patients) == 0: QMessageBox.about(self, "No files found", "Selected directory contains no DICOM files.") def tree_item_changed(self, item, _): """ Executes when a tree item is checked or unchecked. If a different patient is checked, uncheck the previous patient. Inform user about missing DICOM files. """ selected_patient = item # If the item is not top-level, bubble up to see which top-level item this item belongs to if self.open_patient_window_patients_tree.invisibleRootItem( ).indexOfChild(item) == -1: while self.open_patient_window_patients_tree.invisibleRootItem( ).indexOfChild(selected_patient) == -1: selected_patient = selected_patient.parent() # Uncheck previous patient if a different patient is selected if item.checkState( 0 ) == Qt.CheckState.Checked and self.last_patient != selected_patient: if self.last_patient is not None: self.last_patient.setCheckState(0, Qt.CheckState.Unchecked) self.last_patient.setSelected(False) self.last_patient = selected_patient # Get the types of all selected leaves self.selected_series_types = set() for checked_item in self.get_checked_leaves(): series_type = checked_item.dicom_object.get_series_type() if type(series_type) == str: self.selected_series_types.add(series_type) else: self.selected_series_types.update(series_type) # Check the existence of IMAGE, RTSTRUCT and RTDOSE files if len(list({'CT', 'MR', 'PT'} & self.selected_series_types)) == 0: header = "Cannot proceed without an image file." self.open_patient_window_confirm_button.setDisabled(True) elif 'RTSTRUCT' not in self.selected_series_types: header = "DVH and Radiomics calculations are not available without a RTSTRUCT file." elif 'RTDOSE' not in self.selected_series_types: header = "DVH calculations are not available without a RTDOSE file." else: header = "" self.open_patient_window_patients_tree.setHeaderLabel(header) if len(list({'CT', 'MR', 'PT'} & self.selected_series_types)) != 0: self.open_patient_window_confirm_button.setDisabled(False) def confirm_button_clicked(self): """ Begins loading of the selected files. """ selected_files = [] for item in self.get_checked_leaves(): selected_files += item.dicom_object.get_files() self.progress_window = ProgressWindow( self, QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint) self.progress_window.signal_loaded.connect(self.on_loaded) self.progress_window.signal_error.connect(self.on_loading_error) self.progress_window.start_loading(selected_files) self.progress_window.exec_() def on_loaded(self, results): """ Executes when the progress bar finishes loaded the selected files. """ if results[0] is True: # Will be NoneType if loading was interrupted. self.patient_info_initialized.emit( results[1]) # Emits the progress window. def on_loading_error(self, error_code): """ Error handling for progress window. """ if error_code == 0: QMessageBox.about( self.progress_window, "Unable to open selection", "Selected files cannot be opened as they are not a DICOM-RT set." ) self.progress_window.close() elif error_code == 1: QMessageBox.about( self.progress_window, "Unable to open selection", "Selected files cannot be opened as they contain unsupported DICOM classes." ) self.progress_window.close() def get_checked_leaves(self): """ :return: A list of all QTreeWidgetItems in the QTreeWidget that are both leaves and checked. """ checked_items = [] def recurse(parent_item: QTreeWidgetItem): for i in range(parent_item.childCount()): child = parent_item.child(i) grand_children = child.childCount() if grand_children > 0: recurse(child) else: if child.checkState(0) == Qt.Checked: checked_items.append(child) recurse(self.open_patient_window_patients_tree.invisibleRootItem()) return checked_items
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.setWindowModality(Qt.ApplicationModal) MainWindow.resize(1492, 1852) sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QSize(700, 700)) MainWindow.setMaximumSize(QSize(16777215, 16777215)) MainWindow.setBaseSize(QSize(600, 600)) font = QFont() font.setPointSize(12) font.setKerning(True) MainWindow.setFont(font) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet(u"") MainWindow.setDocumentMode(False) MainWindow.setTabShape(QTabWidget.Rounded) MainWindow.setDockOptions(QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.action_Quit = QAction(MainWindow) self.action_Quit.setObjectName(u"action_Quit") self.main_widget = QWidget(MainWindow) self.main_widget.setObjectName(u"main_widget") self.main_widget.setEnabled(True) self.main_widget.setMinimumSize(QSize(650, 650)) self.main_widget.setContextMenuPolicy(Qt.DefaultContextMenu) self.main_widget.setAutoFillBackground(False) self.main_widget.setStyleSheet(u"") self.main_layout = QGridLayout(self.main_widget) self.main_layout.setObjectName(u"main_layout") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.log_button = QPushButton(self.main_widget) self.log_button.setObjectName(u"log_button") sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.log_button.sizePolicy().hasHeightForWidth()) self.log_button.setSizePolicy(sizePolicy1) self.log_button.setMinimumSize(QSize(24, 24)) font1 = QFont() font1.setPointSize(9) font1.setBold(True) font1.setKerning(True) self.log_button.setFont(font1) self.log_button.setCursor(QCursor(Qt.PointingHandCursor)) self.log_button.setCheckable(False) self.log_button.setFlat(True) self.horizontalLayout_2.addWidget(self.log_button) self.main_layout.addLayout(self.horizontalLayout_2, 5, 2, 1, 1) self.shuttle_widget = QWidget(self.main_widget) self.shuttle_widget.setObjectName(u"shuttle_widget") self.shuttle_widget.setMinimumSize(QSize(600, 600)) self.shuttle_widget.setMaximumSize(QSize(600, 600)) self.shuttle_widget.setAutoFillBackground(False) self.shuttle_widget.setStyleSheet(u"QWidget#shuttle_widget {background: url(images/ShuttleXpress_Black.png);\n" " background-repeat:no-repeat;}\n" " ") self.button_1 = QCheckBox(self.shuttle_widget) self.button_1.setObjectName(u"button_1") self.button_1.setGeometry(QRect(80, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_1.sizePolicy().hasHeightForWidth()) self.button_1.setSizePolicy(sizePolicy1) self.button_1.setMinimumSize(QSize(24, 24)) self.button_1.setFont(font) self.button_1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.usb_status = QPushButton(self.shuttle_widget) self.usb_status.setObjectName(u"usb_status") self.usb_status.setEnabled(False) self.usb_status.setGeometry(QRect(288, 10, 24, 24)) sizePolicy1.setHeightForWidth(self.usb_status.sizePolicy().hasHeightForWidth()) self.usb_status.setSizePolicy(sizePolicy1) self.usb_status.setMinimumSize(QSize(24, 24)) self.usb_status.setFont(font1) self.usb_status.setCursor(QCursor(Qt.ArrowCursor)) self.usb_status.setAutoFillBackground(False) self.usb_status.setText(u"") icon = QIcon() icon.addFile(u"images/usb_black_24.png", QSize(), QIcon.Disabled, QIcon.Off) icon.addFile(u"images/usb_white_24.png", QSize(), QIcon.Disabled, QIcon.On) self.usb_status.setIcon(icon) self.usb_status.setIconSize(QSize(24, 24)) self.usb_status.setCheckable(True) self.usb_status.setChecked(False) self.usb_status.setFlat(True) self.button_5 = QCheckBox(self.shuttle_widget) self.button_5.setObjectName(u"button_5") self.button_5.setGeometry(QRect(498, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_5.sizePolicy().hasHeightForWidth()) self.button_5.setSizePolicy(sizePolicy1) self.button_5.setMinimumSize(QSize(24, 24)) self.button_5.setFont(font) self.button_5.setLayoutDirection(Qt.RightToLeft) self.button_5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos4 = QRadioButton(self.shuttle_widget) self.wheel_pos4.setObjectName(u"wheel_pos4") self.wheel_pos4.setGeometry(QRect(382, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos4.sizePolicy().hasHeightForWidth()) self.wheel_pos4.setSizePolicy(sizePolicy1) self.wheel_pos4.setMinimumSize(QSize(24, 24)) self.wheel_pos4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0 = QRadioButton(self.shuttle_widget) self.wheel_cent0.setObjectName(u"wheel_cent0") self.wheel_cent0.setGeometry(QRect(289, 130, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_cent0.sizePolicy().hasHeightForWidth()) self.wheel_cent0.setSizePolicy(sizePolicy1) self.wheel_cent0.setMinimumSize(QSize(24, 24)) self.wheel_cent0.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0.setChecked(True) self.wheel_pos1 = QRadioButton(self.shuttle_widget) self.wheel_pos1.setObjectName(u"wheel_pos1") self.wheel_pos1.setGeometry(QRect(314, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos1.sizePolicy().hasHeightForWidth()) self.wheel_pos1.setSizePolicy(sizePolicy1) self.wheel_pos1.setMinimumSize(QSize(24, 24)) self.wheel_pos1.setStyleSheet(u"color: white;") self.wheel_pos2 = QRadioButton(self.shuttle_widget) self.wheel_pos2.setObjectName(u"wheel_pos2") self.wheel_pos2.setGeometry(QRect(338, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos2.sizePolicy().hasHeightForWidth()) self.wheel_pos2.setSizePolicy(sizePolicy1) self.wheel_pos2.setMinimumSize(QSize(24, 24)) self.wheel_pos2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.dial = QDial(self.shuttle_widget) self.dial.setObjectName(u"dial") self.dial.setGeometry(QRect(197, 178, 216, 216)) sizePolicy2 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.dial.sizePolicy().hasHeightForWidth()) self.dial.setSizePolicy(sizePolicy2) self.dial.setMinimumSize(QSize(24, 24)) self.dial.setAutoFillBackground(False) self.dial.setStyleSheet(u"background-color: black;") self.dial.setMinimum(0) self.dial.setMaximum(10) self.dial.setPageStep(1) self.dial.setValue(5) self.dial.setSliderPosition(5) self.dial.setInvertedAppearance(False) self.dial.setInvertedControls(False) self.dial.setWrapping(True) self.dial.setNotchTarget(3.700000000000000) self.dial.setNotchesVisible(False) self.wheel_neg6 = QRadioButton(self.shuttle_widget) self.wheel_neg6.setObjectName(u"wheel_neg6") self.wheel_neg6.setGeometry(QRect(162, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg6.sizePolicy().hasHeightForWidth()) self.wheel_neg6.setSizePolicy(sizePolicy1) self.wheel_neg6.setMinimumSize(QSize(24, 24)) self.wheel_neg6.setStyleSheet(u"color: white;") self.wheel_pos5 = QRadioButton(self.shuttle_widget) self.wheel_pos5.setObjectName(u"wheel_pos5") self.wheel_pos5.setGeometry(QRect(400, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos5.sizePolicy().hasHeightForWidth()) self.wheel_pos5.setSizePolicy(sizePolicy1) self.wheel_pos5.setMinimumSize(QSize(24, 24)) self.wheel_pos5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_2 = QCheckBox(self.shuttle_widget) self.button_2.setObjectName(u"button_2") self.button_2.setGeometry(QRect(156, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_2.sizePolicy().hasHeightForWidth()) self.button_2.setSizePolicy(sizePolicy1) self.button_2.setMinimumSize(QSize(24, 24)) self.button_2.setFont(font) self.button_2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg5 = QRadioButton(self.shuttle_widget) self.wheel_neg5.setObjectName(u"wheel_neg5") self.wheel_neg5.setGeometry(QRect(178, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg5.sizePolicy().hasHeightForWidth()) self.wheel_neg5.setSizePolicy(sizePolicy1) self.wheel_neg5.setMinimumSize(QSize(24, 24)) self.wheel_neg5.setStyleSheet(u"color: white;") self.wheel_pos6 = QRadioButton(self.shuttle_widget) self.wheel_pos6.setObjectName(u"wheel_pos6") self.wheel_pos6.setGeometry(QRect(416, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos6.sizePolicy().hasHeightForWidth()) self.wheel_pos6.setSizePolicy(sizePolicy1) self.wheel_pos6.setMinimumSize(QSize(24, 24)) self.wheel_pos6.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg1 = QRadioButton(self.shuttle_widget) self.wheel_neg1.setObjectName(u"wheel_neg1") self.wheel_neg1.setGeometry(QRect(264, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg1.sizePolicy().hasHeightForWidth()) self.wheel_neg1.setSizePolicy(sizePolicy1) self.wheel_neg1.setMinimumSize(QSize(24, 24)) self.wheel_neg1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_4 = QCheckBox(self.shuttle_widget) self.button_4.setObjectName(u"button_4") self.button_4.setGeometry(QRect(430, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_4.sizePolicy().hasHeightForWidth()) self.button_4.setSizePolicy(sizePolicy1) self.button_4.setMinimumSize(QSize(24, 24)) self.button_4.setFont(font) self.button_4.setLayoutDirection(Qt.RightToLeft) self.button_4.setAutoFillBackground(False) self.button_4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos7 = QRadioButton(self.shuttle_widget) self.wheel_pos7.setObjectName(u"wheel_pos7") self.wheel_pos7.setGeometry(QRect(427, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos7.sizePolicy().hasHeightForWidth()) self.wheel_pos7.setSizePolicy(sizePolicy1) self.wheel_pos7.setMinimumSize(QSize(24, 24)) self.wheel_pos7.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3 = QCheckBox(self.shuttle_widget) self.button_3.setObjectName(u"button_3") self.button_3.setGeometry(QRect(290, 72, 24, 24)) sizePolicy1.setHeightForWidth(self.button_3.sizePolicy().hasHeightForWidth()) self.button_3.setSizePolicy(sizePolicy1) self.button_3.setMinimumSize(QSize(24, 24)) self.button_3.setFont(font) self.button_3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3.setTristate(False) self.wheel_neg2 = QRadioButton(self.shuttle_widget) self.wheel_neg2.setObjectName(u"wheel_neg2") self.wheel_neg2.setGeometry(QRect(240, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg2.sizePolicy().hasHeightForWidth()) self.wheel_neg2.setSizePolicy(sizePolicy1) self.wheel_neg2.setMinimumSize(QSize(24, 24)) self.wheel_neg2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos3 = QRadioButton(self.shuttle_widget) self.wheel_pos3.setObjectName(u"wheel_pos3") self.wheel_pos3.setGeometry(QRect(361, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos3.sizePolicy().hasHeightForWidth()) self.wheel_pos3.setSizePolicy(sizePolicy1) self.wheel_pos3.setMinimumSize(QSize(24, 24)) self.wheel_pos3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg3 = QRadioButton(self.shuttle_widget) self.wheel_neg3.setObjectName(u"wheel_neg3") self.wheel_neg3.setGeometry(QRect(217, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg3.sizePolicy().hasHeightForWidth()) self.wheel_neg3.setSizePolicy(sizePolicy1) self.wheel_neg3.setMinimumSize(QSize(24, 24)) self.wheel_neg3.setStyleSheet(u"color: white;") self.wheel_neg4 = QRadioButton(self.shuttle_widget) self.wheel_neg4.setObjectName(u"wheel_neg4") self.wheel_neg4.setGeometry(QRect(196, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg4.sizePolicy().hasHeightForWidth()) self.wheel_neg4.setSizePolicy(sizePolicy1) self.wheel_neg4.setMinimumSize(QSize(24, 24)) self.wheel_neg4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg7 = QRadioButton(self.shuttle_widget) self.wheel_neg7.setObjectName(u"wheel_neg7") self.wheel_neg7.setGeometry(QRect(151, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg7.sizePolicy().hasHeightForWidth()) self.wheel_neg7.setSizePolicy(sizePolicy1) self.wheel_neg7.setMinimumSize(QSize(24, 24)) self.wheel_neg7.setStyleSheet(u"color: white;") self.dial.raise_() self.button_1.raise_() self.usb_status.raise_() self.button_5.raise_() self.wheel_pos4.raise_() self.wheel_cent0.raise_() self.wheel_pos1.raise_() self.wheel_pos2.raise_() self.wheel_neg6.raise_() self.wheel_pos5.raise_() self.button_2.raise_() self.wheel_neg5.raise_() self.wheel_pos6.raise_() self.wheel_neg1.raise_() self.button_4.raise_() self.wheel_pos7.raise_() self.button_3.raise_() self.wheel_neg2.raise_() self.wheel_pos3.raise_() self.wheel_neg3.raise_() self.wheel_neg4.raise_() self.wheel_neg7.raise_() self.main_layout.addWidget(self.shuttle_widget, 3, 2, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.about_button = QPushButton(self.main_widget) self.about_button.setObjectName(u"about_button") sizePolicy1.setHeightForWidth(self.about_button.sizePolicy().hasHeightForWidth()) self.about_button.setSizePolicy(sizePolicy1) self.about_button.setMinimumSize(QSize(24, 24)) self.about_button.setFont(font1) self.about_button.setCursor(QCursor(Qt.WhatsThisCursor)) self.about_button.setCheckable(False) self.about_button.setFlat(True) self.horizontalLayout.addWidget(self.about_button) self.main_layout.addLayout(self.horizontalLayout, 1, 2, 1, 1) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.plug_button = QPushButton(self.main_widget) self.plug_button.setObjectName(u"plug_button") sizePolicy1.setHeightForWidth(self.plug_button.sizePolicy().hasHeightForWidth()) self.plug_button.setSizePolicy(sizePolicy1) self.plug_button.setMinimumSize(QSize(24, 24)) self.plug_button.setFont(font1) self.plug_button.setCursor(QCursor(Qt.PointingHandCursor)) self.plug_button.setCheckable(False) self.plug_button.setFlat(True) self.horizontalLayout_3.addWidget(self.plug_button) self.main_layout.addLayout(self.horizontalLayout_3, 3, 1, 1, 1) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.conf_button = QPushButton(self.main_widget) self.conf_button.setObjectName(u"conf_button") sizePolicy1.setHeightForWidth(self.conf_button.sizePolicy().hasHeightForWidth()) self.conf_button.setSizePolicy(sizePolicy1) self.conf_button.setMinimumSize(QSize(24, 24)) self.conf_button.setFont(font1) self.conf_button.setCursor(QCursor(Qt.PointingHandCursor)) self.conf_button.setCheckable(False) self.conf_button.setFlat(True) self.verticalLayout.addWidget(self.conf_button) self.main_layout.addLayout(self.verticalLayout, 3, 4, 1, 1) MainWindow.setCentralWidget(self.main_widget) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") self.statusbar.setMinimumSize(QSize(600, 0)) MainWindow.setStatusBar(self.statusbar) self.about_widget = QDockWidget(MainWindow) self.about_widget.setObjectName(u"about_widget") self.about_widget.setEnabled(True) sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.about_widget.sizePolicy().hasHeightForWidth()) self.about_widget.setSizePolicy(sizePolicy3) self.about_widget.setMinimumSize(QSize(600, 600)) self.about_widget.setVisible(True) self.about_widget.setFloating(False) self.about_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetMovable) self.about_widget.setAllowedAreas(Qt.TopDockWidgetArea) self.about_layout = QWidget() self.about_layout.setObjectName(u"about_layout") sizePolicy3.setHeightForWidth(self.about_layout.sizePolicy().hasHeightForWidth()) self.about_layout.setSizePolicy(sizePolicy3) self.about_layout.setAutoFillBackground(False) self.gridLayout_3 = QGridLayout(self.about_layout) self.gridLayout_3.setObjectName(u"gridLayout_3") self.about_text = QTextEdit(self.about_layout) self.about_text.setObjectName(u"about_text") self.about_text.setFocusPolicy(Qt.WheelFocus) self.about_text.setAcceptDrops(False) self.about_text.setStyleSheet(u"color: white;") self.about_text.setFrameShape(QFrame.StyledPanel) self.about_text.setFrameShadow(QFrame.Sunken) self.about_text.setUndoRedoEnabled(False) self.about_text.setReadOnly(True) self.about_text.setAcceptRichText(True) self.gridLayout_3.addWidget(self.about_text, 0, 0, 1, 1) self.about_widget.setWidget(self.about_layout) MainWindow.addDockWidget(Qt.TopDockWidgetArea, self.about_widget) self.log_widget = QDockWidget(MainWindow) self.log_widget.setObjectName(u"log_widget") self.log_widget.setEnabled(True) self.log_widget.setMinimumSize(QSize(550, 158)) self.log_widget.setFont(font) self.log_widget.setVisible(True) self.log_widget.setFloating(False) self.log_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.log_widget.setAllowedAreas(Qt.BottomDockWidgetArea) self.log_layout = QWidget() self.log_layout.setObjectName(u"log_layout") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth(self.log_layout.sizePolicy().hasHeightForWidth()) self.log_layout.setSizePolicy(sizePolicy4) self.gridLayout_2 = QGridLayout(self.log_layout) self.gridLayout_2.setObjectName(u"gridLayout_2") self.log_content_layout = QVBoxLayout() self.log_content_layout.setObjectName(u"log_content_layout") self.log_content_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_text = QPlainTextEdit(self.log_layout) self.log_text.setObjectName(u"log_text") sizePolicy4.setHeightForWidth(self.log_text.sizePolicy().hasHeightForWidth()) self.log_text.setSizePolicy(sizePolicy4) self.log_text.setMinimumSize(QSize(0, 0)) self.log_text.setAcceptDrops(False) self.log_text.setFrameShape(QFrame.StyledPanel) self.log_text.setFrameShadow(QFrame.Sunken) self.log_text.setUndoRedoEnabled(False) self.log_text.setReadOnly(True) self.log_content_layout.addWidget(self.log_text) self.buttons_layout = QHBoxLayout() self.buttons_layout.setObjectName(u"buttons_layout") self.buttons_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_clear_button = QToolButton(self.log_layout) self.log_clear_button.setObjectName(u"log_clear_button") icon1 = QIcon() icon1.addFile(u"images/delete-sweep_24.png", QSize(), QIcon.Normal, QIcon.Off) self.log_clear_button.setIcon(icon1) self.log_clear_button.setIconSize(QSize(24, 24)) self.buttons_layout.addWidget(self.log_clear_button) self.log_content_layout.addLayout(self.buttons_layout) self.gridLayout_2.addLayout(self.log_content_layout, 0, 0, 1, 1) self.log_widget.setWidget(self.log_layout) MainWindow.addDockWidget(Qt.BottomDockWidgetArea, self.log_widget) self.config_widget = QDockWidget(MainWindow) self.config_widget.setObjectName(u"config_widget") self.config_widget.setEnabled(True) self.config_widget.setMinimumSize(QSize(250, 600)) self.config_widget.setFloating(False) self.config_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.config_widget.setAllowedAreas(Qt.RightDockWidgetArea) self.config_layout = QWidget() self.config_layout.setObjectName(u"config_layout") self.gridLayout = QGridLayout(self.config_layout) self.gridLayout.setObjectName(u"gridLayout") self.config_content_layout = QFormLayout() self.config_content_layout.setObjectName(u"config_content_layout") self.gridLayout.addLayout(self.config_content_layout, 0, 0, 1, 1) self.config_widget.setWidget(self.config_layout) MainWindow.addDockWidget(Qt.RightDockWidgetArea, self.config_widget) self.plugins_widget = QDockWidget(MainWindow) self.plugins_widget.setObjectName(u"plugins_widget") self.plugins_widget.setMinimumSize(QSize(250, 600)) self.plugins_widget.setAllowedAreas(Qt.LeftDockWidgetArea) self.dockWidgetContents = QWidget() self.dockWidgetContents.setObjectName(u"dockWidgetContents") self.plugins_widget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(Qt.LeftDockWidgetArea, self.plugins_widget) self.about_widget.raise_() self.log_widget.raise_() self.retranslateUi(MainWindow) self.usb_status.setDefault(False) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Contour ShuttleXpress", None)) self.action_Quit.setText(QCoreApplication.translate("MainWindow", u"&Quit", None)) #if QT_CONFIG(tooltip) self.log_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.log_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Log", None)) #endif // QT_CONFIG(statustip) self.log_button.setText(QCoreApplication.translate("MainWindow", u"//", None)) #if QT_CONFIG(statustip) self.button_1.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 1", None)) #endif // QT_CONFIG(statustip) self.button_1.setText("") #if QT_CONFIG(tooltip) self.usb_status.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.usb_status.setStatusTip(QCoreApplication.translate("MainWindow", u"USB connection status", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(whatsthis) self.usb_status.setWhatsThis(QCoreApplication.translate("MainWindow", u"USB Status", None)) #endif // QT_CONFIG(whatsthis) #if QT_CONFIG(statustip) self.button_5.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 5", None)) #endif // QT_CONFIG(statustip) self.button_5.setText("") #if QT_CONFIG(statustip) self.wheel_pos4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 4", None)) #endif // QT_CONFIG(statustip) self.wheel_pos4.setText("") #if QT_CONFIG(statustip) self.wheel_cent0.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: center", None)) #endif // QT_CONFIG(statustip) self.wheel_cent0.setText("") #if QT_CONFIG(statustip) self.wheel_pos1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 1", None)) #endif // QT_CONFIG(statustip) self.wheel_pos1.setText("") #if QT_CONFIG(statustip) self.wheel_pos2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 2", None)) #endif // QT_CONFIG(statustip) self.wheel_pos2.setText("") #if QT_CONFIG(statustip) self.dial.setStatusTip(QCoreApplication.translate("MainWindow", u"Dial", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(statustip) self.wheel_neg6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 6", None)) #endif // QT_CONFIG(statustip) self.wheel_neg6.setText("") #if QT_CONFIG(statustip) self.wheel_pos5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 5", None)) #endif // QT_CONFIG(statustip) self.wheel_pos5.setText("") #if QT_CONFIG(statustip) self.button_2.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 2", None)) #endif // QT_CONFIG(statustip) self.button_2.setText("") #if QT_CONFIG(statustip) self.wheel_neg5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 5", None)) #endif // QT_CONFIG(statustip) self.wheel_neg5.setText("") #if QT_CONFIG(statustip) self.wheel_pos6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 6", None)) #endif // QT_CONFIG(statustip) self.wheel_pos6.setText("") #if QT_CONFIG(statustip) self.wheel_neg1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 1", None)) #endif // QT_CONFIG(statustip) self.wheel_neg1.setText("") #if QT_CONFIG(statustip) self.button_4.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 4", None)) #endif // QT_CONFIG(statustip) self.button_4.setText("") #if QT_CONFIG(statustip) self.wheel_pos7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 7", None)) #endif // QT_CONFIG(statustip) self.wheel_pos7.setText("") #if QT_CONFIG(statustip) self.button_3.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 3", None)) #endif // QT_CONFIG(statustip) self.button_3.setText("") #if QT_CONFIG(statustip) self.wheel_neg2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 2", None)) #endif // QT_CONFIG(statustip) self.wheel_neg2.setText("") #if QT_CONFIG(statustip) self.wheel_pos3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 3", None)) #endif // QT_CONFIG(statustip) self.wheel_pos3.setText("") #if QT_CONFIG(statustip) self.wheel_neg3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 3", None)) #endif // QT_CONFIG(statustip) self.wheel_neg3.setText("") #if QT_CONFIG(statustip) self.wheel_neg4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 4", None)) #endif // QT_CONFIG(statustip) self.wheel_neg4.setText(QCoreApplication.translate("MainWindow", u"-", None)) #if QT_CONFIG(statustip) self.wheel_neg7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 7", None)) #endif // QT_CONFIG(statustip) self.wheel_neg7.setText("") #if QT_CONFIG(tooltip) self.about_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.about_button.setStatusTip(QCoreApplication.translate("MainWindow", u"About", None)) #endif // QT_CONFIG(statustip) self.about_button.setText(QCoreApplication.translate("MainWindow", u"?", None)) #if QT_CONFIG(tooltip) self.plug_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.plug_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.plug_button.setText(QCoreApplication.translate("MainWindow", u"#", None)) #if QT_CONFIG(tooltip) self.conf_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.conf_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.conf_button.setText(QCoreApplication.translate("MainWindow", u"=", None)) self.about_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"About", None)) self.about_text.setDocumentTitle("") self.log_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Log", None)) self.log_clear_button.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) self.config_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Configuration", None)) self.plugins_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Plugins", None))
class Ui_LoginFNSDialog(object): def setupUi(self, LoginFNSDialog): if not LoginFNSDialog.objectName(): LoginFNSDialog.setObjectName(u"LoginFNSDialog") LoginFNSDialog.resize(400, 500) self.verticalLayout_3 = QVBoxLayout(LoginFNSDialog) self.verticalLayout_3.setSpacing(6) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(2, 2, 2, 2) self.LoginMethodTabs = QTabWidget(LoginFNSDialog) self.LoginMethodTabs.setObjectName(u"LoginMethodTabs") self.LoginSMSTab = QWidget() self.LoginSMSTab.setObjectName(u"LoginSMSTab") self.verticalLayout_7 = QVBoxLayout(self.LoginSMSTab) self.verticalLayout_7.setSpacing(2) self.verticalLayout_7.setObjectName(u"verticalLayout_7") self.verticalLayout_7.setContentsMargins(0, 0, 0, 0) self.PhoneNumberFrame = QFrame(self.LoginSMSTab) self.PhoneNumberFrame.setObjectName(u"PhoneNumberFrame") self.PhoneNumberFrame.setFrameShape(QFrame.NoFrame) self.PhoneNumberFrame.setFrameShadow(QFrame.Plain) self.formLayout_2 = QFormLayout(self.PhoneNumberFrame) self.formLayout_2.setObjectName(u"formLayout_2") self.formLayout_2.setContentsMargins(6, -1, 6, 0) self.PhoneLbl = QLabel(self.PhoneNumberFrame) self.PhoneLbl.setObjectName(u"PhoneLbl") self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.PhoneLbl) self.PhoneNumberEdit = QLineEdit(self.PhoneNumberFrame) self.PhoneNumberEdit.setObjectName(u"PhoneNumberEdit") self.PhoneNumberEdit.setInputMask(u"+7-999-999-99-99;_") self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.PhoneNumberEdit) self.verticalLayout_7.addWidget(self.PhoneNumberFrame) self.CodeButtonFrame = QFrame(self.LoginSMSTab) self.CodeButtonFrame.setObjectName(u"CodeButtonFrame") self.CodeButtonFrame.setFrameShape(QFrame.NoFrame) self.CodeButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_8 = QVBoxLayout(self.CodeButtonFrame) self.verticalLayout_8.setObjectName(u"verticalLayout_8") self.verticalLayout_8.setContentsMargins(0, 6, 0, 0) self.GetCodeBtn = QPushButton(self.CodeButtonFrame) self.GetCodeBtn.setObjectName(u"GetCodeBtn") sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.GetCodeBtn.sizePolicy().hasHeightForWidth()) self.GetCodeBtn.setSizePolicy(sizePolicy) self.verticalLayout_8.addWidget(self.GetCodeBtn, 0, Qt.AlignHCenter) self.verticalLayout_7.addWidget(self.CodeButtonFrame) self.CodeFrame = QFrame(self.LoginSMSTab) self.CodeFrame.setObjectName(u"CodeFrame") self.CodeFrame.setFrameShape(QFrame.NoFrame) self.CodeFrame.setFrameShadow(QFrame.Plain) self.formLayout_3 = QFormLayout(self.CodeFrame) self.formLayout_3.setObjectName(u"formLayout_3") self.formLayout_3.setContentsMargins(6, -1, 6, 0) self.CodeLbl = QLabel(self.CodeFrame) self.CodeLbl.setObjectName(u"CodeLbl") self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.CodeLbl) self.CodeEdit = QLineEdit(self.CodeFrame) self.CodeEdit.setObjectName(u"CodeEdit") self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.CodeEdit) self.verticalLayout_7.addWidget(self.CodeFrame) self.SMSButtonFrame = QFrame(self.LoginSMSTab) self.SMSButtonFrame.setObjectName(u"SMSButtonFrame") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.SMSButtonFrame.sizePolicy().hasHeightForWidth()) self.SMSButtonFrame.setSizePolicy(sizePolicy1) self.SMSButtonFrame.setFrameShape(QFrame.NoFrame) self.SMSButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_10 = QVBoxLayout(self.SMSButtonFrame) self.verticalLayout_10.setObjectName(u"verticalLayout_10") self.verticalLayout_10.setContentsMargins(0, 0, 0, 6) self.frame = QFrame(self.SMSButtonFrame) self.frame.setObjectName(u"frame") sizePolicy1.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy1) self.frame.setFrameShape(QFrame.NoFrame) self.frame.setFrameShadow(QFrame.Plain) self.verticalLayout_9 = QVBoxLayout(self.frame) self.verticalLayout_9.setObjectName(u"verticalLayout_9") self.SMSLoginBtn = QPushButton(self.frame) self.SMSLoginBtn.setObjectName(u"SMSLoginBtn") sizePolicy.setHeightForWidth( self.SMSLoginBtn.sizePolicy().hasHeightForWidth()) self.SMSLoginBtn.setSizePolicy(sizePolicy) self.verticalLayout_9.addWidget(self.SMSLoginBtn, 0, Qt.AlignHCenter | Qt.AlignTop) self.verticalLayout_10.addWidget(self.frame) self.line = QFrame(self.SMSButtonFrame) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.verticalLayout_10.addWidget(self.line) self.SMSCloseBtn = QPushButton(self.SMSButtonFrame) self.SMSCloseBtn.setObjectName(u"SMSCloseBtn") sizePolicy.setHeightForWidth( self.SMSCloseBtn.sizePolicy().hasHeightForWidth()) self.SMSCloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_10.addWidget(self.SMSCloseBtn, 0, Qt.AlignHCenter) self.verticalLayout_7.addWidget(self.SMSButtonFrame) self.LoginMethodTabs.addTab(self.LoginSMSTab, "") self.LoginPasswordTab = QWidget() self.LoginPasswordTab.setObjectName(u"LoginPasswordTab") self.verticalLayout = QVBoxLayout(self.LoginPasswordTab) self.verticalLayout.setSpacing(2) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.LoginDataFrame = QFrame(self.LoginPasswordTab) self.LoginDataFrame.setObjectName(u"LoginDataFrame") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.LoginDataFrame.sizePolicy().hasHeightForWidth()) self.LoginDataFrame.setSizePolicy(sizePolicy2) self.LoginDataFrame.setFrameShape(QFrame.NoFrame) self.LoginDataFrame.setFrameShadow(QFrame.Plain) self.formLayout = QFormLayout(self.LoginDataFrame) self.formLayout.setObjectName(u"formLayout") self.formLayout.setHorizontalSpacing(6) self.formLayout.setContentsMargins(6, -1, 6, 0) self.InnLbl = QLabel(self.LoginDataFrame) self.InnLbl.setObjectName(u"InnLbl") self.formLayout.setWidget(0, QFormLayout.LabelRole, self.InnLbl) self.InnEdit = QLineEdit(self.LoginDataFrame) self.InnEdit.setObjectName(u"InnEdit") self.formLayout.setWidget(0, QFormLayout.FieldRole, self.InnEdit) self.PasswordLbl = QLabel(self.LoginDataFrame) self.PasswordLbl.setObjectName(u"PasswordLbl") self.formLayout.setWidget(1, QFormLayout.LabelRole, self.PasswordLbl) self.PasswordEdit = QLineEdit(self.LoginDataFrame) self.PasswordEdit.setObjectName(u"PasswordEdit") self.PasswordEdit.setEchoMode(QLineEdit.Password) self.formLayout.setWidget(1, QFormLayout.FieldRole, self.PasswordEdit) self.verticalLayout.addWidget(self.LoginDataFrame) self.FNSButtonFrame = QFrame(self.LoginPasswordTab) self.FNSButtonFrame.setObjectName(u"FNSButtonFrame") self.FNSButtonFrame.setFrameShape(QFrame.NoFrame) self.FNSButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_4 = QVBoxLayout(self.FNSButtonFrame) self.verticalLayout_4.setSpacing(6) self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_4.setContentsMargins(0, 0, 0, 6) self.FNSLoginFrame = QFrame(self.FNSButtonFrame) self.FNSLoginFrame.setObjectName(u"FNSLoginFrame") sizePolicy1.setHeightForWidth( self.FNSLoginFrame.sizePolicy().hasHeightForWidth()) self.FNSLoginFrame.setSizePolicy(sizePolicy1) self.FNSLoginFrame.setFrameShape(QFrame.NoFrame) self.FNSLoginFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_5 = QVBoxLayout(self.FNSLoginFrame) self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.FNSLoginBtn = QPushButton(self.FNSLoginFrame) self.FNSLoginBtn.setObjectName(u"FNSLoginBtn") sizePolicy.setHeightForWidth( self.FNSLoginBtn.sizePolicy().hasHeightForWidth()) self.FNSLoginBtn.setSizePolicy(sizePolicy) self.verticalLayout_5.addWidget(self.FNSLoginBtn, 0, Qt.AlignHCenter | Qt.AlignTop) self.verticalLayout_4.addWidget(self.FNSLoginFrame) self.FNSSplitLine = QFrame(self.FNSButtonFrame) self.FNSSplitLine.setObjectName(u"FNSSplitLine") self.FNSSplitLine.setFrameShape(QFrame.HLine) self.FNSSplitLine.setFrameShadow(QFrame.Sunken) self.verticalLayout_4.addWidget(self.FNSSplitLine) self.FNSCloseBtn = QPushButton(self.FNSButtonFrame) self.FNSCloseBtn.setObjectName(u"FNSCloseBtn") sizePolicy.setHeightForWidth( self.FNSCloseBtn.sizePolicy().hasHeightForWidth()) self.FNSCloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_4.addWidget(self.FNSCloseBtn, 0, Qt.AlignHCenter) self.verticalLayout.addWidget(self.FNSButtonFrame) self.LoginMethodTabs.addTab(self.LoginPasswordTab, "") self.ESIATab = QWidget() self.ESIATab.setObjectName(u"ESIATab") self.verticalLayout_2 = QVBoxLayout(self.ESIATab) self.verticalLayout_2.setSpacing(2) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.ESIAWebView = QWebEngineView(self.ESIATab) self.ESIAWebView.setObjectName(u"ESIAWebView") sizePolicy1.setHeightForWidth( self.ESIAWebView.sizePolicy().hasHeightForWidth()) self.ESIAWebView.setSizePolicy(sizePolicy1) self.ESIAWebView.setUrl(QUrl(u"about:blank")) self.verticalLayout_2.addWidget(self.ESIAWebView) self.ESIAButtonFrame = QFrame(self.ESIATab) self.ESIAButtonFrame.setObjectName(u"ESIAButtonFrame") self.ESIAButtonFrame.setFrameShape(QFrame.NoFrame) self.ESIAButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_6 = QVBoxLayout(self.ESIAButtonFrame) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(0, 0, 0, 6) self.ESIASplitLine = QFrame(self.ESIAButtonFrame) self.ESIASplitLine.setObjectName(u"ESIASplitLine") self.ESIASplitLine.setFrameShape(QFrame.HLine) self.ESIASplitLine.setFrameShadow(QFrame.Sunken) self.verticalLayout_6.addWidget(self.ESIASplitLine) self.ESIACloseBtn = QPushButton(self.ESIAButtonFrame) self.ESIACloseBtn.setObjectName(u"ESIACloseBtn") sizePolicy.setHeightForWidth( self.ESIACloseBtn.sizePolicy().hasHeightForWidth()) self.ESIACloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_6.addWidget(self.ESIACloseBtn, 0, Qt.AlignHCenter) self.verticalLayout_2.addWidget(self.ESIAButtonFrame) self.LoginMethodTabs.addTab(self.ESIATab, "") self.verticalLayout_3.addWidget(self.LoginMethodTabs) self.retranslateUi(LoginFNSDialog) self.FNSCloseBtn.clicked.connect(LoginFNSDialog.close) self.ESIACloseBtn.clicked.connect(LoginFNSDialog.close) self.SMSCloseBtn.clicked.connect(LoginFNSDialog.close) self.LoginMethodTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(LoginFNSDialog) # setupUi def retranslateUi(self, LoginFNSDialog): LoginFNSDialog.setWindowTitle( QCoreApplication.translate("LoginFNSDialog", u"Authorization FNS", None)) self.PhoneLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Phone number:", None)) self.GetCodeBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Send SMS with code", None)) self.CodeLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Code from SMS:", None)) self.SMSLoginBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Login", None)) self.SMSCloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.LoginSMSTab), QCoreApplication.translate("LoginFNSDialog", u"SMS Login", None)) self.InnLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"INN:", None)) self.PasswordLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Password:"******"LoginFNSDialog", u"Login", None)) self.FNSCloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.LoginPasswordTab), QCoreApplication.translate("LoginFNSDialog", u"FNS Login", None)) self.ESIACloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.ESIATab), QCoreApplication.translate("LoginFNSDialog", u"ESIA Login", None))
class MainWindow(QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) #self.dbTableConnection = SqLite() self.mainWidget = QWidget() self.setWindowTitle("Video Game Scanner Inventory") self.left = 2500 self.top = 100 self.width = 1200 self.height = 900 self.setGeometry(self.left, self.top, self.width, self.height) self.mainWindowGrid = QGridLayout() self.barcode = Barcode() self.barcodeNumber = None # Stores info on a single game self.videoGameInfo = None # A List of video games self.videoGameInfoList = [] self.gameVariantDict = dict([]) self.variant = 'Standard' self.dbHandler = SqlHandler() # Barcode Number and Game Variant Buttons self.barcodeWindow = QWidget() self.setBackgroundColor(self.barcodeWindow, 'orange') self.barcodeListLayout = QGridLayout() self.barcodeScannerInput = BarscodeScannerInput() self.barcodeScannerInput.textChanged.connect(self.updateGamePriceTable) self.variantButtonList = [] self.variantButtons = VideoGameVariantButtons() self.standardBarcode = '' self.barcodeListLayout.addWidget(self.barcodeScannerInput, 0, 0) self.barcodeListLayout.addWidget(self.variantButtons, 1, 0) self.barcodeWindow.setLayout(self.barcodeListLayout) self.mainWindowGrid.addWidget(self.barcodeWindow, 0, 1, 2, 2) # Console Label - Unused (potentially for game logos) self.barcodeWindow2 = QWidget() self.setBackgroundColor(self.barcodeWindow2, 'blue') self.flashyBoxLayout = QGridLayout() self.barcodeWindow2.setLayout(self.flashyBoxLayout) self.mainWindowGrid.addWidget(self.barcodeWindow2, 0, 3, 2, 2) # Side Buttons self.barcodeWindow3 = QWidget() self.setBackgroundColor(self.barcodeWindow3, 'grey') self.mainWindowGrid.addWidget(self.barcodeWindow3, 0, 0, 4, 1) #------ Button List self.layout = QVBoxLayout() self.b1 = QPushButton("Process Table") self.layout.addWidget(self.b1) self.b1.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.b1.clicked.connect(self.processTableAndInfo) self.b2 = QPushButton("Button2") self.layout.addWidget(self.b2) self.b2.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.b3 = QPushButton("Button3") self.layout.addWidget(self.b3) self.b3.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.b4 = QPushButton("Button4") self.layout.addWidget(self.b4) self.b4.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.barcodeWindow3.setLayout(self.layout) self.barcodeWindow4 = QWidget() self.setBackgroundColor(self.barcodeWindow4, 'pink') self.mainWindowGrid.addWidget(self.barcodeWindow4, 2, 1, 2, 4) ################ Pricing and Table Widget #################################### self.gridLayout = QGridLayout() self.barcodeWindow4.setLayout(self.gridLayout) #------- unprocessed table values ----------------- self.gamePriceWidget = QWidget() self.setBackgroundColor(self.gamePriceWidget, 'blue') self.gamePriceTableLayout = QVBoxLayout() self.gamePriceTable = TableView() self.gamePriceTable.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.gamePriceTableLayout.addWidget(self.gamePriceTable) self.gamePriceWidget.setLayout(self.gamePriceTableLayout) self.gridLayout.addWidget(self.gamePriceWidget, 0, 0, 2, 6) #------- verify game info labels ------------------ self.gameInfoWidget = QWidget() self.setBackgroundColor(self.gameInfoWidget, 'indigo') self.gameInfoLayout = QGridLayout() self.gameInfoWidget.setLayout(self.gameInfoLayout) self.gridLayout.addWidget(self.gameInfoWidget, 3, 0, 1, 6) self.gameNameBox = QLineEdit() self.gameSystemBox = QLineEdit() self.gameUsedPrice = QLineEdit() self.gameCompletePrice = QLineEdit() self.gameNewPrice = QLineEdit() self.totalPriceLabel = QLabel() self.totalPriceLabel.setFont(QFont('Arial', 15)) self.setBackgroundColor(self.totalPriceLabel, 'beige') self.gameNameBox.setAlignment(QtCore.Qt.AlignCenter) self.gameSystemBox.setAlignment(QtCore.Qt.AlignCenter) self.gameUsedPrice.setAlignment(QtCore.Qt.AlignCenter) self.gameCompletePrice.setAlignment(QtCore.Qt.AlignCenter) self.gameNewPrice.setAlignment(QtCore.Qt.AlignCenter) self.gameInfoLayout.addWidget(self.gameNameBox, 0, 0, 1, 3) self.gameInfoLayout.addWidget(self.gameSystemBox, 1, 0, 1, 3) self.gameInfoLayout.addWidget(self.totalPriceLabel, 0, 4, 2, 2) self.gameInfoLayout.addWidget(self.gameUsedPrice, 2, 0, 1, 2) self.gameInfoLayout.addWidget(self.gameCompletePrice, 2, 2, 1, 2) self.gameInfoLayout.addWidget(self.gameNewPrice, 2, 4, 1, 2) #------------Button Box -------------------------------- self.horizontalGroupBox = QGroupBox("Which Price To Use?") self.buttonLayout = QGridLayout() self.horizontalGroupBox.setLayout(self.buttonLayout) self.gridLayout.addWidget(self.horizontalGroupBox, 6, 0, 1, 6) self.buttonLoose = QPushButton('Loose Price', self) self.buttonLoose.clicked.connect(self.on_click) self.buttonLayout.addWidget(self.buttonLoose, 0, 0, 1, 1) self.buttonComplete = QPushButton('Complete Price', self) self.buttonComplete.clicked.connect(self.on_click) self.buttonLayout.addWidget(self.buttonComplete, 0, 1, 1, 1) self.buttonNew = QPushButton('New Price', self) self.buttonNew.clicked.connect(self.on_click) self.buttonLayout.addWidget(self.buttonNew, 0, 2, 1, 1) self.label1 = QLabel('Alternative Bulk Price') self.label1.setAlignment(QtCore.Qt.AlignCenter) self.buttonLayout.addWidget(self.label1, 1, 1, 1, 1) self.label2 = QLabel('Alternative Single Price') self.label2.setAlignment(QtCore.Qt.AlignCenter) self.buttonLayout.addWidget(self.label2, 1, 2, 1, 1) self.buttonBadinfo = QPushButton('Bad Info', self) self.buttonLayout.addWidget(self.buttonBadinfo, 2, 0, 1, 1) self.bulkPrice = QLineEdit() self.buttonLayout.addWidget(self.bulkPrice, 2, 1, 1, 1) self.bulkPrice.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) self.bulkPrice.setAlignment(QtCore.Qt.AlignCenter) self.singleAltPrice = QLineEdit('') self.buttonLayout.addWidget(self.singleAltPrice, 2, 2, 1, 1) self.singleAltPrice.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) self.singleAltPrice.setAlignment(QtCore.Qt.AlignCenter) self.bulkPriceCheckbox = QCheckBox('Bulk Price Enabled') self.buttonLayout.addWidget(self.bulkPriceCheckbox, 1, 0) #------------------------------------------------------------- ################################################## self.mainWidget.setLayout(self.mainWindowGrid) self.setCentralWidget(self.mainWidget) self.show() def setBackgroundColor(self, widget, color): widget.setAutoFillBackground(True) palette = widget.palette() palette.setColor(QPalette.Window, QColor(color)) widget.setPalette(palette) def closeEvent(self, event): print('I Quit') self.dbHandler.conn.close() QApplication.quit() #When you click 'Loose Price','Complete Price','New Price' #This slot puts that info on the table @Slot() def on_click(self): mp.putGameInfoInTable(self, self.sender().text(), self.gamePriceTable, self.barcodeNumber) self.barcodeScannerInput.setFocus() #Once a barcod has star, this slot processes it @Slot(str) def updateGamePriceTable(self, barcode): if ('*' in barcode): self.barcodeNumber = barcode.strip('*') self.standardBarcode = self.barcodeNumber self.barcodeScannerInput.clear() print(barcode) mp.readBarcodesFromMain(self, self.barcodeNumber, self.barcodeNumber) # Clicking Process Table button - clears the table and enters is into the database @Slot() def processTableAndInfo(self): if (len(self.videoGameInfoList) < 1): return self.dbHandler.processMainWindowTable(self.videoGameInfoList, self.gamePriceTable) self.bulkPrice.clear() self.totalPriceLabel.clear() # Some games variants with different prices. When clicking on a button, this slot handles swapping prices @Slot() def variantClicked(self): self.variant = self.sender().text() variantURL = self.gameVariantDict[self.sender().text()] items = (self.variantButtons.gameVariantLayout.itemAt(i) for i in range(self.variantButtons.gameVariantLayout.count())) for btn in items: btn.widget().deleteLater() mp.readBarcodesFromMain(self, variantURL, self.standardBarcode) pass
class UIDrawROIWindow: def setup_ui(self, draw_roi_window_instance, rois, dataset_rtss, signal_roi_drawn): """ this function is responsible for setting up the UI for DrawROIWindow param draw_roi_window_instance: the current drawing window instance. :param rois: the rois to be drawn :param dataset_rtss: the rtss to be written to :param signal_roi_drawn: the signal to be triggered when roi is drawn """ self.patient_dict_container = PatientDictContainer() self.rois = rois self.dataset_rtss = dataset_rtss self.signal_roi_drawn = signal_roi_drawn self.drawn_roi_list = {} self.standard_organ_names = [] self.standard_volume_names = [] self.standard_names = [] # Combination of organ and volume self.ROI_name = None # Selected ROI name self.target_pixel_coords = [] # This will contain the new pixel # coordinates specified by the min and max self.drawingROI = None self.slice_changed = False self.drawing_tool_radius = INITIAL_DRAWING_TOOL_RADIUS self.keep_empty_pixel = False # pixel density self.target_pixel_coords_single_array = [] # 1D array self.draw_roi_window_instance = draw_roi_window_instance self.colour = None self.ds = None self.zoom = 1.0 self.upper_limit = None self.lower_limit = None # is_four_view is set to True to stop the SUV2ROI button from appearing self.dicom_view = DicomAxialView(is_four_view=True) self.current_slice = self.dicom_view.slider.value() self.dicom_view.slider.valueChanged.connect(self.slider_value_changed) self.init_layout() QtCore.QMetaObject.connectSlotsByName(draw_roi_window_instance) def retranslate_ui(self, draw_roi_window_instance): """ this function retranslate the ui for draw roi window :param draw_roi_window_instance: the current drawing window instance. """ _translate = QtCore.QCoreApplication.translate draw_roi_window_instance.setWindowTitle( _translate("DrawRoiWindowInstance", "OnkoDICOM - Draw Region Of Interest")) self.roi_name_label.setText( _translate("ROINameLabel", "Region of Interest: ")) self.roi_name_line_edit.setText(_translate("ROINameLineEdit", "")) self.image_slice_number_label.setText( _translate("ImageSliceNumberLabel", "Slice Number: ")) self.image_slice_number_line_edit.setText( _translate("ImageSliceNumberLineEdit", str(self.dicom_view.current_slice_number))) self.image_slice_number_transect_button.setText( _translate("ImageSliceNumberTransectButton", "Transect")) self.image_slice_number_box_draw_button.setText( _translate("ImageSliceNumberBoxDrawButton", "Set Bounds")) self.image_slice_number_draw_button.setText( _translate("ImageSliceNumberDrawButton", "Draw")) self.image_slice_number_move_forward_button.setText( _translate("ImageSliceNumberMoveForwardButton", "")) self.image_slice_number_move_backward_button.setText( _translate("ImageSliceNumberMoveBackwardButton", "")) self.draw_roi_window_instance_save_button.setText( _translate("DrawRoiWindowInstanceSaveButton", "Save")) self.draw_roi_window_instance_cancel_button.setText( _translate("DrawRoiWindowInstanceCancelButton", "Cancel")) self.internal_hole_max_label.setText( _translate("InternalHoleLabel", "Maximum internal hole size (pixels): ")) self.internal_hole_max_line_edit.setText( _translate("InternalHoleInput", "9")) self.isthmus_width_max_label.setText( _translate("IsthmusWidthLabel", "Maximum isthmus width size (pixels): ")) self.isthmus_width_max_line_edit.setText( _translate("IsthmusWidthInput", "5")) self.min_pixel_density_label.setText( _translate("MinPixelDensityLabel", "Minimum density (pixels): ")) self.min_pixel_density_line_edit.setText( _translate("MinPixelDensityInput", "")) self.max_pixel_density_label.setText( _translate("MaxPixelDensityLabel", "Maximum density (pixels): ")) self.max_pixel_density_line_edit.setText( _translate("MaxPixelDensityInput", "")) self.toggle_keep_empty_pixel_label.setText( _translate("ToggleKeepEmptyPixelLabel", "Keep empty pixel: ")) self.draw_roi_window_viewport_zoom_label.setText( _translate("DrawRoiWindowViewportZoomLabel", "Zoom: ")) self.draw_roi_window_cursor_radius_change_label.setText( _translate("DrawRoiWindowCursorRadiusChangeLabel", "Cursor Radius: ")) self.draw_roi_window_instance_action_reset_button.setText( _translate("DrawRoiWindowInstanceActionClearButton", "Reset")) def init_layout(self): """ Initialize the layout for the DICOM View tab. Add the view widget and the slider in the layout. Add the whole container 'tab2_view' as a tab in the main page. """ # Initialise a DrawROIWindow if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" stylesheet = open(resource_path(self.stylesheet_path)).read() window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) self.draw_roi_window_instance.setObjectName("DrawRoiWindowInstance") self.draw_roi_window_instance.setWindowIcon(window_icon) # Creating a form box to hold all buttons and input fields self.draw_roi_window_input_container_box = QFormLayout() self.draw_roi_window_input_container_box. \ setObjectName("DrawRoiWindowInputContainerBox") self.draw_roi_window_input_container_box. \ setLabelAlignment(Qt.AlignLeft) # Create a label for denoting the ROI name self.roi_name_label = QLabel() self.roi_name_label.setObjectName("ROINameLabel") self.roi_name_line_edit = QLineEdit() # Create an input box for ROI name self.roi_name_line_edit.setObjectName("ROINameLineEdit") self.roi_name_line_edit.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.roi_name_line_edit.resize( self.roi_name_line_edit.sizeHint().width(), self.roi_name_line_edit.sizeHint().height()) self.roi_name_line_edit.setEnabled(False) self.draw_roi_window_input_container_box. \ addRow(self.roi_name_label, self.roi_name_line_edit) # Create horizontal box to store image slice number and backward, # forward buttons self.image_slice_number_box = QHBoxLayout() self.image_slice_number_box.setObjectName("ImageSliceNumberBox") # Create a label for denoting the Image Slice Number self.image_slice_number_label = QLabel() self.image_slice_number_label.setObjectName("ImageSliceNumberLabel") self.image_slice_number_box.addWidget(self.image_slice_number_label) # Create a line edit for containing the image slice number self.image_slice_number_line_edit = QLineEdit() self.image_slice_number_line_edit. \ setObjectName("ImageSliceNumberLineEdit") self.image_slice_number_line_edit. \ setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.image_slice_number_line_edit.resize( self.image_slice_number_line_edit.sizeHint().width(), self.image_slice_number_line_edit.sizeHint().height()) self.image_slice_number_line_edit.setCursorPosition(0) self.image_slice_number_line_edit.setEnabled(False) self.image_slice_number_box. \ addWidget(self.image_slice_number_line_edit) # Create a button to move backward to the previous image self.image_slice_number_move_backward_button = QPushButton() self.image_slice_number_move_backward_button. \ setObjectName("ImageSliceNumberMoveBackwardButton") self.image_slice_number_move_backward_button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.image_slice_number_move_backward_button.resize(QSize(24, 24)) self.image_slice_number_move_backward_button.clicked. \ connect(self.onBackwardClicked) icon_move_backward = QtGui.QIcon() icon_move_backward.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/backward_slide_icon.png'))) self.image_slice_number_move_backward_button.setIcon( icon_move_backward) self.image_slice_number_box. \ addWidget(self.image_slice_number_move_backward_button) # Create a button to move forward to the next image self.image_slice_number_move_forward_button = QPushButton() self.image_slice_number_move_forward_button. \ setObjectName("ImageSliceNumberMoveForwardButton") self.image_slice_number_move_forward_button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.image_slice_number_move_forward_button.resize(QSize(24, 24)) self.image_slice_number_move_forward_button.clicked. \ connect(self.onForwardClicked) icon_move_forward = QtGui.QIcon() icon_move_forward.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/forward_slide_icon.png'))) self.image_slice_number_move_forward_button.setIcon(icon_move_forward) self.image_slice_number_box. \ addWidget(self.image_slice_number_move_forward_button) self.draw_roi_window_input_container_box. \ addRow(self.image_slice_number_box) # Create a horizontal box for containing the zoom function self.draw_roi_window_viewport_zoom_box = QHBoxLayout() self.draw_roi_window_viewport_zoom_box.setObjectName( "DrawRoiWindowViewportZoomBox") # Create a label for zooming self.draw_roi_window_viewport_zoom_label = QLabel() self.draw_roi_window_viewport_zoom_label. \ setObjectName("DrawRoiWindowViewportZoomLabel") # Create an input box for zoom factor self.draw_roi_window_viewport_zoom_input = QLineEdit() self.draw_roi_window_viewport_zoom_input. \ setObjectName("DrawRoiWindowViewportZoomInput") self.draw_roi_window_viewport_zoom_input. \ setText("{:.2f}".format(self.zoom * 100) + "%") self.draw_roi_window_viewport_zoom_input.setCursorPosition(0) self.draw_roi_window_viewport_zoom_input.setEnabled(False) self.draw_roi_window_viewport_zoom_input. \ setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.draw_roi_window_viewport_zoom_input.resize( self.draw_roi_window_viewport_zoom_input.sizeHint().width(), self.draw_roi_window_viewport_zoom_input.sizeHint().height()) # Create 2 buttons for zooming in and out # Zoom In Button self.draw_roi_window_viewport_zoom_in_button = QPushButton() self.draw_roi_window_viewport_zoom_in_button. \ setObjectName("DrawRoiWindowViewportZoomInButton") self.draw_roi_window_viewport_zoom_in_button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.draw_roi_window_viewport_zoom_in_button.resize(QSize(24, 24)) self.draw_roi_window_viewport_zoom_in_button. \ setProperty("QPushButtonClass", "zoom-button") icon_zoom_in = QtGui.QIcon() icon_zoom_in.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/zoom_in_icon.png'))) self.draw_roi_window_viewport_zoom_in_button.setIcon(icon_zoom_in) self.draw_roi_window_viewport_zoom_in_button.clicked. \ connect(self.onZoomInClicked) # Zoom Out Button self.draw_roi_window_viewport_zoom_out_button = QPushButton() self.draw_roi_window_viewport_zoom_out_button. \ setObjectName("DrawRoiWindowViewportZoomOutButton") self.draw_roi_window_viewport_zoom_out_button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.draw_roi_window_viewport_zoom_out_button.resize(QSize(24, 24)) self.draw_roi_window_viewport_zoom_out_button. \ setProperty("QPushButtonClass", "zoom-button") icon_zoom_out = QtGui.QIcon() icon_zoom_out.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/zoom_out_icon.png'))) self.draw_roi_window_viewport_zoom_out_button.setIcon(icon_zoom_out) self.draw_roi_window_viewport_zoom_out_button.clicked. \ connect(self.onZoomOutClicked) self.draw_roi_window_viewport_zoom_box. \ addWidget(self.draw_roi_window_viewport_zoom_label) self.draw_roi_window_viewport_zoom_box. \ addWidget(self.draw_roi_window_viewport_zoom_input) self.draw_roi_window_viewport_zoom_box. \ addWidget(self.draw_roi_window_viewport_zoom_out_button) self.draw_roi_window_viewport_zoom_box. \ addWidget(self.draw_roi_window_viewport_zoom_in_button) self.draw_roi_window_input_container_box. \ addRow(self.draw_roi_window_viewport_zoom_box) self.init_cursor_radius_change_box() # Create field to toggle two options: Keep empty pixel or fill empty # pixel when using draw cursor self.toggle_keep_empty_pixel_box = QHBoxLayout() self.toggle_keep_empty_pixel_label = QLabel() self.toggle_keep_empty_pixel_label. \ setObjectName("ToggleKeepEmptyPixelLabel") # Create input for min pixel size self.toggle_keep_empty_pixel_combo_box = QComboBox() self.toggle_keep_empty_pixel_combo_box.addItems(["Off", "On"]) self.toggle_keep_empty_pixel_combo_box.setCurrentIndex(0) self.toggle_keep_empty_pixel_combo_box.setEnabled(False) self.toggle_keep_empty_pixel_combo_box. \ setObjectName("ToggleKeepEmptyPixelComboBox") self.toggle_keep_empty_pixel_combo_box. \ setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.toggle_keep_empty_pixel_combo_box.resize( self.toggle_keep_empty_pixel_combo_box.sizeHint().width(), self.toggle_keep_empty_pixel_combo_box.sizeHint().height()) self.toggle_keep_empty_pixel_combo_box.currentIndexChanged.connect( self.toggle_keep_empty_pixel_box_index_changed) self.toggle_keep_empty_pixel_box. \ addWidget(self.toggle_keep_empty_pixel_label) self.toggle_keep_empty_pixel_box. \ addWidget(self.toggle_keep_empty_pixel_combo_box) self.draw_roi_window_input_container_box. \ addRow(self.toggle_keep_empty_pixel_box) # Create a horizontal box for transect and draw button self.draw_roi_window_transect_draw_box = QHBoxLayout() self.draw_roi_window_transect_draw_box. \ setObjectName("DrawRoiWindowTransectDrawBox") # Create a transect button self.image_slice_number_transect_button = QPushButton() self.image_slice_number_transect_button. \ setObjectName("ImageSliceNumberTransectButton") self.image_slice_number_transect_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.image_slice_number_transect_button.resize( self.image_slice_number_transect_button.sizeHint().width(), self.image_slice_number_transect_button.sizeHint().height()) self.image_slice_number_transect_button.clicked. \ connect(self.transect_handler) icon_transect = QtGui.QIcon() icon_transect.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/transect_icon.png'))) self.image_slice_number_transect_button.setIcon(icon_transect) self.draw_roi_window_transect_draw_box. \ addWidget(self.image_slice_number_transect_button) # Create a bounding box button self.image_slice_number_box_draw_button = QPushButton() self.image_slice_number_box_draw_button. \ setObjectName("ImageSliceNumberBoxDrawButton") self.image_slice_number_box_draw_button.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.image_slice_number_box_draw_button.resize( self.image_slice_number_box_draw_button.sizeHint().width(), self.image_slice_number_box_draw_button.sizeHint().height()) self.image_slice_number_box_draw_button.clicked. \ connect(self.onBoxDrawClicked) icon_box_draw = QtGui.QIcon() icon_box_draw.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/draw_bound_icon.png'))) self.image_slice_number_box_draw_button.setIcon(icon_box_draw) self.draw_roi_window_transect_draw_box. \ addWidget(self.image_slice_number_box_draw_button) # Create a draw button self.image_slice_number_draw_button = QPushButton() self.image_slice_number_draw_button. \ setObjectName("ImageSliceNumberDrawButton") self.image_slice_number_draw_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.image_slice_number_draw_button.resize( self.image_slice_number_draw_button.sizeHint().width(), self.image_slice_number_draw_button.sizeHint().height()) self.image_slice_number_draw_button.clicked.connect(self.onDrawClicked) icon_draw = QtGui.QIcon() icon_draw.addPixmap( QtGui.QPixmap(resource_path('res/images/btn-icons/draw_icon.png'))) self.image_slice_number_draw_button.setIcon(icon_draw) self.draw_roi_window_transect_draw_box. \ addWidget(self.image_slice_number_draw_button) self.draw_roi_window_input_container_box. \ addRow(self.draw_roi_window_transect_draw_box) # Create a contour preview button self.row_preview_layout = QtWidgets.QHBoxLayout() self.button_contour_preview = QtWidgets.QPushButton("Preview contour") self.button_contour_preview.clicked.connect(self.onPreviewClicked) self.row_preview_layout.addWidget(self.button_contour_preview) self.draw_roi_window_input_container_box. \ addRow(self.row_preview_layout) icon_preview = QtGui.QIcon() icon_preview.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/preview_icon.png'))) self.button_contour_preview.setIcon(icon_preview) # Create input line edit for alpha value self.label_alpha_value = QtWidgets.QLabel("Alpha value:") self.input_alpha_value = QtWidgets.QLineEdit("0.2") self.input_alpha_value. \ setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.input_alpha_value.resize( self.input_alpha_value.sizeHint().width(), self.input_alpha_value.sizeHint().height()) self.input_alpha_value.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.draw_roi_window_input_container_box. \ addRow(self.label_alpha_value, self.input_alpha_value) # Create a label for denoting the max internal hole size self.internal_hole_max_label = QLabel() self.internal_hole_max_label.setObjectName("InternalHoleLabel") # Create input for max internal hole size self.internal_hole_max_line_edit = QLineEdit() self.internal_hole_max_line_edit.setObjectName("InternalHoleInput") self.internal_hole_max_line_edit. \ setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.internal_hole_max_line_edit.resize( self.internal_hole_max_line_edit.sizeHint().width(), self.internal_hole_max_line_edit.sizeHint().height()) self.internal_hole_max_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.draw_roi_window_input_container_box.addRow( self.internal_hole_max_label, self.internal_hole_max_line_edit) # Create a label for denoting the isthmus width size self.isthmus_width_max_label = QLabel() self.isthmus_width_max_label.setObjectName("IsthmusWidthLabel") # Create input for max isthmus width size self.isthmus_width_max_line_edit = QLineEdit() self.isthmus_width_max_line_edit.setObjectName("IsthmusWidthInput") self.isthmus_width_max_line_edit.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.isthmus_width_max_line_edit.resize( self.isthmus_width_max_line_edit.sizeHint().width(), self.isthmus_width_max_line_edit.sizeHint().height()) self.isthmus_width_max_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.draw_roi_window_input_container_box.addRow( self.isthmus_width_max_label, self.isthmus_width_max_line_edit) # Create a label for denoting the minimum pixel density self.min_pixel_density_label = QLabel() self.min_pixel_density_label.setObjectName("MinPixelDensityLabel") # Create input for min pixel size self.min_pixel_density_line_edit = QLineEdit() self.min_pixel_density_line_edit.setObjectName("MinPixelDensityInput") self.min_pixel_density_line_edit.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.min_pixel_density_line_edit.resize( self.min_pixel_density_line_edit.sizeHint().width(), self.min_pixel_density_line_edit.sizeHint().height()) self.min_pixel_density_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.draw_roi_window_input_container_box.addRow( self.min_pixel_density_label, self.min_pixel_density_line_edit) # Create a label for denoting the minimum pixel density self.max_pixel_density_label = QLabel() self.max_pixel_density_label.setObjectName("MaxPixelDensityLabel") # Create input for min pixel size self.max_pixel_density_line_edit = QLineEdit() self.max_pixel_density_line_edit.setObjectName("MaxPixelDensityInput") self.max_pixel_density_line_edit. \ setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.max_pixel_density_line_edit.resize( self.max_pixel_density_line_edit.sizeHint().width(), self.max_pixel_density_line_edit.sizeHint().height()) self.max_pixel_density_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.draw_roi_window_input_container_box.addRow( self.max_pixel_density_label, self.max_pixel_density_line_edit) # Create a button to clear the draw self.draw_roi_window_instance_action_reset_button = QPushButton() self.draw_roi_window_instance_action_reset_button. \ setObjectName("DrawRoiWindowInstanceActionClearButton") self.draw_roi_window_instance_action_reset_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) reset_button = self.draw_roi_window_instance_action_reset_button self.draw_roi_window_instance_action_reset_button.resize( reset_button.sizeHint().width(), reset_button.sizeHint().height()) self.draw_roi_window_instance_action_reset_button.clicked. \ connect(self.onResetClicked) self.draw_roi_window_instance_action_reset_button. \ setProperty("QPushButtonClass", "fail-button") icon_clear_roi_draw = QtGui.QIcon() icon_clear_roi_draw.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/reset_roi_draw_icon.png'))) self.draw_roi_window_instance_action_reset_button. \ setIcon(icon_clear_roi_draw) self.draw_roi_window_input_container_box. \ addRow(self.draw_roi_window_instance_action_reset_button) # Create a horizontal box for saving and cancel the drawing self.draw_roi_window_cancel_save_box = QHBoxLayout() self.draw_roi_window_cancel_save_box. \ setObjectName("DrawRoiWindowCancelSaveBox") # Create an exit button to cancel the drawing # Add a button to go back/exit from the application self.draw_roi_window_instance_cancel_button = QPushButton() self.draw_roi_window_instance_cancel_button. \ setObjectName("DrawRoiWindowInstanceCancelButton") self.draw_roi_window_instance_cancel_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.draw_roi_window_instance_cancel_button.resize( self.draw_roi_window_instance_cancel_button.sizeHint().width(), self.draw_roi_window_instance_cancel_button.sizeHint().height()) self.draw_roi_window_instance_cancel_button. \ setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.draw_roi_window_instance_cancel_button.clicked. \ connect(self.onCancelButtonClicked) self.draw_roi_window_instance_cancel_button. \ setProperty("QPushButtonClass", "fail-button") icon_cancel = QtGui.QIcon() icon_cancel.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/cancel_icon.png'))) self.draw_roi_window_instance_cancel_button.setIcon(icon_cancel) self.draw_roi_window_cancel_save_box. \ addWidget(self.draw_roi_window_instance_cancel_button) # Create a save button to save all the changes self.draw_roi_window_instance_save_button = QPushButton() self.draw_roi_window_instance_save_button. \ setObjectName("DrawRoiWindowInstanceSaveButton") self.draw_roi_window_instance_save_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.draw_roi_window_instance_save_button.resize( self.draw_roi_window_instance_save_button.sizeHint().width(), self.draw_roi_window_instance_save_button.sizeHint().height()) self.draw_roi_window_instance_save_button. \ setProperty("QPushButtonClass", "success-button") icon_save = QtGui.QIcon() icon_save.addPixmap( QtGui.QPixmap(resource_path('res/images/btn-icons/save_icon.png'))) self.draw_roi_window_instance_save_button.setIcon(icon_save) self.draw_roi_window_instance_save_button.clicked. \ connect(self.onSaveClicked) self.draw_roi_window_cancel_save_box. \ addWidget(self.draw_roi_window_instance_save_button) self.draw_roi_window_input_container_box. \ addRow(self.draw_roi_window_cancel_save_box) # Creating a horizontal box to hold the ROI view and slider self.draw_roi_window_instance_view_box = QHBoxLayout() self.draw_roi_window_instance_view_box. \ setObjectName("DrawRoiWindowInstanceViewBox") # Add View and Slider into horizontal box self.draw_roi_window_instance_view_box.addWidget(self.dicom_view) # Create a widget to hold the image slice box self.draw_roi_window_instance_view_widget = QWidget() self.draw_roi_window_instance_view_widget.setObjectName( "DrawRoiWindowInstanceActionWidget") self.draw_roi_window_instance_view_widget.setLayout( self.draw_roi_window_instance_view_box) # Create a horizontal box for containing the input fields and the # viewport self.draw_roi_window_main_box = QHBoxLayout() self.draw_roi_window_main_box.setObjectName("DrawRoiWindowMainBox") self.draw_roi_window_main_box. \ addLayout(self.draw_roi_window_input_container_box, 1) self.draw_roi_window_main_box. \ addWidget(self.draw_roi_window_instance_view_widget, 11) # Create a new central widget to hold the vertical box layout self.draw_roi_window_instance_central_widget = QWidget() self.draw_roi_window_instance_central_widget. \ setObjectName("DrawRoiWindowInstanceCentralWidget") self.draw_roi_window_instance_central_widget.setLayout( self.draw_roi_window_main_box) self.retranslate_ui(self.draw_roi_window_instance) self.draw_roi_window_instance.setStyleSheet(stylesheet) self.draw_roi_window_instance. \ setCentralWidget(self.draw_roi_window_instance_central_widget) QtCore.QMetaObject.connectSlotsByName(self.draw_roi_window_instance) def slider_value_changed(self): """ actions to be taken when slider value changes """ image_slice_number = self.current_slice # save progress self.save_drawing_progress(image_slice_number) self.set_current_slice(self.dicom_view.slider.value()) def set_current_slice(self, slice_number): """ set the current slice :param slice_number: the slice number to be set """ self.image_slice_number_line_edit.setText(str(slice_number + 1)) self.current_slice = slice_number self.dicom_view.update_view() # check if this slice has any drawings before if self.drawn_roi_list.get(self.current_slice) is not None: self.drawingROI = self.drawn_roi_list[ self.current_slice]['drawingROI'] self.ds = self.drawn_roi_list[self.current_slice]['ds'] self.dicom_view.view.setScene(self.drawingROI) self.enable_cursor_radius_change_box() self.drawingROI.clear_cursor(self.drawing_tool_radius) else: self.disable_cursor_radius_change_box() self.ds = None def onZoomInClicked(self): """ This function is used for zooming in button """ self.dicom_view.zoom *= 1.05 self.dicom_view.update_view(zoom_change=True) if self.drawingROI \ and self.drawingROI.current_slice == self.current_slice: self.dicom_view.view.setScene(self.drawingROI) self.draw_roi_window_viewport_zoom_input.setText( "{:.2f}".format(self.dicom_view.zoom * 100) + "%") self.draw_roi_window_viewport_zoom_input.setCursorPosition(0) def onZoomOutClicked(self): """ This function is used for zooming out button """ self.dicom_view.zoom /= 1.05 self.dicom_view.update_view(zoom_change=True) if self.drawingROI \ and self.drawingROI.current_slice == self.current_slice: self.dicom_view.view.setScene(self.drawingROI) self.draw_roi_window_viewport_zoom_input. \ setText("{:.2f}".format(self.dicom_view.zoom * 100) + "%") self.draw_roi_window_viewport_zoom_input.setCursorPosition(0) def toggle_keep_empty_pixel_box_index_changed(self): self.keep_empty_pixel = self.toggle_keep_empty_pixel_combo_box. \ currentText() == "On" self.drawingROI.keep_empty_pixel = self.keep_empty_pixel def onCancelButtonClicked(self): """ This function is used for canceling the drawing """ self.closeWindow() def onBackwardClicked(self): """ This function is used when backward button is clicked """ image_slice_number = self.current_slice # save progress if self.save_drawing_progress(image_slice_number): # Backward will only execute if current image slice is above 0. if int(image_slice_number) > 0: # decrements slice by 1 and update slider to move to correct # position self.dicom_view.slider.setValue(image_slice_number - 1) def onForwardClicked(self): """ This function is used when forward button is clicked """ image_slice_number = self.current_slice # save progress if self.save_drawing_progress(image_slice_number): pixmaps = self.patient_dict_container.get("pixmaps_axial") total_slices = len(pixmaps) # Forward will only execute if current image slice is below the # total number of slices. if int(image_slice_number) < total_slices: # increments slice by 1 and update slider to move to correct # position self.dicom_view.slider.setValue(image_slice_number + 1) def onResetClicked(self): """ This function is used when reset button is clicked """ self.dicom_view.image_display() self.dicom_view.update_view() self.isthmus_width_max_line_edit.setText("5") self.internal_hole_max_line_edit.setText("9") self.min_pixel_density_line_edit.setText("") self.max_pixel_density_line_edit.setText("") if hasattr(self, 'bounds_box_draw'): delattr(self, 'bounds_box_draw') if hasattr(self, 'drawingROI'): delattr(self, 'drawingROI') self.ds = None def transect_handler(self): """ Function triggered when the Transect button is pressed from the menu. """ pixmaps = self.patient_dict_container.get("pixmaps_axial") id = self.current_slice dt = self.patient_dict_container.dataset[id] rowS = dt.PixelSpacing[0] colS = dt.PixelSpacing[1] dt.convert_pixel_data() MainPageCallClass().run_transect( self.draw_roi_window_instance, self.dicom_view.view, pixmaps[id], dt._pixel_array.transpose(), rowS, colS, is_roi_draw=True, ) def save_drawing_progress(self, image_slice_number): """ this function saves the drawing progress on current slice :param image_slice_number: the slice number to be saved """ if self.slice_changed: if hasattr(self, 'drawingROI') and self.drawingROI \ and self.ds is not None \ and len(self.drawingROI.target_pixel_coords) != 0: alpha = float(self.input_alpha_value.text()) pixel_hull_list = calculate_concave_hull_of_points( self.drawingROI.target_pixel_coords, alpha) coord_list = [] for pixel_hull in pixel_hull_list: coord_list.append(pixel_hull) self.drawn_roi_list[image_slice_number] = { 'coords': coord_list, 'ds': self.ds, 'drawingROI': self.drawingROI } self.slice_changed = False return True else: return True return True def on_transect_close(self): """ Function triggered when transect is closed """ if self.upper_limit and self.lower_limit: self.min_pixel_density_line_edit.setText(str(self.lower_limit)) self.max_pixel_density_line_edit.setText(str(self.upper_limit)) self.dicom_view.update_view() def onDrawClicked(self): """ Function triggered when the Draw button is pressed from the menu. """ pixmaps = self.patient_dict_container.get("pixmaps_axial") if self.min_pixel_density_line_edit.text() == "" \ or self.max_pixel_density_line_edit.text() == "": QMessageBox.about(self.draw_roi_window_instance, "Not Enough Data", "Not all values are specified or correct.") else: # Getting most updated selected slice id = self.current_slice dt = self.patient_dict_container.dataset[id] dt.convert_pixel_data() # Path to the selected .dcm file location = self.patient_dict_container.filepaths[id] self.ds = pydicom.dcmread(location) min_pixel = self.min_pixel_density_line_edit.text() max_pixel = self.max_pixel_density_line_edit.text() # If they are number inputs if min_pixel.isdecimal() and max_pixel.isdecimal(): min_pixel = int(min_pixel) max_pixel = int(max_pixel) if min_pixel >= max_pixel: QMessageBox.about( self.draw_roi_window_instance, "Incorrect Input", "Please ensure maximum density is " "atleast higher than minimum density.") self.drawingROI = Drawing( pixmaps[id], dt._pixel_array.transpose(), min_pixel, max_pixel, self.patient_dict_container.dataset[id], self.draw_roi_window_instance, self.slice_changed, self.current_slice, self.drawing_tool_radius, self.keep_empty_pixel, set()) self.slice_changed = True self.dicom_view.view.setScene(self.drawingROI) self.enable_cursor_radius_change_box() else: QMessageBox.about(self.draw_roi_window_instance, "Not Enough Data", "Not all values are specified or correct.") def onBoxDrawClicked(self): """ Function triggered when bounding box button is pressed """ id = self.current_slice dt = self.patient_dict_container.dataset[id] dt.convert_pixel_data() pixmaps = self.patient_dict_container.get("pixmaps_axial") self.bounds_box_draw = DrawBoundingBox(pixmaps[id], dt) self.dicom_view.view.setScene(self.bounds_box_draw) self.disable_cursor_radius_change_box() def onSaveClicked(self): """ Function triggered when Save button is clicked """ # Make sure the user has clicked Draw first if self.save_drawing_progress(image_slice_number=self.current_slice): self.saveROIList() def saveROIList(self): """ Function triggered when saving ROI list """ roi_list = ROI.convert_hull_list_to_contours_data( self.drawn_roi_list, self.patient_dict_container) if len(roi_list) == 0: QMessageBox.about(self.draw_roi_window_instance, "No ROI Detected", "Please ensure you have drawn your ROI first.") return # The list of points will need to be converted into a # single-dimensional array, as RTSTRUCT contour data is stored in # such a way. i.e. [x, y, z, x, y, z, x, y, z, ..., ...] Create a # popup window that modifies the RTSTRUCT and tells the user that # processing is happening. connectSaveROIProgress(self, roi_list, self.dataset_rtss, self.ROI_name, self.roi_saved) def roi_saved(self, new_rtss): """ Function to call save ROI and display progress """ self.signal_roi_drawn.emit((new_rtss, {"draw": self.ROI_name})) QMessageBox.about(self.draw_roi_window_instance, "Saved", "New contour successfully created!") self.closeWindow() def onPreviewClicked(self): """ function triggered when Preview button is clicked """ if hasattr(self, 'drawingROI') and self.drawingROI and len( self.drawingROI.target_pixel_coords) > 0: alpha = float(self.input_alpha_value.text()) polygon_list = calculate_concave_hull_of_points( self.drawingROI.target_pixel_coords, alpha) self.drawingROI.draw_contour_preview(polygon_list) else: QMessageBox.about(self.draw_roi_window_instance, "Not Enough Data", "Please ensure you have drawn your ROI first.") def set_selected_roi_name(self, roi_name): """ function to set selected roi name :param roi_name: roi name selected """ roi_exists = False patient_dict_container = PatientDictContainer() existing_rois = patient_dict_container.get("rois") number_of_rois = len(existing_rois) # Check to see if the ROI already exists for key, value in existing_rois.items(): if roi_name in value['name']: roi_exists = True if roi_exists: QMessageBox.about(self.draw_roi_window_instance, "ROI already exists in RTSS", "Would you like to continue?") self.ROI_name = roi_name self.roi_name_line_edit.setText(self.ROI_name) def onRadiusReduceClicked(self): """ function triggered when user reduce cursor radius """ self.drawing_tool_radius = max(self.drawing_tool_radius - 1, 4) self.draw_roi_window_cursor_radius_change_input.setText( str(self.drawing_tool_radius)) self.draw_roi_window_cursor_radius_change_input.setCursorPosition(0) self.draw_cursor_when_radius_changed() def onRadiusIncreaseClicked(self): """ function triggered when user increase cursor radius """ self.drawing_tool_radius = min(self.drawing_tool_radius + 1, 25) self.draw_roi_window_cursor_radius_change_input.setText( str(self.drawing_tool_radius)) self.draw_cursor_when_radius_changed() def draw_cursor_when_radius_changed(self): """ function to update drawing cursor when radius changed """ if self.drawingROI.cursor: self.drawingROI.draw_cursor( self.drawingROI.current_cursor_x + self.drawing_tool_radius, self.drawingROI.current_cursor_y + self.drawing_tool_radius, self.drawing_tool_radius) else: self.drawingROI.draw_cursor( (self.drawingROI.min_x + self.drawingROI.max_x) / 2, (self.drawingROI.min_y + self.drawingROI.max_y) / 2, self.drawing_tool_radius, True) def init_cursor_radius_change_box(self): """ function to init cursor radius change box """ # Create a horizontal box for containing the cursor radius changing # function self.draw_roi_window_cursor_radius_change_box = QHBoxLayout() self.draw_roi_window_cursor_radius_change_box.setObjectName( "DrawRoiWindowCursorRadiusChangeBox") # Create a label for cursor radius change self.draw_roi_window_cursor_radius_change_label = QLabel() self.draw_roi_window_cursor_radius_change_label.setObjectName( "DrawRoiWindowCursorRadiusChangeLabel") # Create an input box for cursor radius self.draw_roi_window_cursor_radius_change_input = QLineEdit() self.draw_roi_window_cursor_radius_change_input.setObjectName( "DrawRoiWindowCursorRadiusChangeInput") self.draw_roi_window_cursor_radius_change_input.setText(str(19)) self.draw_roi_window_cursor_radius_change_input.setCursorPosition(0) self.draw_roi_window_cursor_radius_change_input.setEnabled(False) self.draw_roi_window_cursor_radius_change_input.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.draw_roi_window_cursor_radius_change_input.resize( self.draw_roi_window_cursor_radius_change_input.sizeHint().width(), self.draw_roi_window_cursor_radius_change_input.sizeHint().height( )) # Create 2 buttons for increasing and reducing cursor radius # Increase Button self.draw_roi_window_cursor_radius_change_increase_button = \ QPushButton() self.draw_roi_window_cursor_radius_change_increase_button. \ setObjectName("DrawRoiWindowCursorRadiusIncreaseButton") self.draw_roi_window_cursor_radius_change_increase_button. \ setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.draw_roi_window_cursor_radius_change_increase_button.resize( QSize(24, 24)) self.draw_roi_window_cursor_radius_change_increase_button.setProperty( "QPushButtonClass", "zoom-button") icon_zoom_in = QtGui.QIcon() icon_zoom_in.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/zoom_in_icon.png'))) self.draw_roi_window_cursor_radius_change_increase_button.setIcon( icon_zoom_in) self.draw_roi_window_cursor_radius_change_increase_button.clicked. \ connect(self.onRadiusIncreaseClicked) # Reduce Button self.draw_roi_window_cursor_radius_change_reduce_button = QPushButton() self.draw_roi_window_cursor_radius_change_reduce_button.setObjectName( "DrawRoiWindowCursorRadiusReduceButton") self.draw_roi_window_cursor_radius_change_reduce_button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.draw_roi_window_cursor_radius_change_reduce_button.resize( QSize(24, 24)) self.draw_roi_window_cursor_radius_change_reduce_button.setProperty( "QPushButtonClass", "zoom-button") icon_zoom_out = QtGui.QIcon() icon_zoom_out.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/zoom_out_icon.png'))) self.draw_roi_window_cursor_radius_change_reduce_button.setIcon( icon_zoom_out) self.draw_roi_window_cursor_radius_change_reduce_button.clicked. \ connect(self.onRadiusReduceClicked) self.draw_roi_window_cursor_radius_change_box.addWidget( self.draw_roi_window_cursor_radius_change_label) self.draw_roi_window_cursor_radius_change_box.addWidget( self.draw_roi_window_cursor_radius_change_input) self.draw_roi_window_cursor_radius_change_box.addWidget( self.draw_roi_window_cursor_radius_change_reduce_button) self.draw_roi_window_cursor_radius_change_box.addWidget( self.draw_roi_window_cursor_radius_change_increase_button) self.draw_roi_window_input_container_box.addRow( self.draw_roi_window_cursor_radius_change_box) self.draw_roi_window_cursor_radius_change_increase_button.setEnabled( False) self.draw_roi_window_cursor_radius_change_reduce_button.setEnabled( False) def disable_cursor_radius_change_box(self): """ function to disable cursor radius change box """ self.draw_roi_window_cursor_radius_change_reduce_button.setEnabled( False) self.draw_roi_window_cursor_radius_change_increase_button.setEnabled( False) self.toggle_keep_empty_pixel_combo_box.setEnabled(False) def enable_cursor_radius_change_box(self): """ function to enable cursor radius change box """ self.draw_roi_window_cursor_radius_change_reduce_button.setEnabled( True) self.draw_roi_window_cursor_radius_change_increase_button.setEnabled( True) self.toggle_keep_empty_pixel_combo_box.setEnabled(True) def closeWindow(self): """ function to close draw roi window """ self.drawn_roi_list = {} if hasattr(self, 'bounds_box_draw'): delattr(self, 'bounds_box_draw') if hasattr(self, 'drawingROI'): delattr(self, 'drawingROI') self.ds = None self.close()
class MainWindow(QMainWindow): """Main application window""" def __init__(self) -> None: QMainWindow.__init__(self) self.setSizePolicy( QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)) self.setMaximumSize(QSize(1920, 1080)) self.setStyleSheet("padding: 0px; margin: 0px;") self.setIconSize(QSize(32, 32)) self.setWindowTitle("BossyBot 2000 - Image Tagger") self.setWindowIcon(self.load_icon(icon)) self.menubar = QMenuBar(self) self.menubar.setSizePolicy(EXP_MAX) self.menubar.setMaximumSize(QSize(INFINITE, 30)) self.menu_file = QMenu('File', self.menubar) self.menu_options = QMenu('Options', self.menubar) self.menu_help = QMenu('Help', self.menubar) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_options.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.open = QAction('Open', self) self.menu_file.addAction(self.open) self.open.triggered.connect(self.open_file) self.exit_button = QAction('Exit', self) self.exit_button.triggered.connect(lambda: sys.exit(0), Qt.QueuedConnection) self.menu_file.addAction(self.exit_button) self.setMenuBar(self.menubar) self.previous_button = QAction(self.load_icon(previous), '<<', self) self.next_button = QAction(self.load_icon(next_icon), '>>', self) self.rotate_left_button = QAction(self.load_icon(left), '', self) self.rotate_right_button = QAction(self.load_icon(right), '', self) self.play_button = QAction(self.load_icon(play), '', self) self.play_button.setCheckable(True) self.delete_button = QAction(self.load_icon(delete), '', self) self.reload_button = QAction(self.load_icon(reload), '', self) self.mirror_button = QAction('Mirror', self) self.actual_size_button = QAction('Actual Size', self) self.browser_button = QAction('Browser', self) self.browser_button.setCheckable(True) self.browser_button.setChecked(True) self.crop_button = QAction('Crop', self) self.crop_button.setCheckable(True) self.toolbuttons = { self.rotate_left_button: { 'shortcut': ',', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() - 90) }, self.rotate_right_button: { 'shortcut': '.', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() + 90) }, self.delete_button: { 'shortcut': 'Del', 'connect': self.delete }, self.previous_button: { 'shortcut': 'Left', 'connect': self.previous }, self.play_button: { 'shortcut': 'Space', 'connect': self.play }, self.next_button: { 'shortcut': 'Right', 'connect': self.next }, self.reload_button: { 'shortcut': 'F5', 'connect': self.reload } } self.toolbar = QToolBar(self) self.toolbar.setSizePolicy(EXP_MAX) self.toolbar.setMaximumSize(QSize(INFINITE, 27)) for _ in (self.browser_button, self.crop_button, self.mirror_button, self.actual_size_button): self.toolbar.addAction(_) self.addToolBar(Qt.TopToolBarArea, self.toolbar) for button in self.toolbuttons: button.setShortcut(self.toolbuttons[button]['shortcut']) button.triggered.connect(self.toolbuttons[button]['connect']) self.toolbar.addAction(button) self.centralwidget = QWidget(self) self.centralwidget.setSizePolicy(EXP_EXP) self.setCentralWidget(self.centralwidget) self.grid = QGridLayout(self.centralwidget) self.media = QGraphicsScene(self) self.media.setItemIndexMethod(QGraphicsScene.NoIndex) self.media.setBackgroundBrush(QBrush(Qt.black)) self.view = MyView(self.media, self) self.view.setSizePolicy(EXP_EXP) self.media.setSceneRect(0, 0, self.view.width(), self.view.height()) self.grid.addWidget(self.view, 0, 0, 1, 1) self.frame = QFrame(self.centralwidget) self.frame.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)) self.frame.setMinimumSize(QSize(325, 500)) self.frame.setStyleSheet( "QFrame { border: 4px inset #222; border-radius: 10; }") self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 400, 321, 91)) self.layout_widget.setContentsMargins(15, 15, 15, 15) self.grid2 = QGridLayout(self.layout_widget) self.grid2.setContentsMargins(0, 0, 0, 0) self.save_button = QPushButton('Yes (Save)', self.layout_widget) self.save_button.setSizePolicy(FIX_FIX) self.save_button.setMaximumSize(QSize(120, 26)) self.save_button.setVisible(False) self.grid2.addWidget(self.save_button, 1, 0, 1, 1) self.no_save_button = QPushButton('No (Reload)', self.layout_widget) self.no_save_button.setSizePolicy(FIX_FIX) self.no_save_button.setMaximumSize(QSize(120, 26)) self.no_save_button.setVisible(False) self.grid2.addWidget(self.no_save_button, 1, 1, 1, 1) self.label = QLabel("Current image modified, save it?", self.layout_widget) self.label.setSizePolicy(FIX_FIX) self.label.setMaximumSize(QSize(325, 60)) self.label.setVisible(False) self.label.setAlignment(Qt.AlignCenter) self.grid2.addWidget(self.label, 0, 0, 1, 2) self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 0, 321, 213)) self.ass = QRadioButton('Ass', self.layout_widget) self.ass_exposed = QRadioButton('Ass (exposed)', self.layout_widget) self.ass_reset = QRadioButton(self.frame) self.ass_group = QButtonGroup(self) self.breasts = QRadioButton('Breasts', self.layout_widget) self.breasts_exposed = QRadioButton('Breasts (exposed)', self.layout_widget) self.breasts_reset = QRadioButton(self.frame) self.breasts_group = QButtonGroup(self) self.pussy = QRadioButton('Pussy', self.layout_widget) self.pussy_exposed = QRadioButton('Pussy (exposed)', self.layout_widget) self.pussy_reset = QRadioButton(self.frame) self.pussy_group = QButtonGroup(self) self.fully_clothed = QRadioButton('Fully Clothed', self.layout_widget) self.fully_nude = QRadioButton('Fully Nude', self.layout_widget) self.nudity_reset = QRadioButton(self.frame) self.nudity = QButtonGroup(self) self.smiling = QRadioButton('Smiling', self.layout_widget) self.glaring = QRadioButton('Glaring', self.layout_widget) self.expression_reset = QRadioButton(self.frame) self.expression = QButtonGroup(self) self.grid3 = QGridLayout(self.layout_widget) self.grid3.setVerticalSpacing(15) self.grid3.setContentsMargins(0, 15, 0, 0) self.radios = { self.ass: { 'this': 'ass', 'that': 'ass_exposed', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 0, 1, 1) }, self.ass_exposed: { 'this': 'ass_exposed', 'that': 'ass', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 1, 1, 1) }, self.breasts: { 'this': 'breasts', 'that': 'breasts_exposed', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 0, 1, 1) }, self.breasts_exposed: { 'this': 'breasts_exposed', 'that': 'breasts', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 1, 1, 1) }, self.pussy: { 'this': 'pussy', 'that': 'pussy_exposed', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 0, 1, 1) }, self.pussy_exposed: { 'this': 'pussy_exposed', 'that': 'pussy', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 1, 1, 1) }, self.fully_clothed: { 'this': 'fully_clothed', 'that': 'fully_nude', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 0, 1, 1) }, self.fully_nude: { 'this': 'fully_nude', 'that': 'fully_clothed', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 1, 1, 1) }, self.smiling: { 'this': 'smiling', 'that': 'glaring', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 0, 1, 1) }, self.glaring: { 'this': 'glaring', 'that': 'smiling', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 1, 1, 1) }, } for radio in self.radios: radio.setSizePolicy(FIX_FIX) radio.setMaximumSize(QSize(150, 22)) self.radios[radio]['reset'].setGeometry(QRect(0, 0, 0, 0)) self.grid3.addWidget(radio, *self.radios[radio]['grid']) if self.radios[radio]['group'] != self.nudity: radio.toggled.connect( lambda x=_, y=radio: self.annotate(self.radios[y]['this'])) self.radios[radio]['group'].addButton(radio) self.radios[radio]['group'].addButton(self.radios[radio]['reset']) self.save_tags_button = QPushButton('Save Tags', self.layout_widget) self.save_tags_button.setSizePolicy(FIX_FIX) self.save_tags_button.setMaximumSize(QSize(120, 26)) self.grid3.addWidget(self.save_tags_button, 5, 1, 1, 1) self.grid.addWidget(self.frame, 0, 1, 1, 1) self.browse_bar = QLabel(self.centralwidget) self.browse_bar.setSizePolicy(EXP_FIX) self.browse_bar.setMinimumSize(QSize(0, 100)) self.browse_bar.setMaximumSize(QSize(INFINITE, 100)) self.browse_bar.setStyleSheet("background: #000;") self.browse_bar.setAlignment(Qt.AlignCenter) self.h_box2 = QHBoxLayout(self.browse_bar) self.h_box2.setContentsMargins(4, 0, 0, 0) self.grid.addWidget(self.browse_bar, 1, 0, 1, 2) hiders = [ self.no_save_button.clicked, self.save_button.clicked, self.reload_button.triggered ] for hider in hiders: hider.connect(self.save_button.hide) hider.connect(self.no_save_button.hide) hider.connect(self.label.hide) showers = [ self.mirror_button.triggered, self.rotate_right_button.triggered, self.rotate_left_button.triggered ] for shower in showers: shower.connect(self.save_button.show) shower.connect(self.no_save_button.show) shower.connect(self.label.show) self.no_save_button.clicked.connect(self.reload) self.browser_button.toggled.connect(self.browse_bar.setVisible) self.play_button.toggled.connect(lambda: self.frame.setVisible( (True, False)[self.frame.isVisible()])) self.reload_button.triggered.connect(self.reload) self.mirror_button.triggered.connect(lambda: self.pixmap.setScale(-1)) self.save_button.clicked.connect(self.save_image) self.play_button.toggled.connect( lambda: self.browser_button.setChecked( (True, False)[self.browse_bar.isVisible()])) self.crop_button.toggled.connect(self.view.reset) self.actual_size_button.triggered.connect(self.actual_size) self.browser_button.triggered.connect(self.browser) self.save_tags_button.clicked.connect(self.save_tags) self.view.got_rect.connect(self.set_rect) self.crop_rect = QRect(QPoint(0, 0), QSize(0, 0)) self.dir_now = os.getcwd() self.files = [] self.index = 0 self.refresh_files() self.pixmap_is_scaled = False self.pixmap = QGraphicsPixmapItem() self.active_tag = '' self.reset_browser = False self.txt = PngInfo() def set_rect(self, rect: tuple[QPointF, QPointF]): """Converts the crop rectangle to a QRect after a crop action""" self.crop_rect = QRect(rect[0].toPoint(), rect[1].toPoint()) def keyPressEvent(self, event: QKeyEvent): # pylint: disable=invalid-name; """Keyboard event handler.""" if event.key() == Qt.Key_Escape and self.play_button.isChecked(): self.play_button.toggle() self.browser_button.setChecked((True, False)[self.reset_browser]) elif (event.key() in [16777220, 16777221] and self.view.g_rect.rect().width() > 0): self.view.got_rect.emit((self.view.g_rect.rect().topLeft(), self.view.g_rect.rect().bottomRight())) if self.view.g_rect.pen().color() == Qt.red: new_pix = self.pixmap.pixmap().copy(self.crop_rect) if self.pixmap_is_scaled: new_pix = new_pix.transformed( self.view.transform().inverted()[0], Qt.SmoothTransformation) self.update_pixmap(new_pix) elif self.view.g_rect.pen().color() == Qt.magenta: self.annotate_rect() self.view.annotation = False for _ in (self.label, self.save_button, self.no_save_button): _.show() self.view.reset() def play(self): """Starts a slideshow.""" if self.play_button.isChecked(): if self.browser_button.isChecked(): self.reset_browser = True else: self.reset_browser = False QTimer.singleShot(3000, self.play) self.next() def _yield_radio(self): """Saves code connecting signals from all the radio buttons.""" yield from self.radios.keys().__str__() def load_icon(self, icon_file): """Loads an icon from Base64 encoded strings in icons.py.""" pix = QPixmap() pix.loadFromData(icon_file) return QIcon(pix) def open_file(self, file: str) -> None: """ Open an image file and display it. :param file: The filename of the image to open """ if not os.path.isfile(file): file = QFileDialog(self, self.dir_now, self.dir_now).getOpenFileName()[0] self.dir_now = os.path.dirname(file) self.refresh_files() for i, index_file in enumerate(self.files): if file.split('/')[-1] == index_file: self.index = i self.view.setTransform(QTransform()) self.update_pixmap(QPixmap(file)) self.browser() self.load_tags() def refresh_files(self) -> list[str]: """Updates the file list when the directory is changed. Returns a list of image files available in the current directory.""" files = os.listdir(self.dir_now) self.files = [ file for file in sorted(files, key=lambda x: x.lower()) if file.endswith((".png", ".jpg", ".gif", ".bmp", ".jpeg")) ] def next(self) -> None: """Opens the next image in the file list.""" self.index = (self.index + 1) % len(self.files) self.reload() def previous(self) -> None: """Opens the previous image in the file list.""" self.index = (self.index + (len(self.files) - 1)) % len(self.files) self.reload() def save_image(self) -> None: """ Save the modified image file. If the current pixmap has been scaled, we need to load a non-scaled pixmap from the original file and re-apply the transformations that have been performed to prevent it from being saved as the scaled-down image. """ if self.pixmap_is_scaled: rotation = self.pixmap.rotation() mirror = self.pixmap.scale() < 0 pix = QPixmap(self.files[self.index]) pix = pix.transformed(QTransform().rotate(rotation)) if mirror: pix = pix.transformed(QTransform().scale(-1, 1)) pix.save(self.files[self.index], quality=-1) else: self.pixmap.pixmap().save(self.files[self.index], quality=-1) self.save_tags() def delete(self) -> None: """Deletes the current image from the file system.""" with suppress(OSError): os.remove(f"{self.dir_now}/{self.files.pop(self.index)}") self.refresh_files() def reload(self) -> None: """Reloads the current pixmap; used to update the screen when the current file is changed.""" self.open_file(f"{self.dir_now}/{self.files[self.index]}") def annotate(self, tag): """Starts an annotate action""" self.txt = PngInfo() self.view.annotation = True self.active_tag = tag self.view.reset() def wheelEvent(self, event: QWheelEvent) -> None: # pylint: disable=invalid-name """With Ctrl depressed, zoom the current image, otherwise fire the next/previous functions.""" modifiers = QApplication.keyboardModifiers() if event.angleDelta().y() == 120 and modifiers == Qt.ControlModifier: self.view.scale(0.75, 0.75) elif event.angleDelta().y() == 120: self.previous() elif event.angleDelta().y( ) == -120 and modifiers == Qt.ControlModifier: self.view.scale(1.25, 1.25) elif event.angleDelta().y() == -120: self.next() def actual_size(self) -> None: """Display the current image at its actual size, rather than scaled to fit the viewport.""" self.update_pixmap(QPixmap(self.files[self.index]), False) self.view.setDragMode(QGraphicsView.ScrollHandDrag) def mousePressEvent(self, event: QMouseEvent) -> None: # pylint: disable=invalid-name """Event handler for mouse button presses.""" if event.button() == Qt.MouseButton.ForwardButton: self.next() elif event.button() == Qt.MouseButton.BackButton: self.previous() def update_pixmap(self, new: QPixmap, scaled: bool = True) -> None: """ Updates the currently displayed image. :param new: The new `QPixmap` to be displayed. :param scaled: If False, don't scale the image to fit the viewport. """ self.pixmap_is_scaled = scaled self.media.clear() self.pixmap = self.media.addPixmap(new) self.pixmap.setTransformOriginPoint( self.pixmap.boundingRect().width() / 2, self.pixmap.boundingRect().height() / 2) if scaled and (new.size().width() > self.view.width() or new.size().height() > self.view.height()): self.view.fitInView(self.pixmap, Qt.KeepAspectRatio) self.media.setSceneRect(self.pixmap.boundingRect()) def annotate_rect(self): """Creates image coordinate annotation data.""" self.txt.add_itxt( f'{str(self.active_tag)}-rect', f'{str(self.crop_rect.x())}, {str(self.crop_rect.y())}, {str(self.crop_rect.width())}, {str(self.crop_rect.height())}' ) def browser(self): """Slot function to initialize image thumbnails for the 'browse mode.'""" while self.h_box2.itemAt(0): self.h_box2.takeAt(0).widget().deleteLater() index = (self.index + (len(self.files) - 2)) % len(self.files) for i, file in enumerate(self.files): file = self.dir_now + '/' + self.files[index] label = ClickableLabel(self, file) self.h_box2.addWidget(label) pix = QPixmap(file) if (pix.size().width() > self.browse_bar.width() / 5 or pix.size().height() > 100): pix = pix.scaled(self.browse_bar.width() / 5, 100, Qt.KeepAspectRatio) label.setPixmap(pix) index = (index + 1) % len(self.files) if i == 4: break def save_tags(self): """Save tags for currently loaded image into its iTxt data.""" file = self.files[self.index] img = Image.open(file) img.load() for key, value, in img.text.items(): self.txt.add_itxt(key, value) for key in self.radios: if key.isChecked(): self.txt.add_itxt(self.radios[key]['this'], 'True') self.txt.add_itxt(self.radios[key]['that'], 'False') img.save(file, pnginfo=self.txt) def load_tags(self): """Load tags from iTxt data.""" for radio in self.radios: if radio.isChecked(): self.radios[radio]['reset'].setChecked(True) filename = self.files[self.index] fqp = filename img = Image.open(fqp) img.load() with suppress(AttributeError): for key, value in img.text.items(): if value == 'True': for radio in self.radios: if key == self.radios[radio]['this']: radio.setChecked(True) self.view.annotation = False self.active_tag = '' self.view.reset() for key, value in img.text.items(): if key.endswith('-rect'): btn = [ radio for radio in self.radios if self.radios[radio]['this'] == key.split('-')[0] ] print(key, value) if btn[0].isChecked(): coords = [int(coord) for coord in value.split(', ')] rect = QGraphicsRectItem(*coords) rect.setPen(QPen(Qt.magenta, 1, Qt.SolidLine)) rect.setBrush(QBrush(Qt.magenta, Qt.Dense4Pattern)) self.view.scene().addItem(rect) text = self.view.scene().addText( key.split('-')[0], QFont('monospace', 20, 400, False)) text.font().setPointSize(text.font().pointSize() * 2) text.update() text.setX(rect.rect().x() + 10) text.setY(rect.rect().y() + 10) print(f'set {key}')
class ApplicationWindow(QMainWindow): """ Example based on the example by 'scikit-image' gallery: "Immunohistochemical staining colors separation" https://scikit-image.org/docs/stable/auto_examples/color_exposure/plot_ihc_color_separation.html """ def __init__(self, parent=None): QMainWindow.__init__(self, parent) self._main = QWidget() self.setCentralWidget(self._main) # Main menu bar self.menu = self.menuBar() self.menu_file = self.menu.addMenu("File") exit = QAction("Exit", self, triggered=qApp.quit) self.menu_file.addAction(exit) self.menu_about = self.menu.addMenu("&About") about = QAction("About Qt", self, shortcut=QKeySequence(QKeySequence.HelpContents), triggered=qApp.aboutQt) self.menu_about.addAction(about) # Create an artificial color close to the original one self.ihc_rgb = data.immunohistochemistry() self.ihc_hed = rgb2hed(self.ihc_rgb) main_layout = QVBoxLayout(self._main) plot_layout = QHBoxLayout() button_layout = QHBoxLayout() label_layout = QHBoxLayout() self.canvas1 = FigureCanvas(Figure(figsize=(5, 5))) self.canvas2 = FigureCanvas(Figure(figsize=(5, 5))) self._ax1 = self.canvas1.figure.subplots() self._ax2 = self.canvas2.figure.subplots() self._ax1.imshow(self.ihc_rgb) plot_layout.addWidget(self.canvas1) plot_layout.addWidget(self.canvas2) self.button1 = QPushButton("Hematoxylin") self.button2 = QPushButton("Eosin") self.button3 = QPushButton("DAB") self.button4 = QPushButton("Fluorescence") self.button1.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button2.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button3.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button4.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button1.clicked.connect(self.plot_hematoxylin) self.button2.clicked.connect(self.plot_eosin) self.button3.clicked.connect(self.plot_dab) self.button4.clicked.connect(self.plot_final) self.label1 = QLabel("Original", alignment=Qt.AlignCenter) self.label2 = QLabel("", alignment=Qt.AlignCenter) font = self.label1.font() font.setPointSize(16) self.label1.setFont(font) self.label2.setFont(font) label_layout.addWidget(self.label1) label_layout.addWidget(self.label2) button_layout.addWidget(self.button1) button_layout.addWidget(self.button2) button_layout.addWidget(self.button3) button_layout.addWidget(self.button4) main_layout.addLayout(label_layout, 2) main_layout.addLayout(plot_layout, 88) main_layout.addLayout(button_layout, 10) # Default image self.plot_hematoxylin() def set_buttons_state(self, states): self.button1.setEnabled(states[0]) self.button2.setEnabled(states[1]) self.button3.setEnabled(states[2]) self.button4.setEnabled(states[3]) @Slot() def plot_hematoxylin(self): cmap_hema = LinearSegmentedColormap.from_list("mycmap", ["white", "navy"]) self._ax2.imshow(self.ihc_hed[:, :, 0], cmap=cmap_hema) self.canvas2.draw() self.label2.setText("Hematoxylin") self.set_buttons_state((False, True, True, True)) @Slot() def plot_eosin(self): cmap_eosin = LinearSegmentedColormap.from_list("mycmap", ["darkviolet", "white"]) self._ax2.imshow(self.ihc_hed[:, :, 1], cmap=cmap_eosin) self.canvas2.draw() self.label2.setText("Eosin") self.set_buttons_state((True, False, True, True)) @Slot() def plot_dab(self): cmap_dab = LinearSegmentedColormap.from_list("mycmap", ["white", "saddlebrown"]) self._ax2.imshow(self.ihc_hed[:, :, 2], cmap=cmap_dab) self.canvas2.draw() self.label2.setText("DAB") self.set_buttons_state((True, True, False, True)) @Slot() def plot_final(self): h = rescale_intensity(self.ihc_hed[:, :, 0], out_range=(0, 1)) d = rescale_intensity(self.ihc_hed[:, :, 2], out_range=(0, 1)) zdh = np.dstack((np.zeros_like(h), d, h)) self._ax2.imshow(zdh) self.canvas2.draw() self.label2.setText("Stain separated image") self.set_buttons_state((True, True, True, False))
class Ui_StepData(object): def setupUi(self, stepData): if not stepData.objectName(): stepData.setObjectName(u"stepData") stepData.setEnabled(True) stepData.setMaximumSize(QSize(410, 16777215)) self.stepsTab = QWidget() self.stepsTab.setObjectName(u"stepsTab") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stepsTab.sizePolicy().hasHeightForWidth()) self.stepsTab.setSizePolicy(sizePolicy) self.stepsTab.setMinimumSize(QSize(200, 278)) self.stepsTab.setAutoFillBackground(False) self.verticalLayout_2 = QVBoxLayout(self.stepsTab) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(-1, 11, -1, -1) self.stepsTable = QTableWidget(self.stepsTab) self.stepsTable.setObjectName(u"stepsTable") self.verticalLayout_2.addWidget(self.stepsTable) self.stepButtons = QHBoxLayout() self.stepButtons.setObjectName(u"stepButtons") self.stepDownBtn = QPushButton(self.stepsTab) self.stepDownBtn.setObjectName(u"stepDownBtn") self.stepButtons.addWidget(self.stepDownBtn) self.stepUpBtn = QPushButton(self.stepsTab) self.stepUpBtn.setObjectName(u"stepUpBtn") self.stepButtons.addWidget(self.stepUpBtn) self.removeStepBtn = QPushButton(self.stepsTab) self.removeStepBtn.setObjectName(u"removeStepBtn") self.stepButtons.addWidget(self.removeStepBtn) self.addStepBtn = QPushButton(self.stepsTab) self.addStepBtn.setObjectName(u"addStepBtn") self.stepButtons.addWidget(self.addStepBtn) self.runBtn = QPushButton(self.stepsTab) self.runBtn.setObjectName(u"runBtn") sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.runBtn.sizePolicy().hasHeightForWidth()) self.runBtn.setSizePolicy(sizePolicy1) self.runBtn.setMinimumSize(QSize(0, 0)) font = QFont() font.setBold(False) self.runBtn.setFont(font) self.runBtn.setCheckable(False) self.runBtn.setFlat(False) self.stepButtons.addWidget(self.runBtn) self.verticalLayout_2.addLayout(self.stepButtons) stepData.addTab(self.stepsTab, "") self.templatesTab = QWidget() self.templatesTab.setObjectName(u"templatesTab") sizePolicy2 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.templatesTab.sizePolicy().hasHeightForWidth()) self.templatesTab.setSizePolicy(sizePolicy2) self.verticalLayout_19 = QVBoxLayout(self.templatesTab) self.verticalLayout_19.setObjectName(u"verticalLayout_19") self.treeWidget = QTreeWidget(self.templatesTab) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, u"1") self.treeWidget.setHeaderItem(__qtreewidgetitem) self.treeWidget.setObjectName(u"treeWidget") sizePolicy3 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth( self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy3) self.verticalLayout_19.addWidget(self.treeWidget) stepData.addTab(self.templatesTab, "") self.optionsTab = QWidget() self.optionsTab.setObjectName(u"optionsTab") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth( self.optionsTab.sizePolicy().hasHeightForWidth()) self.optionsTab.setSizePolicy(sizePolicy4) self.optionsTab.setAutoFillBackground(True) self.verticalLayout_17 = QVBoxLayout(self.optionsTab) self.verticalLayout_17.setObjectName(u"verticalLayout_17") self.stepOptionsTable = QTableWidget(self.optionsTab) self.stepOptionsTable.setObjectName(u"stepOptionsTable") self.verticalLayout_17.addWidget(self.stepOptionsTable) stepData.addTab(self.optionsTab, "") self.retranslateUi(stepData) stepData.setCurrentIndex(2) QMetaObject.connectSlotsByName(stepData) # setupUi def retranslateUi(self, stepData): self.stepDownBtn.setText( QCoreApplication.translate("StepData", u"<", None)) self.stepUpBtn.setText( QCoreApplication.translate("StepData", u">", None)) self.removeStepBtn.setText( QCoreApplication.translate("StepData", u"-", None)) self.addStepBtn.setText( QCoreApplication.translate("StepData", u"+", None)) self.runBtn.setText( QCoreApplication.translate("StepData", u"Run", None)) stepData.setTabText( stepData.indexOf(self.stepsTab), QCoreApplication.translate("StepData", u"Steps", None)) stepData.setTabText( stepData.indexOf(self.templatesTab), QCoreApplication.translate("StepData", u"Templates", None)) stepData.setTabText( stepData.indexOf(self.optionsTab), QCoreApplication.translate("StepData", u"Options", None)) pass
class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(1136, 733) self.formLayout = QFormLayout(Dialog) self.formLayout.setObjectName(u"formLayout") self.tableWidget = QTableWidget(Dialog) if (self.tableWidget.columnCount() < 4): self.tableWidget.setColumnCount(4) __qtablewidgetitem = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, __qtablewidgetitem) __qtablewidgetitem1 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, __qtablewidgetitem1) __qtablewidgetitem2 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, __qtablewidgetitem2) __qtablewidgetitem3 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(3, __qtablewidgetitem3) self.tableWidget.setObjectName(u"tableWidget") self.tableWidget.setMinimumSize(QSize(0, 450)) self.tableWidget.verticalHeader().setVisible(False) self.formLayout.setWidget(1, QFormLayout.SpanningRole, self.tableWidget) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.textEdit = QTextEdit(Dialog) self.textEdit.setObjectName(u"textEdit") self.textEdit.setReadOnly(True) self.horizontalLayout.addWidget(self.textEdit) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.pushButton = QPushButton(Dialog) self.pushButton.setObjectName(u"pushButton") sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) self.pushButton.setSizePolicy(sizePolicy) self.pushButton.setCursor(QCursor(Qt.PointingHandCursor)) self.verticalLayout.addWidget(self.pushButton) self.pushButton_2 = QPushButton(Dialog) self.pushButton_2.setObjectName(u"pushButton_2") sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth()) self.pushButton_2.setSizePolicy(sizePolicy) self.pushButton_2.setCursor(QCursor(Qt.PointingHandCursor)) self.verticalLayout.addWidget(self.pushButton_2) self.horizontalLayout.addLayout(self.verticalLayout) self.formLayout.setLayout(0, QFormLayout.SpanningRole, self.horizontalLayout) self.buttonBox = QDialogButtonBox(Dialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.formLayout.setWidget(2, QFormLayout.FieldRole, self.buttonBox) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"popup_hyperv", None)) ___qtablewidgetitem = self.tableWidget.horizontalHeaderItem(0) ___qtablewidgetitem.setText(QCoreApplication.translate("Dialog", u"\u529f\u80fd", None)); ___qtablewidgetitem1 = self.tableWidget.horizontalHeaderItem(1) ___qtablewidgetitem1.setText(QCoreApplication.translate("Dialog", u"\u8bf4\u660e", None)); ___qtablewidgetitem2 = self.tableWidget.horizontalHeaderItem(2) ___qtablewidgetitem2.setText(QCoreApplication.translate("Dialog", u"\u5f53\u524d\u503c", None)); ___qtablewidgetitem3 = self.tableWidget.horizontalHeaderItem(3) ___qtablewidgetitem3.setText(QCoreApplication.translate("Dialog", u"\u4fee\u6539", None)); self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u5237\u65b0", None)) self.pushButton_2.setText(QCoreApplication.translate("Dialog", u"\u4fee\u6539", None))
class UIManipulateROIWindow: def setup_ui(self, manipulate_roi_window_instance, rois, dataset_rtss, roi_color, signal_roi_manipulated): self.patient_dict_container = PatientDictContainer() self.rois = rois self.dataset_rtss = dataset_rtss self.signal_roi_manipulated = signal_roi_manipulated self.roi_color = roi_color self.roi_names = [] # Names of selected ROIs self.all_roi_names = [] # Names of all existing ROIs for roi_id, roi_dict in self.rois.items(): self.all_roi_names.append(roi_dict['name']) # Operation names self.single_roi_operation_names = [ "Expand", "Contract", "Inner Rind (annulus)", "Outer Rind (annulus)" ] self.multiple_roi_operation_names = [ "Union", "Intersection", "Difference" ] self.operation_names = self.multiple_roi_operation_names + \ self.single_roi_operation_names self.new_ROI_contours = None self.manipulate_roi_window_instance = manipulate_roi_window_instance self.dicom_view = DicomAxialView(metadata_formatted=True, is_four_view=True) self.dicom_preview = DicomAxialView(metadata_formatted=True, is_four_view=True) self.dicom_view.slider.valueChanged.connect( self.dicom_view_slider_value_changed) self.dicom_preview.slider.valueChanged.connect( self.dicom_preview_slider_value_changed) self.init_layout() QtCore.QMetaObject.connectSlotsByName(manipulate_roi_window_instance) def retranslate_ui(self, manipulate_roi_window_instance): _translate = QtCore.QCoreApplication.translate manipulate_roi_window_instance.setWindowTitle( _translate("ManipulateRoiWindowInstance", "OnkoDICOM - Draw Region Of Interest")) self.first_roi_name_label.setText( _translate("FirstROINameLabel", "ROI 1: ")) self.first_roi_name_dropdown_list.setPlaceholderText("ROI 1") self.first_roi_name_dropdown_list.addItems(self.all_roi_names) self.operation_name_label.setText( _translate("OperationNameLabel", "Operation")) self.operation_name_dropdown_list.setPlaceholderText("Operation") self.operation_name_dropdown_list.addItems(self.operation_names) self.second_roi_name_label.setText( _translate("SecondROINameLabel", "ROI 2: ")) self.second_roi_name_dropdown_list.setPlaceholderText("ROI 2") self.second_roi_name_dropdown_list.addItems(self.all_roi_names) self.manipulate_roi_window_instance_draw_button.setText( _translate("ManipulateRoiWindowInstanceDrawButton", "Draw")) self.manipulate_roi_window_instance_save_button.setText( _translate("ManipulateRoiWindowInstanceSaveButton", "Save")) self.manipulate_roi_window_instance_cancel_button.setText( _translate("ManipulateRoiWindowInstanceCancelButton", "Cancel")) self.margin_label.setText(_translate("MarginLabel", "Margin (mm): ")) self.new_roi_name_label.setText( _translate("NewROINameLabel", "New ROI Name")) self.ROI_view_box_label.setText("ROI") self.preview_box_label.setText("Preview") def init_layout(self): """ Initialize the layout for the DICOM View tab. Add the view widget and the slider in the layout. Add the whole container 'tab2_view' as a tab in the main page. """ # Initialise a ManipulateROIWindow if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" stylesheet = open(resource_path(self.stylesheet_path)).read() window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) self.manipulate_roi_window_instance.setObjectName( "ManipulateRoiWindowInstance") self.manipulate_roi_window_instance.setWindowIcon(window_icon) # Creating a form box to hold all buttons and input fields self.manipulate_roi_window_input_container_box = QFormLayout() self.manipulate_roi_window_input_container_box.setObjectName( "ManipulateRoiWindowInputContainerBox") self.manipulate_roi_window_input_container_box.setLabelAlignment( Qt.AlignLeft) # Create a label for denoting the first ROI name self.first_roi_name_label = QLabel() self.first_roi_name_label.setObjectName("FirstROINameLabel") self.first_roi_name_dropdown_list = QComboBox() # Create an dropdown list for ROI name self.first_roi_name_dropdown_list.setObjectName( "FirstROINameDropdownList") self.first_roi_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.first_roi_name_dropdown_list.resize( self.first_roi_name_dropdown_list.sizeHint().width(), self.first_roi_name_dropdown_list.sizeHint().height()) self.first_roi_name_dropdown_list.activated.connect( self.update_selected_rois) self.manipulate_roi_window_input_container_box.addRow( self.first_roi_name_label, self.first_roi_name_dropdown_list) # Create a label for denoting the operation self.operation_name_label = QLabel() self.operation_name_label.setObjectName("OperationNameLabel") self.operation_name_dropdown_list = QComboBox() # Create an dropdown list for operation name self.operation_name_dropdown_list.setObjectName( "OperationNameDropdownList") self.operation_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.operation_name_dropdown_list.resize( self.operation_name_dropdown_list.sizeHint().width(), self.operation_name_dropdown_list.sizeHint().height()) self.operation_name_dropdown_list.activated.connect( self.operation_changed) self.manipulate_roi_window_input_container_box.addRow( self.operation_name_label, self.operation_name_dropdown_list) # Create a label for denoting the second ROI name self.second_roi_name_label = QLabel() self.second_roi_name_label.setObjectName("SecondROINameLabel") self.second_roi_name_label.setVisible(False) self.second_roi_name_dropdown_list = QComboBox() # Create an dropdown list for ROI name self.second_roi_name_dropdown_list.setObjectName( "SecondROINameDropdownList") self.second_roi_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.second_roi_name_dropdown_list.resize( self.second_roi_name_dropdown_list.sizeHint().width(), self.second_roi_name_dropdown_list.sizeHint().height()) self.second_roi_name_dropdown_list.setVisible(False) self.second_roi_name_dropdown_list.activated.connect( self.update_selected_rois) self.manipulate_roi_window_input_container_box.addRow( self.second_roi_name_label, self.second_roi_name_dropdown_list) # Create a label for denoting the margin self.margin_label = QLabel() self.margin_label.setObjectName("MarginLabel") self.margin_label.setVisible(False) # Create input for the new ROI name self.margin_line_edit = QLineEdit() self.margin_line_edit.setObjectName("MarginInput") self.margin_line_edit.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.margin_line_edit.resize(self.margin_line_edit.sizeHint().width(), self.margin_line_edit.sizeHint().height()) self.margin_line_edit.setVisible(False) self.margin_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.manipulate_roi_window_input_container_box.addRow( self.margin_label, self.margin_line_edit) # Create a label for denoting the new ROI name self.new_roi_name_label = QLabel() self.new_roi_name_label.setObjectName("NewROINameLabel") # Create input for the new ROI name self.new_roi_name_line_edit = QLineEdit() self.new_roi_name_line_edit.setObjectName("NewROINameInput") self.new_roi_name_line_edit.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.new_roi_name_line_edit.resize( self.new_roi_name_line_edit.sizeHint().width(), self.new_roi_name_line_edit.sizeHint().height()) self.manipulate_roi_window_input_container_box.addRow( self.new_roi_name_label, self.new_roi_name_line_edit) # Create a spacer between inputs and buttons spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) spacer.setFocusPolicy(Qt.NoFocus) self.manipulate_roi_window_input_container_box.addRow(spacer) # Create a warning message when missing inputs self.warning_message = QWidget() self.warning_message.setContentsMargins(8, 5, 8, 5) warning_message_layout = QHBoxLayout() warning_message_layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignLeft) warning_message_icon = QLabel() warning_message_icon.setPixmap( QtGui.QPixmap( resource_path("res/images/btn-icons/alert_icon.png"))) warning_message_layout.addWidget(warning_message_icon) self.warning_message_text = QLabel() self.warning_message_text.setStyleSheet("color: red") warning_message_layout.addWidget(self.warning_message_text) self.warning_message.setLayout(warning_message_layout) self.warning_message.setVisible(False) self.manipulate_roi_window_input_container_box.addRow( self.warning_message) # Create a draw button self.manipulate_roi_window_instance_draw_button = QPushButton() self.manipulate_roi_window_instance_draw_button.setObjectName( "ManipulateRoiWindowInstanceDrawButton") self.manipulate_roi_window_instance_draw_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_draw_button.resize( self.manipulate_roi_window_instance_draw_button.sizeHint().width(), self.manipulate_roi_window_instance_draw_button.sizeHint().height( )) self.manipulate_roi_window_instance_draw_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.manipulate_roi_window_instance_draw_button.clicked.connect( self.onDrawButtonClicked) self.manipulate_roi_window_input_container_box.addRow( self.manipulate_roi_window_instance_draw_button) # Create a horizontal box for saving and cancel the drawing self.manipulate_roi_window_cancel_save_box = QHBoxLayout() self.manipulate_roi_window_cancel_save_box.setObjectName( "ManipulateRoiWindowCancelSaveBox") # Create an exit button to cancel the drawing # Add a button to go back/exit from the application self.manipulate_roi_window_instance_cancel_button = QPushButton() self.manipulate_roi_window_instance_cancel_button.setObjectName( "ManipulateRoiWindowInstanceCancelButton") self.manipulate_roi_window_instance_cancel_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_cancel_button.resize( self.manipulate_roi_window_instance_cancel_button.sizeHint().width( ), self.manipulate_roi_window_instance_cancel_button.sizeHint(). height()) self.manipulate_roi_window_instance_cancel_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.manipulate_roi_window_instance_cancel_button.clicked.connect( self.onCancelButtonClicked) self.manipulate_roi_window_instance_cancel_button.setProperty( "QPushButtonClass", "fail-button") icon_cancel = QtGui.QIcon() icon_cancel.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/cancel_icon.png'))) self.manipulate_roi_window_instance_cancel_button.setIcon(icon_cancel) self.manipulate_roi_window_cancel_save_box.addWidget( self.manipulate_roi_window_instance_cancel_button) # Create a save button to save all the changes self.manipulate_roi_window_instance_save_button = QPushButton() self.manipulate_roi_window_instance_save_button.setObjectName( "ManipulateRoiWindowInstanceSaveButton") self.manipulate_roi_window_instance_save_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_save_button.resize( self.manipulate_roi_window_instance_save_button.sizeHint().width(), self.manipulate_roi_window_instance_save_button.sizeHint().height( )) self.manipulate_roi_window_instance_save_button.setProperty( "QPushButtonClass", "success-button") icon_save = QtGui.QIcon() icon_save.addPixmap( QtGui.QPixmap(resource_path('res/images/btn-icons/save_icon.png'))) self.manipulate_roi_window_instance_save_button.setIcon(icon_save) self.manipulate_roi_window_instance_save_button.clicked.connect( self.onSaveClicked) self.manipulate_roi_window_cancel_save_box.addWidget( self.manipulate_roi_window_instance_save_button) self.manipulate_roi_window_input_container_box.addRow( self.manipulate_roi_window_cancel_save_box) # Creating a horizontal box to hold the ROI view and the preview self.manipulate_roi_window_instance_view_box = QHBoxLayout() self.manipulate_roi_window_instance_view_box.setObjectName( "ManipulateRoiWindowInstanceViewBoxes") # Font for the ROI view and preview's labels font = QFont() font.setBold(True) font.setPixelSize(20) # Creating the ROI view self.ROI_view_box_layout = QVBoxLayout() self.ROI_view_box_label = QLabel() self.ROI_view_box_label.setFont(font) self.ROI_view_box_label.setAlignment(Qt.AlignHCenter) self.ROI_view_box_layout.addWidget(self.ROI_view_box_label) self.ROI_view_box_layout.addWidget(self.dicom_view) self.ROI_view_box_widget = QWidget() self.ROI_view_box_widget.setLayout(self.ROI_view_box_layout) # Creating the preview self.preview_box_layout = QVBoxLayout() self.preview_box_label = QLabel() self.preview_box_label.setFont(font) self.preview_box_label.setAlignment(Qt.AlignHCenter) self.preview_box_layout.addWidget(self.preview_box_label) self.preview_box_layout.addWidget(self.dicom_preview) self.preview_box_widget = QWidget() self.preview_box_widget.setLayout(self.preview_box_layout) # Add View and Slider into horizontal box self.manipulate_roi_window_instance_view_box.addWidget( self.ROI_view_box_widget) self.manipulate_roi_window_instance_view_box.addWidget( self.preview_box_widget) # Create a widget to hold the image slice box self.manipulate_roi_window_instance_view_widget = QWidget() self.manipulate_roi_window_instance_view_widget.setObjectName( "ManipulateRoiWindowInstanceActionWidget") self.manipulate_roi_window_instance_view_widget.setLayout( self.manipulate_roi_window_instance_view_box) # Create a horizontal box for containing the input fields and the # viewports self.manipulate_roi_window_main_box = QHBoxLayout() self.manipulate_roi_window_main_box.setObjectName( "ManipulateRoiWindowMainBox") self.manipulate_roi_window_main_box.addLayout( self.manipulate_roi_window_input_container_box, 1) self.manipulate_roi_window_main_box.addWidget( self.manipulate_roi_window_instance_view_widget, 11) # Create a new central widget to hold the horizontal box layout self.manipulate_roi_window_instance_central_widget = QWidget() self.manipulate_roi_window_instance_central_widget.setObjectName( "ManipulateRoiWindowInstanceCentralWidget") self.manipulate_roi_window_instance_central_widget.setLayout( self.manipulate_roi_window_main_box) self.retranslate_ui(self.manipulate_roi_window_instance) self.manipulate_roi_window_instance.setStyleSheet(stylesheet) self.manipulate_roi_window_instance.setCentralWidget( self.manipulate_roi_window_instance_central_widget) QtCore.QMetaObject.connectSlotsByName( self.manipulate_roi_window_instance) def dicom_view_slider_value_changed(self): """ Display selected ROIs in dropbox when moving to another image slice """ self.display_selected_roi() if self.dicom_preview.slider.value() != self.dicom_view.slider.value(): self.dicom_preview.slider.setValue(self.dicom_view.slider.value()) def dicom_preview_slider_value_changed(self): """ Display generated ROI when moving to another image slice """ self.draw_roi() if self.dicom_preview.slider.value() != self.dicom_view.slider.value(): self.dicom_view.slider.setValue(self.dicom_preview.slider.value()) def onCancelButtonClicked(self): """ This function is used for canceling the drawing """ self.close() def onDrawButtonClicked(self): """ Function triggered when the Draw button is pressed from the menu. """ # Hide warning message self.warning_message.setVisible(False) # Check inputs selected_operation = self.operation_name_dropdown_list.currentText() roi_1 = self.first_roi_name_dropdown_list.currentText() roi_2 = self.second_roi_name_dropdown_list.currentText() new_roi_name = self.new_roi_name_line_edit.text() # Check the selected inputs and execute the operations if roi_1 != "" and new_roi_name != "" and \ self.margin_line_edit.text() != "" and \ selected_operation in self.single_roi_operation_names: # Single ROI operations dict_rois_contours = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), [roi_1], self.patient_dict_container.get("pixluts")) roi_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_1]) margin = float(self.margin_line_edit.text()) if selected_operation == self.single_roi_operation_names[0]: new_geometry = ROI.scale_roi(roi_geometry, margin) elif selected_operation == self.single_roi_operation_names[1]: new_geometry = ROI.scale_roi(roi_geometry, -margin) elif selected_operation == self.single_roi_operation_names[2]: new_geometry = ROI.rind_roi(roi_geometry, -margin) else: new_geometry = ROI.rind_roi(roi_geometry, margin) self.new_ROI_contours = ROI.geometry_to_roi(new_geometry) self.draw_roi() return True elif roi_1 != "" and roi_2 != "" and new_roi_name != "" and \ selected_operation in self.multiple_roi_operation_names: # Multiple ROI operations dict_rois_contours = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), [roi_1, roi_2], self.patient_dict_container.get("pixluts")) roi_1_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_1]) roi_2_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_2]) # Execute the selected operation new_geometry = ROI.manipulate_rois(roi_1_geometry, roi_2_geometry, selected_operation.upper()) self.new_ROI_contours = ROI.geometry_to_roi(new_geometry) self.draw_roi() return True self.warning_message_text.setText("Not all values are specified.") self.warning_message.setVisible(True) return False def onSaveClicked(self): """ Save the new ROI """ # Get the name of the new ROI new_roi_name = self.new_roi_name_line_edit.text() # If the new ROI hasn't been drawn, draw the new ROI. Then if the new # ROI is drawn successfully, proceed to save the new ROI. if self.new_ROI_contours is None: if not self.onDrawButtonClicked(): return # Get a dict to convert SOPInstanceUID to slice id slice_ids_dict = get_dict_slice_to_uid(PatientDictContainer()) # Transform new_ROI_contours to a list of roi information rois_to_save = {} for uid, contour_sequence in self.new_ROI_contours.items(): slider_id = slice_ids_dict[uid] location = self.patient_dict_container.filepaths[slider_id] ds = pydicom.dcmread(location) slice_info = {'coords': contour_sequence, 'ds': ds} rois_to_save[slider_id] = slice_info roi_list = ROI.convert_hull_list_to_contours_data( rois_to_save, self.patient_dict_container) connectSaveROIProgress(self, roi_list, self.dataset_rtss, new_roi_name, self.roi_saved) def draw_roi(self): """ Draw the new ROI """ # Get the new ROI's name new_roi_name = self.new_roi_name_line_edit.text() # Check if the new ROI contour is None if self.new_ROI_contours is None: return # Get the info required to draw the new ROI slider_id = self.dicom_preview.slider.value() curr_slice = self.patient_dict_container.get("dict_uid")[slider_id] # Calculate the new ROI's polygon dict_ROI_contours = {} dict_ROI_contours[new_roi_name] = self.new_ROI_contours polygons = ROI.calc_roi_polygon(new_roi_name, curr_slice, dict_ROI_contours) # Set the new ROI color color = QtGui.QColor() color.setRgb(90, 250, 175, 200) pen_color = QtGui.QColor(color.red(), color.green(), color.blue()) pen = QtGui.QPen(pen_color) pen.setStyle(QtCore.Qt.PenStyle(1)) pen.setWidthF(2.0) # Draw the new ROI self.dicom_preview.update_view() for i in range(len(polygons)): self.dicom_preview.scene.addPolygon(polygons[i], pen, QtGui.QBrush(color)) def update_selected_rois(self): """ Get the names of selected ROIs """ # Hide warning message self.warning_message.setVisible(False) self.roi_names = [] if self.first_roi_name_dropdown_list.currentText() != "": self.roi_names.append( self.first_roi_name_dropdown_list.currentText()) if self.second_roi_name_dropdown_list.currentText() != "" and \ self.second_roi_name_dropdown_list.isVisible(): self.roi_names.append( self.second_roi_name_dropdown_list.currentText()) self.dict_rois_contours_axial = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), self.roi_names, self.patient_dict_container.get("pixluts")) self.display_selected_roi() def display_selected_roi(self): """ Display selected ROIs """ # Get the info required to display the selected ROIs slider_id = self.dicom_view.slider.value() curr_slice = self.patient_dict_container.get("dict_uid")[slider_id] self.rois = self.patient_dict_container.get("rois") # Display the selected ROIs self.dicom_view.update_view() for roi_id, roi_dict in self.rois.items(): roi_name = roi_dict['name'] if roi_name in self.roi_names: polygons = ROI.calc_roi_polygon(roi_name, curr_slice, self.dict_rois_contours_axial) self.dicom_view.draw_roi_polygons(roi_id, polygons, self.roi_color) def operation_changed(self): """ Change the form when users select different operations """ # Hide warning message self.warning_message.setVisible(False) selected_operation = self.operation_name_dropdown_list.currentText() if selected_operation in self.single_roi_operation_names: self.second_roi_name_label.setVisible(False) self.second_roi_name_dropdown_list.setVisible(False) self.margin_label.setVisible(True) self.margin_line_edit.setVisible(True) self.update_selected_rois() else: self.second_roi_name_label.setVisible(True) self.second_roi_name_dropdown_list.setVisible(True) self.margin_label.setVisible(False) self.margin_line_edit.setVisible(False) self.update_selected_rois() def roi_saved(self, new_rtss): """ Create a new ROI in Structure Tab and notify user """ new_roi_name = self.new_roi_name_line_edit.text() self.signal_roi_manipulated.emit((new_rtss, {"draw": new_roi_name})) QMessageBox.about(self.manipulate_roi_window_instance, "Saved", "New contour successfully created!") self.close()
class Ui_TaxWidget(object): def setupUi(self, TaxWidget): if not TaxWidget.objectName(): TaxWidget.setObjectName(u"TaxWidget") TaxWidget.resize(696, 408) self.gridLayout = QGridLayout(TaxWidget) self.gridLayout.setObjectName(u"gridLayout") self.AccountLbl = QLabel(TaxWidget) self.AccountLbl.setObjectName(u"AccountLbl") self.gridLayout.addWidget(self.AccountLbl, 1, 0, 1, 1) self.AccountWidget = AccountSelector(TaxWidget) self.AccountWidget.setObjectName(u"AccountWidget") self.gridLayout.addWidget(self.AccountWidget, 1, 1, 1, 2) self.YearLbl = QLabel(TaxWidget) self.YearLbl.setObjectName(u"YearLbl") self.gridLayout.addWidget(self.YearLbl, 0, 0, 1, 1) self.Year = QSpinBox(TaxWidget) self.Year.setObjectName(u"Year") self.Year.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.Year.setMinimum(2010) self.Year.setMaximum(2030) self.Year.setValue(2020) self.gridLayout.addWidget(self.Year, 0, 1, 1, 2) self.verticalSpacer = QSpacerItem(20, 52, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 8, 0, 1, 1) self.line = QFrame(TaxWidget) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.gridLayout.addWidget(self.line, 3, 0, 1, 3) self.DlsgGroup = QGroupBox(TaxWidget) self.DlsgGroup.setObjectName(u"DlsgGroup") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.DlsgGroup.sizePolicy().hasHeightForWidth()) self.DlsgGroup.setSizePolicy(sizePolicy) self.DlsgGroup.setFlat(False) self.DlsgGroup.setCheckable(True) self.DlsgGroup.setChecked(False) self.gridLayout_2 = QGridLayout(self.DlsgGroup) self.gridLayout_2.setSpacing(2) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(6, 6, 6, 6) self.DlsgFileLbl = QLabel(self.DlsgGroup) self.DlsgFileLbl.setObjectName(u"DlsgFileLbl") self.gridLayout_2.addWidget(self.DlsgFileLbl, 0, 0, 1, 1) self.IncomeSourceBroker = QCheckBox(self.DlsgGroup) self.IncomeSourceBroker.setObjectName(u"IncomeSourceBroker") self.IncomeSourceBroker.setChecked(True) self.gridLayout_2.addWidget(self.IncomeSourceBroker, 1, 0, 1, 3) self.DividendsOnly = QCheckBox(self.DlsgGroup) self.DividendsOnly.setObjectName(u"DividendsOnly") self.gridLayout_2.addWidget(self.DividendsOnly, 2, 0, 1, 3) self.DlsgSelectBtn = QPushButton(self.DlsgGroup) self.DlsgSelectBtn.setObjectName(u"DlsgSelectBtn") self.gridLayout_2.addWidget(self.DlsgSelectBtn, 0, 2, 1, 1) self.DlsgFileName = QLineEdit(self.DlsgGroup) self.DlsgFileName.setObjectName(u"DlsgFileName") self.gridLayout_2.addWidget(self.DlsgFileName, 0, 1, 1, 1) self.gridLayout.addWidget(self.DlsgGroup, 5, 0, 1, 3) self.XlsFileLbl = QLabel(TaxWidget) self.XlsFileLbl.setObjectName(u"XlsFileLbl") self.gridLayout.addWidget(self.XlsFileLbl, 2, 0, 1, 1) self.XlsFileName = QLineEdit(TaxWidget) self.XlsFileName.setObjectName(u"XlsFileName") sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.XlsFileName.sizePolicy().hasHeightForWidth()) self.XlsFileName.setSizePolicy(sizePolicy1) self.gridLayout.addWidget(self.XlsFileName, 2, 1, 1, 1) self.XlsSelectBtn = QPushButton(TaxWidget) self.XlsSelectBtn.setObjectName(u"XlsSelectBtn") sizePolicy2 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.XlsSelectBtn.sizePolicy().hasHeightForWidth()) self.XlsSelectBtn.setSizePolicy(sizePolicy2) self.gridLayout.addWidget(self.XlsSelectBtn, 2, 2, 1, 1) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout.addItem(self.horizontalSpacer, 5, 3, 1, 1) self.NoSettlement = QCheckBox(TaxWidget) self.NoSettlement.setObjectName(u"NoSettlement") self.gridLayout.addWidget(self.NoSettlement, 6, 0, 1, 4) self.SaveButton = QPushButton(TaxWidget) self.SaveButton.setObjectName(u"SaveButton") self.gridLayout.addWidget(self.SaveButton, 7, 2, 1, 1) self.WarningLbl = QLabel(TaxWidget) self.WarningLbl.setObjectName(u"WarningLbl") font = QFont() font.setItalic(True) self.WarningLbl.setFont(font) self.gridLayout.addWidget(self.WarningLbl, 4, 0, 1, 3) self.retranslateUi(TaxWidget) QMetaObject.connectSlotsByName(TaxWidget) # setupUi def retranslateUi(self, TaxWidget): TaxWidget.setWindowTitle(QCoreApplication.translate("TaxWidget", u"Taxes", None)) self.AccountLbl.setText(QCoreApplication.translate("TaxWidget", u"Account:", None)) #if QT_CONFIG(tooltip) self.AccountWidget.setToolTip(QCoreApplication.translate("TaxWidget", u"Foreign account to prepare tax report for", None)) #endif // QT_CONFIG(tooltip) self.YearLbl.setText(QCoreApplication.translate("TaxWidget", u"Year:", None)) self.Year.setSuffix("") self.DlsgGroup.setTitle(QCoreApplication.translate("TaxWidget", u"Create tax form in \"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\" program format (*.dcX)", None)) self.DlsgFileLbl.setText(QCoreApplication.translate("TaxWidget", u"Output file:", None)) self.IncomeSourceBroker.setText(QCoreApplication.translate("TaxWidget", u"Use broker name as income source", None)) self.DividendsOnly.setText(QCoreApplication.translate("TaxWidget", u"Update only information about dividends", None)) #if QT_CONFIG(tooltip) self.DlsgSelectBtn.setToolTip(QCoreApplication.translate("TaxWidget", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.DlsgSelectBtn.setText(QCoreApplication.translate("TaxWidget", u" ... ", None)) #if QT_CONFIG(tooltip) self.DlsgFileName.setToolTip(QCoreApplication.translate("TaxWidget", u"File where to store russian tax form", None)) #endif // QT_CONFIG(tooltip) self.XlsFileLbl.setText(QCoreApplication.translate("TaxWidget", u"Excel file:", None)) #if QT_CONFIG(tooltip) self.XlsFileName.setToolTip(QCoreApplication.translate("TaxWidget", u"File where to store tax report in Excel format", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.XlsSelectBtn.setToolTip(QCoreApplication.translate("TaxWidget", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.XlsSelectBtn.setText(QCoreApplication.translate("TaxWidget", u"...", None)) self.NoSettlement.setText(QCoreApplication.translate("TaxWidget", u"Do not use settlement date for currency rates", None)) self.SaveButton.setText(QCoreApplication.translate("TaxWidget", u"Save Report", None)) self.WarningLbl.setText(QCoreApplication.translate("TaxWidget", u"Below functions are experimental - use it with care", None))
class Ui_TaxExportDlg(object): def setupUi(self, TaxExportDlg): if not TaxExportDlg.objectName(): TaxExportDlg.setObjectName(u"TaxExportDlg") TaxExportDlg.resize(602, 315) self.gridLayout = QGridLayout(TaxExportDlg) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setHorizontalSpacing(6) self.gridLayout.setContentsMargins(9, 9, 9, 9) self.line = QFrame(TaxExportDlg) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.gridLayout.addWidget(self.line, 4, 0, 1, 4) self.XlsSelectBtn = QPushButton(TaxExportDlg) self.XlsSelectBtn.setObjectName(u"XlsSelectBtn") sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.XlsSelectBtn.sizePolicy().hasHeightForWidth()) self.XlsSelectBtn.setSizePolicy(sizePolicy) self.gridLayout.addWidget(self.XlsSelectBtn, 3, 2, 1, 1) self.WarningLbl = QLabel(TaxExportDlg) self.WarningLbl.setObjectName(u"WarningLbl") font = QFont() font.setItalic(True) self.WarningLbl.setFont(font) self.gridLayout.addWidget(self.WarningLbl, 5, 0, 1, 4) self.DlsgGroup = QGroupBox(TaxExportDlg) self.DlsgGroup.setObjectName(u"DlsgGroup") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.DlsgGroup.sizePolicy().hasHeightForWidth()) self.DlsgGroup.setSizePolicy(sizePolicy1) self.DlsgGroup.setFlat(False) self.DlsgGroup.setCheckable(True) self.DlsgGroup.setChecked(False) self.gridLayout_2 = QGridLayout(self.DlsgGroup) self.gridLayout_2.setSpacing(2) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(6, 6, 6, 6) self.InitialFileLbl = QLabel(self.DlsgGroup) self.InitialFileLbl.setObjectName(u"InitialFileLbl") self.gridLayout_2.addWidget(self.InitialFileLbl, 0, 0, 1, 1) self.DlsgOutFileName = QLineEdit(self.DlsgGroup) self.DlsgOutFileName.setObjectName(u"DlsgOutFileName") self.gridLayout_2.addWidget(self.DlsgOutFileName, 1, 1, 1, 1) self.DlsgInFileName = QLineEdit(self.DlsgGroup) self.DlsgInFileName.setObjectName(u"DlsgInFileName") self.gridLayout_2.addWidget(self.DlsgInFileName, 0, 1, 1, 1) self.OutputFileLbl = QLabel(self.DlsgGroup) self.OutputFileLbl.setObjectName(u"OutputFileLbl") self.gridLayout_2.addWidget(self.OutputFileLbl, 1, 0, 1, 1) self.DividendsOnly = QCheckBox(self.DlsgGroup) self.DividendsOnly.setObjectName(u"DividendsOnly") self.gridLayout_2.addWidget(self.DividendsOnly, 3, 0, 1, 3) self.OutputSelectBtn = QPushButton(self.DlsgGroup) self.OutputSelectBtn.setObjectName(u"OutputSelectBtn") self.gridLayout_2.addWidget(self.OutputSelectBtn, 1, 2, 1, 1) self.InitialSelectBtn = QPushButton(self.DlsgGroup) self.InitialSelectBtn.setObjectName(u"InitialSelectBtn") self.gridLayout_2.addWidget(self.InitialSelectBtn, 0, 2, 1, 1) self.IncomeSourceBroker = QCheckBox(self.DlsgGroup) self.IncomeSourceBroker.setObjectName(u"IncomeSourceBroker") self.IncomeSourceBroker.setChecked(True) self.gridLayout_2.addWidget(self.IncomeSourceBroker, 2, 0, 1, 3) self.gridLayout.addWidget(self.DlsgGroup, 7, 0, 1, 4) self.Year = QSpinBox(TaxExportDlg) self.Year.setObjectName(u"Year") self.Year.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.Year.setMinimum(2010) self.Year.setMaximum(2030) self.Year.setValue(2020) self.gridLayout.addWidget(self.Year, 1, 1, 1, 2) self.XlsFileName = QLineEdit(TaxExportDlg) self.XlsFileName.setObjectName(u"XlsFileName") sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.XlsFileName.sizePolicy().hasHeightForWidth()) self.XlsFileName.setSizePolicy(sizePolicy2) self.gridLayout.addWidget(self.XlsFileName, 3, 1, 1, 1) self.AccountWidget = AccountSelector(TaxExportDlg) self.AccountWidget.setObjectName(u"AccountWidget") self.gridLayout.addWidget(self.AccountWidget, 2, 1, 1, 2) self.YearLbl = QLabel(TaxExportDlg) self.YearLbl.setObjectName(u"YearLbl") self.gridLayout.addWidget(self.YearLbl, 1, 0, 1, 1) self.buttonBox = QDialogButtonBox(TaxExportDlg) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Vertical) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.gridLayout.addWidget(self.buttonBox, 1, 3, 3, 1) self.AccountLbl = QLabel(TaxExportDlg) self.AccountLbl.setObjectName(u"AccountLbl") self.gridLayout.addWidget(self.AccountLbl, 2, 0, 1, 1) self.XlsFileLbl = QLabel(TaxExportDlg) self.XlsFileLbl.setObjectName(u"XlsFileLbl") self.gridLayout.addWidget(self.XlsFileLbl, 3, 0, 1, 1) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 9, 0, 1, 1) self.NoSettlement = QCheckBox(TaxExportDlg) self.NoSettlement.setObjectName(u"NoSettlement") self.gridLayout.addWidget(self.NoSettlement, 8, 0, 1, 4) QWidget.setTabOrder(self.Year, self.XlsFileName) QWidget.setTabOrder(self.XlsFileName, self.XlsSelectBtn) QWidget.setTabOrder(self.XlsSelectBtn, self.DlsgGroup) QWidget.setTabOrder(self.DlsgGroup, self.DlsgInFileName) QWidget.setTabOrder(self.DlsgInFileName, self.InitialSelectBtn) QWidget.setTabOrder(self.InitialSelectBtn, self.DlsgOutFileName) QWidget.setTabOrder(self.DlsgOutFileName, self.OutputSelectBtn) self.retranslateUi(TaxExportDlg) self.buttonBox.accepted.connect(TaxExportDlg.accept) self.buttonBox.rejected.connect(TaxExportDlg.reject) QMetaObject.connectSlotsByName(TaxExportDlg) # setupUi def retranslateUi(self, TaxExportDlg): TaxExportDlg.setWindowTitle( QCoreApplication.translate( "TaxExportDlg", u"Select parameters and files for tax report", None)) #if QT_CONFIG(tooltip) self.XlsSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.XlsSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u"...", None)) self.WarningLbl.setText( QCoreApplication.translate( "TaxExportDlg", u"Below functions are experimental - use it with care", None)) self.DlsgGroup.setTitle( QCoreApplication.translate( "TaxExportDlg", u"Update file \"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\" (*.dc0)", None)) self.InitialFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Initial file:", None)) #if QT_CONFIG(tooltip) self.DlsgOutFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File where to store russian tax form", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.DlsgInFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File to use as a template for russian tax form", None)) #endif // QT_CONFIG(tooltip) self.OutputFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Output file:", None)) self.DividendsOnly.setText( QCoreApplication.translate( "TaxExportDlg", u"Update only information about dividends", None)) #if QT_CONFIG(tooltip) self.OutputSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.OutputSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u" ... ", None)) #if QT_CONFIG(tooltip) self.InitialSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.InitialSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u" ... ", None)) self.IncomeSourceBroker.setText( QCoreApplication.translate("TaxExportDlg", u"Use broker name as income source", None)) self.Year.setSuffix("") #if QT_CONFIG(tooltip) self.XlsFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File where to store tax report in Excel format", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.AccountWidget.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"Foreign account to prepare tax report for", None)) #endif // QT_CONFIG(tooltip) self.YearLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Year:", None)) self.AccountLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Account:", None)) self.XlsFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Excel file:", None)) self.NoSettlement.setText( QCoreApplication.translate( "TaxExportDlg", u"Do not use settlement date for currency rates", None))
class UIDeleteROIWindow(): def setup_ui(self, delete_roi_window_instance, regions_of_interest, dataset_rtss, deleting_rois_structure_tuple): # Initialise the 2 lists for containing the ROI(s) that we are going to keep and delete respectively self.regions_of_interest_to_keep = [] self.regions_of_interest_to_delete = [] # This is for holding the original list of ROI(s) self.regions_of_interest_list = regions_of_interest # This is for holding the DICOM dataset of that specific patient self.dataset_rtss = dataset_rtss # Assigning new tuple for holding the deleting ROI(s) self.deleting_rois_structure_tuple = deleting_rois_structure_tuple # Initialise a DeleteROIWindow if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" stylesheet = open(resource_path(self.stylesheet_path)).read() window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) delete_roi_window_instance.setObjectName("DeleteRoiWindowInstance") delete_roi_window_instance.setWindowIcon(window_icon) delete_roi_window_instance.resize(800, 606) # Create a vertical box to hold all widgets self.delete_roi_window_instance_vertical_box = QVBoxLayout() self.delete_roi_window_instance_vertical_box.setObjectName( "DeleteRoiWindowInstanceVerticalBox") # Create a label for holding the window's title self.delete_roi_window_title = QLabel() self.delete_roi_window_title.setObjectName("DeleteRoiWindowTitle") self.delete_roi_window_title.setProperty("QLabelClass", "window-title") self.delete_roi_window_title.setAlignment(Qt.AlignLeft) self.delete_roi_window_instance_vertical_box.addWidget( self.delete_roi_window_title) # Create a label for holding the instruction of how to delete the ROIs self.delete_roi_window_instruction = QLabel() self.delete_roi_window_instruction.setObjectName( "DeleteRoiWindowInstruction") self.delete_roi_window_instruction.setAlignment(Qt.AlignCenter) self.delete_roi_window_instance_vertical_box.addWidget( self.delete_roi_window_instruction) # Create a horizontal box for holding the 2 lists and the move left, move right buttons self.delete_roi_window_keep_and_delete_box = QHBoxLayout() self.delete_roi_window_keep_and_delete_box.setObjectName( "DeleteRoiWindowKeepAndDeleteBox") # ================================= KEEP BOX ================================= # Create a vertical box for holding the label and the tree view for holding the ROIs that we are keeping self.delete_roi_window_keep_vertical_box = QVBoxLayout() self.delete_roi_window_keep_vertical_box.setObjectName( "DeleteRoiWindowKeepVerticalBox") # Create a label for the tree view with the list of ROIs to keep self.delete_roi_window_keep_tree_view_label = QLabel() self.delete_roi_window_keep_tree_view_label.setObjectName( "DeleteRoiWindowKeepTreeViewLabel") self.delete_roi_window_keep_tree_view_label.setProperty( "QLabelClass", ["tree-view-label", "tree-view-label-keep-delete"]) self.delete_roi_window_keep_tree_view_label.setAlignment( Qt.AlignCenter) self.delete_roi_window_keep_tree_view_label.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_keep_tree_view_label.resize( self.delete_roi_window_keep_tree_view_label.sizeHint().width(), self.delete_roi_window_keep_tree_view_label.sizeHint().height()) self.delete_roi_window_keep_vertical_box.addWidget( self.delete_roi_window_keep_tree_view_label) # Create a tree view for containing the list of ROIs to keep self.delete_roi_window_keep_tree_view = QTreeWidget() self.delete_roi_window_keep_tree_view.setObjectName( "DeleteRoiWindowKeepTreeView") self.delete_roi_window_keep_tree_view.setHeaderHidden(True) self.delete_roi_window_keep_tree_view.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_keep_tree_view.resize( self.delete_roi_window_keep_tree_view.sizeHint().width(), self.delete_roi_window_keep_tree_view.sizeHint().height()) self.delete_roi_window_keep_vertical_box.addWidget( self.delete_roi_window_keep_tree_view) self.delete_roi_window_keep_vertical_box.setStretch(1, 4) # Create a widget to hold the keep vertical box self.delete_roi_window_keep_widget = QWidget() self.delete_roi_window_keep_widget.setObjectName( "DeleteRoiWindowKeepWidget") self.delete_roi_window_keep_widget.setLayout( self.delete_roi_window_keep_vertical_box) self.delete_roi_window_keep_and_delete_box.addStretch(1) self.delete_roi_window_keep_and_delete_box.addWidget( self.delete_roi_window_keep_widget) # ================================= KEEP BOX ================================= # ================================= MOVE LEFT/RIGHT BOX ================================= # Create a vertical box for holding the 2 buttons for moving left and right self.delete_roi_window_move_left_right_vertical_box = QVBoxLayout() self.delete_roi_window_move_left_right_vertical_box.setObjectName( "DeleteRoiWindowMoveLeftRightVerticalBox") # Create Move Right Button / Delete Button self.move_right_button = QPushButton() self.move_right_button.setObjectName("MoveRightButton") self.move_right_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.move_right_button.resize( self.move_right_button.sizeHint().width(), self.move_right_button.sizeHint().height()) self.move_right_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.move_right_button.clicked.connect( self.move_right_button_onClicked) self.move_right_button.setProperty("QPushButtonClass", "fail-button") self.delete_roi_window_move_left_right_vertical_box.addStretch(1) self.delete_roi_window_move_left_right_vertical_box.addWidget( self.move_right_button) # Create Move Left Button / Keep Button self.move_left_button = QPushButton() self.move_left_button.setObjectName("MoveLeftButton") self.move_left_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.move_left_button.resize(self.move_left_button.sizeHint().width(), self.move_left_button.sizeHint().height()) self.move_left_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.move_left_button.clicked.connect(self.move_left_button_onClicked) self.move_left_button.setProperty("QPushButtonClass", "success-button") self.delete_roi_window_move_left_right_vertical_box.addWidget( self.move_left_button) self.delete_roi_window_move_left_right_vertical_box.addStretch(1) # Create a widget for holding the 2 buttons self.delete_roi_window_move_left_right_widget = QWidget() self.delete_roi_window_move_left_right_widget.setObjectName( "DeleteRoiWindowMoveLeftRightWidget") self.delete_roi_window_move_left_right_widget.setLayout( self.delete_roi_window_move_left_right_vertical_box) self.delete_roi_window_keep_and_delete_box.addWidget( self.delete_roi_window_move_left_right_widget) # ================================= MOVE LEFT/RIGHT BOX ================================= # ================================= DELETE BOX ================================= # Create a vertical box for holding the label and the tree view for holding the ROIs that we are deleting self.delete_roi_window_delete_vertical_box = QVBoxLayout() self.delete_roi_window_delete_vertical_box.setObjectName( "DeleteRoiWindowDeleteVerticalBox") # Create a label for the tree view with the list of ROIs to delete self.delete_roi_window_delete_tree_view_label = QLabel() self.delete_roi_window_delete_tree_view_label.setObjectName( "DeleteRoiWindowDeleteTreeViewLabel") self.delete_roi_window_delete_tree_view_label.setProperty( "QLabelClass", ["tree-view-label", "tree-view-label-keep-delete"]) self.delete_roi_window_delete_tree_view_label.setAlignment( Qt.AlignCenter) self.delete_roi_window_delete_tree_view_label.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_delete_tree_view_label.resize( self.delete_roi_window_delete_tree_view_label.sizeHint().width(), self.delete_roi_window_delete_tree_view_label.sizeHint().height()) self.delete_roi_window_delete_vertical_box.addWidget( self.delete_roi_window_delete_tree_view_label) # Create a tree view for containing the list of ROIs to delete self.delete_roi_window_delete_tree_view = QTreeWidget() self.delete_roi_window_delete_tree_view.setObjectName( "DeleteRoiWindowDeleteTreeView") self.delete_roi_window_delete_tree_view.setHeaderHidden(True) self.delete_roi_window_delete_tree_view.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_delete_tree_view.resize( self.delete_roi_window_delete_tree_view.sizeHint().width(), self.delete_roi_window_delete_tree_view.sizeHint().height()) self.delete_roi_window_delete_vertical_box.addWidget( self.delete_roi_window_delete_tree_view) self.delete_roi_window_delete_vertical_box.setStretch(1, 4) # Create a widget to hold the delete vertical box self.delete_roi_window_delete_widget = QWidget() self.delete_roi_window_delete_widget.setObjectName( "DeleteRoiWindowDeleteWidget") self.delete_roi_window_delete_widget.setLayout( self.delete_roi_window_delete_vertical_box) self.delete_roi_window_keep_and_delete_box.addWidget( self.delete_roi_window_delete_widget) self.delete_roi_window_keep_and_delete_box.addStretch(1) self.delete_roi_window_keep_and_delete_box.setStretch(1, 4) self.delete_roi_window_keep_and_delete_box.setStretch(3, 4) # ================================= DELETE BOX ================================= # Create a widget to hold the keep and delete box self.delete_roi_window_keep_and_delete_widget = QWidget() self.delete_roi_window_keep_and_delete_widget.setObjectName( "DeleteRoiWindowKeepAndDeleteWidget") self.delete_roi_window_keep_and_delete_widget.setLayout( self.delete_roi_window_keep_and_delete_box) self.delete_roi_window_instance_vertical_box.addWidget( self.delete_roi_window_keep_and_delete_widget) # Create a horizontal box to hold 2 action buttons for this window self.delete_roi_window_action_buttons_box = QHBoxLayout() self.delete_roi_window_action_buttons_box.setObjectName( "DeleteRoiWindowActionButtonsBox") # Create the cancel button self.delete_roi_window_cancel_button = QPushButton() self.delete_roi_window_cancel_button.setObjectName( "DeleteRoiWindowCancelButton") self.delete_roi_window_cancel_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_cancel_button.resize( self.delete_roi_window_cancel_button.sizeHint().width(), self.delete_roi_window_cancel_button.sizeHint().height()) self.delete_roi_window_cancel_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.delete_roi_window_cancel_button.clicked.connect( self.on_cancel_button_clicked) self.delete_roi_window_cancel_button.setProperty( "QPushButtonClass", "fail-button") self.delete_roi_window_action_buttons_box.addStretch(1) self.delete_roi_window_action_buttons_box.addWidget( self.delete_roi_window_cancel_button) # Create the confirm button self.delete_roi_window_confirm_button = QPushButton() self.delete_roi_window_confirm_button.setObjectName( "DeleteRoiWindowConfirmButton") self.delete_roi_window_confirm_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.delete_roi_window_confirm_button.resize( self.delete_roi_window_confirm_button.sizeHint().width(), self.delete_roi_window_confirm_button.sizeHint().height()) self.delete_roi_window_confirm_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.delete_roi_window_confirm_button.clicked.connect( self.confirm_button_onClicked) self.delete_roi_window_confirm_button.setEnabled(False) self.delete_roi_window_confirm_button.setProperty( "QPushButtonClass", "success-button") self.delete_roi_window_action_buttons_box.addWidget( self.delete_roi_window_confirm_button) # Create a widget to hold the action buttons self.delete_roi_window_action_buttons_widget = QWidget() self.delete_roi_window_action_buttons_widget.setObjectName( "DeleteRoiWindowActionButtonsWidget") self.delete_roi_window_action_buttons_widget.setLayout( self.delete_roi_window_action_buttons_box) self.delete_roi_window_instance_vertical_box.addWidget( self.delete_roi_window_action_buttons_widget) # Set text for all attributes self.retranslate_ui(delete_roi_window_instance) # Create a central widget to hold the vertical layout box self.delete_roi_window_instance_central_widget = QWidget() self.delete_roi_window_instance_central_widget.setObjectName( "DeleteRoiWindowInstanceCentralWidget") self.delete_roi_window_instance_central_widget.setLayout( self.delete_roi_window_instance_vertical_box) self.delete_roi_window_instance_vertical_box.setStretch(2, 4) # Set the central widget for the main window and style the window delete_roi_window_instance.setCentralWidget( self.delete_roi_window_instance_central_widget) delete_roi_window_instance.setStyleSheet(stylesheet) # Load the ROIs in self.display_rois_in_listViewKeep() # Set the selection mode to multi so that we can select multiple ROIs to delete self.delete_roi_window_keep_tree_view.setSelectionMode( QAbstractItemView.MultiSelection) self.delete_roi_window_delete_tree_view.setSelectionMode( QAbstractItemView.MultiSelection) QtCore.QMetaObject.connectSlotsByName(delete_roi_window_instance) def retranslate_ui(self, delete_roi_window_instance): _translate = QtCore.QCoreApplication.translate delete_roi_window_instance.setWindowTitle( _translate("DeleteRoiWindowInstance", "OnkoDICOM - Delete ROI(s)")) self.delete_roi_window_title.setText( _translate("DeleteRoiWindowTitle", "Delete ROI(s)")) self.delete_roi_window_instruction.setText( _translate( "DeleteRoiWindowInstruction", "Move the Regions of Interest to be deleted to the right-hand side or vice versa" )) self.delete_roi_window_keep_tree_view_label.setText( _translate("DeleteRoiWindowKeepTreeViewLabel", "To Keep")) self.delete_roi_window_delete_tree_view_label.setText( _translate("DeleteRoiWindowDeleteTreeViewLabel", "To Delete")) self.move_right_button.setText( _translate("MoveRightButton", "Move Right ->>>")) self.move_left_button.setText( _translate("MoveLeftButton", "<<<- Move Left")) self.delete_roi_window_cancel_button.setText( _translate("DeleteRoiWindowCancelButton", "Cancel")) self.delete_roi_window_confirm_button.setText( _translate("DeleteRoiWindowConfirmButton", "Confirm")) def on_cancel_button_clicked(self): self.close() def display_rois_in_listViewKeep(self): self.regions_of_interest_to_keep.clear() for roi_id, roi_dict in self.regions_of_interest_list.items(): self.regions_of_interest_to_keep.append(roi_dict['name']) self.delete_roi_window_keep_tree_view.clear() self.delete_roi_window_keep_tree_view.setIndentation(0) self.item = QTreeWidgetItem(["item"]) for index in self.regions_of_interest_to_keep: item = QTreeWidgetItem([index]) self.delete_roi_window_keep_tree_view.addTopLevelItem(item) def move_right_button_onClicked(self): root_item = self.delete_roi_window_keep_tree_view.invisibleRootItem() for index in range(root_item.childCount()): item = root_item.child(index) if item in self.delete_roi_window_keep_tree_view.selectedItems(): # This will get ROI name self.regions_of_interest_to_delete.append(item.text(0)) # Move to the right column list self.delete_roi_window_delete_tree_view.clear() self.delete_roi_window_delete_tree_view.setIndentation(0) for roi in self.regions_of_interest_to_delete: item = QTreeWidgetItem([roi]) self.delete_roi_window_delete_tree_view.addTopLevelItem(item) self.delete_roi_window_confirm_button.setEnabled(True) # Delete moved items from the left column list self.regions_of_interest_to_keep = [ x for x in self.regions_of_interest_to_keep if x not in self.regions_of_interest_to_delete ] self.delete_roi_window_keep_tree_view.clear() for index in self.regions_of_interest_to_keep: item = QTreeWidgetItem([index]) self.delete_roi_window_keep_tree_view.addTopLevelItem(item) def move_left_button_onClicked(self): root_item = self.delete_roi_window_delete_tree_view.invisibleRootItem() for index in range(root_item.childCount()): item = root_item.child(index) if item in self.delete_roi_window_delete_tree_view.selectedItems(): # This will get ROI name self.regions_of_interest_to_keep.append(item.text(0)) # Move to the left column list self.delete_roi_window_keep_tree_view.clear() self.delete_roi_window_keep_tree_view.setIndentation(0) for roi in self.regions_of_interest_to_keep: item = QTreeWidgetItem([roi]) self.delete_roi_window_keep_tree_view.addTopLevelItem(item) # Delete moved items from the right column list self.regions_of_interest_to_delete = [ x for x in self.regions_of_interest_to_delete if x not in self.regions_of_interest_to_keep ] self.delete_roi_window_delete_tree_view.clear() for index in self.regions_of_interest_to_delete: item = QTreeWidgetItem([index]) self.delete_roi_window_delete_tree_view.addTopLevelItem(item) if len(self.regions_of_interest_to_delete) == 0: self.delete_roi_window_confirm_button.setEnabled(False) def confirm_button_onClicked(self): confirmation_dialog = QMessageBox.information( self, 'Delete ROI(s)?', 'Region(s) of Interest in the To Delete table will be deleted. ' 'Would you like to continue?', QMessageBox.Yes | QMessageBox.No) if confirmation_dialog == QMessageBox.Yes: progress_window = DeleteROIProgressWindow( self, QtCore.Qt.WindowTitleHint) progress_window.signal_roi_deleted.connect(self.on_rois_deleted) progress_window.start_deleting(self.dataset_rtss, self.regions_of_interest_to_delete) progress_window.show() def on_rois_deleted(self, new_rtss): self.deleting_rois_structure_tuple.emit((new_rtss, { "delete": self.regions_of_interest_to_delete })) QMessageBox.about(self, "Saved", "Regions of interest successfully deleted!") self.close()
class UIImageFusionWindow(object): image_fusion_info_initialized = QtCore.Signal(object) def setup_ui(self, open_image_fusion_select_instance): """Sets up a UI""" if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) open_image_fusion_select_instance.setObjectName( "OpenPatientWindowInstance") open_image_fusion_select_instance.setWindowIcon(window_icon) open_image_fusion_select_instance.resize(840, 530) # Create a vertical box for containing the other elements and layouts self.open_patient_window_instance_vertical_box = QVBoxLayout() self.open_patient_window_instance_vertical_box.setObjectName( "OpenPatientWindowInstanceVerticalBox") # Create a label to prompt the user to enter the path to the # directory that contains the DICOM files self.open_patient_directory_prompt = QLabel() self.open_patient_directory_prompt.setObjectName( "OpenPatientDirectoryPrompt") self.open_patient_directory_prompt.setAlignment(Qt.AlignLeft) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_prompt) # Create a horizontal box to hold the input box for the directory # and the choose button self.open_patient_directory_input_horizontal_box = QHBoxLayout() self.open_patient_directory_input_horizontal_box.setObjectName( "OpenPatientDirectoryInputHorizontalBox") # Create a textbox to contain the path to the directory that contains # the DICOM files self.open_patient_directory_input_box = \ UIImageFusionWindowDragAndDropEvent(self) self.open_patient_directory_input_box.setObjectName( "OpenPatientDirectoryInputBox") self.open_patient_directory_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_directory_input_box.returnPressed.connect( self.scan_directory_for_patient) self.open_patient_directory_input_horizontal_box.addWidget( self.open_patient_directory_input_box) # Create a choose button to open the file dialog self.open_patient_directory_choose_button = QPushButton() self.open_patient_directory_choose_button.setObjectName( "OpenPatientDirectoryChooseButton") self.open_patient_directory_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_directory_choose_button.resize( self.open_patient_directory_choose_button.sizeHint().width(), self.open_patient_directory_input_box.height()) self.open_patient_directory_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_directory_input_horizontal_box.addWidget( self.open_patient_directory_choose_button) self.open_patient_directory_choose_button.clicked.connect( self.choose_button_clicked) # Create a widget to hold the input fields self.open_patient_directory_input_widget = QWidget() self.open_patient_directory_input_horizontal_box.setStretch(0, 4) self.open_patient_directory_input_widget.setLayout( self.open_patient_directory_input_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_input_widget) # Create a horizontal box to hold the stop button and direction to # the user on where to select the patient self.open_patient_appear_prompt_and_stop_horizontal_box = QHBoxLayout() self.open_patient_appear_prompt_and_stop_horizontal_box.setObjectName( "OpenPatientAppearPromptAndStopHorizontalBox") # Create a label to show direction on where the files will appear self.open_patient_directory_appear_prompt = QLabel() self.open_patient_directory_appear_prompt.setObjectName( "OpenPatientDirectoryAppearPrompt") self.open_patient_directory_appear_prompt.setAlignment(Qt.AlignLeft) self.open_patient_appear_prompt_and_stop_horizontal_box.addWidget( self.open_patient_directory_appear_prompt) self.open_patient_appear_prompt_and_stop_horizontal_box.addStretch(1) # Create a button to stop searching self.open_patient_window_stop_button = QPushButton() self.open_patient_window_stop_button.setObjectName( "OpenPatientWindowStopButton") self.open_patient_window_stop_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_stop_button.resize( self.open_patient_window_stop_button.sizeHint().width(), self.open_patient_window_stop_button.sizeHint().height()) self.open_patient_window_stop_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_stop_button.clicked.connect( self.stop_button_clicked) self.open_patient_window_stop_button.setProperty( "QPushButtonClass", "fail-button") self.open_patient_window_stop_button.setVisible(False) self.open_patient_appear_prompt_and_stop_horizontal_box.addWidget( self.open_patient_window_stop_button) # Create a widget to hold the layout self.open_patient_appear_prompt_and_stop_widget = QWidget() self.open_patient_appear_prompt_and_stop_widget.setLayout( self.open_patient_appear_prompt_and_stop_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_appear_prompt_and_stop_widget) # Create a tree view list to list out all patients in the directory # selected above self.open_patient_window_patients_tree = QTreeWidget() self.open_patient_window_patients_tree.setObjectName( "OpenPatientWindowPatientsTree") self.open_patient_window_patients_tree.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_patients_tree.resize( self.open_patient_window_patients_tree.sizeHint().width(), self.open_patient_window_patients_tree.sizeHint().height()) self.open_patient_window_patients_tree.setHeaderHidden(False) self.open_patient_window_patients_tree.setHeaderLabels([""]) self.open_patient_window_patients_tree.itemChanged.connect( self.tree_item_clicked) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_window_patients_tree) self.last_patient = None # Create a label to show what would happen if they select the patient self.open_patient_directory_result_label = QtWidgets.QLabel() self.open_patient_directory_result_label.setObjectName( "OpenPatientDirectoryResultLabel") self.open_patient_directory_result_label.setAlignment(Qt.AlignLeft) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_directory_result_label) # Create a horizontal box to hold the Cancel and Open button self.open_patient_window_patient_open_actions_horizontal_box = \ QHBoxLayout() self.open_patient_window_patient_open_actions_horizontal_box. \ setObjectName("OpenPatientWindowPatientOpenActionsHorizontalBox") self.open_patient_window_patient_open_actions_horizontal_box. \ addStretch(1) # Add a button to go back/close from the application self.open_patient_window_close_button = QPushButton() self.open_patient_window_close_button.setObjectName( "OpenPatientWindowcloseButton") self.open_patient_window_close_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_close_button.resize( self.open_patient_window_stop_button.sizeHint().width(), self.open_patient_window_stop_button.sizeHint().height()) self.open_patient_window_close_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_close_button.clicked.connect( self.close_button_clicked) self.open_patient_window_close_button.setProperty( "QPushButtonClass", "fail-button") self.open_patient_window_patient_open_actions_horizontal_box. \ addWidget(self.open_patient_window_close_button) # Add a button to confirm opening of the patient self.open_patient_window_confirm_button = QPushButton() self.open_patient_window_confirm_button.setObjectName( "OpenPatientWindowConfirmButton") self.open_patient_window_confirm_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.open_patient_window_confirm_button.resize( self.open_patient_window_confirm_button.sizeHint().width(), self.open_patient_window_confirm_button.sizeHint().height()) self.open_patient_window_confirm_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.open_patient_window_confirm_button.setDisabled(True) self.open_patient_window_confirm_button.clicked.connect( self.confirm_button_clicked) self.open_patient_window_confirm_button.setProperty( "QPushButtonClass", "success-button") self.open_patient_window_patient_open_actions_horizontal_box. \ addWidget( self.open_patient_window_confirm_button) # Create a widget to house all of the actions button for open patient # window self.open_patient_window_patient_open_actions_widget = QWidget() self.open_patient_window_patient_open_actions_widget.setLayout( self.open_patient_window_patient_open_actions_horizontal_box) self.open_patient_window_instance_vertical_box.addWidget( self.open_patient_window_patient_open_actions_widget) # Set the vertical box fourth element, the tree view, to stretch # out as far as possible self.open_patient_window_instance_vertical_box.setStretch(3, 4) self.open_patient_window_instance_central_widget = QWidget() self.open_patient_window_instance_central_widget.setObjectName( "OpenPatientWindowInstanceCentralWidget") self.open_patient_window_instance_central_widget.setLayout( self.open_patient_window_instance_vertical_box) # Create threadpool for multithreading self.threadpool = QThreadPool() # print("Multithreading with maximum %d threads" % self.threadpool. # maxThreadCount()) # Create interrupt event for stopping the directory search self.interrupt_flag = threading.Event() # Bind all texts into the buttons and labels self.retranslate_ui(open_image_fusion_select_instance) # Set the central widget, ready for display open_image_fusion_select_instance.setCentralWidget( self.open_patient_window_instance_central_widget) # Set the current stylesheet to the instance and connect it back # to the caller through slot _stylesheet = open(resource_path(self.stylesheet_path)).read() open_image_fusion_select_instance.setStyleSheet(_stylesheet) QtCore.QMetaObject.connectSlotsByName( open_image_fusion_select_instance) def retranslate_ui(self, open_image_fusion_select_instance): """Translates UI""" _translate = QtCore.QCoreApplication.translate open_image_fusion_select_instance.setWindowTitle( _translate("OpenPatientWindowInstance", "OnkoDICOM - Select Patient")) self.open_patient_directory_prompt.setText(_translate( "OpenPatientWindowInstance", "Choose an image to merge with:")) self.open_patient_directory_input_box.setPlaceholderText( _translate("OpenPatientWindowInstance", "Enter DICOM Files Path (For example, " "C:\path\\to\your\DICOM\Files)")) self.open_patient_directory_choose_button.setText(_translate( "OpenPatientWindowInstance", "Choose")) self.open_patient_directory_appear_prompt.setText(_translate( "OpenPatientWindowInstance", "Please select below the image set you wish to overlay:")) self.open_patient_directory_result_label. \ setText("The selected imageset(s) above will be " "co-registered with the current imageset.") self.open_patient_window_stop_button.setText(_translate( "OpenPatientWindowInstance", "Stop Search")) self.open_patient_window_close_button.setText(_translate( "OpenPatientWindowInstance", "Close")) self.open_patient_window_confirm_button.setText(_translate( "OpenPatientWindowInstance", "Confirm")) def update_patient(self): self.clear_checked_leaves() self.patient_dict_container = PatientDictContainer() self.patient = self.patient_dict_container.get("basic_info") self.patient_id = self.patient['id'] dataset = self.patient_dict_container.dataset[0] self.patient_current_image_series_uid = \ dataset.get("SeriesInstanceUID") def clear_checked_leaves(self): """ Resets all leaves to their unchecked state """ def recurse(parent_item: QTreeWidgetItem): for i in range(parent_item.childCount()): child = parent_item.child(i) grand_children = child.childCount() if grand_children > 0: recurse(child) else: if child.checkState(0) == Qt.Checked: child.setCheckState(0, Qt.CheckState.Unchecked) child.setSelected(False) recurse(self.open_patient_window_patients_tree.invisibleRootItem()) self.open_patient_window_patients_tree.collapseAll() def close_button_clicked(self): """Closes the window.""" self.close() def scan_directory_for_patient(self): # Reset tree view header and last patient self.open_patient_window_confirm_button.setDisabled(True) self.open_patient_window_patients_tree.setHeaderLabels([""]) self.last_patient = None self.filepath = self.open_patient_directory_input_box.text() # Proceed if a folder was selected if self.filepath != "": # Update the QTreeWidget to reflect data being loaded # First, clear the widget of any existing data self.open_patient_window_patients_tree.clear() # Next, update the tree widget self.open_patient_window_patients_tree.addTopLevelItem( QTreeWidgetItem(["Loading selected directory..."])) # The choose button is disabled until the thread finishes executing self.open_patient_directory_choose_button.setEnabled(False) # Reveals the Stop Search button for the duration of the search self.open_patient_window_stop_button.setVisible(True) # The interrupt flag is then un-set if a previous search has been # stopped. self.interrupt_flag.clear() # Then, create a new thread that will load the selected folder worker = Worker(DICOMDirectorySearch.get_dicom_structure, self.filepath, self.interrupt_flag, progress_callback=True) worker.signals.result.connect(self.on_search_complete) worker.signals.progress.connect(self.search_progress) # Execute the thread self.threadpool.start(worker) def choose_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user and loads all files and subdirectories. """ # Get folder path from pop up dialog box self.filepath = QtWidgets.QFileDialog.getExistingDirectory( None, 'Select patient folder...', '') self.open_patient_directory_input_box.setText(self.filepath) self.scan_directory_for_patient() def stop_button_clicked(self): self.interrupt_flag.set() def search_progress(self, progress_update): """ Current progress of the file search. """ self.open_patient_window_patients_tree.clear() self.open_patient_window_patients_tree.addTopLevelItem( QTreeWidgetItem(["Loading selected directory... " "(%s files searched)" % progress_update])) def on_search_complete(self, dicom_structure): """ Executes once the directory search is complete. :param dicom_structure: DICOMStructure object constructed by the directory search. """ self.open_patient_directory_choose_button.setEnabled(True) self.open_patient_window_stop_button.setVisible(False) self.open_patient_window_patients_tree.clear() # dicom_structure will be None if function was interrupted. if dicom_structure is None: return for patient_item in dicom_structure.get_tree_items_list(): self.open_patient_window_patients_tree.addTopLevelItem( patient_item) patient_item.setExpanded(True) # Display all studies # Display all image sets for i in range(patient_item.childCount()): study = patient_item.child(i) study.setExpanded(True) if len(dicom_structure.patients) == 0: QMessageBox.about(self, "No files found", "Selected directory contains no DICOM files.") def tree_item_clicked(self, item, _): """ Executes when a tree item is checked or unchecked. If a different patient is checked, uncheck the previous patient. Inform user about missing DICOM files. """ # If patient is only selected, but not checked, set it to "focus" to # coincide with stylesheet. And if the selected item is an image set, # display its child branches. if item.checkState(0) == Qt.CheckState.Unchecked: self.open_patient_window_patients_tree.setCurrentItem(item) else: # Otherwise don't "focus", then set patient as selected self.open_patient_window_patients_tree.setCurrentItem(None) item.setSelected(True) # Expand or collapse the tree branch if item is an image series # Only collapse if the selected image series is expanded but unchecked # Otherwise, expand its tree branch to show RT files is_expanded = False \ if (item.isExpanded() is True and item.checkState(0) == Qt.CheckState.Unchecked) else True self.display_a_tree_branch(item, is_expanded) selected_patient = item # If the item is not top-level, bubble up to see which top-level item # this item belongs to if self.open_patient_window_patients_tree.invisibleRootItem(). \ indexOfChild(item) == -1: while self.open_patient_window_patients_tree.invisibleRootItem(). \ indexOfChild(selected_patient) == -1: selected_patient = selected_patient.parent() # Uncheck previous patient if a different patient is selected if item.checkState(0) == Qt.CheckState.Checked and self.last_patient \ != selected_patient: if self.last_patient is not None: last_patient_checked_items = self.get_checked_nodes( self.last_patient) for checked_item in last_patient_checked_items: checked_item.setCheckState(0, Qt.Unchecked) self.last_patient = selected_patient # Check selected items and display warning messages self.check_selected_items(selected_patient) def display_a_tree_branch(self, node, is_expanded): # TO DO: # Could Team 23 please update the defintion of this docstring as # well as same function presented in OpenPatientWindow. """ Displays a tree branch Parameters: node : root node the tree is_expanded (boolean): flag for checking if a particular node/leaf is expanded. """ node.setExpanded(is_expanded) if node.childCount() > 0: for i in range(node.childCount()): self.display_a_tree_branch(node.child(i), is_expanded) else: return def check_selected_items(self, selected_patient): """ Check and display warning messages based on the existence and quantity of image series, RTSTRUCT, RTPLAN, RTDOSE and SR files Parameters: selected_patient (DICOMStructure): DICOM Object of patient """ # Get the types of all selected leaves & Get the names of all selected # studies checked_nodes = self.get_checked_nodes( self.open_patient_window_patients_tree.invisibleRootItem()) selected_series_types = [checked_node.dicom_object.get_series_type() for checked_node in checked_nodes] selected_series_id = [checked_node.dicom_object.series_uid for checked_node in checked_nodes] # Total number of selected image series total_selected_image_series = selected_series_types.count('CT') + \ selected_series_types.count('MR') + \ selected_series_types.count('PT') # Check the existence of IMAGE, RTSTRUCT, RTPLAN and RTDOSE files proceed = True if total_selected_image_series < 1: header = "Cannot proceed without an image." proceed = False elif total_selected_image_series > 1: header = "Cannot proceed with more than 1 selected image." proceed = False elif selected_patient.dicom_object.patient_id.strip() != \ self.patient_id: header = "Cannot proceed with different patient." proceed = False elif self.patient_current_image_series_uid in selected_series_id: header = "Cannot fuse with the same series." proceed = False elif not self.check_selected_items_referencing(checked_nodes): # Check that selected items properly reference each other header = "Selected series do not reference each other." proceed = False elif 'RTSTRUCT' not in selected_series_types and \ self.check_existing_rtss(checked_nodes): header = "The associated RTSTRUCT must be selected." proceed = False elif 'RTDOSE' in selected_series_types: header = "Cannot fuse with a RTDOSE file." proceed = False else: header = "" self.open_patient_window_confirm_button.setDisabled(not proceed) # Set the tree header self.open_patient_window_patients_tree.setHeaderLabel(header) def check_selected_items_referencing(self, items): """ Check if selected tree items properly reference each other. :param items: List of selected DICOMWidgetItems. :return: True if the selected items belong to the same tree branch. """ # Dictionary of series of different file types series = { "IMAGE": None, "RTSTRUCT": None, "RTPLAN": None, "RTDOSE": None, "SR": None } for item in items: series_type = item.dicom_object.get_series_type() if series_type in series: series[series_type] = item else: series["IMAGE"] = item # Check if the RTSTRUCT, RTPLAN, and RTDOSE are a child item of the # image series if series["IMAGE"]: if series["RTSTRUCT"] and series["RTSTRUCT"].parent() != \ series["IMAGE"]: return False if series["RTPLAN"] and \ series["RTPLAN"].parent().parent() != series["IMAGE"]: return False if series["SR"] and series["SR"].parent() != series["IMAGE"]: return False return True def check_existing_rtss(self, items): """ Check for existing rtss :return: bool, whether there is a rtss associated with the selected image series """ image_series = ['CT', 'MR', 'PT'] for item in items: if item.dicom_object.get_series_type() in image_series: for i in range(item.childCount()): if item.child(i).dicom_object: return True return False def get_checked_nodes(self, root): """ :param root: QTreeWidgetItem as a root. :return: A list of all QTreeWidgetItems in the QTreeWidget that are checked under the root. """ checked_items = [] def recurse(parent_item: QTreeWidgetItem): for i in range(parent_item.childCount()): child = parent_item.child(i) if int(child.flags()) & int(Qt.ItemIsUserCheckable) and \ child.checkState(0) == Qt.Checked: checked_items.append(child) grand_children = child.childCount() if grand_children > 0: recurse(child) recurse(root) return checked_items def confirm_button_clicked(self): """ Begins loading of the selected files. """ selected_files = [] for item in self.get_checked_nodes( self.open_patient_window_patients_tree.invisibleRootItem()): selected_files += item.dicom_object.get_files() self.progress_window = ImageFusionProgressWindow(self) self.progress_window.signal_loaded.connect(self.on_loaded) self.progress_window.signal_error.connect(self.on_loading_error) self.progress_window.start_loading(selected_files) def on_loaded(self, results): """ Executes when the progress bar finishes loaded the selected files. """ if results[0] is True: # Will be NoneType if loading was interrupted. self.image_fusion_info_initialized.emit(results[1]) def on_loading_error(self, exception): """ Error handling for progress window. """ if type(exception[1]) == ImageLoading.NotRTSetError: QMessageBox.about(self.progress_window, "Unable to open selection", "Selected files cannot be opened as they are not" " a DICOM-RT set.") self.progress_window.close() elif type(exception[1]) == ImageLoading.NotAllowedClassError: QMessageBox.about(self.progress_window, "Unable to open selection", "Selected files cannot be opened as they contain" " unsupported DICOM classes.") self.progress_window.close()
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(911, 607) self.action_open = QAction(MainWindow) self.action_open.setObjectName(u"action_open") self.action_open.setVisible(False) self.action_comparison = QAction(MainWindow) self.action_comparison.setObjectName(u"action_comparison") self.action_comparison.setVisible(False) self.action_plot = QAction(MainWindow) self.action_plot.setObjectName(u"action_plot") self.action_training_session = QAction(MainWindow) self.action_training_session.setObjectName(u"action_training_session") self.action_training_session.setVisible(False) self.action_game = QAction(MainWindow) self.action_game.setObjectName(u"action_game") self.action_save = QAction(MainWindow) self.action_save.setObjectName(u"action_save") self.action_save.setVisible(False) self.action_save_log = QAction(MainWindow) self.action_save_log.setObjectName(u"action_save_log") self.action_save_log.setVisible(False) self.action_coordinates = QAction(MainWindow) self.action_coordinates.setObjectName(u"action_coordinates") self.action_coordinates.setCheckable(True) self.action_about = QAction(MainWindow) self.action_about.setObjectName(u"action_about") self.action_new_db = QAction(MainWindow) self.action_new_db.setObjectName(u"action_new_db") self.action_open_db = QAction(MainWindow) self.action_open_db.setObjectName(u"action_open_db") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout_2 = QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.stacked_widget = QStackedWidget(self.centralwidget) self.stacked_widget.setObjectName(u"stacked_widget") self.game_page = QWidget() self.game_page.setObjectName(u"game_page") self.gridLayout_3 = QGridLayout(self.game_page) self.gridLayout_3.setObjectName(u"gridLayout_3") self.connect4 = QPushButton(self.game_page) self.connect4.setObjectName(u"connect4") sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.connect4.sizePolicy().hasHeightForWidth()) self.connect4.setSizePolicy(sizePolicy) self.gridLayout_3.addWidget(self.connect4, 0, 1, 1, 1) self.tic_tac_toe = QPushButton(self.game_page) self.tic_tac_toe.setObjectName(u"tic_tac_toe") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.tic_tac_toe.sizePolicy().hasHeightForWidth()) self.tic_tac_toe.setSizePolicy(sizePolicy1) self.gridLayout_3.addWidget(self.tic_tac_toe, 0, 0, 1, 1) self.othello = QPushButton(self.game_page) self.othello.setObjectName(u"othello") sizePolicy.setHeightForWidth( self.othello.sizePolicy().hasHeightForWidth()) self.othello.setSizePolicy(sizePolicy) self.gridLayout_3.addWidget(self.othello, 1, 0, 1, 1) self.stacked_widget.addWidget(self.game_page) self.players_page = QWidget() self.players_page.setObjectName(u"players_page") self.verticalLayout = QVBoxLayout(self.players_page) self.verticalLayout.setObjectName(u"verticalLayout") self.player_layout = QGridLayout() self.player_layout.setObjectName(u"player_layout") self.searches_lock2 = QCheckBox(self.players_page) self.searches_lock2.setObjectName(u"searches_lock2") self.player_layout.addWidget(self.searches_lock2, 2, 4, 1, 1) self.player1 = QComboBox(self.players_page) self.player1.setObjectName(u"player1") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.player1.sizePolicy().hasHeightForWidth()) self.player1.setSizePolicy(sizePolicy2) self.player_layout.addWidget(self.player1, 1, 1, 1, 1) self.cancel = QPushButton(self.players_page) self.cancel.setObjectName(u"cancel") self.player_layout.addWidget(self.cancel, 4, 0, 1, 1) self.searches_label1 = QLabel(self.players_page) self.searches_label1.setObjectName(u"searches_label1") sizePolicy3 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth( self.searches_label1.sizePolicy().hasHeightForWidth()) self.searches_label1.setSizePolicy(sizePolicy3) self.player_layout.addWidget(self.searches_label1, 1, 3, 1, 1) self.player2 = QComboBox(self.players_page) self.player2.setObjectName(u"player2") sizePolicy2.setHeightForWidth( self.player2.sizePolicy().hasHeightForWidth()) self.player2.setSizePolicy(sizePolicy2) self.player_layout.addWidget(self.player2, 2, 1, 1, 1) self.searches_lock1 = QCheckBox(self.players_page) self.searches_lock1.setObjectName(u"searches_lock1") self.player_layout.addWidget(self.searches_lock1, 1, 4, 1, 1) self.game_label = QLabel(self.players_page) self.game_label.setObjectName(u"game_label") sizePolicy4 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth( self.game_label.sizePolicy().hasHeightForWidth()) self.game_label.setSizePolicy(sizePolicy4) self.player_layout.addWidget(self.game_label, 0, 0, 1, 1) self.game_name = QLabel(self.players_page) self.game_name.setObjectName(u"game_name") self.player_layout.addWidget(self.game_name, 0, 1, 1, 4) self.searches_label2 = QLabel(self.players_page) self.searches_label2.setObjectName(u"searches_label2") self.player_layout.addWidget(self.searches_label2, 2, 3, 1, 1) self.player_label1 = QLabel(self.players_page) self.player_label1.setObjectName(u"player_label1") sizePolicy4.setHeightForWidth( self.player_label1.sizePolicy().hasHeightForWidth()) self.player_label1.setSizePolicy(sizePolicy4) self.player_layout.addWidget(self.player_label1, 1, 0, 1, 1) self.searches1 = QSpinBox(self.players_page) self.searches1.setObjectName(u"searches1") sizePolicy5 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy5.setHorizontalStretch(0) sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth( self.searches1.sizePolicy().hasHeightForWidth()) self.searches1.setSizePolicy(sizePolicy5) self.searches1.setMaximum(1000000) self.player_layout.addWidget(self.searches1, 1, 2, 1, 1) self.player_label2 = QLabel(self.players_page) self.player_label2.setObjectName(u"player_label2") self.player_layout.addWidget(self.player_label2, 2, 0, 1, 1) self.shuffle_players = QCheckBox(self.players_page) self.shuffle_players.setObjectName(u"shuffle_players") self.player_layout.addWidget(self.shuffle_players, 3, 1, 1, 4) self.searches2 = QSpinBox(self.players_page) self.searches2.setObjectName(u"searches2") sizePolicy5.setHeightForWidth( self.searches2.sizePolicy().hasHeightForWidth()) self.searches2.setSizePolicy(sizePolicy5) self.searches2.setMaximum(1000000) self.player_layout.addWidget(self.searches2, 2, 2, 1, 1) self.start = QPushButton(self.players_page) self.start.setObjectName(u"start") self.player_layout.addWidget(self.start, 4, 1, 1, 4) self.player_layout.setColumnStretch(1, 10) self.player_layout.setColumnStretch(2, 1) self.verticalLayout.addLayout(self.player_layout) self.stacked_widget.addWidget(self.players_page) self.humans_page = QWidget() self.humans_page.setObjectName(u"humans_page") self.gridLayout = QGridLayout(self.humans_page) self.gridLayout.setObjectName(u"gridLayout") self.close_humans = QPushButton(self.humans_page) self.close_humans.setObjectName(u"close_humans") sizePolicy4.setHeightForWidth( self.close_humans.sizePolicy().hasHeightForWidth()) self.close_humans.setSizePolicy(sizePolicy4) self.gridLayout.addWidget(self.close_humans, 1, 1, 1, 1) self.players_label = QLabel(self.humans_page) self.players_label.setObjectName(u"players_label") self.gridLayout.addWidget(self.players_label, 0, 0, 1, 1) self.new_human = QPushButton(self.humans_page) self.new_human.setObjectName(u"new_human") sizePolicy4.setHeightForWidth( self.new_human.sizePolicy().hasHeightForWidth()) self.new_human.setSizePolicy(sizePolicy4) self.gridLayout.addWidget(self.new_human, 1, 3, 1, 1) self.players_table = QTableWidget(self.humans_page) self.players_table.setObjectName(u"players_table") self.gridLayout.addWidget(self.players_table, 0, 1, 1, 3) self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout.addItem(self.spacer, 1, 2, 1, 1) self.stacked_widget.addWidget(self.humans_page) self.rules_page = QWidget() self.rules_page.setObjectName(u"rules_page") self.gridLayout_4 = QGridLayout(self.rules_page) self.gridLayout_4.setObjectName(u"gridLayout_4") self.rules_text = QTextBrowser(self.rules_page) self.rules_text.setObjectName(u"rules_text") self.gridLayout_4.addWidget(self.rules_text, 0, 0, 1, 1) self.rules_close = QPushButton(self.rules_page) self.rules_close.setObjectName(u"rules_close") sizePolicy4.setHeightForWidth( self.rules_close.sizePolicy().hasHeightForWidth()) self.rules_close.setSizePolicy(sizePolicy4) self.gridLayout_4.addWidget(self.rules_close, 1, 0, 1, 1) self.stacked_widget.addWidget(self.rules_page) self.display_page = QWidget() self.display_page.setObjectName(u"display_page") self.gridLayout_2 = QGridLayout(self.display_page) self.gridLayout_2.setObjectName(u"gridLayout_2") self.toggle_review = QPushButton(self.display_page) self.toggle_review.setObjectName(u"toggle_review") sizePolicy4.setHeightForWidth( self.toggle_review.sizePolicy().hasHeightForWidth()) self.toggle_review.setSizePolicy(sizePolicy4) self.gridLayout_2.addWidget(self.toggle_review, 3, 2, 1, 1) self.move_history = QComboBox(self.display_page) self.move_history.setObjectName(u"move_history") sizePolicy6 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy6.setHorizontalStretch(1) sizePolicy6.setVerticalStretch(0) sizePolicy6.setHeightForWidth( self.move_history.sizePolicy().hasHeightForWidth()) self.move_history.setSizePolicy(sizePolicy6) self.gridLayout_2.addWidget(self.move_history, 3, 1, 1, 1) self.choices = QTableWidget(self.display_page) self.choices.setObjectName(u"choices") sizePolicy7 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy7.setHorizontalStretch(0) sizePolicy7.setVerticalStretch(0) sizePolicy7.setHeightForWidth( self.choices.sizePolicy().hasHeightForWidth()) self.choices.setSizePolicy(sizePolicy7) self.gridLayout_2.addWidget(self.choices, 1, 0, 1, 3) self.resume_here = QPushButton(self.display_page) self.resume_here.setObjectName(u"resume_here") sizePolicy5.setHeightForWidth( self.resume_here.sizePolicy().hasHeightForWidth()) self.resume_here.setSizePolicy(sizePolicy5) self.gridLayout_2.addWidget(self.resume_here, 3, 0, 1, 1) self.game_display = QLabel(self.display_page) self.game_display.setObjectName(u"game_display") self.gridLayout_2.addWidget(self.game_display, 0, 0, 1, 3) self.stacked_widget.addWidget(self.display_page) self.plot_strength_page = QWidget() self.plot_strength_page.setObjectName(u"plot_strength_page") self.gridLayout_5 = QGridLayout(self.plot_strength_page) self.gridLayout_5.setObjectName(u"gridLayout_5") self.label = QLabel(self.plot_strength_page) self.label.setObjectName(u"label") self.gridLayout_5.addWidget(self.label, 0, 0, 1, 1) self.plot_game = QComboBox(self.plot_strength_page) self.plot_game.setObjectName(u"plot_game") self.gridLayout_5.addWidget(self.plot_game, 0, 1, 1, 2) self.lineEdit = QLineEdit(self.plot_strength_page) self.lineEdit.setObjectName(u"lineEdit") self.gridLayout_5.addWidget(self.lineEdit, 2, 1, 1, 2) self.label_2 = QLabel(self.plot_strength_page) self.label_2.setObjectName(u"label_2") self.gridLayout_5.addWidget(self.label_2, 3, 0, 1, 1) self.lineEdit_2 = QLineEdit(self.plot_strength_page) self.lineEdit_2.setObjectName(u"lineEdit_2") self.gridLayout_5.addWidget(self.lineEdit_2, 3, 1, 1, 2) self.reset_plot = QPushButton(self.plot_strength_page) self.reset_plot.setObjectName(u"reset_plot") self.gridLayout_5.addWidget(self.reset_plot, 6, 2, 1, 1) self.start_stop_plot = QPushButton(self.plot_strength_page) self.start_stop_plot.setObjectName(u"start_stop_plot") self.gridLayout_5.addWidget(self.start_stop_plot, 6, 1, 1, 1) self.strengths_label = QLabel(self.plot_strength_page) self.strengths_label.setObjectName(u"strengths_label") self.gridLayout_5.addWidget(self.strengths_label, 2, 0, 1, 1) self.label_3 = QLabel(self.plot_strength_page) self.label_3.setObjectName(u"label_3") self.gridLayout_5.addWidget(self.label_3, 4, 0, 1, 1) self.lineEdit_3 = QLineEdit(self.plot_strength_page) self.lineEdit_3.setObjectName(u"lineEdit_3") self.gridLayout_5.addWidget(self.lineEdit_3, 4, 1, 1, 2) self.stacked_widget.addWidget(self.plot_strength_page) self.plot_history_page = QWidget() self.plot_history_page.setObjectName(u"plot_history_page") self.gridLayout_6 = QGridLayout(self.plot_history_page) self.gridLayout_6.setObjectName(u"gridLayout_6") self.label_4 = QLabel(self.plot_history_page) self.label_4.setObjectName(u"label_4") self.gridLayout_6.addWidget(self.label_4, 0, 0, 1, 1) self.history_game = QComboBox(self.plot_history_page) self.history_game.setObjectName(u"history_game") self.gridLayout_6.addWidget(self.history_game, 0, 1, 1, 1) self.gridLayout_6.setColumnStretch(0, 1) self.gridLayout_6.setColumnStretch(1, 8) self.stacked_widget.addWidget(self.plot_history_page) self.verticalLayout_2.addWidget(self.stacked_widget) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 911, 22)) self.menu_file = QMenu(self.menubar) self.menu_file.setObjectName(u"menu_file") self.menu_new = QMenu(self.menu_file) self.menu_new.setObjectName(u"menu_new") self.menu_view = QMenu(self.menubar) self.menu_view.setObjectName(u"menu_view") self.menu_help = QMenu(self.menubar) self.menu_help.setObjectName(u"menu_help") self.menu_rules = QMenu(self.menu_help) self.menu_rules.setObjectName(u"menu_rules") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_view.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.menu_file.addAction(self.menu_new.menuAction()) self.menu_file.addAction(self.action_open) self.menu_file.addAction(self.action_save) self.menu_file.addAction(self.action_save_log) self.menu_file.addAction(self.action_new_db) self.menu_file.addAction(self.action_open_db) self.menu_new.addAction(self.action_game) self.menu_new.addAction(self.action_comparison) self.menu_new.addAction(self.action_plot) self.menu_new.addAction(self.action_training_session) self.menu_view.addAction(self.action_coordinates) self.menu_help.addAction(self.action_about) self.menu_help.addAction(self.menu_rules.menuAction()) self.retranslateUi(MainWindow) self.stacked_widget.setCurrentIndex(2) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.action_open.setText( QCoreApplication.translate("MainWindow", u"&Open...", None)) self.action_comparison.setText( QCoreApplication.translate("MainWindow", u"&Comparison", None)) self.action_plot.setText( QCoreApplication.translate("MainWindow", u"&Plot", None)) self.action_training_session.setText( QCoreApplication.translate("MainWindow", u"&Training Session", None)) self.action_game.setText( QCoreApplication.translate("MainWindow", u"&Game", None)) self.action_save.setText( QCoreApplication.translate("MainWindow", u"&Save...", None)) self.action_save_log.setText( QCoreApplication.translate("MainWindow", u"Save &Log...", None)) self.action_coordinates.setText( QCoreApplication.translate("MainWindow", u"Coordinates", None)) self.action_about.setText( QCoreApplication.translate("MainWindow", u"&About...", None)) self.action_new_db.setText( QCoreApplication.translate("MainWindow", u"New Player &Database...", None)) self.action_open_db.setText( QCoreApplication.translate("MainWindow", u"&Open Player Database...", None)) self.connect4.setText( QCoreApplication.translate("MainWindow", u"Connect 4", None)) self.tic_tac_toe.setText( QCoreApplication.translate("MainWindow", u"Tic Tac Toe", None)) self.othello.setText( QCoreApplication.translate("MainWindow", u"Othello", None)) self.searches_lock2.setText( QCoreApplication.translate("MainWindow", u"Lock", None)) self.cancel.setText( QCoreApplication.translate("MainWindow", u"Cancel", None)) self.searches_label1.setText( QCoreApplication.translate("MainWindow", u"searches", None)) self.searches_lock1.setText( QCoreApplication.translate("MainWindow", u"Lock", None)) self.game_label.setText( QCoreApplication.translate("MainWindow", u"Game:", None)) self.game_name.setText( QCoreApplication.translate("MainWindow", u"Chosen Game's Name", None)) self.searches_label2.setText( QCoreApplication.translate("MainWindow", u"searches", None)) self.player_label1.setText( QCoreApplication.translate("MainWindow", u"Player 1:", None)) self.player_label2.setText( QCoreApplication.translate("MainWindow", u"Player 2:", None)) self.shuffle_players.setText( QCoreApplication.translate("MainWindow", u"Shuffle Player Order", None)) self.start.setText( QCoreApplication.translate("MainWindow", u"Start", None)) self.close_humans.setText( QCoreApplication.translate("MainWindow", u"OK", None)) self.players_label.setText( QCoreApplication.translate("MainWindow", u"Players", None)) self.new_human.setText( QCoreApplication.translate("MainWindow", u"New", None)) self.rules_close.setText( QCoreApplication.translate("MainWindow", u"Close", None)) self.toggle_review.setText( QCoreApplication.translate("MainWindow", u"Review / Resume", None)) self.resume_here.setText( QCoreApplication.translate("MainWindow", u"Resume Here", None)) self.game_display.setText( QCoreApplication.translate("MainWindow", u"Game Display", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Game:", None)) #if QT_CONFIG(whatsthis) self.lineEdit.setWhatsThis("") #endif // QT_CONFIG(whatsthis) self.label_2.setText( QCoreApplication.translate("MainWindow", u"Opponent min:", None)) self.reset_plot.setText( QCoreApplication.translate("MainWindow", u"Reset", None)) self.start_stop_plot.setText( QCoreApplication.translate("MainWindow", u"Start / Stop", None)) self.strengths_label.setText( QCoreApplication.translate("MainWindow", u"Player Strengths:", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"Opponent max:", None)) self.label_4.setText( QCoreApplication.translate("MainWindow", u"Game:", None)) self.menu_file.setTitle( QCoreApplication.translate("MainWindow", u"&File", None)) self.menu_new.setTitle( QCoreApplication.translate("MainWindow", u"&New", None)) self.menu_view.setTitle( QCoreApplication.translate("MainWindow", u"&View", None)) self.menu_help.setTitle( QCoreApplication.translate("MainWindow", u"&Help", None)) self.menu_rules.setTitle( QCoreApplication.translate("MainWindow", u"&Rules", None))
class UIBuilder(object): """Constructs the UI for a main application window""" def setup(self, main_window: QMainWindow) -> None: """ Initialize the UI. :param main_window: An instance of the `QMainWindow` class. :type main_window: :class:`QMainWindow` """ main_window.setObjectName("main_window") main_window.setWindowTitle("TeaseAI") main_window.resize(1137, 751) main_window.setSizePolicy(*EXP_EXP) main_window.setTabShape(QTabWidget.Rounded) self.menubar = QMenuBar(main_window) self.menubar.setObjectName("menubar") self.menubar.setGeometry(0, 0, 1137, 23) self.file_menu = QMenu("File", self.menubar) self.file_menu.setObjectName("file_men") self.server_menu = QMenu("Server", self.menubar) self.server_menu.setObjectName("server_men") self.options_menu = QMenu("Options", self.menubar) self.options_menu.setObjectName("options_men") self.media_menu = QMenu("Media", self.menubar) self.media_menu.setObjectName("media_men") main_window.setMenuBar(self.menubar) self.exit = QAction("Exit", main_window) self.exit.setObjectName("exit") self.start_server = QAction("Start Server", main_window) self.start_server.setObjectName("start_server") self.connect_server = QAction("Connect to Server", main_window) self.connect_server.setObjectName("connect_server") self.kill_server = QAction("Kill Server", main_window) self.kill_server.setObjectName("kill_server") self.options = QAction("Options", main_window) self.options.setObjectName("options") self.start_webcam = QAction("Start Webcam", main_window) self.start_webcam.setObjectName("start_webcam") self.start_webcam.setCheckable(False) self.centralwidget = QWidget(main_window) self.centralwidget.setObjectName("centralwidget") self.centralwidget.setContentsMargins(QMargins(0, 0, 0, 0)) self.centralwidget.setSizePolicy(*EXP_EXP) self.grid_layout = QGridLayout(self.centralwidget) self.media = QFrame(self.centralwidget) self.media.setObjectName("media") self.media.setSizePolicy(*EXP_EXP) self.media.setMinimumSize(200, 200) self.media.setStyleSheet("background: #000;") self.grid_layout.addWidget(self.media, 0, 0, 5, 1) self.users_label = QLabel(" Online users:", self.centralwidget) self.users_label.setObjectName("users_label") self.users_label.setMinimumSize(300, 15) self.users_label.setMaximumSize(300, 15) self.grid_layout.addWidget(self.users_label, 0, 1, 1, 2) self.online = QPlainTextEdit("", self.centralwidget) self.online.setObjectName("online") self.online.setSizePolicy(*FIX_FIX) self.online.setMinimumSize(300, 50) self.online.setMaximumSize(300, 50) self.online.setStyleSheet("margin-left: 3px;" + SUNKEN) self.online.setLineWidth(2) self.online.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setSizeAdjustPolicy(QAbstractScrollArea.AdjustIgnored) self.online.setReadOnly(True) self.grid_layout.addWidget(self.online, 1, 1, 1, 2) self.chat = QPlainTextEdit("", self.centralwidget) self.chat.setObjectName("chat") self.chat.setSizePolicy(*FIX_EXP) self.chat.setMinimumSize(300, 0) self.chat.setMaximumSize(300, INFINITE) self.chat.setStyleSheet("margin-bottom: 3px; margin-top: 8px;" + SUNKEN) self.chat.setLineWidth(2) self.chat.setReadOnly(True) self.chat.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.grid_layout.addWidget(self.chat, 2, 1, 1, 2) self.input = QLineEdit(self.centralwidget) self.input.setObjectName("input") self.input.setSizePolicy(*FIX_FIX) self.input.setMinimumSize(224, 30) self.input.setMaximumSize(224, 30) self.input.setStyleSheet(SUNKEN) self.input.setEchoMode(QLineEdit.Normal) self.input.setClearButtonEnabled(True) self.grid_layout.addWidget(self.input, 3, 1, 1, 1) self.submit = QPushButton("Submit", self.centralwidget) self.submit.setObjectName("submit") self.submit.setSizePolicy(*FIX_FIX) self.submit.setMinimumSize(70, 30) self.submit.setMaximumSize(70, 30) self.grid_layout.addWidget(self.submit, 3, 2, 1, 1) self.tabs = QTabWidget(self.centralwidget) self.tabs.setObjectName("tabs") self.tabs.setSizePolicy(*FIX_FIX) self.tabs.setMinimumSize(300, 150) self.tabs.setMaximumSize(300, 150) self.tab = QWidget() self.tab.setObjectName("tab") self.tabs.addTab(self.tab, "Actions") self.tab2 = QWidget() self.tab2.setObjectName("tab2") self.tabs.addTab(self.tab2, "My Media") self.tab3 = QWidget() self.tab3.setObjectName("tab3") self.tab3.setSizePolicy(*FIX_FIX) self.grid_layout2 = QGridLayout(self.tab3) self.grid_layout2.setHorizontalSpacing(0) self.grid_layout2.setVerticalSpacing(3) self.grid_layout2.setContentsMargins(3, -1, 3, -1) self.server_folder = QLineEdit(self.tab3) self.server_folder.setObjectName("server_folder") self.grid_layout2.addWidget(self.server_folder, 0, 0, 1, 3) self.srv_browse = QPushButton("BROWSE", self.tab3) self.srv_browse.setObjectName("srv_browse") self.srv_browse.setStyleSheet("background: transparent;\n" " color: #4d4940;\n" " font-size: 8pt;\n" " font-weight: 450;\n" " padding: 6px;\n") self.grid_layout2.addWidget(self.srv_browse, 0, 3, 1, 1) self.back_button = QPushButton("", self.tab3) self.back_button.setObjectName("back_button") self.back_button.setSizePolicy(*FIX_FIX) self.back_button.setMaximumSize(SEVENTY_FIVE) self.back_button.setCursor(QCursor(Qt.PointingHandCursor)) self.back_button.setStyleSheet("border: 0;\n" "background: transparent;") icon = QIcon() icon.addFile(":/newPrefix/back_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.back_button.setIcon(icon) self.back_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.back_button, 1, 0, 1, 1) self.play_button = QPushButton("", self.tab3) self.play_button.setObjectName("play_button") self.play_button.setSizePolicy(*FIX_FIX) self.play_button.setMaximumSize(SEVENTY_FIVE) self.play_button.setCursor(QCursor(Qt.PointingHandCursor)) self.play_button.setStyleSheet("border: 0;\n" "background: transparent;") icon1 = QIcon() icon1.addFile(":/newPrefix/play_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.play_button.setIcon(icon1) self.play_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.play_button, 1, 1, 1, 1) self.stop_button = QPushButton("", self.tab3) self.stop_button.setObjectName("stop_button") self.stop_button.setSizePolicy(*FIX_FIX) self.stop_button.setMaximumSize(SEVENTY_FIVE) self.stop_button.setCursor(QCursor(Qt.PointingHandCursor)) self.stop_button.setStyleSheet("border: 0;\n" "background: transparent;") icon2 = QIcon() icon2.addFile(":/newPrefix/stop_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.stop_button.setIcon(icon2) self.stop_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.stop_button, 1, 2, 1, 1) self.fast_forward = QPushButton("", self.tab3) self.fast_forward.setObjectName("fast_forward") self.fast_forward.setSizePolicy(*FIX_FIX) self.fast_forward.setMaximumSize(SEVENTY_FIVE) self.fast_forward.setCursor(QCursor(Qt.PointingHandCursor)) self.fast_forward.setStyleSheet("border: 0;\n" "background: transparent;") icon3 = QIcon() icon3.addFile(":/newPrefix/fast_forward.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.fast_forward.setIcon(icon3) self.fast_forward.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.fast_forward, 1, 3, 1, 1) self.tabs.addTab(self.tab3, "Server Media") self.grid_layout.addWidget(self.tabs, 4, 1, 1, 2) main_window.setCentralWidget(self.centralwidget) self.statusbar = QStatusBar(main_window) self.statusbar.setObjectName("statusbar") self.statusbar.setEnabled(True) self.statusbar.setStyleSheet("margin-bottom: 5px;") self.statusbar.setSizePolicy(*EXP_FIX) self.statusbar.setMinimumSize(INFINITE, 30) self.statusbar.setMaximumSize(INFINITE, 30) self.statusbar.setSizeGripEnabled(False) main_window.setStatusBar(self.statusbar) self.menubar.addAction(self.file_menu.menuAction()) self.menubar.addAction(self.server_menu.menuAction()) self.menubar.addAction(self.options_menu.menuAction()) self.menubar.addAction(self.media_menu.menuAction()) self.file_menu.addAction(self.exit) self.server_menu.addAction(self.start_server) self.server_menu.addAction(self.connect_server) self.server_menu.addAction(self.kill_server) self.options_menu.addAction(self.options) self.media_menu.addAction(self.start_webcam) self.exit.triggered.connect(main_window.close) self.tabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(main_window) self.exit.setStatusTip("Exit the program.") self.start_server.setStatusTip("Initialize a local server instance.") self.connect_server.setStatusTip("Connect to a remote server.") self.kill_server.setStatusTip("Shut down a running local server.") self.options.setStatusTip("Open the options menu.") self.start_webcam.setStatusTip("Start webcam feed.") self.tooltip = QLabel("", self.statusbar) tooltip_policy = QSizePolicy(*EXP_FIX) tooltip_policy.setHorizontalStretch(100) self.tooltip.setSizePolicy(tooltip_policy) self.tooltip.setMinimumSize(INFINITE, 26) self.tooltip.setMaximumSize(INFINITE, 26) self.server_status = QLabel("Server status:", self.statusbar) self.server_status.setSizePolicy(*FIX_FIX) self.server_status.setMinimumSize(300, 26) self.server_status.setMaximumSize(300, 26) self.client_status = QLabel("Client status:", self.statusbar) self.client_status.setSizePolicy(*FIX_FIX) self.client_status.setMinimumSize(302, 26) self.client_status.setMaximumSize(302, 26) self.statusbar.addPermanentWidget(self.tooltip) self.statusbar.addPermanentWidget(self.server_status) self.statusbar.addPermanentWidget(self.client_status) self.tooltip.setStyleSheet(SUNKEN + "margin-left: 4px;\ margin-right: 0px;") self.client_status.setStyleSheet(SUNKEN + "margin-right: 7px;") self.server_status.setStyleSheet(SUNKEN + "margin-right: 2px;\ margin-left: 2px;") self.statusbar.messageChanged.connect(main_window.status_tip)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(770, 640) MainWindow.setMinimumSize(QSize(770, 640)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout_10 = QGridLayout(self.centralwidget) self.gridLayout_10.setObjectName(u"gridLayout_10") self.groupBoxConnection = QGroupBox(self.centralwidget) self.groupBoxConnection.setObjectName(u"groupBoxConnection") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.groupBoxConnection.sizePolicy().hasHeightForWidth()) self.groupBoxConnection.setSizePolicy(sizePolicy) self.gridLayout_2 = QGridLayout(self.groupBoxConnection) self.gridLayout_2.setObjectName(u"gridLayout_2") self.pushButtonConnect = QPushButton(self.groupBoxConnection) self.pushButtonConnect.setObjectName(u"pushButtonConnect") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(1) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.pushButtonConnect.sizePolicy().hasHeightForWidth()) self.pushButtonConnect.setSizePolicy(sizePolicy1) self.gridLayout_2.addWidget(self.pushButtonConnect, 0, 1, 1, 1) self.labelUpdateDelay = QLabel(self.groupBoxConnection) self.labelUpdateDelay.setObjectName(u"labelUpdateDelay") self.gridLayout_2.addWidget(self.labelUpdateDelay, 1, 0, 1, 1) self.labelStatus = QLabel(self.groupBoxConnection) self.labelStatus.setObjectName(u"labelStatus") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(1) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.labelStatus.sizePolicy().hasHeightForWidth()) self.labelStatus.setSizePolicy(sizePolicy2) self.gridLayout_2.addWidget(self.labelStatus, 1, 2, 1, 1) self.comboBoxGameSelection = QComboBox(self.groupBoxConnection) self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.setObjectName(u"comboBoxGameSelection") sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy3.setHorizontalStretch(1) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.comboBoxGameSelection.sizePolicy().hasHeightForWidth()) self.comboBoxGameSelection.setSizePolicy(sizePolicy3) self.gridLayout_2.addWidget(self.comboBoxGameSelection, 0, 0, 1, 1) self.doubleSpinBoxDelay = QDoubleSpinBox(self.groupBoxConnection) self.doubleSpinBoxDelay.setObjectName(u"doubleSpinBoxDelay") self.doubleSpinBoxDelay.setEnabled(False) self.doubleSpinBoxDelay.setMinimum(0.500000000000000) self.doubleSpinBoxDelay.setMaximum(2.000000000000000) self.gridLayout_2.addWidget(self.doubleSpinBoxDelay, 1, 1, 1, 1) self.gridLayout_10.addWidget(self.groupBoxConnection, 0, 0, 1, 1) self.tabWidget = QTabWidget(self.centralwidget) self.tabWidget.setObjectName(u"tabWidget") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(5) sizePolicy4.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy4) self.tabGen6 = QWidget() self.tabGen6.setObjectName(u"tabGen6") self.gridLayout = QGridLayout(self.tabGen6) self.gridLayout.setObjectName(u"gridLayout") self.tabWidgetGen6 = QTabWidget(self.tabGen6) self.tabWidgetGen6.setObjectName(u"tabWidgetGen6") self.tabMain6 = QWidget() self.tabMain6.setObjectName(u"tabMain6") self.gridLayout_13 = QGridLayout(self.tabMain6) self.gridLayout_13.setObjectName(u"gridLayout_13") self.comboBoxMainIndex6 = QComboBox(self.tabMain6) self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.setObjectName(u"comboBoxMainIndex6") self.comboBoxMainIndex6.setEnabled(False) sizePolicy3.setHeightForWidth(self.comboBoxMainIndex6.sizePolicy().hasHeightForWidth()) self.comboBoxMainIndex6.setSizePolicy(sizePolicy3) self.gridLayout_13.addWidget(self.comboBoxMainIndex6, 0, 0, 1, 1) self.groupBoxMainRNG6 = QGroupBox(self.tabMain6) self.groupBoxMainRNG6.setObjectName(u"groupBoxMainRNG6") sizePolicy2.setHeightForWidth(self.groupBoxMainRNG6.sizePolicy().hasHeightForWidth()) self.groupBoxMainRNG6.setSizePolicy(sizePolicy2) self.gridLayout_11 = QGridLayout(self.groupBoxMainRNG6) self.gridLayout_11.setObjectName(u"gridLayout_11") self.lineEditFrame6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditFrame6.setObjectName(u"lineEditFrame6") sizePolicy5 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy5.setHorizontalStretch(0) sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth(self.lineEditFrame6.sizePolicy().hasHeightForWidth()) self.lineEditFrame6.setSizePolicy(sizePolicy5) self.lineEditFrame6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditFrame6, 3, 2, 1, 2) self.labelTiny2 = QLabel(self.groupBoxMainRNG6) self.labelTiny2.setObjectName(u"labelTiny2") self.gridLayout_11.addWidget(self.labelTiny2, 5, 2, 1, 1) self.labelTiny0 = QLabel(self.groupBoxMainRNG6) self.labelTiny0.setObjectName(u"labelTiny0") self.gridLayout_11.addWidget(self.labelTiny0, 6, 2, 1, 1) self.lineEditInitialSeed6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditInitialSeed6.setObjectName(u"lineEditInitialSeed6") sizePolicy5.setHeightForWidth(self.lineEditInitialSeed6.sizePolicy().hasHeightForWidth()) self.lineEditInitialSeed6.setSizePolicy(sizePolicy5) self.lineEditInitialSeed6.setMaxLength(8) self.lineEditInitialSeed6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditInitialSeed6, 1, 2, 1, 2) self.labelTiny3 = QLabel(self.groupBoxMainRNG6) self.labelTiny3.setObjectName(u"labelTiny3") self.gridLayout_11.addWidget(self.labelTiny3, 5, 0, 1, 1) self.labelTiny1 = QLabel(self.groupBoxMainRNG6) self.labelTiny1.setObjectName(u"labelTiny1") self.gridLayout_11.addWidget(self.labelTiny1, 6, 0, 1, 1) self.labelMainCurrentSeed6 = QLabel(self.groupBoxMainRNG6) self.labelMainCurrentSeed6.setObjectName(u"labelMainCurrentSeed6") self.gridLayout_11.addWidget(self.labelMainCurrentSeed6, 2, 0, 1, 2) self.lineEditCurrentSeed6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditCurrentSeed6.setObjectName(u"lineEditCurrentSeed6") sizePolicy5.setHeightForWidth(self.lineEditCurrentSeed6.sizePolicy().hasHeightForWidth()) self.lineEditCurrentSeed6.setSizePolicy(sizePolicy5) self.lineEditCurrentSeed6.setMaxLength(16) self.lineEditCurrentSeed6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditCurrentSeed6, 2, 2, 1, 2) self.lineEditTiny2 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny2.setObjectName(u"lineEditTiny2") self.gridLayout_11.addWidget(self.lineEditTiny2, 5, 3, 1, 1) self.lineEditTiny1 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny1.setObjectName(u"lineEditTiny1") self.gridLayout_11.addWidget(self.lineEditTiny1, 6, 1, 1, 1) self.lineEditTiny3 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny3.setObjectName(u"lineEditTiny3") self.gridLayout_11.addWidget(self.lineEditTiny3, 5, 1, 1, 1) self.labelMainInitialSeed6 = QLabel(self.groupBoxMainRNG6) self.labelMainInitialSeed6.setObjectName(u"labelMainInitialSeed6") self.gridLayout_11.addWidget(self.labelMainInitialSeed6, 1, 0, 1, 2) self.labelMainFrame6 = QLabel(self.groupBoxMainRNG6) self.labelMainFrame6.setObjectName(u"labelMainFrame6") self.gridLayout_11.addWidget(self.labelMainFrame6, 3, 0, 1, 1) self.lineEditTiny0 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny0.setObjectName(u"lineEditTiny0") self.gridLayout_11.addWidget(self.lineEditTiny0, 6, 3, 1, 1) self.pushButtonMainUpdate6 = QPushButton(self.groupBoxMainRNG6) self.pushButtonMainUpdate6.setObjectName(u"pushButtonMainUpdate6") self.pushButtonMainUpdate6.setEnabled(False) self.gridLayout_11.addWidget(self.pushButtonMainUpdate6, 0, 0, 1, 4) self.labelSaveVariable = QLabel(self.groupBoxMainRNG6) self.labelSaveVariable.setObjectName(u"labelSaveVariable") self.gridLayout_11.addWidget(self.labelSaveVariable, 4, 0, 1, 1) self.lineEditSaveVariable = QLineEdit(self.groupBoxMainRNG6) self.lineEditSaveVariable.setObjectName(u"lineEditSaveVariable") self.lineEditSaveVariable.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditSaveVariable, 4, 2, 1, 2) self.gridLayout_13.addWidget(self.groupBoxMainRNG6, 0, 1, 2, 1) self.mainPokemon6 = PokemonDisplay(self.tabMain6) self.mainPokemon6.setObjectName(u"mainPokemon6") sizePolicy2.setHeightForWidth(self.mainPokemon6.sizePolicy().hasHeightForWidth()) self.mainPokemon6.setSizePolicy(sizePolicy2) self.gridLayout_13.addWidget(self.mainPokemon6, 1, 0, 1, 1) self.tabWidgetGen6.addTab(self.tabMain6, "") self.tabEgg6 = QWidget() self.tabEgg6.setObjectName(u"tabEgg6") self.gridLayout_15 = QGridLayout(self.tabEgg6) self.gridLayout_15.setObjectName(u"gridLayout_15") self.eggParent1_6 = PokemonDisplay(self.tabEgg6) self.eggParent1_6.setObjectName(u"eggParent1_6") sizePolicy2.setHeightForWidth(self.eggParent1_6.sizePolicy().hasHeightForWidth()) self.eggParent1_6.setSizePolicy(sizePolicy2) self.gridLayout_15.addWidget(self.eggParent1_6, 0, 0, 1, 1) self.eggParent2_6 = PokemonDisplay(self.tabEgg6) self.eggParent2_6.setObjectName(u"eggParent2_6") sizePolicy2.setHeightForWidth(self.eggParent2_6.sizePolicy().hasHeightForWidth()) self.eggParent2_6.setSizePolicy(sizePolicy2) self.gridLayout_15.addWidget(self.eggParent2_6, 0, 1, 1, 1) self.groupBoxEggRNG6 = QGroupBox(self.tabEgg6) self.groupBoxEggRNG6.setObjectName(u"groupBoxEggRNG6") sizePolicy2.setHeightForWidth(self.groupBoxEggRNG6.sizePolicy().hasHeightForWidth()) self.groupBoxEggRNG6.setSizePolicy(sizePolicy2) self.gridLayout_14 = QGridLayout(self.groupBoxEggRNG6) self.gridLayout_14.setObjectName(u"gridLayout_14") self.labelEggReady6 = QLabel(self.groupBoxEggRNG6) self.labelEggReady6.setObjectName(u"labelEggReady6") sizePolicy5.setHeightForWidth(self.labelEggReady6.sizePolicy().hasHeightForWidth()) self.labelEggReady6.setSizePolicy(sizePolicy5) self.gridLayout_14.addWidget(self.labelEggReady6, 1, 0, 1, 1) self.labelEggReadyStatus6 = QLabel(self.groupBoxEggRNG6) self.labelEggReadyStatus6.setObjectName(u"labelEggReadyStatus6") self.gridLayout_14.addWidget(self.labelEggReadyStatus6, 1, 1, 1, 1) self.lineEditEggSeed0_6 = QLineEdit(self.groupBoxEggRNG6) self.lineEditEggSeed0_6.setObjectName(u"lineEditEggSeed0_6") sizePolicy5.setHeightForWidth(self.lineEditEggSeed0_6.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed0_6.setSizePolicy(sizePolicy5) self.lineEditEggSeed0_6.setMaxLength(8) self.lineEditEggSeed0_6.setReadOnly(True) self.gridLayout_14.addWidget(self.lineEditEggSeed0_6, 3, 1, 1, 1) self.pushButtonEggUpdate6 = QPushButton(self.groupBoxEggRNG6) self.pushButtonEggUpdate6.setObjectName(u"pushButtonEggUpdate6") self.pushButtonEggUpdate6.setEnabled(False) self.gridLayout_14.addWidget(self.pushButtonEggUpdate6, 0, 0, 1, 2) self.labelEggSeed0_6 = QLabel(self.groupBoxEggRNG6) self.labelEggSeed0_6.setObjectName(u"labelEggSeed0_6") self.gridLayout_14.addWidget(self.labelEggSeed0_6, 3, 0, 1, 1) self.labelEggSeed1_6 = QLabel(self.groupBoxEggRNG6) self.labelEggSeed1_6.setObjectName(u"labelEggSeed1_6") self.gridLayout_14.addWidget(self.labelEggSeed1_6, 2, 0, 1, 1) self.lineEditEggSeed1_6 = QLineEdit(self.groupBoxEggRNG6) self.lineEditEggSeed1_6.setObjectName(u"lineEditEggSeed1_6") sizePolicy5.setHeightForWidth(self.lineEditEggSeed1_6.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed1_6.setSizePolicy(sizePolicy5) self.lineEditEggSeed1_6.setMaxLength(8) self.lineEditEggSeed1_6.setReadOnly(True) self.gridLayout_14.addWidget(self.lineEditEggSeed1_6, 2, 1, 1, 1) self.gridLayout_15.addWidget(self.groupBoxEggRNG6, 0, 2, 1, 1) self.tabWidgetGen6.addTab(self.tabEgg6, "") self.gridLayout.addWidget(self.tabWidgetGen6, 0, 0, 1, 1) self.tabWidget.addTab(self.tabGen6, "") self.tabGen7 = QWidget() self.tabGen7.setObjectName(u"tabGen7") self.tabGen7.setEnabled(False) self.gridLayout_12 = QGridLayout(self.tabGen7) self.gridLayout_12.setObjectName(u"gridLayout_12") self.tabWidgetGen7 = QTabWidget(self.tabGen7) self.tabWidgetGen7.setObjectName(u"tabWidgetGen7") self.tabMain7 = QWidget() self.tabMain7.setObjectName(u"tabMain7") self.gridLayout_7 = QGridLayout(self.tabMain7) self.gridLayout_7.setObjectName(u"gridLayout_7") self.comboBoxMainIndex7 = QComboBox(self.tabMain7) self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.setObjectName(u"comboBoxMainIndex7") self.comboBoxMainIndex7.setEnabled(False) sizePolicy3.setHeightForWidth(self.comboBoxMainIndex7.sizePolicy().hasHeightForWidth()) self.comboBoxMainIndex7.setSizePolicy(sizePolicy3) self.gridLayout_7.addWidget(self.comboBoxMainIndex7, 0, 0, 1, 1) self.groupBoxMainRNG7 = QGroupBox(self.tabMain7) self.groupBoxMainRNG7.setObjectName(u"groupBoxMainRNG7") sizePolicy2.setHeightForWidth(self.groupBoxMainRNG7.sizePolicy().hasHeightForWidth()) self.groupBoxMainRNG7.setSizePolicy(sizePolicy2) self.gridLayout_3 = QGridLayout(self.groupBoxMainRNG7) self.gridLayout_3.setObjectName(u"gridLayout_3") self.labelMainInitialSeed7 = QLabel(self.groupBoxMainRNG7) self.labelMainInitialSeed7.setObjectName(u"labelMainInitialSeed7") self.gridLayout_3.addWidget(self.labelMainInitialSeed7, 1, 0, 1, 1) self.lineEditInitialSeed7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditInitialSeed7.setObjectName(u"lineEditInitialSeed7") sizePolicy5.setHeightForWidth(self.lineEditInitialSeed7.sizePolicy().hasHeightForWidth()) self.lineEditInitialSeed7.setSizePolicy(sizePolicy5) self.lineEditInitialSeed7.setMaxLength(8) self.lineEditInitialSeed7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditInitialSeed7, 1, 1, 1, 1) self.labelMainCurrentSeed7 = QLabel(self.groupBoxMainRNG7) self.labelMainCurrentSeed7.setObjectName(u"labelMainCurrentSeed7") self.gridLayout_3.addWidget(self.labelMainCurrentSeed7, 2, 0, 1, 1) self.lineEditCurrentSeed7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditCurrentSeed7.setObjectName(u"lineEditCurrentSeed7") sizePolicy5.setHeightForWidth(self.lineEditCurrentSeed7.sizePolicy().hasHeightForWidth()) self.lineEditCurrentSeed7.setSizePolicy(sizePolicy5) self.lineEditCurrentSeed7.setMaxLength(16) self.lineEditCurrentSeed7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditCurrentSeed7, 2, 1, 1, 1) self.labelMainFrame7 = QLabel(self.groupBoxMainRNG7) self.labelMainFrame7.setObjectName(u"labelMainFrame7") self.gridLayout_3.addWidget(self.labelMainFrame7, 3, 0, 1, 1) self.lineEditFrame7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditFrame7.setObjectName(u"lineEditFrame7") sizePolicy5.setHeightForWidth(self.lineEditFrame7.sizePolicy().hasHeightForWidth()) self.lineEditFrame7.setSizePolicy(sizePolicy5) self.lineEditFrame7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditFrame7, 3, 1, 1, 1) self.pushButtonMainUpdate7 = QPushButton(self.groupBoxMainRNG7) self.pushButtonMainUpdate7.setObjectName(u"pushButtonMainUpdate7") self.pushButtonMainUpdate7.setEnabled(False) self.gridLayout_3.addWidget(self.pushButtonMainUpdate7, 0, 0, 1, 2) self.gridLayout_7.addWidget(self.groupBoxMainRNG7, 0, 1, 2, 1) self.mainPokemon7 = PokemonDisplay(self.tabMain7) self.mainPokemon7.setObjectName(u"mainPokemon7") sizePolicy2.setHeightForWidth(self.mainPokemon7.sizePolicy().hasHeightForWidth()) self.mainPokemon7.setSizePolicy(sizePolicy2) self.gridLayout_7.addWidget(self.mainPokemon7, 1, 0, 1, 1) self.tabWidgetGen7.addTab(self.tabMain7, "") self.tabEgg7 = QWidget() self.tabEgg7.setObjectName(u"tabEgg7") self.gridLayout_6 = QGridLayout(self.tabEgg7) self.gridLayout_6.setObjectName(u"gridLayout_6") self.groupBoxEggRNG7 = QGroupBox(self.tabEgg7) self.groupBoxEggRNG7.setObjectName(u"groupBoxEggRNG7") sizePolicy2.setHeightForWidth(self.groupBoxEggRNG7.sizePolicy().hasHeightForWidth()) self.groupBoxEggRNG7.setSizePolicy(sizePolicy2) self.gridLayout_4 = QGridLayout(self.groupBoxEggRNG7) self.gridLayout_4.setObjectName(u"gridLayout_4") self.pushButtonEggUpdate7 = QPushButton(self.groupBoxEggRNG7) self.pushButtonEggUpdate7.setObjectName(u"pushButtonEggUpdate7") self.pushButtonEggUpdate7.setEnabled(False) self.gridLayout_4.addWidget(self.pushButtonEggUpdate7, 0, 0, 1, 2) self.labelEggReady7 = QLabel(self.groupBoxEggRNG7) self.labelEggReady7.setObjectName(u"labelEggReady7") sizePolicy5.setHeightForWidth(self.labelEggReady7.sizePolicy().hasHeightForWidth()) self.labelEggReady7.setSizePolicy(sizePolicy5) self.gridLayout_4.addWidget(self.labelEggReady7, 1, 0, 1, 1) self.labelEggReadyStatus7 = QLabel(self.groupBoxEggRNG7) self.labelEggReadyStatus7.setObjectName(u"labelEggReadyStatus7") self.gridLayout_4.addWidget(self.labelEggReadyStatus7, 1, 1, 1, 1) self.labelEggSeed3_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed3_7.setObjectName(u"labelEggSeed3_7") self.gridLayout_4.addWidget(self.labelEggSeed3_7, 2, 0, 1, 1) self.lineEditEggSeed3_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed3_7.setObjectName(u"lineEditEggSeed3_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed3_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed3_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed3_7.setMaxLength(8) self.lineEditEggSeed3_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed3_7, 2, 1, 1, 1) self.labelEggSeed2_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed2_7.setObjectName(u"labelEggSeed2_7") self.gridLayout_4.addWidget(self.labelEggSeed2_7, 3, 0, 1, 1) self.lineEditEggSeed2_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed2_7.setObjectName(u"lineEditEggSeed2_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed2_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed2_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed2_7.setMaxLength(8) self.lineEditEggSeed2_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed2_7, 3, 1, 1, 1) self.labelEggSeed1_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed1_7.setObjectName(u"labelEggSeed1_7") self.gridLayout_4.addWidget(self.labelEggSeed1_7, 4, 0, 1, 1) self.lineEditEggSeed1_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed1_7.setObjectName(u"lineEditEggSeed1_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed1_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed1_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed1_7.setMaxLength(8) self.lineEditEggSeed1_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed1_7, 4, 1, 1, 1) self.labelEggSeed0_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed0_7.setObjectName(u"labelEggSeed0_7") self.gridLayout_4.addWidget(self.labelEggSeed0_7, 5, 0, 1, 1) self.lineEditEggSeed0_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed0_7.setObjectName(u"lineEditEggSeed0_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed0_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed0_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed0_7.setMaxLength(8) self.lineEditEggSeed0_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed0_7, 5, 1, 1, 1) self.gridLayout_6.addWidget(self.groupBoxEggRNG7, 0, 2, 2, 1) self.eggParent1_7 = PokemonDisplay(self.tabEgg7) self.eggParent1_7.setObjectName(u"eggParent1_7") sizePolicy2.setHeightForWidth(self.eggParent1_7.sizePolicy().hasHeightForWidth()) self.eggParent1_7.setSizePolicy(sizePolicy2) self.gridLayout_6.addWidget(self.eggParent1_7, 0, 0, 2, 1) self.eggParent2_7 = PokemonDisplay(self.tabEgg7) self.eggParent2_7.setObjectName(u"eggParent2_7") sizePolicy2.setHeightForWidth(self.eggParent2_7.sizePolicy().hasHeightForWidth()) self.eggParent2_7.setSizePolicy(sizePolicy2) self.gridLayout_6.addWidget(self.eggParent2_7, 0, 1, 2, 1) self.tabWidgetGen7.addTab(self.tabEgg7, "") self.tabSOS = QWidget() self.tabSOS.setObjectName(u"tabSOS") self.gridLayout_8 = QGridLayout(self.tabSOS) self.gridLayout_8.setObjectName(u"gridLayout_8") self.comboBoxSOSIndex = QComboBox(self.tabSOS) self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.setObjectName(u"comboBoxSOSIndex") self.comboBoxSOSIndex.setEnabled(False) self.gridLayout_8.addWidget(self.comboBoxSOSIndex, 0, 0, 1, 1) self.groupBoxSOS = QGroupBox(self.tabSOS) self.groupBoxSOS.setObjectName(u"groupBoxSOS") sizePolicy2.setHeightForWidth(self.groupBoxSOS.sizePolicy().hasHeightForWidth()) self.groupBoxSOS.setSizePolicy(sizePolicy2) self.gridLayout_5 = QGridLayout(self.groupBoxSOS) self.gridLayout_5.setObjectName(u"gridLayout_5") self.pushButtonSOSUpdate = QPushButton(self.groupBoxSOS) self.pushButtonSOSUpdate.setObjectName(u"pushButtonSOSUpdate") self.pushButtonSOSUpdate.setEnabled(False) self.gridLayout_5.addWidget(self.pushButtonSOSUpdate, 0, 0, 1, 1) self.pushButtonSOSReset = QPushButton(self.groupBoxSOS) self.pushButtonSOSReset.setObjectName(u"pushButtonSOSReset") self.pushButtonSOSReset.setEnabled(False) self.gridLayout_5.addWidget(self.pushButtonSOSReset, 0, 1, 1, 1) self.labelSOSInitialSeed = QLabel(self.groupBoxSOS) self.labelSOSInitialSeed.setObjectName(u"labelSOSInitialSeed") self.gridLayout_5.addWidget(self.labelSOSInitialSeed, 1, 0, 1, 1) self.lineEditSOSInitialSeed = QLineEdit(self.groupBoxSOS) self.lineEditSOSInitialSeed.setObjectName(u"lineEditSOSInitialSeed") self.lineEditSOSInitialSeed.setMaxLength(8) self.lineEditSOSInitialSeed.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSInitialSeed, 1, 1, 1, 1) self.labelSOSCurrentSeed = QLabel(self.groupBoxSOS) self.labelSOSCurrentSeed.setObjectName(u"labelSOSCurrentSeed") self.gridLayout_5.addWidget(self.labelSOSCurrentSeed, 2, 0, 1, 1) self.lineEditSOSCurrentSeed = QLineEdit(self.groupBoxSOS) self.lineEditSOSCurrentSeed.setObjectName(u"lineEditSOSCurrentSeed") self.lineEditSOSCurrentSeed.setMaxLength(8) self.lineEditSOSCurrentSeed.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSCurrentSeed, 2, 1, 1, 1) self.labelSOSFrame = QLabel(self.groupBoxSOS) self.labelSOSFrame.setObjectName(u"labelSOSFrame") self.gridLayout_5.addWidget(self.labelSOSFrame, 3, 0, 1, 1) self.lineEditSOSFrame = QLineEdit(self.groupBoxSOS) self.lineEditSOSFrame.setObjectName(u"lineEditSOSFrame") self.lineEditSOSFrame.setMaxLength(8) self.lineEditSOSFrame.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSFrame, 3, 1, 1, 1) self.labelSOSChainCount = QLabel(self.groupBoxSOS) self.labelSOSChainCount.setObjectName(u"labelSOSChainCount") self.gridLayout_5.addWidget(self.labelSOSChainCount, 4, 0, 1, 1) self.lineEditSOSChainCount = QLineEdit(self.groupBoxSOS) self.lineEditSOSChainCount.setObjectName(u"lineEditSOSChainCount") self.lineEditSOSChainCount.setMaxLength(8) self.lineEditSOSChainCount.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSChainCount, 4, 1, 1, 1) self.gridLayout_8.addWidget(self.groupBoxSOS, 0, 1, 2, 1) self.sosPokemon = PokemonDisplay(self.tabSOS) self.sosPokemon.setObjectName(u"sosPokemon") sizePolicy2.setHeightForWidth(self.sosPokemon.sizePolicy().hasHeightForWidth()) self.sosPokemon.setSizePolicy(sizePolicy2) self.gridLayout_8.addWidget(self.sosPokemon, 1, 0, 1, 1) self.tabWidgetGen7.addTab(self.tabSOS, "") self.gridLayout_12.addWidget(self.tabWidgetGen7, 0, 0, 1, 1) self.tabWidget.addTab(self.tabGen7, "") self.gridLayout_10.addWidget(self.tabWidget, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"CitraRNG 3.2.0", None)) self.groupBoxConnection.setTitle(QCoreApplication.translate("MainWindow", u"Connection", None)) self.pushButtonConnect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) self.labelUpdateDelay.setText(QCoreApplication.translate("MainWindow", u"Auto update delay(seconds):", None)) self.labelStatus.setText(QCoreApplication.translate("MainWindow", u"Status: Not Connected", None)) self.comboBoxGameSelection.setItemText(0, QCoreApplication.translate("MainWindow", u"XY", None)) self.comboBoxGameSelection.setItemText(1, QCoreApplication.translate("MainWindow", u"ORAS", None)) self.comboBoxGameSelection.setItemText(2, QCoreApplication.translate("MainWindow", u"SM", None)) self.comboBoxGameSelection.setItemText(3, QCoreApplication.translate("MainWindow", u"USUM", None)) self.comboBoxMainIndex6.setItemText(0, QCoreApplication.translate("MainWindow", u"Party 1", None)) self.comboBoxMainIndex6.setItemText(1, QCoreApplication.translate("MainWindow", u"Party 2", None)) self.comboBoxMainIndex6.setItemText(2, QCoreApplication.translate("MainWindow", u"Party 3", None)) self.comboBoxMainIndex6.setItemText(3, QCoreApplication.translate("MainWindow", u"Party 4", None)) self.comboBoxMainIndex6.setItemText(4, QCoreApplication.translate("MainWindow", u"Party 5", None)) self.comboBoxMainIndex6.setItemText(5, QCoreApplication.translate("MainWindow", u"Party 6", None)) self.comboBoxMainIndex6.setItemText(6, QCoreApplication.translate("MainWindow", u"Wild", None)) self.groupBoxMainRNG6.setTitle(QCoreApplication.translate("MainWindow", u"Main RNG", None)) self.labelTiny2.setText(QCoreApplication.translate("MainWindow", u"[2]", None)) self.labelTiny0.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.labelTiny3.setText(QCoreApplication.translate("MainWindow", u"[3]", None)) self.labelTiny1.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.labelMainCurrentSeed6.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelMainInitialSeed6.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelMainFrame6.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.pushButtonMainUpdate6.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelSaveVariable.setText(QCoreApplication.translate("MainWindow", u"Save Variable:", None)) self.tabWidgetGen6.setTabText(self.tabWidgetGen6.indexOf(self.tabMain6), QCoreApplication.translate("MainWindow", u"Main", None)) self.groupBoxEggRNG6.setTitle(QCoreApplication.translate("MainWindow", u"Egg RNG", None)) self.labelEggReady6.setText(QCoreApplication.translate("MainWindow", u"Egg Ready:", None)) self.labelEggReadyStatus6.setText(QCoreApplication.translate("MainWindow", u"No egg yet", None)) self.pushButtonEggUpdate6.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelEggSeed0_6.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.labelEggSeed1_6.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.tabWidgetGen6.setTabText(self.tabWidgetGen6.indexOf(self.tabEgg6), QCoreApplication.translate("MainWindow", u"Egg", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabGen6), QCoreApplication.translate("MainWindow", u"Gen 6", None)) self.comboBoxMainIndex7.setItemText(0, QCoreApplication.translate("MainWindow", u"Party 1", None)) self.comboBoxMainIndex7.setItemText(1, QCoreApplication.translate("MainWindow", u"Party 2", None)) self.comboBoxMainIndex7.setItemText(2, QCoreApplication.translate("MainWindow", u"Party 3", None)) self.comboBoxMainIndex7.setItemText(3, QCoreApplication.translate("MainWindow", u"Party 4", None)) self.comboBoxMainIndex7.setItemText(4, QCoreApplication.translate("MainWindow", u"Party 5", None)) self.comboBoxMainIndex7.setItemText(5, QCoreApplication.translate("MainWindow", u"Party 6", None)) self.comboBoxMainIndex7.setItemText(6, QCoreApplication.translate("MainWindow", u"Wild", None)) self.groupBoxMainRNG7.setTitle(QCoreApplication.translate("MainWindow", u"Main RNG", None)) self.labelMainInitialSeed7.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelMainCurrentSeed7.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelMainFrame7.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.pushButtonMainUpdate7.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabMain7), QCoreApplication.translate("MainWindow", u"Main", None)) self.groupBoxEggRNG7.setTitle(QCoreApplication.translate("MainWindow", u"Egg RNG", None)) self.pushButtonEggUpdate7.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelEggReady7.setText(QCoreApplication.translate("MainWindow", u"Egg Ready:", None)) self.labelEggReadyStatus7.setText(QCoreApplication.translate("MainWindow", u"No egg yet", None)) self.labelEggSeed3_7.setText(QCoreApplication.translate("MainWindow", u"[3]", None)) self.labelEggSeed2_7.setText(QCoreApplication.translate("MainWindow", u"[2]", None)) self.labelEggSeed1_7.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.labelEggSeed0_7.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabEgg7), QCoreApplication.translate("MainWindow", u"Egg", None)) self.comboBoxSOSIndex.setItemText(0, QCoreApplication.translate("MainWindow", u"SOS 1", None)) self.comboBoxSOSIndex.setItemText(1, QCoreApplication.translate("MainWindow", u"SOS 2", None)) self.comboBoxSOSIndex.setItemText(2, QCoreApplication.translate("MainWindow", u"SOS 3", None)) self.comboBoxSOSIndex.setItemText(3, QCoreApplication.translate("MainWindow", u"SOS 4", None)) self.groupBoxSOS.setTitle(QCoreApplication.translate("MainWindow", u"SOS RNG", None)) self.pushButtonSOSUpdate.setText(QCoreApplication.translate("MainWindow", u"Update", None)) #if QT_CONFIG(tooltip) self.pushButtonSOSReset.setToolTip(QCoreApplication.translate("MainWindow", u"This should be used after a battle", None)) #endif // QT_CONFIG(tooltip) self.pushButtonSOSReset.setText(QCoreApplication.translate("MainWindow", u"Reset", None)) self.labelSOSInitialSeed.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelSOSCurrentSeed.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelSOSFrame.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.labelSOSChainCount.setText(QCoreApplication.translate("MainWindow", u"Chain Count:", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabSOS), QCoreApplication.translate("MainWindow", u"SOS", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabGen7), QCoreApplication.translate("MainWindow", u"Gen 7", None))