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 Ui_demoView(object): def setupUi(self, demoView): if not demoView.objectName(): demoView.setObjectName(u"demoView") demoView.resize(570, 550) self.verticalLayout_2 = QVBoxLayout(demoView) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.demoViewGroupBox = QGroupBox(demoView) self.demoViewGroupBox.setObjectName(u"demoViewGroupBox") self.demoViewGroupBox.setFlat(True) self.verticalLayout_6 = QVBoxLayout(self.demoViewGroupBox) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(4, 4, 4, 4) self.demoTreeView = QTreeWidget(self.demoViewGroupBox) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, u"Step") self.demoTreeView.setHeaderItem(__qtreewidgetitem) self.demoTreeView.setObjectName(u"demoTreeView") self.verticalLayout_6.addWidget(self.demoTreeView) self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.demoDuplicateBtn = QPushButton(self.demoViewGroupBox) self.demoDuplicateBtn.setObjectName(u"demoDuplicateBtn") self.horizontalLayout_5.addWidget(self.demoDuplicateBtn) self.demoInsertSectionBtn = QPushButton(self.demoViewGroupBox) self.demoInsertSectionBtn.setObjectName(u"demoInsertSectionBtn") self.horizontalLayout_5.addWidget(self.demoInsertSectionBtn) self.demoDeleteBtn = QPushButton(self.demoViewGroupBox) self.demoDeleteBtn.setObjectName(u"demoDeleteBtn") self.horizontalLayout_5.addWidget(self.demoDeleteBtn) self.demoAddStepBtn = QPushButton(self.demoViewGroupBox) self.demoAddStepBtn.setObjectName(u"demoAddStepBtn") self.horizontalLayout_5.addWidget(self.demoAddStepBtn) self.demoOverflowBtn = QToolButton(self.demoViewGroupBox) self.demoOverflowBtn.setObjectName(u"demoOverflowBtn") self.horizontalLayout_5.addWidget(self.demoOverflowBtn) self.verticalLayout_6.addLayout(self.horizontalLayout_5) self.verticalLayout_2.addWidget(self.demoViewGroupBox) self.metadataGroupBox = QGroupBox(demoView) self.metadataGroupBox.setObjectName(u"metadataGroupBox") self.metadataGroupBox.setMaximumSize(QSize(16777215, 300)) self.metadataGroupBox.setFlat(True) self.metadataGroupBox.setCheckable(False) self.verticalLayout_8 = QVBoxLayout(self.metadataGroupBox) self.verticalLayout_8.setObjectName(u"verticalLayout_8") self.verticalLayout_8.setContentsMargins(4, 4, 4, 4) self.dataStack = QStackedWidget(self.metadataGroupBox) self.dataStack.setObjectName(u"dataStack") self.stepDataL = QWidget() self.stepDataL.setObjectName(u"stepDataL") self.verticalLayout_14 = QVBoxLayout(self.stepDataL) self.verticalLayout_14.setObjectName(u"verticalLayout_14") self.metadataTreeWidget = QTreeWidget(self.stepDataL) self.metadataTreeWidget.setObjectName(u"metadataTreeWidget") self.verticalLayout_14.addWidget(self.metadataTreeWidget) self.stepDataBtnL = QHBoxLayout() self.stepDataBtnL.setObjectName(u"stepDataBtnL") self.pushButton_2 = QPushButton(self.stepDataL) self.pushButton_2.setObjectName(u"pushButton_2") self.stepDataBtnL.addWidget(self.pushButton_2) self.pushButton = QPushButton(self.stepDataL) self.pushButton.setObjectName(u"pushButton") self.stepDataBtnL.addWidget(self.pushButton) self.toolButton = QToolButton(self.stepDataL) self.toolButton.setObjectName(u"toolButton") self.stepDataBtnL.addWidget(self.toolButton) self.verticalLayout_14.addLayout(self.stepDataBtnL) self.dataStack.addWidget(self.stepDataL) self.sectDataL = QWidget() self.sectDataL.setObjectName(u"sectDataL") self.verticalLayout_16 = QVBoxLayout(self.sectDataL) self.verticalLayout_16.setObjectName(u"verticalLayout_16") self.sectionDataTreeW = QTreeWidget(self.sectDataL) self.sectionDataTreeW.setObjectName(u"sectionDataTreeW") self.verticalLayout_16.addWidget(self.sectionDataTreeW) self.sectionDataBtnL = QHBoxLayout() self.sectionDataBtnL.setObjectName(u"sectionDataBtnL") self.pushButton_4 = QPushButton(self.sectDataL) self.pushButton_4.setObjectName(u"pushButton_4") self.sectionDataBtnL.addWidget(self.pushButton_4) self.pushButton_3 = QPushButton(self.sectDataL) self.pushButton_3.setObjectName(u"pushButton_3") self.sectionDataBtnL.addWidget(self.pushButton_3) self.pushButton_5 = QPushButton(self.sectDataL) self.pushButton_5.setObjectName(u"pushButton_5") self.sectionDataBtnL.addWidget(self.pushButton_5) self.toolButton_2 = QToolButton(self.sectDataL) self.toolButton_2.setObjectName(u"toolButton_2") self.sectionDataBtnL.addWidget(self.toolButton_2) self.verticalLayout_16.addLayout(self.sectionDataBtnL) self.dataStack.addWidget(self.sectDataL) self.verticalLayout_8.addWidget(self.dataStack) self.verticalLayout_2.addWidget(self.metadataGroupBox) self.retranslateUi(demoView) self.dataStack.setCurrentIndex(1) QMetaObject.connectSlotsByName(demoView) # setupUi def retranslateUi(self, demoView): demoView.setWindowTitle( QCoreApplication.translate("demoView", u"Form", None)) self.demoViewGroupBox.setTitle( QCoreApplication.translate("demoView", u"Demo (None loaded)", None)) ___qtreewidgetitem = self.demoTreeView.headerItem() ___qtreewidgetitem.setText( 2, QCoreApplication.translate("demoView", u"CI", None)) ___qtreewidgetitem.setText( 1, QCoreApplication.translate("demoView", u"TP", None)) self.demoDuplicateBtn.setText( QCoreApplication.translate("demoView", u"Duplicate", None)) self.demoInsertSectionBtn.setText( QCoreApplication.translate("demoView", u"Insert section", None)) self.demoDeleteBtn.setText( QCoreApplication.translate("demoView", u"-", None)) self.demoAddStepBtn.setText( QCoreApplication.translate("demoView", u"+", None)) self.demoOverflowBtn.setText( QCoreApplication.translate("demoView", u"...", None)) self.metadataGroupBox.setTitle( QCoreApplication.translate("demoView", u"Metadata", None)) ___qtreewidgetitem1 = self.metadataTreeWidget.headerItem() ___qtreewidgetitem1.setText( 1, QCoreApplication.translate("demoView", u"Value", None)) ___qtreewidgetitem1.setText( 0, QCoreApplication.translate("demoView", u"Property", None)) self.pushButton_2.setText( QCoreApplication.translate("demoView", u"Set animated", None)) self.pushButton.setText( QCoreApplication.translate("demoView", u"Add highlight", None)) self.toolButton.setText( QCoreApplication.translate("demoView", u"...", None)) ___qtreewidgetitem2 = self.sectionDataTreeW.headerItem() ___qtreewidgetitem2.setText( 1, QCoreApplication.translate("demoView", u"Value", None)) ___qtreewidgetitem2.setText( 0, QCoreApplication.translate("demoView", u"Property", None)) self.pushButton_4.setText( QCoreApplication.translate("demoView", u"Set Animated", None)) self.pushButton_3.setText( QCoreApplication.translate("demoView", u"Set Guided", None)) self.pushButton_5.setText( QCoreApplication.translate("demoView", u"Set Scroll", None)) self.toolButton_2.setText( QCoreApplication.translate("demoView", u"...", None))
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 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 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 Ui_ProjectSettings_UI(object): def setupUi(self, ProjectSettings_UI): if not ProjectSettings_UI.objectName(): ProjectSettings_UI.setObjectName(u"ProjectSettings_UI") ProjectSettings_UI.resize(575, 685) self.gridLayout_3 = QGridLayout(ProjectSettings_UI) self.gridLayout_3.setObjectName(u"gridLayout_3") self.buttonBox = QDialogButtonBox(ProjectSettings_UI) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1) self.tabWidget = QTabWidget(ProjectSettings_UI) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setDocumentMode(True) self.tab = QWidget() self.tab.setObjectName(u"tab") self.gridLayout = QGridLayout(self.tab) self.gridLayout.setObjectName(u"gridLayout") self.previewparams = QPlainTextEdit(self.tab) self.previewparams.setObjectName(u"previewparams") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.previewparams.sizePolicy().hasHeightForWidth()) self.previewparams.setSizePolicy(sizePolicy) self.previewparams.setReadOnly(True) self.gridLayout.addWidget(self.previewparams, 7, 0, 1, 4) self.label_2 = QLabel(self.tab) self.label_2.setObjectName(u"label_2") self.gridLayout.addWidget(self.label_2, 5, 0, 1, 1) self.audio_thumbs = QCheckBox(self.tab) self.audio_thumbs.setObjectName(u"audio_thumbs") self.gridLayout.addWidget(self.audio_thumbs, 5, 2, 1, 1) self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.label_7 = QLabel(self.tab) self.label_7.setObjectName(u"label_7") self.horizontalLayout_2.addWidget(self.label_7) self.video_tracks = QSpinBox(self.tab) self.video_tracks.setObjectName(u"video_tracks") self.horizontalLayout_2.addWidget(self.video_tracks) self.label_8 = QLabel(self.tab) self.label_8.setObjectName(u"label_8") self.horizontalLayout_2.addWidget(self.label_8) self.audio_tracks = QSpinBox(self.tab) self.audio_tracks.setObjectName(u"audio_tracks") self.horizontalLayout_2.addWidget(self.audio_tracks) self.label = QLabel(self.tab) self.label.setObjectName(u"label") self.horizontalLayout_2.addWidget(self.label) self.audio_channels = QComboBox(self.tab) self.audio_channels.addItem("") self.audio_channels.addItem("") self.audio_channels.addItem("") self.audio_channels.setObjectName(u"audio_channels") sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.audio_channels.sizePolicy().hasHeightForWidth()) self.audio_channels.setSizePolicy(sizePolicy1) self.horizontalLayout_2.addWidget(self.audio_channels) self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 4) self.horizontalSpacer = QSpacerItem(229, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout.addItem(self.horizontalSpacer, 5, 3, 1, 1) self.profile_box = QGroupBox(self.tab) self.profile_box.setObjectName(u"profile_box") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.MinimumExpanding) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.profile_box.sizePolicy().hasHeightForWidth()) self.profile_box.setSizePolicy(sizePolicy2) self.profile_box.setFlat(True) self.gridLayout.addWidget(self.profile_box, 3, 0, 1, 4) self.label_4 = QLabel(self.tab) self.label_4.setObjectName(u"label_4") self.gridLayout.addWidget(self.label_4, 0, 0, 1, 4) self.video_thumbs = QCheckBox(self.tab) self.video_thumbs.setObjectName(u"video_thumbs") self.gridLayout.addWidget(self.video_thumbs, 5, 1, 1, 1) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.label_25 = QLabel(self.tab) self.label_25.setObjectName(u"label_25") sizePolicy3 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth( self.label_25.sizePolicy().hasHeightForWidth()) self.label_25.setSizePolicy(sizePolicy3) self.horizontalLayout_4.addWidget(self.label_25) self.preview_profile = KComboBox(self.tab) self.preview_profile.setObjectName(u"preview_profile") sizePolicy1.setHeightForWidth( self.preview_profile.sizePolicy().hasHeightForWidth()) self.preview_profile.setSizePolicy(sizePolicy1) self.horizontalLayout_4.addWidget(self.preview_profile) self.preview_showprofileinfo = QToolButton(self.tab) self.preview_showprofileinfo.setObjectName(u"preview_showprofileinfo") self.preview_showprofileinfo.setCheckable(True) self.horizontalLayout_4.addWidget(self.preview_showprofileinfo) self.preview_manageprofile = QToolButton(self.tab) self.preview_manageprofile.setObjectName(u"preview_manageprofile") self.horizontalLayout_4.addWidget(self.preview_manageprofile) self.gridLayout.addLayout(self.horizontalLayout_4, 6, 0, 1, 4) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.custom_folder = QCheckBox(self.tab) self.custom_folder.setObjectName(u"custom_folder") self.horizontalLayout.addWidget(self.custom_folder) self.project_folder = KUrlRequester(self.tab) self.project_folder.setObjectName(u"project_folder") self.project_folder.setEnabled(False) self.horizontalLayout.addWidget(self.project_folder) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 4) self.same_folder = QCheckBox(self.tab) self.same_folder.setObjectName(u"same_folder") self.gridLayout.addWidget(self.same_folder, 2, 0, 1, 4) self.tabWidget.addTab(self.tab, "") self.label_4.raise_() self.profile_box.raise_() self.label_2.raise_() self.video_thumbs.raise_() self.audio_thumbs.raise_() self.previewparams.raise_() self.same_folder.raise_() self.tab_4 = QWidget() self.tab_4.setObjectName(u"tab_4") self.verticalLayout = QVBoxLayout(self.tab_4) self.verticalLayout.setObjectName(u"verticalLayout") self.enable_proxy = QCheckBox(self.tab_4) self.enable_proxy.setObjectName(u"enable_proxy") self.verticalLayout.addWidget(self.enable_proxy) self.proxy_box = QGroupBox(self.tab_4) self.proxy_box.setObjectName(u"proxy_box") self.proxy_box.setEnabled(False) self.proxy_box.setFlat(True) self.proxy_box.setCheckable(False) self.proxy_box.setChecked(False) self.gridLayout_2 = QGridLayout(self.proxy_box) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setHorizontalSpacing(6) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.l_relPathProxyToOrig = QLabel(self.proxy_box) self.l_relPathProxyToOrig.setObjectName(u"l_relPathProxyToOrig") self.gridLayout_2.addWidget(self.l_relPathProxyToOrig, 10, 1, 1, 1) self.generate_imageproxy = QCheckBox(self.proxy_box) self.generate_imageproxy.setObjectName(u"generate_imageproxy") self.gridLayout_2.addWidget(self.generate_imageproxy, 3, 0, 1, 2) self.l_prefix_proxy = QLabel(self.proxy_box) self.l_prefix_proxy.setObjectName(u"l_prefix_proxy") self.gridLayout_2.addWidget(self.l_prefix_proxy, 11, 1, 1, 1) self.proxy_imagesize = QSpinBox(self.proxy_box) self.proxy_imagesize.setObjectName(u"proxy_imagesize") self.proxy_imagesize.setEnabled(False) self.proxy_imagesize.setMinimum(200) self.proxy_imagesize.setMaximum(100000) self.proxy_imagesize.setValue(800) self.gridLayout_2.addWidget(self.proxy_imagesize, 4, 2, 1, 4) self.label_24 = QLabel(self.proxy_box) self.label_24.setObjectName(u"label_24") sizePolicy3.setHeightForWidth( self.label_24.sizePolicy().hasHeightForWidth()) self.label_24.setSizePolicy(sizePolicy3) self.gridLayout_2.addWidget(self.label_24, 1, 0, 1, 1) self.proxy_minsize = QSpinBox(self.proxy_box) self.proxy_minsize.setObjectName(u"proxy_minsize") self.proxy_minsize.setMaximum(10000) self.proxy_minsize.setValue(1000) self.gridLayout_2.addWidget(self.proxy_minsize, 0, 2, 1, 4) self.l_prefix_clip = QLabel(self.proxy_box) self.l_prefix_clip.setObjectName(u"l_prefix_clip") self.gridLayout_2.addWidget(self.l_prefix_clip, 8, 1, 1, 1) self.proxy_profile = KComboBox(self.proxy_box) self.proxy_profile.setObjectName(u"proxy_profile") sizePolicy1.setHeightForWidth( self.proxy_profile.sizePolicy().hasHeightForWidth()) self.proxy_profile.setSizePolicy(sizePolicy1) self.gridLayout_2.addWidget(self.proxy_profile, 1, 1, 1, 2) self.proxy_showprofileinfo = QToolButton(self.proxy_box) self.proxy_showprofileinfo.setObjectName(u"proxy_showprofileinfo") self.proxy_showprofileinfo.setCheckable(True) self.gridLayout_2.addWidget(self.proxy_showprofileinfo, 1, 4, 1, 1) self.generate_proxy = QCheckBox(self.proxy_box) self.generate_proxy.setObjectName(u"generate_proxy") self.gridLayout_2.addWidget(self.generate_proxy, 0, 0, 1, 2) self.proxyparams = QPlainTextEdit(self.proxy_box) self.proxyparams.setObjectName(u"proxyparams") sizePolicy.setHeightForWidth( self.proxyparams.sizePolicy().hasHeightForWidth()) self.proxyparams.setSizePolicy(sizePolicy) self.proxyparams.setReadOnly(True) self.gridLayout_2.addWidget(self.proxyparams, 2, 0, 1, 6) self.image_label = QLabel(self.proxy_box) self.image_label.setObjectName(u"image_label") self.image_label.setEnabled(False) self.gridLayout_2.addWidget(self.image_label, 4, 0, 1, 2) self.le_relPathProxyToOrig = QLineEdit(self.proxy_box) self.le_relPathProxyToOrig.setObjectName(u"le_relPathProxyToOrig") self.le_relPathProxyToOrig.setEnabled(False) self.gridLayout_2.addWidget(self.le_relPathProxyToOrig, 10, 3, 1, 1) self.le_prefix_proxy = QLineEdit(self.proxy_box) self.le_prefix_proxy.setObjectName(u"le_prefix_proxy") self.le_prefix_proxy.setEnabled(False) self.gridLayout_2.addWidget(self.le_prefix_proxy, 11, 3, 1, 1) self.l_suffix_proxy = QLabel(self.proxy_box) self.l_suffix_proxy.setObjectName(u"l_suffix_proxy") self.gridLayout_2.addWidget(self.l_suffix_proxy, 12, 1, 1, 1) self.le_prefix_clip = QLineEdit(self.proxy_box) self.le_prefix_clip.setObjectName(u"le_prefix_clip") self.le_prefix_clip.setEnabled(False) self.gridLayout_2.addWidget(self.le_prefix_clip, 8, 3, 1, 1) self.le_suffix_proxy = QLineEdit(self.proxy_box) self.le_suffix_proxy.setObjectName(u"le_suffix_proxy") self.le_suffix_proxy.setEnabled(False) self.gridLayout_2.addWidget(self.le_suffix_proxy, 12, 3, 1, 1) self.proxy_imageminsize = QSpinBox(self.proxy_box) self.proxy_imageminsize.setObjectName(u"proxy_imageminsize") self.proxy_imageminsize.setMinimum(500) self.proxy_imageminsize.setMaximum(100000) self.proxy_imageminsize.setValue(2000) self.gridLayout_2.addWidget(self.proxy_imageminsize, 3, 2, 1, 4) self.l_suffix_clip = QLabel(self.proxy_box) self.l_suffix_clip.setObjectName(u"l_suffix_clip") self.gridLayout_2.addWidget(self.l_suffix_clip, 9, 1, 1, 1) self.l_relPathOrigToProxy = QLabel(self.proxy_box) self.l_relPathOrigToProxy.setObjectName(u"l_relPathOrigToProxy") self.gridLayout_2.addWidget(self.l_relPathOrigToProxy, 7, 1, 1, 1) self.le_relPathOrigToProxy = QLineEdit(self.proxy_box) self.le_relPathOrigToProxy.setObjectName(u"le_relPathOrigToProxy") self.le_relPathOrigToProxy.setEnabled(False) self.gridLayout_2.addWidget(self.le_relPathOrigToProxy, 7, 3, 1, 1) self.external_proxy_profile = QComboBox(self.proxy_box) self.external_proxy_profile.setObjectName(u"external_proxy_profile") self.gridLayout_2.addWidget(self.external_proxy_profile, 6, 1, 1, 5) self.proxy_resize = QSpinBox(self.proxy_box) self.proxy_resize.setObjectName(u"proxy_resize") self.proxy_resize.setMinimum(200) self.proxy_resize.setMaximum(100000) self.gridLayout_2.addWidget(self.proxy_resize, 5, 2, 1, 4) self.le_suffix_clip = QLineEdit(self.proxy_box) self.le_suffix_clip.setObjectName(u"le_suffix_clip") self.le_suffix_clip.setEnabled(False) self.gridLayout_2.addWidget(self.le_suffix_clip, 9, 3, 1, 1) self.external_proxy = QCheckBox(self.proxy_box) self.external_proxy.setObjectName(u"external_proxy") self.gridLayout_2.addWidget(self.external_proxy, 6, 0, 1, 1) self.checkProxy = QToolButton(self.proxy_box) self.checkProxy.setObjectName(u"checkProxy") self.gridLayout_2.addWidget(self.checkProxy, 1, 3, 1, 1) self.label_3 = QLabel(self.proxy_box) self.label_3.setObjectName(u"label_3") self.gridLayout_2.addWidget(self.label_3, 5, 0, 1, 1) self.proxy_manageprofile = QToolButton(self.proxy_box) self.proxy_manageprofile.setObjectName(u"proxy_manageprofile") self.gridLayout_2.addWidget(self.proxy_manageprofile, 1, 5, 1, 1) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout_2.addItem(self.verticalSpacer, 13, 1, 1, 1) self.verticalLayout.addWidget(self.proxy_box) self.tabWidget.addTab(self.tab_4, "") self.tab_3 = QWidget() self.tab_3.setObjectName(u"tab_3") self.gridLayout_6 = QGridLayout(self.tab_3) self.gridLayout_6.setObjectName(u"gridLayout_6") self.metadata_list = QTreeWidget(self.tab_3) self.metadata_list.setObjectName(u"metadata_list") self.metadata_list.setAlternatingRowColors(True) self.metadata_list.setRootIsDecorated(False) self.metadata_list.setAllColumnsShowFocus(True) self.metadata_list.setColumnCount(2) self.metadata_list.header().setVisible(False) self.gridLayout_6.addWidget(self.metadata_list, 0, 0, 1, 1) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.add_metadata = QToolButton(self.tab_3) self.add_metadata.setObjectName(u"add_metadata") self.horizontalLayout_3.addWidget(self.add_metadata) self.delete_metadata = QToolButton(self.tab_3) self.delete_metadata.setObjectName(u"delete_metadata") self.horizontalLayout_3.addWidget(self.delete_metadata) self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_3.addItem(self.horizontalSpacer_3) self.gridLayout_6.addLayout(self.horizontalLayout_3, 1, 0, 1, 1) self.tabWidget.addTab(self.tab_3, "") self.tab_2 = QWidget() self.tab_2.setObjectName(u"tab_2") self.gridLayout_4 = QGridLayout(self.tab_2) self.gridLayout_4.setObjectName(u"gridLayout_4") self.fonts_list = QListWidget(self.tab_2) self.fonts_list.setObjectName(u"fonts_list") self.fonts_list.setAlternatingRowColors(True) self.gridLayout_4.addWidget(self.fonts_list, 5, 0, 1, 5) self.files_list = QTreeWidget(self.tab_2) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, u"1") self.files_list.setHeaderItem(__qtreewidgetitem) self.files_list.setObjectName(u"files_list") self.files_list.setAlternatingRowColors(True) self.files_list.setRootIsDecorated(False) self.files_list.setItemsExpandable(False) self.files_list.setHeaderHidden(True) self.files_list.setExpandsOnDoubleClick(False) self.gridLayout_4.addWidget(self.files_list, 3, 0, 1, 5) self.label_12 = QLabel(self.tab_2) self.label_12.setObjectName(u"label_12") self.gridLayout_4.addWidget(self.label_12, 0, 0, 1, 2) self.used_count = QLabel(self.tab_2) self.used_count.setObjectName(u"used_count") self.gridLayout_4.addWidget(self.used_count, 0, 2, 1, 1) self.used_size = QLabel(self.tab_2) self.used_size.setObjectName(u"used_size") self.gridLayout_4.addWidget(self.used_size, 0, 3, 1, 1) self.label_6 = QLabel(self.tab_2) self.label_6.setObjectName(u"label_6") self.gridLayout_4.addWidget(self.label_6, 1, 0, 1, 1) self.unused_count = QLabel(self.tab_2) self.unused_count.setObjectName(u"unused_count") self.gridLayout_4.addWidget(self.unused_count, 1, 2, 1, 1) self.unused_size = QLabel(self.tab_2) self.unused_size.setObjectName(u"unused_size") self.gridLayout_4.addWidget(self.unused_size, 1, 3, 1, 1) self.delete_unused = QPushButton(self.tab_2) self.delete_unused.setObjectName(u"delete_unused") self.gridLayout_4.addWidget(self.delete_unused, 1, 4, 1, 1) self.list_search = KTreeWidgetSearchLine(self.tab_2) self.list_search.setObjectName(u"list_search") self.gridLayout_4.addWidget(self.list_search, 2, 3, 1, 2) self.label_13 = QLabel(self.tab_2) self.label_13.setObjectName(u"label_13") self.gridLayout_4.addWidget(self.label_13, 2, 0, 1, 1) self.label_fonts = QLabel(self.tab_2) self.label_fonts.setObjectName(u"label_fonts") self.gridLayout_4.addWidget(self.label_fonts, 4, 0, 1, 1) self.button_export = QPushButton(self.tab_2) self.button_export.setObjectName(u"button_export") self.gridLayout_4.addWidget(self.button_export, 6, 0, 1, 2) self.files_count = QLabel(self.tab_2) self.files_count.setObjectName(u"files_count") self.gridLayout_4.addWidget(self.files_count, 2, 2, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.gridLayout_3.addWidget(self.tabWidget, 0, 0, 1, 1) self.retranslateUi(ProjectSettings_UI) self.buttonBox.accepted.connect(ProjectSettings_UI.accept) self.buttonBox.rejected.connect(ProjectSettings_UI.reject) self.custom_folder.toggled.connect(self.project_folder.setEnabled) self.enable_proxy.toggled.connect(self.proxy_box.setEnabled) self.external_proxy.toggled.connect( self.external_proxy_profile.setEnabled) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(ProjectSettings_UI) # setupUi def retranslateUi(self, ProjectSettings_UI): ProjectSettings_UI.setWindowTitle( QCoreApplication.translate("ProjectSettings_UI", u"Project Settings", None)) self.label_2.setText( QCoreApplication.translate("ProjectSettings_UI", u"Thumbnails:", None)) self.audio_thumbs.setText( QCoreApplication.translate("ProjectSettings_UI", u"Audio", None)) self.label_7.setText( QCoreApplication.translate("ProjectSettings_UI", u"Video tracks:", None)) self.label_8.setText( QCoreApplication.translate("ProjectSettings_UI", u"Audio tracks:", None)) self.label.setText( QCoreApplication.translate("ProjectSettings_UI", u"Audio channels:", None)) self.audio_channels.setItemText( 0, QCoreApplication.translate("ProjectSettings_UI", u"2 Channels (Stereo)", None)) self.audio_channels.setItemText( 1, QCoreApplication.translate("ProjectSettings_UI", u"4 Channels", None)) self.audio_channels.setItemText( 2, QCoreApplication.translate("ProjectSettings_UI", u"6 Channels", None)) self.label_4.setText( QCoreApplication.translate( "ProjectSettings_UI", u"Project folder to store proxy clips, thumbnails, previews", None)) self.video_thumbs.setText( QCoreApplication.translate("ProjectSettings_UI", u"Video", None)) self.label_25.setText( QCoreApplication.translate("ProjectSettings_UI", u"Preview profile:", None)) self.preview_showprofileinfo.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.preview_manageprofile.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.custom_folder.setText( QCoreApplication.translate("ProjectSettings_UI", u"Custom project folder:", None)) self.same_folder.setText( QCoreApplication.translate( "ProjectSettings_UI", u"Use parent folder of the project file as project folder", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab), QCoreApplication.translate("ProjectSettings_UI", u"Settings", None)) self.enable_proxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Enable proxy clips", None)) self.l_relPathProxyToOrig.setText( QCoreApplication.translate("ProjectSettings_UI", u"Relative path from proxy to clip:", None)) self.generate_imageproxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Generate for images larger than", None)) self.l_prefix_proxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Prefix of proxy:", None)) self.proxy_imagesize.setSuffix( QCoreApplication.translate("ProjectSettings_UI", u"pixels", None)) self.label_24.setText( QCoreApplication.translate("ProjectSettings_UI", u"Encoding profile:", None)) self.proxy_minsize.setSuffix( QCoreApplication.translate("ProjectSettings_UI", u"pixels", None)) self.l_prefix_clip.setText( QCoreApplication.translate("ProjectSettings_UI", u"Prefix of clip:", None)) self.proxy_showprofileinfo.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.generate_proxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Generate for videos larger than", None)) self.image_label.setText( QCoreApplication.translate("ProjectSettings_UI", u"Proxy image size", None)) self.l_suffix_proxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Suffix of proxy:", None)) self.proxy_imageminsize.setSuffix( QCoreApplication.translate("ProjectSettings_UI", u"pixels", None)) self.l_suffix_clip.setText( QCoreApplication.translate("ProjectSettings_UI", u"Suffix of clip:", None)) self.l_relPathOrigToProxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Relative path from clip to proxy:", None)) self.proxy_resize.setSuffix( QCoreApplication.translate("ProjectSettings_UI", u"pixels", None)) self.external_proxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"Use external proxy clips", None)) self.checkProxy.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.label_3.setText( QCoreApplication.translate("ProjectSettings_UI", u"Proxy video resize (width)", None)) self.proxy_manageprofile.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab_4), QCoreApplication.translate("ProjectSettings_UI", u"Proxy", None)) ___qtreewidgetitem = self.metadata_list.headerItem() ___qtreewidgetitem.setText( 1, QCoreApplication.translate("ProjectSettings_UI", u"2", None)) ___qtreewidgetitem.setText( 0, QCoreApplication.translate("ProjectSettings_UI", u"1", None)) self.add_metadata.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.delete_metadata.setText( QCoreApplication.translate("ProjectSettings_UI", u"...", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("ProjectSettings_UI", u"Metadata", None)) self.label_12.setText( QCoreApplication.translate("ProjectSettings_UI", u"Clips used in project:", None)) self.used_count.setText("") self.used_size.setText("") self.label_6.setText( QCoreApplication.translate("ProjectSettings_UI", u"Unused clips:", None)) self.unused_count.setText("") self.unused_size.setText("") self.delete_unused.setText( QCoreApplication.translate("ProjectSettings_UI", u"Delete files", None)) self.label_13.setText( QCoreApplication.translate("ProjectSettings_UI", u"Project files:", None)) self.label_fonts.setText( QCoreApplication.translate("ProjectSettings_UI", u"Fonts", None)) self.button_export.setText( QCoreApplication.translate("ProjectSettings_UI", u"Plain Text Export...", None)) self.files_count.setText("") self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("ProjectSettings_UI", u"Project Files", None))
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 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_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(688, 530) Dialog.setMinimumSize(QSize(600, 0)) Dialog.setMaximumSize(QSize(1000000, 16777215)) self.verticalLayout = QVBoxLayout(Dialog) self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.verticalFrame = QFrame(Dialog) self.verticalFrame.setObjectName(u"verticalFrame") self.verticalFrame.setMaximumSize(QSize(250, 16777215)) self.verticalLayout_2 = QVBoxLayout(self.verticalFrame) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.label = QLabel(self.verticalFrame) self.label.setObjectName(u"label") self.verticalLayout_2.addWidget(self.label) self.treeWidget = QTreeWidget(self.verticalFrame) QTreeWidgetItem(self.treeWidget) QTreeWidgetItem(self.treeWidget) QTreeWidgetItem(self.treeWidget) self.treeWidget.setObjectName(u"treeWidget") font = QFont() font.setFamilies([u"Segoe UI"]) font.setPointSize(10) self.treeWidget.setFont(font) self.treeWidget.setFrameShape(QFrame.VLine) self.treeWidget.setFrameShadow(QFrame.Plain) self.treeWidget.setTabKeyNavigation(True) self.treeWidget.setAlternatingRowColors(False) self.verticalLayout_2.addWidget(self.treeWidget) self.horizontalLayout.addWidget(self.verticalFrame) self.line = QFrame(Dialog) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.VLine) self.line.setFrameShadow(QFrame.Sunken) self.horizontalLayout.addWidget(self.line) self.stackedWidget = QStackedWidget(Dialog) self.stackedWidget.setObjectName(u"stackedWidget") self.page = QWidget() self.page.setObjectName(u"page") self.verticalLayout_3 = QVBoxLayout(self.page) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.groupBox = QGroupBox(self.page) self.groupBox.setObjectName(u"groupBox") self.formLayout_4 = QFormLayout(self.groupBox) self.formLayout_4.setObjectName(u"formLayout_4") self.label_2 = QLabel(self.groupBox) self.label_2.setObjectName(u"label_2") self.formLayout_4.setWidget(0, QFormLayout.LabelRole, self.label_2) self.comboBox = QComboBox(self.groupBox) self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.setObjectName(u"comboBox") self.formLayout_4.setWidget(0, QFormLayout.FieldRole, self.comboBox) self.verticalLayout_3.addWidget(self.groupBox) self.groupBox_2 = QGroupBox(self.page) self.groupBox_2.setObjectName(u"groupBox_2") self.formLayout_3 = QFormLayout(self.groupBox_2) self.formLayout_3.setObjectName(u"formLayout_3") self.label_3 = QLabel(self.groupBox_2) self.label_3.setObjectName(u"label_3") self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.label_3) self.spinBox = QSpinBox(self.groupBox_2) self.spinBox.setObjectName(u"spinBox") self.spinBox.setValue(11) self.formLayout_3.setWidget(1, QFormLayout.FieldRole, self.spinBox) self.label_4 = QLabel(self.groupBox_2) self.label_4.setObjectName(u"label_4") self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_4) self.fontComboBox = QFontComboBox(self.groupBox_2) self.fontComboBox.setObjectName(u"fontComboBox") self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.fontComboBox) self.verticalLayout_3.addWidget(self.groupBox_2) self.stackedWidget.addWidget(self.page) self.page_2 = QWidget() self.page_2.setObjectName(u"page_2") self.verticalLayout_5 = QVBoxLayout(self.page_2) self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.verticalLayout_4 = QVBoxLayout() self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_5.addLayout(self.verticalLayout_4) self.stackedWidget.addWidget(self.page_2) self.horizontalLayout.addWidget(self.stackedWidget) self.verticalLayout.addLayout(self.horizontalLayout) self.buttonBox = QDialogButtonBox(Dialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Apply | QDialogButtonBox.Close | QDialogButtonBox.Save) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) self.stackedWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Dialog", None)) self.label.setText( QCoreApplication.translate("Dialog", u"Preferences", None)) ___qtreewidgetitem = self.treeWidget.headerItem() ___qtreewidgetitem.setText( 0, QCoreApplication.translate("Dialog", u"General", None)) __sortingEnabled = self.treeWidget.isSortingEnabled() self.treeWidget.setSortingEnabled(False) ___qtreewidgetitem1 = self.treeWidget.topLevelItem(0) ___qtreewidgetitem1.setText( 0, QCoreApplication.translate("Dialog", u"Appearance", None)) ___qtreewidgetitem2 = self.treeWidget.topLevelItem(1) ___qtreewidgetitem2.setText( 0, QCoreApplication.translate("Dialog", u"Behavior", None)) ___qtreewidgetitem3 = self.treeWidget.topLevelItem(2) ___qtreewidgetitem3.setText( 0, QCoreApplication.translate("Dialog", u"Advanced", None)) self.treeWidget.setSortingEnabled(__sortingEnabled) self.groupBox.setTitle( QCoreApplication.translate("Dialog", u"Theme", None)) self.label_2.setText( QCoreApplication.translate("Dialog", u"Window style", None)) self.comboBox.setItemText( 0, QCoreApplication.translate("Dialog", u"Native", None)) self.comboBox.setItemText( 1, QCoreApplication.translate("Dialog", u"Fusion", None)) self.comboBox.setItemText( 2, QCoreApplication.translate("Dialog", u"Fusion dark", None)) self.groupBox_2.setTitle( QCoreApplication.translate("Dialog", u"Accessibility", None)) self.label_3.setText( QCoreApplication.translate("Dialog", u"Font size", None)) self.label_4.setText( QCoreApplication.translate("Dialog", u"Font", None))
class DataLoaded(QWidget): def __init__(self, parent: QWidget | None) -> None: QWidget.__init__(self, parent) UiLoad().loadUi("steps.ui", self, parent) uifile = QDir(os.path.dirname(os.path.realpath(__file__))) def setupUi(self, dataLoaded): if not dataLoaded.objectName(): dataLoaded.setObjectName("dataLoaded") dataLoaded.resize(400, 301) self.verticalLayout = QVBoxLayout(dataLoaded) self.verticalLayout.setObjectName("verticalLayout") self.assetsTabs = QTabWidget(dataLoaded) self.assetsTabs.setObjectName("assetsTabs") self.assetsTabs.setMinimumSize(QSize(362, 0)) self.assetsTabs.setMaximumSize(QSize(410, 16777215)) self.assetsTabs.setMouseTracking(False) self.assetsTabs.setLayoutDirection(Qt.LeftToRight) self.assetsTabs.setAutoFillBackground(False) self.assetsTabs.setTabPosition(QTabWidget.North) self.assetsTabs.setTabShape(QTabWidget.Rounded) self.assetsTabs.setUsesScrollButtons(False) self.assetsTabs.setDocumentMode(False) self.assetsTabs.setTabsClosable(False) self.assetsTabs.setMovable(False) self.assetsTabs.setTabBarAutoHide(False) self.demoList = QWidget() self.demoList.setObjectName("demoList") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.demoList.sizePolicy().hasHeightForWidth()) self.demoList.setSizePolicy(sizePolicy) self.verticalLayout_11 = QVBoxLayout(self.demoList) self.verticalLayout_11.setObjectName("verticalLayout_11") self.verticalLayout_12 = QVBoxLayout() self.verticalLayout_12.setObjectName("verticalLayout_12") self.horizontalLayout_10 = QHBoxLayout() self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.browseDemoBtn = QPushButton(self.demoList) self.browseDemoBtn.setObjectName("browseDemoBtn") self.horizontalLayout_10.addWidget(self.browseDemoBtn) self.browseScriptBtn = QPushButton(self.demoList) self.browseScriptBtn.setObjectName("browseScriptBtn") self.horizontalLayout_10.addWidget(self.browseScriptBtn) self.browseAudioBtn = QPushButton(self.demoList) self.browseAudioBtn.setObjectName("browseAudioBtn") self.horizontalLayout_10.addWidget(self.browseAudioBtn) self.verticalLayout_12.addLayout(self.horizontalLayout_10) self.verticalLayout_11.addLayout(self.verticalLayout_12) self.demoListTreeWidget = QTreeWidget(self.demoList) self.demoListTreeWidget.setObjectName("demoListTreeWidget") self.verticalLayout_11.addWidget(self.demoListTreeWidget) self.horizontalLayout_11 = QHBoxLayout() self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.infoBtn = QPushButton(self.demoList) self.infoBtn.setObjectName("infoBtn") self.horizontalLayout_11.addWidget(self.infoBtn) self.loadScriptBtn = QPushButton(self.demoList) self.loadScriptBtn.setObjectName("loadScriptBtn") self.horizontalLayout_11.addWidget(self.loadScriptBtn) self.loadAudioBtn = QPushButton(self.demoList) self.loadAudioBtn.setObjectName("loadAudioBtn") self.horizontalLayout_11.addWidget(self.loadAudioBtn) self.removeDemoBtn = QPushButton(self.demoList) self.removeDemoBtn.setObjectName("removeDemoBtn") self.horizontalLayout_11.addWidget(self.removeDemoBtn) self.addDemoBtn = QPushButton(self.demoList) self.addDemoBtn.setObjectName("addDemoBtn") self.horizontalLayout_11.addWidget(self.addDemoBtn) self.verticalLayout_11.addLayout(self.horizontalLayout_11) self.assetsTabs.addTab(self.demoList, "") self.scriptOverviewTab = QWidget() self.scriptOverviewTab.setObjectName("scriptOverviewTab") self.verticalLayout_13 = QVBoxLayout(self.scriptOverviewTab) self.verticalLayout_13.setObjectName("verticalLayout_13") self.scriptListTreeWidget = QListWidget(self.scriptOverviewTab) self.scriptListTreeWidget.setObjectName("scriptListTreeWidget") self.verticalLayout_13.addWidget(self.scriptListTreeWidget) self.assetsTabs.addTab(self.scriptOverviewTab, "") self.audioOverviewTab = QWidget() self.audioOverviewTab.setObjectName("audioOverviewTab") self.verticalLayout_15 = QVBoxLayout(self.audioOverviewTab) self.verticalLayout_15.setObjectName("verticalLayout_15") self.audioListTreeWidget = QListWidget(self.audioOverviewTab) self.audioListTreeWidget.setObjectName("audioListTreeWidget") self.verticalLayout_15.addWidget(self.audioListTreeWidget) self.assetsTabs.addTab(self.audioOverviewTab, "") self.verticalLayout.addWidget(self.assetsTabs) self.retranslateUi(dataLoaded) self.assetsTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(dataLoaded) # setupUi def retranslateUi(self, dataLoaded): dataLoaded.setWindowTitle( QCoreApplication.translate(b"dataLoaded", b"Form", None)) self.browseDemoBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Demo", None)) self.browseScriptBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Script", None)) self.browseAudioBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Audio", None)) ___qtreewidgetitem = self.demoListTreeWidget.headerItem() ___qtreewidgetitem.setText( 2, QCoreApplication.translate(b"dataLoaded", b"Script", None)) ___qtreewidgetitem.setText( 1, QCoreApplication.translate(b"dataLoaded", b"Audio", None)) ___qtreewidgetitem.setText( 0, QCoreApplication.translate(b"dataLoaded", b"Demo", None)) self.infoBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Info", None)) self.loadScriptBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Load Script", None)) self.loadAudioBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Load audio", None)) self.removeDemoBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Remove", None)) self.addDemoBtn.setText( QCoreApplication.translate(b"dataLoaded", b"Add Demo", None)) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.demoList), QCoreApplication.translate(b"dataLoaded", b"Demo", None)) #if QT_CONFIG(tooltip) self.assetsTabs.setTabToolTip( self.assetsTabs.indexOf(self.demoList), QCoreApplication.translate(b"dataLoaded", b"Demo information", None)) #endif // QT_CONFIG(tooltip) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.scriptOverviewTab), QCoreApplication.translate(b"dataLoaded", b"Script", None)) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.audioOverviewTab), QCoreApplication.translate(b"dataLoaded", b"Audio", None))
class Ui_Form(object): def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(529, 777) self.verticalLayout = QVBoxLayout(Form) self.verticalLayout.setObjectName(u"verticalLayout") self.stepsLayout = QVBoxLayout() self.stepsLayout.setSpacing(10) self.stepsLayout.setObjectName(u"stepsLayout") self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize) self.stepsLayout.setContentsMargins(0, 0, 0, 0) self.assetsTabs = QTabWidget(Form) self.assetsTabs.setObjectName(u"assetsTabs") self.assetsTabs.setMinimumSize(QSize(362, 0)) self.assetsTabs.setMaximumSize(QSize(410, 16777215)) self.assetsTabs.setMouseTracking(False) self.assetsTabs.setLayoutDirection(Qt.LeftToRight) self.assetsTabs.setAutoFillBackground(False) self.assetsTabs.setTabPosition(QTabWidget.North) self.assetsTabs.setTabShape(QTabWidget.Rounded) self.assetsTabs.setUsesScrollButtons(False) self.assetsTabs.setDocumentMode(False) self.assetsTabs.setTabsClosable(False) self.assetsTabs.setMovable(False) self.assetsTabs.setTabBarAutoHide(False) self.demoList = QWidget() self.demoList.setObjectName(u"demoList") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.demoList.sizePolicy().hasHeightForWidth()) self.demoList.setSizePolicy(sizePolicy) self.verticalLayout_11 = QVBoxLayout(self.demoList) self.verticalLayout_11.setObjectName(u"verticalLayout_11") self.verticalLayout_12 = QVBoxLayout() self.verticalLayout_12.setObjectName(u"verticalLayout_12") self.horizontalLayout_10 = QHBoxLayout() self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.browseDemoBtn = QPushButton(self.demoList) self.browseDemoBtn.setObjectName(u"browseDemoBtn") self.horizontalLayout_10.addWidget(self.browseDemoBtn) self.browseScriptBtn = QPushButton(self.demoList) self.browseScriptBtn.setObjectName(u"browseScriptBtn") self.horizontalLayout_10.addWidget(self.browseScriptBtn) self.browseAudioBtn = QPushButton(self.demoList) self.browseAudioBtn.setObjectName(u"browseAudioBtn") self.horizontalLayout_10.addWidget(self.browseAudioBtn) self.verticalLayout_12.addLayout(self.horizontalLayout_10) self.verticalLayout_11.addLayout(self.verticalLayout_12) self.demoListTreeWidget = QTreeWidget(self.demoList) self.demoListTreeWidget.setObjectName(u"demoListTreeWidget") self.verticalLayout_11.addWidget(self.demoListTreeWidget) self.horizontalLayout_11 = QHBoxLayout() self.horizontalLayout_11.setObjectName(u"horizontalLayout_11") self.infoBtn = QPushButton(self.demoList) self.infoBtn.setObjectName(u"infoBtn") self.horizontalLayout_11.addWidget(self.infoBtn) self.loadScriptBtn = QPushButton(self.demoList) self.loadScriptBtn.setObjectName(u"loadScriptBtn") self.horizontalLayout_11.addWidget(self.loadScriptBtn) self.loadAudioBtn = QPushButton(self.demoList) self.loadAudioBtn.setObjectName(u"loadAudioBtn") self.horizontalLayout_11.addWidget(self.loadAudioBtn) self.removeDemoBtn = QPushButton(self.demoList) self.removeDemoBtn.setObjectName(u"removeDemoBtn") self.horizontalLayout_11.addWidget(self.removeDemoBtn) self.addDemoBtn = QPushButton(self.demoList) self.addDemoBtn.setObjectName(u"addDemoBtn") self.horizontalLayout_11.addWidget(self.addDemoBtn) self.verticalLayout_11.addLayout(self.horizontalLayout_11) self.assetsTabs.addTab(self.demoList, "") self.scriptOverviewTab = QWidget() self.scriptOverviewTab.setObjectName(u"scriptOverviewTab") self.verticalLayout_13 = QVBoxLayout(self.scriptOverviewTab) self.verticalLayout_13.setObjectName(u"verticalLayout_13") self.scriptListTreeWidget = QListWidget(self.scriptOverviewTab) self.scriptListTreeWidget.setObjectName(u"scriptListTreeWidget") self.verticalLayout_13.addWidget(self.scriptListTreeWidget) self.assetsTabs.addTab(self.scriptOverviewTab, "") self.audioOverviewTab = QWidget() self.audioOverviewTab.setObjectName(u"audioOverviewTab") self.verticalLayout_15 = QVBoxLayout(self.audioOverviewTab) self.verticalLayout_15.setObjectName(u"verticalLayout_15") self.audioListTreeWidget = QListWidget(self.audioOverviewTab) self.audioListTreeWidget.setObjectName(u"audioListTreeWidget") self.verticalLayout_15.addWidget(self.audioListTreeWidget) self.assetsTabs.addTab(self.audioOverviewTab, "") self.stepsLayout.addWidget(self.assetsTabs) 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.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.stepsLayout.addWidget(self.opsTabs) self.verticalLayout.addLayout(self.stepsLayout) self.retranslateUi(Form) self.assetsTabs.setCurrentIndex(0) self.opsTabs.setCurrentIndex(1) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, Form): Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None)) self.browseDemoBtn.setText( QCoreApplication.translate("Form", u"Demo", None)) self.browseScriptBtn.setText( QCoreApplication.translate("Form", u"Script", None)) self.browseAudioBtn.setText( QCoreApplication.translate("Form", u"Audio", None)) ___qtreewidgetitem = self.demoListTreeWidget.headerItem() ___qtreewidgetitem.setText( 2, QCoreApplication.translate("Form", u"Script", None)) ___qtreewidgetitem.setText( 1, QCoreApplication.translate("Form", u"Audio", None)) ___qtreewidgetitem.setText( 0, QCoreApplication.translate("Form", u"Demo", None)) self.infoBtn.setText(QCoreApplication.translate("Form", u"Info", None)) self.loadScriptBtn.setText( QCoreApplication.translate("Form", u"Load Script", None)) self.loadAudioBtn.setText( QCoreApplication.translate("Form", u"Load audio", None)) self.removeDemoBtn.setText( QCoreApplication.translate("Form", u"Remove", None)) self.addDemoBtn.setText( QCoreApplication.translate("Form", u"Add Demo", None)) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.demoList), QCoreApplication.translate("Form", u"Demo", None)) #if QT_CONFIG(tooltip) self.assetsTabs.setTabToolTip( self.assetsTabs.indexOf(self.demoList), QCoreApplication.translate("Form", u"Demo information", None)) #endif // QT_CONFIG(tooltip) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.scriptOverviewTab), QCoreApplication.translate("Form", u"Script", None)) self.assetsTabs.setTabText( self.assetsTabs.indexOf(self.audioOverviewTab), QCoreApplication.translate("Form", u"Audio", None)) ___qtreewidgetitem1 = self.stepsTreeWidget.headerItem() ___qtreewidgetitem1.setText( 2, QCoreApplication.translate("Form", u"Target", None)) ___qtreewidgetitem1.setText( 1, QCoreApplication.translate("Form", u"Operation", None)) ___qtreewidgetitem1.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))