def __init__(self, program: Program): super().__init__() AppGlobals.Instance().onChipOpened.connect(self.CheckForProgram) AppGlobals.Instance().onChipModified.connect(self.CheckForProgram) self.program = program self.modified = False self.codeEditor = CodeTextEditor() layout = QHBoxLayout() self.setLayout(layout) self._programNameField = QLineEdit(program.name) self._programNameField.textChanged.connect(self.UpdateProgramName) self._parameterEditor = ParameterEditor(program) self._parameterEditor.onParametersChanged.connect(self.ProgramEdited) programNameLabel = QLabel("Name:") sideLayout = QVBoxLayout() sideLayout.addWidget(programNameLabel) sideLayout.addWidget(self._programNameField) sideLayout.addWidget(self._parameterEditor) layout.addLayout(sideLayout, stretch=0) layout.addWidget(self.codeEditor, stretch=1) self.codeEditor.SetCode(self.program.script) self.codeEditor.codeChanged.connect(self.ProgramEdited)
def initUI(self): self.cam = CamImage() self.start_button = QPushButton("Start") self.quit_button = QPushButton("Quit") controls = ControlWidget() self.combo = QComboBox(self) for it in self.MainProcess.list_of_filters: self.combo.addItem(it[0]) hbox = QHBoxLayout() hbox.addWidget(controls) hbox.addStretch(1) hbuttons = QHBoxLayout() hbuttons.addWidget(self.combo) hbuttons.addWidget(self.start_button) hbuttons.addWidget(self.quit_button) vbutton = QVBoxLayout() vbutton.addLayout(hbuttons) vbutton.addWidget(self.fps_label) hbox.addLayout(vbutton) vbox = QVBoxLayout() vbox.addWidget(self.cam) vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.setGeometry(300, 300, 300, 150) self.setWindowTitle('Buttons') self.show()
def __init__(self): super(MainWindow, self).__init__() self.setWindowTitle("My App") layout1 = QHBoxLayout() layout2 = QVBoxLayout() layout3 = QVBoxLayout() layout2.addWidget(Color("red")) layout2.addWidget(Color("yellow")) layout2.addWidget(Color("purple")) layout1.addLayout(layout2) layout1.addWidget(Color('green')) layout3.addWidget(Color("red")) layout3.addWidget(Color("purple")) layout1.addLayout(layout3) widget = QWidget() widget.setLayout(layout1) self.setCentralWidget(widget)
def __init__(self, parent, persepolis_setting): super().__init__(parent) self.persepolis_setting = persepolis_setting # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) # set size self.resize(QSize(400, 80)) self.setFixedWidth(400) # show this widget as ToolTip widget self.setWindowFlags(Qt.ToolTip) # find bottom right position bottom_right_screen = QDesktopWidget().availableGeometry().bottomRight( ) bottom_right_notification = QRect(QPoint(0, 0), QSize(410, 120)) bottom_right_notification.moveBottomRight(bottom_right_screen) self.move(bottom_right_notification.topLeft()) # get persepolis icon path icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' notification_horizontalLayout = QHBoxLayout(self) # persepolis icon svgWidget = QtSvg.QSvgWidget(':/persepolis.svg') svgWidget.setFixedSize(QSize(64, 64)) notification_horizontalLayout.addWidget(svgWidget) notification_verticalLayout = QVBoxLayout() # 2 labels for notification messages self.label1 = QLabel(self) self.label1.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.label1.setStyleSheet("font-weight: bold") self.label1.setWordWrap(True) self.label2 = QLabel(self) self.label2.setWordWrap(True) self.label2.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) notification_verticalLayout.addWidget(self.label1) notification_verticalLayout.addWidget(self.label2) notification_horizontalLayout.addLayout(notification_verticalLayout)
class ValidationTable(QGroupBox): table_headers = ["Validator", "Group", "Field", "Value", "Operator"] def __init__(self, file_type): super().__init__(file_type) # switch to track if we are expecting the input validation output self.input = True self.file_type = file_type self.layout = QHBoxLayout() self.setLayout(self.layout) self.input_table = self.create_table("Input Validation") self.output_table = self.create_table("Output Validation") def create_table(self, group_name): table = QTableWidget(0, len(self.table_headers)) table.setHorizontalHeaderLabels(self.table_headers) table.resizeColumnsToContents() layout = QVBoxLayout() layout.addWidget(QLabel(group_name)) layout.addWidget(table) self.layout.addLayout(layout) return table def redraw_table(self, data): table = self.input_table if self.input else self.output_table self.input = not self.input # clear the table and resize table.clearContents() table.rowCount = len(data) # type: ignore table.columnCount = len(self.table_headers) # type: ignore # set the values of each entry for row_id, row in enumerate(data): for col_id, val in enumerate(row): item = QTableWidgetItem(str(val)) item.setFlags(Qt.ItemFlag.ItemIsEnabled) table.setItem(row_id, col_id, item) # resize the table to fit the content table.resizeColumnsToContents() def clear(self): self.input = True self.redraw_table([]) self.redraw_table([])
def __init__(self, parent, name, data): if not type(data) == binaryninja.binaryview.BinaryView: raise Exception('expected widget data to be a BinaryView') self.bv = data QWidget.__init__(self, parent) DockContextHandler.__init__(self, self, name) self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) layout = QVBoxLayout() self.consoleText = QTextEdit(self) self.consoleText.setReadOnly(True) self.consoleText.setFont(getMonospaceFont(self)) layout.addWidget(self.consoleText, 1) inputLayout = QHBoxLayout() inputLayout.setContentsMargins(4, 4, 4, 4) promptLayout = QVBoxLayout() promptLayout.setContentsMargins(0, 5, 0, 5) inputLayout.addLayout(promptLayout) self.consoleEntry = QLineEdit(self) inputLayout.addWidget(self.consoleEntry, 1) self.entryLabel = QLabel("dbg>>> ", self) self.entryLabel.setFont(getMonospaceFont(self)) promptLayout.addWidget(self.entryLabel) promptLayout.addStretch(1) self.consoleEntry.returnPressed.connect(lambda: self.sendLine()) layout.addLayout(inputLayout) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout)
def initUI(self): """ Init app """ vbox = QVBoxLayout() hbox = QHBoxLayout() # Create button "back to the menu" self._buttonBack = QPushButton(QIcon(PATH_IMAGE_BACK_NEDDLE), "", self) self._buttonBack.clicked.connect(self.signalController.back2menu) self._buttonBack.setFixedSize(60, 30) vbox.addWidget(self._buttonBack, 0, QtCore.Qt.AlignTop) self.tboard = Board(self) # Create button which restart game self._restartGame = QPushButton(QIcon(PATH_IMAGE_RELOAD), "", self) self._restartGame.clicked.connect(self.tboard.start) self._restartGame.setFixedSize(60, 30) vbox.addWidget(self._restartGame, 1, QtCore.Qt.AlignTop) # Create label "Score" self._labelScore = QLabel("Game Score", self) vbox.addWidget(self._labelScore, 2, QtCore.Qt.AlignBottom) # Create score counter self._score = QLCDNumber(self) self._score.setFixedSize(70, 50) vbox.addWidget(self._score, 3, QtCore.Qt.AlignTop) hbox.addLayout(vbox, 0) hbox.addWidget(self.tboard, 1) self.setLayout(hbox) self.setWindowTitle("TetrisView") self.tboard.msg2StatusBar[str].connect(self._score.display)
def __init__(self, img): super().__init__() # Declare Widgets self.edit_label = QLabel('Change your image') # set up list and combo box option self.my_list = [ "Pick a value", "Luminosity", "Contrast", "Colorize", "Sepia", "Negative", "Grayscale", "None" ] self.my_combo_box = QComboBox() self.my_combo_box.addItems(self.my_list) self.edit_btn = QPushButton("Edit") # Create U.I. Layout mbox = QHBoxLayout() vbox = QVBoxLayout() vbox.addWidget(self.edit_label) vbox.addWidget(self.my_combo_box) vbox.addWidget(self.edit_btn) mbox.addLayout(vbox) image = Image.open(requests.get(img['urls']['thumb'], stream=True).raw) editpath = "./editing/edit.jpg" image.save(editpath) self.lbl = QLabel() pix = QPixmap(editpath) self.lbl.setPixmap(pix) mbox.addWidget(self.lbl) self.setLayout(mbox) # apply layout to this class # when button is clicked send lineedit and combo box info to on_submit self.edit_btn.clicked.connect(self.on_edit)
class Page1Widget(QWidget): def __init__(self): super().__init__() # Create Widgets self.dropdown_quest = QComboBox() self.dropdown_quest.addItems(MODES) self.dropdown_quest.setCurrentText("Romaji") self.dropdown_ans = QComboBox() self.dropdown_ans.addItems(MODES) self.dropdown_also = QComboBox() self.dropdown_also.addItem("----") self.dropdown_also.addItems(MODES) self.spinbox_level = QSpinBox(Minimum=1, Maximum=2) self.list_groups = QListWidget(FixedWidth=W * .6) for group_name in GROUPS: item = QListWidgetItem(group_name) item.setCheckState(QtCore.Qt.Unchecked) self.list_groups.addItem(item) # Make Layout self.sub_layout = QVBoxLayout() self.sub_layout.addWidget(QLabel('Question:')) self.sub_layout.addWidget(self.dropdown_quest) self.sub_layout.addWidget(QLabel('Answer:')) self.sub_layout.addWidget(self.dropdown_ans) self.sub_layout.addWidget(QLabel('Also:')) self.sub_layout.addWidget(self.dropdown_also) self.sub_layout.addWidget(QLabel('Level:')) self.sub_layout.addWidget(self.spinbox_level) self.layout = QHBoxLayout(self) self.layout.addLayout(self.sub_layout) self.layout.addWidget(self.list_groups)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1024, 768) self.actionOpen_ObjectBlueprints_xml = QAction(MainWindow) self.actionOpen_ObjectBlueprints_xml.setObjectName( u"actionOpen_ObjectBlueprints_xml") self.actionExit = QAction(MainWindow) self.actionExit.setObjectName(u"actionExit") self.actionWiki_template = QAction(MainWindow) self.actionWiki_template.setObjectName(u"actionWiki_template") self.actionWiki_template.setCheckable(True) self.actionWiki_template.setChecked(True) self.actionAttributes = QAction(MainWindow) self.actionAttributes.setObjectName(u"actionAttributes") self.actionAttributes.setCheckable(True) self.actionAll_attributes = QAction(MainWindow) self.actionAll_attributes.setObjectName(u"actionAll_attributes") self.actionAll_attributes.setCheckable(True) self.actionScan_wiki = QAction(MainWindow) self.actionScan_wiki.setObjectName(u"actionScan_wiki") self.actionUpload_templates = QAction(MainWindow) self.actionUpload_templates.setObjectName(u"actionUpload_templates") self.actionUpload_tiles = QAction(MainWindow) self.actionUpload_tiles.setObjectName(u"actionUpload_tiles") self.actionXML_source = QAction(MainWindow) self.actionXML_source.setObjectName(u"actionXML_source") self.actionXML_source.setCheckable(True) self.actionShow_help = QAction(MainWindow) self.actionShow_help.setObjectName(u"actionShow_help") self.actionUpload_extra_image_s_for_selected_objects = QAction( MainWindow) self.actionUpload_extra_image_s_for_selected_objects.setObjectName( u"actionUpload_extra_image_s_for_selected_objects") self.actionDiff_template_against_wiki = QAction(MainWindow) self.actionDiff_template_against_wiki.setObjectName( u"actionDiff_template_against_wiki") self.actionDark_mode = QAction(MainWindow) self.actionDark_mode.setObjectName(u"actionDark_mode") self.actionSuppress_image_comparison_popups = QAction(MainWindow) self.actionSuppress_image_comparison_popups.setObjectName( u"actionSuppress_image_comparison_popups") self.actionSuppress_image_comparison_popups.setCheckable(True) self.actionSuppress_image_comparison_popups.setChecked(False) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName(u"gridLayout") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.plainTextEdit = QPlainTextEdit(self.centralwidget) self.plainTextEdit.setObjectName(u"plainTextEdit") font = QFont() font.setFamilies([u"Consolas"]) font.setPointSize(10) self.plainTextEdit.setFont(font) self.plainTextEdit.setUndoRedoEnabled(False) self.plainTextEdit.setReadOnly(True) self.horizontalLayout.addWidget(self.plainTextEdit) self.verticalLayout_4 = QVBoxLayout() self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.tile_label = QLabel(self.centralwidget) self.tile_label.setObjectName(u"tile_label") self.tile_label.setMinimumSize(QSize(160, 240)) font1 = QFont() font1.setFamilies([u"Segoe UI"]) self.tile_label.setFont(font1) self.tile_label.setStyleSheet(u"background-color: rgb(15, 59, 58);") self.verticalLayout_4.addWidget(self.tile_label) self.save_tile_button = QPushButton(self.centralwidget) self.save_tile_button.setObjectName(u"save_tile_button") font2 = QFont() font2.setFamilies([u"Segoe UI"]) font2.setPointSize(10) self.save_tile_button.setFont(font2) self.verticalLayout_4.addWidget(self.save_tile_button) self.swap_tile_button = QPushButton(self.centralwidget) self.swap_tile_button.setObjectName(u"swap_tile_button") self.swap_tile_button.setEnabled(True) self.swap_tile_button.setFont(font2) self.verticalLayout_4.addWidget(self.swap_tile_button) self.horizontalLayout.addLayout(self.verticalLayout_4) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout_3 = QVBoxLayout() self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.search_label = QLabel(self.centralwidget) self.search_label.setObjectName(u"search_label") self.search_label.setMinimumSize(QSize(0, 0)) self.search_label.setFont(font2) self.horizontalLayout_2.addWidget(self.search_label) self.search_line_edit = QLineEdit(self.centralwidget) self.search_line_edit.setObjectName(u"search_line_edit") self.search_line_edit.setFont(font2) self.horizontalLayout_2.addWidget(self.search_line_edit) self.expand_all_button = QPushButton(self.centralwidget) self.expand_all_button.setObjectName(u"expand_all_button") self.expand_all_button.setMinimumSize(QSize(90, 0)) self.expand_all_button.setFont(font2) self.horizontalLayout_2.addWidget(self.expand_all_button) self.collapse_all_button = QPushButton(self.centralwidget) self.collapse_all_button.setObjectName(u"collapse_all_button") self.collapse_all_button.setMinimumSize(QSize(90, 0)) self.collapse_all_button.setFont(font2) self.horizontalLayout_2.addWidget(self.collapse_all_button) self.restore_all_button = QPushButton(self.centralwidget) self.restore_all_button.setObjectName(u"restore_all_button") self.restore_all_button.setMinimumSize(QSize(130, 0)) self.restore_all_button.setFont(font2) self.horizontalLayout_2.addWidget(self.restore_all_button) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.tree_target_widget = QWidget(self.centralwidget) self.tree_target_widget.setObjectName(u"tree_target_widget") self.tree_target_widget.setFont(font1) self.verticalLayout_3.addWidget(self.tree_target_widget, 0, Qt.AlignBottom) self.verticalLayout.addLayout(self.verticalLayout_3) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 1024, 21)) self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName(u"menuFile") self.menuView = QMenu(self.menubar) self.menuView.setObjectName(u"menuView") self.menuWiki = QMenu(self.menubar) self.menuWiki.setObjectName(u"menuWiki") self.menuHelp = QMenu(self.menubar) self.menuHelp.setObjectName(u"menuHelp") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuWiki.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.menuFile.addAction(self.actionOpen_ObjectBlueprints_xml) self.menuFile.addAction(self.actionExit) self.menuView.addAction(self.actionWiki_template) self.menuView.addAction(self.actionAttributes) self.menuView.addAction(self.actionAll_attributes) self.menuView.addAction(self.actionXML_source) self.menuView.addSeparator() self.menuView.addAction(self.actionDark_mode) self.menuWiki.addAction(self.actionScan_wiki) self.menuWiki.addAction(self.actionDiff_template_against_wiki) self.menuWiki.addAction(self.actionUpload_templates) self.menuWiki.addAction(self.actionUpload_tiles) self.menuWiki.addAction( self.actionUpload_extra_image_s_for_selected_objects) self.menuWiki.addAction(self.actionSuppress_image_comparison_popups) self.menuHelp.addAction(self.actionShow_help) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"Qud Blueprint Explorer", None)) self.actionOpen_ObjectBlueprints_xml.setText( QCoreApplication.translate("MainWindow", u"Open ObjectBlueprints.xml...", None)) self.actionExit.setText( QCoreApplication.translate("MainWindow", u"Exit", None)) self.actionWiki_template.setText( QCoreApplication.translate("MainWindow", u"Wiki template", None)) self.actionAttributes.setText( QCoreApplication.translate("MainWindow", u"Attributes", None)) self.actionAll_attributes.setText( QCoreApplication.translate("MainWindow", u"All attributes", None)) self.actionScan_wiki.setText( QCoreApplication.translate("MainWindow", u"Scan wiki for selected objects", None)) self.actionUpload_templates.setText( QCoreApplication.translate( "MainWindow", u"Upload templates for selected objects", None)) self.actionUpload_tiles.setText( QCoreApplication.translate("MainWindow", u"Upload tiles for selected objects", None)) self.actionXML_source.setText( QCoreApplication.translate("MainWindow", u"XML source", None)) self.actionShow_help.setText( QCoreApplication.translate("MainWindow", u"Show help", None)) self.actionUpload_extra_image_s_for_selected_objects.setText( QCoreApplication.translate( "MainWindow", u"Upload extra image(s) for selected objects", None)) self.actionDiff_template_against_wiki.setText( QCoreApplication.translate("MainWindow", u"Diff template against wiki", None)) self.actionDark_mode.setText( QCoreApplication.translate("MainWindow", u"Toggle dark mode", None)) self.actionSuppress_image_comparison_popups.setText( QCoreApplication.translate("MainWindow", u"Suppress image comparison pop-ups", None)) self.tile_label.setText("") self.save_tile_button.setText( QCoreApplication.translate("MainWindow", u"Save tile...", None)) self.swap_tile_button.setText( QCoreApplication.translate("MainWindow", u"Toggle .png/.gif", None)) self.search_label.setText( QCoreApplication.translate("MainWindow", u"Search:", None)) self.expand_all_button.setText( QCoreApplication.translate("MainWindow", u"Expand all", None)) self.collapse_all_button.setText( QCoreApplication.translate("MainWindow", u"Collapse all", None)) self.restore_all_button.setText( QCoreApplication.translate("MainWindow", u"Default expansion", None)) self.menuFile.setTitle( QCoreApplication.translate("MainWindow", u"File", None)) self.menuView.setTitle( QCoreApplication.translate("MainWindow", u"View type", None)) self.menuWiki.setTitle( QCoreApplication.translate("MainWindow", u"Wiki", None)) self.menuHelp.setTitle( QCoreApplication.translate("MainWindow", u"Help", None))
class DeviceItem(QWidget): numberChanged = Signal() def __init__(self, device: RigDevice): super().__init__() self.device = device self._nameLabel = QLabel(device.serialNumber) self._statusLabel = QLabel("") self._startNumberDial = QSpinBox() self._startNumberDial.setMinimum(0) self._startNumberDial.setMaximum(9999) self._startNumberDial.setValue(device.startNumber) self._startNumberDial.valueChanged.connect(self.SetStartNumber) self._enableToggle = QToolButton() self._enableToggle.clicked.connect(self.ToggleEnable) self._enableToggle.setText("Disable") self._layout = QHBoxLayout() self.setLayout(self._layout) self._layout.addWidget(self._nameLabel, stretch=1) self._layout.addWidget(self._statusLabel, stretch=1) self._layout.addWidget(self._enableToggle) self._layout.addWidget(self._startNumberDial) self._layout.addStretch(1) solenoidLabelLayout = QVBoxLayout() solenoidLabelLayout.addWidget(QLabel("State"), alignment=Qt.AlignRight) solenoidLabelLayout.addWidget(QLabel("Invert"), alignment=Qt.AlignRight) self._layout.addLayout(solenoidLabelLayout) self._layout.addSpacing(5) self._solenoidButtons: List[SolenoidButton] = [] for solenoidNumber in range(24): newButton = SolenoidButton( solenoidNumber, device.solenoidPolarities[solenoidNumber]) newButton.solenoidClicked.connect( lambda s=newButton: self.ToggleSolenoid(s)) newButton.polarityClicked.connect( lambda s=newButton: self.TogglePolarity(s)) self._solenoidButtons.append(newButton) self._layout.addWidget(newButton, stretch=0) self.Update() def SetStartNumber(self): self.device.startNumber = self._startNumberDial.value() self.Update() self.numberChanged.emit() def ToggleEnable(self): self.device.SetEnabled(not self.device.isEnabled) self.Update() def ToggleSolenoid(self, button: 'SolenoidButton'): index = self._solenoidButtons.index(button) AppGlobals.Rig().SetSolenoidState( self.device.startNumber + index, not AppGlobals.Rig().GetSolenoidState(self.device.startNumber + index)) AppGlobals.Rig().FlushStates() self.Update() def TogglePolarity(self, button: 'SolenoidButton'): index = self._solenoidButtons.index(button) self.device.solenoidPolarities[ index] = not self.device.solenoidPolarities[index] AppGlobals.Rig().FlushStates() self.Update() def Update(self): if not self.device.IsDeviceAvailable(): self.deleteLater() return if self.device.isConnected: self._statusLabel.setText("Connected.") else: if self.device.isEnabled: self._statusLabel.setText(self.device.errorMessage) else: self._statusLabel.setText("Disabled.") self._enableToggle.setText({ False: "Enable", True: "Disable" }[self.device.isEnabled]) self._startNumberDial.setEnabled(self.device.isEnabled and self.device.isConnected) for i in range(24): self._solenoidButtons[i].setEnabled(self.device.isConnected and self.device.isEnabled) self._solenoidButtons[i].Update(self.device.startNumber + i, self.device.solenoidPolarities[i])
class Ui_TimeRemap_UI(object): def setupUi(self, TimeRemap_UI): if not TimeRemap_UI.objectName(): TimeRemap_UI.setObjectName(u"TimeRemap_UI") TimeRemap_UI.resize(398, 379) self.gridLayout_2 = QGridLayout(TimeRemap_UI) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.warningMessage = KMessageWidget(TimeRemap_UI) self.warningMessage.setObjectName(u"warningMessage") self.warningMessage.setWordWrap(True) self.warningMessage.setCloseButtonVisible(False) self.warningMessage.setMessageType(KMessageWidget.Warning) self.gridLayout_2.addWidget(self.warningMessage, 0, 0, 1, 1) self.remap_box = QFrame(TimeRemap_UI) self.remap_box.setObjectName(u"remap_box") self.remap_box.setFrameShape(QFrame.NoFrame) self.remap_box.setFrameShadow(QFrame.Plain) self.gridLayout = QGridLayout(self.remap_box) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_6 = QHBoxLayout() self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.label_6 = QLabel(self.remap_box) self.label_6.setObjectName(u"label_6") self.horizontalLayout_6.addWidget(self.label_6) self.button_center_top = QToolButton(self.remap_box) self.button_center_top.setObjectName(u"button_center_top") icon = QIcon() iconThemeName = u"align-horizontal-center" if QIcon.hasThemeIcon(iconThemeName): icon = QIcon.fromTheme(iconThemeName) else: icon.addFile(u".", QSize(), QIcon.Normal, QIcon.Off) self.button_center_top.setIcon(icon) self.button_center_top.setAutoRaise(True) self.horizontalLayout_6.addWidget(self.button_center_top) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_6.addItem(self.horizontalSpacer) self.horizontalSpacer1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_6.addItem(self.horizontalSpacer1) self.gridLayout.addLayout(self.horizontalLayout_6, 0, 0, 1, 1) self.remapLayout = QVBoxLayout() self.remapLayout.setObjectName(u"remapLayout") self.gridLayout.addLayout(self.remapLayout, 1, 0, 1, 1) self.horizontalLayout_7 = QHBoxLayout() self.horizontalLayout_7.setObjectName(u"horizontalLayout_7") self.label_5 = QLabel(self.remap_box) self.label_5.setObjectName(u"label_5") self.horizontalLayout_7.addWidget(self.label_5) self.button_center = QToolButton(self.remap_box) self.button_center.setObjectName(u"button_center") self.button_center.setIcon(icon) self.button_center.setAutoRaise(True) self.horizontalLayout_7.addWidget(self.button_center) self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_7.addItem(self.horizontalSpacer_2) self.gridLayout.addLayout(self.horizontalLayout_7, 2, 0, 1, 1) self.horizontalLayout_8 = QHBoxLayout() self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.button_prev = QToolButton(self.remap_box) self.button_prev.setObjectName(u"button_prev") self.button_prev.setAutoRaise(True) self.horizontalLayout_8.addWidget(self.button_prev) self.button_add = QToolButton(self.remap_box) self.button_add.setObjectName(u"button_add") self.button_add.setAutoRaise(True) self.horizontalLayout_8.addWidget(self.button_add) self.button_next = QToolButton(self.remap_box) self.button_next.setObjectName(u"button_next") self.button_next.setAutoRaise(True) self.horizontalLayout_8.addWidget(self.button_next) self.horizontalSpacer_3 = QSpacerItem(28, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_8.addItem(self.horizontalSpacer_3) self.gridLayout.addLayout(self.horizontalLayout_8, 3, 0, 1, 1) self.info_frame = QFrame(self.remap_box) self.info_frame.setObjectName(u"info_frame") self.info_frame.setFrameShape(QFrame.NoFrame) self.info_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_2 = QVBoxLayout(self.info_frame) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_9 = QHBoxLayout() self.horizontalLayout_9.setObjectName(u"horizontalLayout_9") self.label_7 = QLabel(self.info_frame) self.label_7.setObjectName(u"label_7") self.horizontalLayout_9.addWidget(self.label_7) self.inLayout = QHBoxLayout() self.inLayout.setObjectName(u"inLayout") self.horizontalLayout_9.addLayout(self.inLayout) self.verticalLayout_2.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QHBoxLayout() self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.label_8 = QLabel(self.info_frame) self.label_8.setObjectName(u"label_8") self.horizontalLayout_10.addWidget(self.label_8) self.outLayout = QHBoxLayout() self.outLayout.setObjectName(u"outLayout") self.horizontalLayout_10.addLayout(self.outLayout) self.verticalLayout_2.addLayout(self.horizontalLayout_10) self.horizontalLayout_11 = QHBoxLayout() self.horizontalLayout_11.setObjectName(u"horizontalLayout_11") self.label_9 = QLabel(self.info_frame) self.label_9.setObjectName(u"label_9") self.horizontalLayout_11.addWidget(self.label_9) self.speedBefore = QDoubleSpinBox(self.info_frame) self.speedBefore.setObjectName(u"speedBefore") self.speedBefore.setMinimum(-100000.000000000000000) self.speedBefore.setMaximum(100000.000000000000000) self.speedBefore.setValue(100.000000000000000) self.horizontalLayout_11.addWidget(self.speedBefore) self.verticalLayout_2.addLayout(self.horizontalLayout_11) self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.label_10 = QLabel(self.info_frame) self.label_10.setObjectName(u"label_10") self.horizontalLayout_12.addWidget(self.label_10) self.speedAfter = QDoubleSpinBox(self.info_frame) self.speedAfter.setObjectName(u"speedAfter") self.speedAfter.setMinimum(-100000.000000000000000) self.speedAfter.setMaximum(100000.000000000000000) self.speedAfter.setValue(100.000000000000000) self.horizontalLayout_12.addWidget(self.speedAfter) self.verticalLayout_2.addLayout(self.horizontalLayout_12) self.gridLayout.addWidget(self.info_frame, 4, 0, 1, 1) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 5, 0, 1, 1) self.horizontalLayout_13 = QHBoxLayout() self.horizontalLayout_13.setObjectName(u"horizontalLayout_13") self.pitch_compensate = QCheckBox(self.remap_box) self.pitch_compensate.setObjectName(u"pitch_compensate") self.pitch_compensate.setChecked(True) self.pitch_compensate.setTristate(False) self.horizontalLayout_13.addWidget(self.pitch_compensate) self.frame_blending = QCheckBox(self.remap_box) self.frame_blending.setObjectName(u"frame_blending") self.horizontalLayout_13.addWidget(self.frame_blending) self.gridLayout.addLayout(self.horizontalLayout_13, 6, 0, 1, 1) self.horizontalLayout_14 = QHBoxLayout() self.horizontalLayout_14.setObjectName(u"horizontalLayout_14") self.move_next = QCheckBox(self.remap_box) self.move_next.setObjectName(u"move_next") self.move_next.setChecked(True) self.horizontalLayout_14.addWidget(self.move_next) self.button_del = QToolButton(self.remap_box) self.button_del.setObjectName(u"button_del") icon1 = QIcon() iconThemeName = u"edit-delete" if QIcon.hasThemeIcon(iconThemeName): icon1 = QIcon.fromTheme(iconThemeName) else: icon1.addFile(u".", QSize(), QIcon.Normal, QIcon.Off) self.button_del.setIcon(icon1) self.horizontalLayout_14.addWidget(self.button_del) self.gridLayout.addLayout(self.horizontalLayout_14, 7, 0, 1, 1) self.gridLayout_2.addWidget(self.remap_box, 1, 0, 1, 1) self.retranslateUi(TimeRemap_UI) QMetaObject.connectSlotsByName(TimeRemap_UI) # setupUi def retranslateUi(self, TimeRemap_UI): TimeRemap_UI.setWindowTitle( QCoreApplication.translate("TimeRemap_UI", u"Form", None)) self.label_6.setText( QCoreApplication.translate("TimeRemap_UI", u"Source clip", None)) self.button_center_top.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None)) self.label_5.setText( QCoreApplication.translate("TimeRemap_UI", u"Output", None)) self.button_center.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None)) self.button_prev.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None)) self.button_add.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None)) self.button_next.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None)) self.label_7.setText( QCoreApplication.translate("TimeRemap_UI", u"Source time", None)) self.label_8.setText( QCoreApplication.translate("TimeRemap_UI", u"Output time", None)) self.label_9.setText( QCoreApplication.translate("TimeRemap_UI", u"Speed before", None)) self.label_10.setText( QCoreApplication.translate("TimeRemap_UI", u"After", None)) self.pitch_compensate.setText( QCoreApplication.translate("TimeRemap_UI", u"Pitch compensation", None)) self.frame_blending.setText( QCoreApplication.translate("TimeRemap_UI", u"Frame blending", None)) self.move_next.setText( QCoreApplication.translate("TimeRemap_UI", u"Preserve speed of next keyframes", None)) self.button_del.setText( QCoreApplication.translate("TimeRemap_UI", u"...", None))
def __init__(self, persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting icons = ':/' + str(persepolis_setting.value('settings/icons')) + '/' # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) # window self.setMinimumSize(QSize(595, 284)) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle( QCoreApplication.translate("progress_ui_tr", "Persepolis Download Manager")) verticalLayout = QVBoxLayout(self) # progress_tabWidget self.progress_tabWidget = QTabWidget(self) # information_tab self.information_tab = QWidget() information_verticalLayout = QVBoxLayout(self.information_tab) # link_label self.link_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.link_label) # status_label self.status_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.status_label) # downloaded_label self.downloaded_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.downloaded_label) # rate_label self.rate_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.rate_label) # time_label self.time_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.time_label) # connections_label self.connections_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.connections_label) information_verticalLayout.addStretch(1) # add information_tab to progress_tabWidget self.progress_tabWidget.addTab(self.information_tab, "") # options_tab self.options_tab = QWidget() options_tab_verticalLayout = QVBoxLayout(self.options_tab) options_tab_horizontalLayout = QHBoxLayout() # options_tab_horizontalLayout.setContentsMargins(11, 11, 11, 11) # limit_checkBox self.limit_checkBox = QCheckBox(self.options_tab) limit_verticalLayout = QVBoxLayout() limit_verticalLayout.addWidget(self.limit_checkBox) # limit_frame self.limit_frame = QFrame(self.options_tab) self.limit_frame.setFrameShape(QFrame.StyledPanel) self.limit_frame.setFrameShadow(QFrame.Raised) limit_frame_verticalLayout = QVBoxLayout(self.limit_frame) limit_frame_horizontalLayout = QHBoxLayout() # limit_spinBox self.limit_spinBox = QDoubleSpinBox(self.options_tab) self.limit_spinBox.setMinimum(1) self.limit_spinBox.setMaximum(1023) limit_frame_horizontalLayout.addWidget(self.limit_spinBox) # limit_comboBox self.limit_comboBox = QComboBox(self.options_tab) self.limit_comboBox.addItem("") self.limit_comboBox.addItem("") limit_frame_horizontalLayout.addWidget(self.limit_comboBox) # limit_pushButton self.limit_pushButton = QPushButton(self.options_tab) limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout) limit_frame_verticalLayout.addWidget(self.limit_pushButton) limit_verticalLayout.addWidget(self.limit_frame) limit_verticalLayout.setContentsMargins(11, 11, 11, 11) options_tab_horizontalLayout.addLayout(limit_verticalLayout) options_tab_verticalLayout.addLayout(options_tab_horizontalLayout) options_tab_verticalLayout.addStretch(1) # after_checkBox self.after_checkBox = QCheckBox(self.options_tab) after_verticalLayout = QVBoxLayout() after_verticalLayout.addWidget(self.after_checkBox) # after_frame self.after_frame = QFrame(self.options_tab) self.after_frame.setFrameShape(QFrame.StyledPanel) self.after_frame.setFrameShadow(QFrame.Raised) after_frame_verticalLayout = QVBoxLayout(self.after_frame) # after_comboBox self.after_comboBox = QComboBox(self.options_tab) self.after_comboBox.addItem("") after_frame_verticalLayout.addWidget(self.after_comboBox) # after_pushButton self.after_pushButton = QPushButton(self.options_tab) after_frame_verticalLayout.addWidget(self.after_pushButton) after_verticalLayout.addWidget(self.after_frame) after_verticalLayout.setContentsMargins(11, 11, 11, 11) options_tab_horizontalLayout.addLayout(after_verticalLayout) self.progress_tabWidget.addTab(self.options_tab, "") verticalLayout.addWidget(self.progress_tabWidget) # download_progressBar self.download_progressBar = QProgressBar(self) verticalLayout.addWidget(self.download_progressBar) self.download_progressBar.setTextVisible(False) # buttons button_horizontalLayout = QHBoxLayout() button_horizontalLayout.addStretch(1) # resume_pushButton self.resume_pushButton = QPushButton(self) self.resume_pushButton.setIcon(QIcon(icons + 'play')) button_horizontalLayout.addWidget(self.resume_pushButton) # pause_pushButton self.pause_pushButton = QPushButton(self) self.pause_pushButton.setIcon(QIcon(icons + 'pause')) button_horizontalLayout.addWidget(self.pause_pushButton) # stop_pushButton self.stop_pushButton = QPushButton(self) self.stop_pushButton.setIcon(QIcon(icons + 'stop')) button_horizontalLayout.addWidget(self.stop_pushButton) verticalLayout.addLayout(button_horizontalLayout) self.progress_tabWidget.setCurrentIndex(0) # labels self.link_label.setText( QCoreApplication.translate("progress_ui_tr", "Link: ")) self.status_label.setText( QCoreApplication.translate("progress_ui_tr", "Status: ")) self.downloaded_label.setText( QCoreApplication.translate("progress_ui_tr", "Downloaded:")) self.rate_label.setText( QCoreApplication.translate("progress_ui_tr", "Transfer rate: ")) self.time_label.setText( QCoreApplication.translate("progress_ui_tr", "Estimated time left:")) self.connections_label.setText( QCoreApplication.translate("progress_ui_tr", "Number of connections: ")) self.progress_tabWidget.setTabText( self.progress_tabWidget.indexOf(self.information_tab), QCoreApplication.translate("progress_ui_tr", "Download Information")) self.limit_checkBox.setText( QCoreApplication.translate("progress_ui_tr", "Limit speed")) self.after_checkBox.setText( QCoreApplication.translate("progress_ui_tr", "After download")) self.limit_comboBox.setItemText(0, "KiB/s") self.limit_comboBox.setItemText(1, "MiB/s") self.limit_pushButton.setText( QCoreApplication.translate("progress_ui_tr", "Apply")) self.after_comboBox.setItemText( 0, QCoreApplication.translate("progress_ui_tr", "Shut Down")) self.progress_tabWidget.setTabText( self.progress_tabWidget.indexOf(self.options_tab), QCoreApplication.translate("progress_ui_tr", "Download Options")) self.resume_pushButton.setText( QCoreApplication.translate("progress_ui_tr", "Resume")) self.pause_pushButton.setText( QCoreApplication.translate("progress_ui_tr", "Pause")) self.stop_pushButton.setText( QCoreApplication.translate("progress_ui_tr", "Stop")) self.after_pushButton.setText( QCoreApplication.translate("progress_ui_tr", "Apply"))
class Ui_centralTabs(object): def setupUi(self, centralTabs): if not centralTabs.objectName(): centralTabs.setObjectName(u"centralTabs") centralTabs.setEnabled(True) centralTabs.resize(342, 289) sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( centralTabs.sizePolicy().hasHeightForWidth()) centralTabs.setSizePolicy(sizePolicy) centralTabs.setAcceptDrops(True) centralTabs.setAutoFillBackground(False) centralTabs.setDocumentMode(True) centralTabs.setTabsClosable(False) centralTabs.setMovable(True) centralTabs.setTabBarAutoHide(False) self.demoPage = QWidget() self.demoPage.setObjectName(u"demoPage") self.demoPageLayout = QHBoxLayout(self.demoPage) self.demoPageLayout.setObjectName(u"demoPageLayout") 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.demoPageLayout.addLayout(self.stepsLayout) centralTabs.addTab(self.demoPage, "") self.scriptsPage = QWidget() self.scriptsPage.setObjectName(u"scriptsPage") self.horizontalLayoutWidget = QWidget(self.scriptsPage) self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget") self.horizontalLayoutWidget.setGeometry(QRect(210, 120, 74, 26)) self.scriptsLayout = QHBoxLayout(self.horizontalLayoutWidget) self.scriptsLayout.setObjectName(u"scriptsLayout") self.scriptsLayout.setContentsMargins(0, 0, 0, 0) centralTabs.addTab(self.scriptsPage, "") self.productionPage = QWidget() self.productionPage.setObjectName(u"productionPage") centralTabs.addTab(self.productionPage, "") self.retranslateUi(centralTabs) centralTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(centralTabs) # setupUi def retranslateUi(self, centralTabs): centralTabs.setWindowTitle( QCoreApplication.translate("centralTabs", u"Form", None)) centralTabs.setTabText( centralTabs.indexOf(self.demoPage), QCoreApplication.translate("centralTabs", u"Demo Utilities", None)) centralTabs.setTabText( centralTabs.indexOf(self.scriptsPage), QCoreApplication.translate("centralTabs", u"Script Studio", None)) centralTabs.setTabText( centralTabs.indexOf(self.productionPage), QCoreApplication.translate("centralTabs", u"Production", None))
class Ui_EditRenderPreset_UI(object): def setupUi(self, EditRenderPreset_UI): if not EditRenderPreset_UI.objectName(): EditRenderPreset_UI.setObjectName(u"EditRenderPreset_UI") EditRenderPreset_UI.resize(463, 630) self.verticalLayout_2 = QVBoxLayout(EditRenderPreset_UI) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.mainBox = QHBoxLayout() self.mainBox.setObjectName(u"mainBox") self.formLayout_6 = QFormLayout() self.formLayout_6.setObjectName(u"formLayout_6") self.formLayout_6.setContentsMargins(-1, 20, 10, -1) self.groupLabel = QLabel(EditRenderPreset_UI) self.groupLabel.setObjectName(u"groupLabel") self.formLayout_6.setWidget(0, QFormLayout.LabelRole, self.groupLabel) self.presetNameLabel = QLabel(EditRenderPreset_UI) self.presetNameLabel.setObjectName(u"presetNameLabel") self.formLayout_6.setWidget(1, QFormLayout.LabelRole, self.presetNameLabel) self.preset_name = QLineEdit(EditRenderPreset_UI) self.preset_name.setObjectName(u"preset_name") self.formLayout_6.setWidget(1, QFormLayout.FieldRole, self.preset_name) self.label_2 = QLabel(EditRenderPreset_UI) self.label_2.setObjectName(u"label_2") self.formLayout_6.setWidget(2, QFormLayout.LabelRole, self.label_2) self.formatCombo = QComboBox(EditRenderPreset_UI) self.formatCombo.setObjectName(u"formatCombo") self.formLayout_6.setWidget(2, QFormLayout.FieldRole, self.formatCombo) self.tabWidget = QTabWidget(EditRenderPreset_UI) self.tabWidget.setObjectName(u"tabWidget") self.video_tab = QWidget() self.video_tab.setObjectName(u"video_tab") self.verticalLayout_3 = QVBoxLayout(self.video_tab) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.scrollArea = QScrollArea(self.video_tab) self.scrollArea.setObjectName(u"scrollArea") sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.scrollArea.sizePolicy().hasHeightForWidth()) self.scrollArea.setSizePolicy(sizePolicy) self.scrollArea.setFrameShape(QFrame.NoFrame) self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollAreaWidgetContents = QWidget() self.scrollAreaWidgetContents.setObjectName( u"scrollAreaWidgetContents") self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 428, 650)) self.formLayout_3 = QFormLayout(self.scrollAreaWidgetContents) self.formLayout_3.setObjectName(u"formLayout_3") self.formLayout_3.setContentsMargins(-1, -1, 40, -1) self.label_4 = QLabel(self.scrollAreaWidgetContents) self.label_4.setObjectName(u"label_4") self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_4) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.resWidth = QSpinBox(self.scrollAreaWidgetContents) self.resWidth.setObjectName(u"resWidth") self.resWidth.setMinimum(1) self.resWidth.setMaximum(8192) self.resWidth.setSingleStep(2) self.resWidth.setValue(1) self.horizontalLayout_3.addWidget(self.resWidth) self.label_9 = QLabel(self.scrollAreaWidgetContents) self.label_9.setObjectName(u"label_9") self.label_9.setMinimumSize(QSize(10, 0)) self.label_9.setText(u"x") self.label_9.setAlignment(Qt.AlignCenter) self.horizontalLayout_3.addWidget(self.label_9) self.resHeight = QSpinBox(self.scrollAreaWidgetContents) self.resHeight.setObjectName(u"resHeight") self.resHeight.setMinimum(1) self.resHeight.setMaximum(8192) self.resHeight.setSingleStep(2) self.horizontalLayout_3.addWidget(self.resHeight) self.linkResoultion = QToolButton(self.scrollAreaWidgetContents) self.linkResoultion.setObjectName(u"linkResoultion") icon = QIcon() iconThemeName = u"link" if QIcon.hasThemeIcon(iconThemeName): icon = QIcon.fromTheme(iconThemeName) else: icon.addFile(u".", QSize(), QIcon.Normal, QIcon.Off) self.linkResoultion.setIcon(icon) self.linkResoultion.setCheckable(True) self.linkResoultion.setAutoRaise(True) self.horizontalLayout_3.addWidget(self.linkResoultion) self.formLayout_3.setLayout(0, QFormLayout.FieldRole, self.horizontalLayout_3) self.label_6 = QLabel(self.scrollAreaWidgetContents) self.label_6.setObjectName(u"label_6") self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.label_6) self.parCombo = QComboBox(self.scrollAreaWidgetContents) self.parCombo.setObjectName(u"parCombo") self.parCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.formLayout_3.setWidget(1, QFormLayout.FieldRole, self.parCombo) self.label_16 = QLabel(self.scrollAreaWidgetContents) self.label_16.setObjectName(u"label_16") self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_16) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.displayAspectNum = QSpinBox(self.scrollAreaWidgetContents) self.displayAspectNum.setObjectName(u"displayAspectNum") self.displayAspectNum.setMinimum(1) self.displayAspectNum.setMaximum(8192) self.horizontalLayout_4.addWidget(self.displayAspectNum) self.label_17 = QLabel(self.scrollAreaWidgetContents) self.label_17.setObjectName(u"label_17") self.label_17.setMinimumSize(QSize(10, 0)) self.label_17.setText(u":") self.label_17.setAlignment(Qt.AlignCenter) self.horizontalLayout_4.addWidget(self.label_17) self.displayAspectDen = QSpinBox(self.scrollAreaWidgetContents) self.displayAspectDen.setObjectName(u"displayAspectDen") self.displayAspectDen.setMinimum(1) self.displayAspectDen.setMaximum(8192) self.horizontalLayout_4.addWidget(self.displayAspectDen) self.formLayout_3.setLayout(2, QFormLayout.FieldRole, self.horizontalLayout_4) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.framerateNum = QSpinBox(self.scrollAreaWidgetContents) self.framerateNum.setObjectName(u"framerateNum") self.framerateNum.setMinimum(1) self.framerateNum.setMaximum(1000000) self.horizontalLayout.addWidget(self.framerateNum) self.label_8 = QLabel(self.scrollAreaWidgetContents) self.label_8.setObjectName(u"label_8") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.label_8.sizePolicy().hasHeightForWidth()) self.label_8.setSizePolicy(sizePolicy1) self.label_8.setMinimumSize(QSize(10, 0)) self.label_8.setText(u"/") self.label_8.setAlignment(Qt.AlignCenter) self.horizontalLayout.addWidget(self.label_8) self.framerateDen = QSpinBox(self.scrollAreaWidgetContents) self.framerateDen.setObjectName(u"framerateDen") self.framerateDen.setMinimum(1) self.framerateDen.setMaximum(9999) self.horizontalLayout.addWidget(self.framerateDen) self.formLayout_3.setLayout(3, QFormLayout.FieldRole, self.horizontalLayout) self.label_3 = QLabel(self.scrollAreaWidgetContents) self.label_3.setObjectName(u"label_3") self.formLayout_3.setWidget(3, QFormLayout.LabelRole, self.label_3) self.label_22 = QLabel(self.scrollAreaWidgetContents) self.label_22.setObjectName(u"label_22") self.formLayout_3.setWidget(4, QFormLayout.LabelRole, self.label_22) self.frameRateDisplay = QLabel(self.scrollAreaWidgetContents) self.frameRateDisplay.setObjectName(u"frameRateDisplay") self.frameRateDisplay.setEnabled(True) self.formLayout_3.setWidget(4, QFormLayout.FieldRole, self.frameRateDisplay) self.label_7 = QLabel(self.scrollAreaWidgetContents) self.label_7.setObjectName(u"label_7") self.formLayout_3.setWidget(5, QFormLayout.LabelRole, self.label_7) self.scanningCombo = QComboBox(self.scrollAreaWidgetContents) self.scanningCombo.addItem("") self.scanningCombo.addItem("") self.scanningCombo.setObjectName(u"scanningCombo") self.formLayout_3.setWidget(5, QFormLayout.FieldRole, self.scanningCombo) self.fieldOrderLabel = QLabel(self.scrollAreaWidgetContents) self.fieldOrderLabel.setObjectName(u"fieldOrderLabel") self.formLayout_3.setWidget(6, QFormLayout.LabelRole, self.fieldOrderLabel) self.fieldOrderCombo = QComboBox(self.scrollAreaWidgetContents) self.fieldOrderCombo.addItem("") self.fieldOrderCombo.addItem("") self.fieldOrderCombo.setObjectName(u"fieldOrderCombo") self.fieldOrderCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.formLayout_3.setWidget(6, QFormLayout.FieldRole, self.fieldOrderCombo) self.colorspaceLabel = QLabel(self.scrollAreaWidgetContents) self.colorspaceLabel.setObjectName(u"colorspaceLabel") self.colorspaceLabel.setEnabled(False) self.formLayout_3.setWidget(7, QFormLayout.LabelRole, self.colorspaceLabel) self.colorspaceCombo = QComboBox(self.scrollAreaWidgetContents) self.colorspaceCombo.setObjectName(u"colorspaceCombo") self.colorspaceCombo.setEnabled(False) self.formLayout_3.setWidget(7, QFormLayout.FieldRole, self.colorspaceCombo) self.vCodecCombo = QComboBox(self.scrollAreaWidgetContents) self.vCodecCombo.setObjectName(u"vCodecCombo") sizePolicy2 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.vCodecCombo.sizePolicy().hasHeightForWidth()) self.vCodecCombo.setSizePolicy(sizePolicy2) self.formLayout_3.setWidget(8, QFormLayout.FieldRole, self.vCodecCombo) self.vRateControlCombo = QComboBox(self.scrollAreaWidgetContents) self.vRateControlCombo.setObjectName(u"vRateControlCombo") sizePolicy2.setHeightForWidth( self.vRateControlCombo.sizePolicy().hasHeightForWidth()) self.vRateControlCombo.setSizePolicy(sizePolicy2) self.formLayout_3.setWidget(9, QFormLayout.FieldRole, self.vRateControlCombo) self.label_24 = QLabel(self.scrollAreaWidgetContents) self.label_24.setObjectName(u"label_24") self.formLayout_3.setWidget(8, QFormLayout.LabelRole, self.label_24) self.label_12 = QLabel(self.scrollAreaWidgetContents) self.label_12.setObjectName(u"label_12") self.formLayout_3.setWidget(9, QFormLayout.LabelRole, self.label_12) self.default_vbitrate_label = QLabel(self.scrollAreaWidgetContents) self.default_vbitrate_label.setObjectName(u"default_vbitrate_label") self.formLayout_3.setWidget(10, QFormLayout.LabelRole, self.default_vbitrate_label) self.default_vbitrate = QSpinBox(self.scrollAreaWidgetContents) self.default_vbitrate.setObjectName(u"default_vbitrate") self.default_vbitrate.setMaximum(500000) self.formLayout_3.setWidget(10, QFormLayout.FieldRole, self.default_vbitrate) self.vBuffer_label = QLabel(self.scrollAreaWidgetContents) self.vBuffer_label.setObjectName(u"vBuffer_label") self.formLayout_3.setWidget(11, QFormLayout.LabelRole, self.vBuffer_label) self.vBuffer = QSpinBox(self.scrollAreaWidgetContents) self.vBuffer.setObjectName(u"vBuffer") self.vBuffer.setMaximum(9999) self.formLayout_3.setWidget(11, QFormLayout.FieldRole, self.vBuffer) self.vquality_label = QLabel(self.scrollAreaWidgetContents) self.vquality_label.setObjectName(u"vquality_label") self.formLayout_3.setWidget(12, QFormLayout.LabelRole, self.vquality_label) self.default_vquality = QSpinBox(self.scrollAreaWidgetContents) self.default_vquality.setObjectName(u"default_vquality") self.default_vquality.setMaximum(500000) self.formLayout_3.setWidget(12, QFormLayout.FieldRole, self.default_vquality) self.label_26 = QLabel(self.scrollAreaWidgetContents) self.label_26.setObjectName(u"label_26") self.formLayout_3.setWidget(13, QFormLayout.LabelRole, self.label_26) self.gopSpinner = QSpinBox(self.scrollAreaWidgetContents) self.gopSpinner.setObjectName(u"gopSpinner") self.gopSpinner.setMaximum(999) self.gopSpinner.setSingleStep(1) self.formLayout_3.setWidget(13, QFormLayout.FieldRole, self.gopSpinner) self.fixedGop = QCheckBox(self.scrollAreaWidgetContents) self.fixedGop.setObjectName(u"fixedGop") self.fixedGop.setEnabled(False) self.formLayout_3.setWidget(14, QFormLayout.FieldRole, self.fixedGop) self.bFramesSpinner = QSpinBox(self.scrollAreaWidgetContents) self.bFramesSpinner.setObjectName(u"bFramesSpinner") self.bFramesSpinner.setEnabled(False) self.bFramesSpinner.setMinimum(-1) self.bFramesSpinner.setMaximum(8) self.bFramesSpinner.setValue(-1) self.formLayout_3.setWidget(15, QFormLayout.FieldRole, self.bFramesSpinner) self.bFramesLabel = QLabel(self.scrollAreaWidgetContents) self.bFramesLabel.setObjectName(u"bFramesLabel") self.formLayout_3.setWidget(15, QFormLayout.LabelRole, self.bFramesLabel) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout_3.addWidget(self.scrollArea) self.tabWidget.addTab(self.video_tab, "") self.audio_tab = QWidget() self.audio_tab.setObjectName(u"audio_tab") self.formLayout_2 = QFormLayout(self.audio_tab) self.formLayout_2.setObjectName(u"formLayout_2") self.label_15 = QLabel(self.audio_tab) self.label_15.setObjectName(u"label_15") self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label_15) self.audioChannels = QComboBox(self.audio_tab) self.audioChannels.setObjectName(u"audioChannels") self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.audioChannels) self.label_13 = QLabel(self.audio_tab) self.label_13.setObjectName(u"label_13") self.formLayout_2.setWidget(1, QFormLayout.LabelRole, self.label_13) self.aCodecCombo = QComboBox(self.audio_tab) self.aCodecCombo.setObjectName(u"aCodecCombo") self.formLayout_2.setWidget(1, QFormLayout.FieldRole, self.aCodecCombo) self.label_11 = QLabel(self.audio_tab) self.label_11.setObjectName(u"label_11") self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_11) self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.audioSampleRate = QComboBox(self.audio_tab) self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.addItem("") self.audioSampleRate.setObjectName(u"audioSampleRate") self.audioSampleRate.setEditable(True) self.horizontalLayout_5.addWidget(self.audioSampleRate) self.label_20 = QLabel(self.audio_tab) self.label_20.setObjectName(u"label_20") self.horizontalLayout_5.addWidget(self.label_20) self.formLayout_2.setLayout(2, QFormLayout.FieldRole, self.horizontalLayout_5) self.label_14 = QLabel(self.audio_tab) self.label_14.setObjectName(u"label_14") self.formLayout_2.setWidget(3, QFormLayout.LabelRole, self.label_14) self.aRateControlCombo = QComboBox(self.audio_tab) self.aRateControlCombo.setObjectName(u"aRateControlCombo") self.formLayout_2.setWidget(3, QFormLayout.FieldRole, self.aRateControlCombo) self.label_18 = QLabel(self.audio_tab) self.label_18.setObjectName(u"label_18") self.formLayout_2.setWidget(4, QFormLayout.LabelRole, self.label_18) self.aBitrate = QSpinBox(self.audio_tab) self.aBitrate.setObjectName(u"aBitrate") self.aBitrate.setMaximum(500000) self.formLayout_2.setWidget(4, QFormLayout.FieldRole, self.aBitrate) self.label_19 = QLabel(self.audio_tab) self.label_19.setObjectName(u"label_19") self.formLayout_2.setWidget(5, QFormLayout.LabelRole, self.label_19) self.aQuality = QSpinBox(self.audio_tab) self.aQuality.setObjectName(u"aQuality") self.aQuality.setMaximum(500000) self.formLayout_2.setWidget(5, QFormLayout.FieldRole, self.aQuality) self.tabWidget.addTab(self.audio_tab, "") self.tab = QWidget() self.tab.setObjectName(u"tab") self.verticalLayout = QVBoxLayout(self.tab) self.verticalLayout.setObjectName(u"verticalLayout") self.speedsLabel = QLabel(self.tab) self.speedsLabel.setObjectName(u"speedsLabel") self.verticalLayout.addWidget(self.speedsLabel) self.speeds_list = QTextEdit(self.tab) self.speeds_list.setObjectName(u"speeds_list") self.speeds_list.setAcceptRichText(False) self.verticalLayout.addWidget(self.speeds_list) self.label = QLabel(self.tab) self.label.setObjectName(u"label") self.verticalLayout.addWidget(self.label) self.overrideParamsWarning = KMessageWidget(self.tab) self.overrideParamsWarning.setObjectName(u"overrideParamsWarning") self.overrideParamsWarning.setProperty("wordWrap", True) self.overrideParamsWarning.setProperty("closeButtonVisible", False) self.verticalLayout.addWidget(self.overrideParamsWarning) self.additionalParams = QPlainTextEdit(self.tab) self.additionalParams.setObjectName(u"additionalParams") self.verticalLayout.addWidget(self.additionalParams) self.parametersLabel = QLabel(self.tab) self.parametersLabel.setObjectName(u"parametersLabel") self.parametersLabel.setTextFormat(Qt.RichText) self.parametersLabel.setWordWrap(True) self.parametersLabel.setOpenExternalLinks(True) self.verticalLayout.addWidget(self.parametersLabel) self.tabWidget.addTab(self.tab, "") self.formLayout_6.setWidget(4, QFormLayout.SpanningRole, self.tabWidget) self.parameters = QTextEdit(EditRenderPreset_UI) self.parameters.setObjectName(u"parameters") self.parameters.setReadOnly(True) self.parameters.setAcceptRichText(False) self.formLayout_6.setWidget(5, QFormLayout.SpanningRole, self.parameters) self.groupName = QComboBox(EditRenderPreset_UI) self.groupName.setObjectName(u"groupName") sizePolicy2.setHeightForWidth( self.groupName.sizePolicy().hasHeightForWidth()) self.groupName.setSizePolicy(sizePolicy2) self.groupName.setEditable(True) self.groupName.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.formLayout_6.setWidget(0, QFormLayout.FieldRole, self.groupName) self.mainBox.addLayout(self.formLayout_6) self.verticalLayout_2.addLayout(self.mainBox) self.buttonBox = QDialogButtonBox(EditRenderPreset_UI) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.verticalLayout_2.addWidget(self.buttonBox) self.retranslateUi(EditRenderPreset_UI) self.buttonBox.rejected.connect(EditRenderPreset_UI.reject) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(EditRenderPreset_UI) # setupUi def retranslateUi(self, EditRenderPreset_UI): EditRenderPreset_UI.setWindowTitle( QCoreApplication.translate("EditRenderPreset_UI", u"Save Render Preset", None)) self.groupLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Group:", None)) self.presetNameLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Preset name:", None)) self.label_2.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Container:", None)) self.label_4.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Resolution:", None)) self.linkResoultion.setText( QCoreApplication.translate("EditRenderPreset_UI", u"...", None)) self.label_6.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Pixel Aspect Ratio:", None)) self.label_16.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Display Aspect Ratio:", None)) self.label_3.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Frame Rate:", None)) self.label_22.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Fields per Second:", None)) self.frameRateDisplay.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Placeholder", None)) self.label_7.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Scanning:", None)) self.scanningCombo.setItemText( 0, QCoreApplication.translate("EditRenderPreset_UI", u"Interlaced", None)) self.scanningCombo.setItemText( 1, QCoreApplication.translate("EditRenderPreset_UI", u"Progressive", None)) self.fieldOrderLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Field Order:", None)) self.fieldOrderCombo.setItemText( 0, QCoreApplication.translate("EditRenderPreset_UI", u"Bottom Field First", None)) self.fieldOrderCombo.setItemText( 1, QCoreApplication.translate("EditRenderPreset_UI", u"Top Field First", None)) self.colorspaceLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Colorspace:", None)) self.label_24.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Codec:", None)) self.label_12.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Rate Control:", None)) self.default_vbitrate_label.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Bitrate:", None)) self.default_vbitrate.setSuffix( QCoreApplication.translate("EditRenderPreset_UI", u"k", None)) self.vBuffer_label.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Buffer Size:", None)) self.vBuffer.setSuffix( QCoreApplication.translate("EditRenderPreset_UI", u" KiB", None)) self.vquality_label.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Quality:", None)) #if QT_CONFIG(tooltip) self.label_26.setToolTip( QCoreApplication.translate("EditRenderPreset_UI", u"GOP = Group of Pictures", None)) #endif // QT_CONFIG(tooltip) self.label_26.setText( QCoreApplication.translate("EditRenderPreset_UI", u"GOP:", None)) self.gopSpinner.setSpecialValueText( QCoreApplication.translate("EditRenderPreset_UI", u"Auto", None)) self.gopSpinner.setSuffix( QCoreApplication.translate("EditRenderPreset_UI", u" frame(s)", None)) #if QT_CONFIG(tooltip) self.fixedGop.setToolTip( QCoreApplication.translate( "EditRenderPreset_UI", u"A fixed GOP means that keyframes will not be inserted at detected scene changes.", None)) #endif // QT_CONFIG(tooltip) self.fixedGop.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Fixed", None)) self.bFramesSpinner.setSpecialValueText( QCoreApplication.translate("EditRenderPreset_UI", u"Auto", None)) self.bFramesSpinner.setSuffix( QCoreApplication.translate("EditRenderPreset_UI", u" frame(s)", None)) self.bFramesLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"B Frames:", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.video_tab), QCoreApplication.translate("EditRenderPreset_UI", u"Video", None)) self.label_15.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Channels:", None)) self.label_13.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Codec:", None)) self.label_11.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Sample Rate:", None)) self.audioSampleRate.setItemText( 0, QCoreApplication.translate("EditRenderPreset_UI", u"8000", None)) self.audioSampleRate.setItemText( 1, QCoreApplication.translate("EditRenderPreset_UI", u"12000", None)) self.audioSampleRate.setItemText( 2, QCoreApplication.translate("EditRenderPreset_UI", u"16000", None)) self.audioSampleRate.setItemText( 3, QCoreApplication.translate("EditRenderPreset_UI", u"22050", None)) self.audioSampleRate.setItemText( 4, QCoreApplication.translate("EditRenderPreset_UI", u"32000", None)) self.audioSampleRate.setItemText( 5, QCoreApplication.translate("EditRenderPreset_UI", u"44100", None)) self.audioSampleRate.setItemText( 6, QCoreApplication.translate("EditRenderPreset_UI", u"48000", None)) self.audioSampleRate.setItemText( 7, QCoreApplication.translate("EditRenderPreset_UI", u"96000", None)) self.label_20.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Hz", None)) self.label_14.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Rate Control:", None)) self.label_18.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Bitrate:", None)) self.aBitrate.setSuffix( QCoreApplication.translate("EditRenderPreset_UI", u"k", None)) self.label_19.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Quality:", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.audio_tab), QCoreApplication.translate("EditRenderPreset_UI", u"Audio", None)) self.speedsLabel.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Speed options:", None)) #if QT_CONFIG(tooltip) self.speeds_list.setToolTip( QCoreApplication.translate( "EditRenderPreset_UI", u"One line of options per speedup step, from slowest to fastest", None)) #endif // QT_CONFIG(tooltip) self.label.setText( QCoreApplication.translate("EditRenderPreset_UI", u"Additional Parameters:", None)) self.parametersLabel.setText( QCoreApplication.translate( "EditRenderPreset_UI", u"<html><head/><body><p>See <a href=\"https://www.mltframework.org/plugins/ConsumerAvformat/\"><span style=\" text-decoration: underline; color:#2980b9;\">MLT documentation</span></a> for reference.</p></body></html>", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab), QCoreApplication.translate("EditRenderPreset_UI", u"Other", None))
def __init__(self, parent=None): super(Form, self).__init__(parent) self.title = "Emoji Splitter" self.setWindowTitle(self.title) # preview_split widget self.preview_widget = QLabel() # media_preview = QPixmap('C:/Users/roela/PycharmProjects/Emojisplitter/bolkvis.png') # media_preview = QMovie('Naamloos.gif') # QPixmap('Naamloos.gif') self.media_preview('Naamloos.gif') # embed preview_split in a scrollable window self.preview_scroll_area = QScrollArea() self.preview_scroll_area.setWidget(self.preview_widget) self.preview_scroll_area.setBackgroundRole(QPalette.Dark) self.preview_scroll_area.setWidgetResizable(True) # Create button widgets self.open_file_button = QPushButton("Select &File") self.filename = QLineEdit("C:/Users/roela/PycharmProjects/Emojisplitter/Naamloos.gif") self.preview_button = QPushButton("&Preview Split") self.fit_to_window_checkbox = QCheckBox("Fit Preview Image to &Window") self.horizontal_emojis_spinbox = QSpinBox() self.horizontal_emojis_spinbox.setMinimum(1) self.horizontal_emojis_label = QLabel("Number of &horizontal emojis:") self.horizontal_emojis_label.setBuddy(self.horizontal_emojis_spinbox) self.vertical_emojis_spinbox = QSpinBox() self.vertical_emojis_spinbox.setMinimum(1) self.vertical_emojis_label = QLabel("Number of &vertical emojis:") self.vertical_emojis_label.setBuddy(self.vertical_emojis_spinbox) self.split_emojis_button = QPushButton("&Split Emoji") self.results_folder_button = QPushButton("Open folder with &results") # give the button_layout a fixed width button_container = QWidget() button_container.setFixedWidth(256) # Create layout and add widgets button_layout = QVBoxLayout(button_container) button_layout.addWidget(self.open_file_button) button_layout.addWidget(self.filename) # Put labels next to spinboxes horizontal_emojis_layout = QHBoxLayout() horizontal_emojis_layout.addWidget(self.horizontal_emojis_label) horizontal_emojis_layout.addWidget(self.horizontal_emojis_spinbox) vertical_emojis_layout = QHBoxLayout() vertical_emojis_layout.addWidget(self.vertical_emojis_label) vertical_emojis_layout.addWidget(self.vertical_emojis_spinbox) button_layout.addLayout(horizontal_emojis_layout) button_layout.addLayout(vertical_emojis_layout) button_layout.addWidget(self.preview_button) button_layout.addWidget(self.fit_to_window_checkbox) button_layout.addWidget(self.split_emojis_button) button_layout.addWidget(self.results_folder_button) preview_layout = QVBoxLayout() # preview_layout.addWidget(self.preview_widget) preview_layout.addWidget(self.preview_scroll_area) # combine button and preview_split layout nested_layout = QHBoxLayout() nested_layout.addWidget(button_container) nested_layout.addLayout(preview_layout) # Set dialog layout self.setLayout(nested_layout) # Add button functions self.open_file_button.clicked.connect(self.open_file) self.preview_button.clicked.connect(self.preview_split) self.fit_to_window_checkbox.clicked.connect(self.fit_to_window) self.split_emojis_button.clicked.connect(self.split) self.results_folder_button.clicked.connect(self.open_folder_with_results) # update preview_split on changing value of a spinbox self.horizontal_emojis_spinbox.valueChanged.connect(self.preview_split) self.vertical_emojis_spinbox.valueChanged.connect(self.preview_split)
def __init__(self, persepolis_setting): super().__init__() # MainWindow self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' self.setWindowTitle( QCoreApplication.translate("mainwindow_ui_tr", "Persepolis Download Manager")) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.centralwidget = QWidget(self) self.verticalLayout = QVBoxLayout(self.centralwidget) # enable drag and drop self.setAcceptDrops(True) # frame self.frame = QFrame(self.centralwidget) # download_table_horizontalLayout download_table_horizontalLayout = QHBoxLayout() horizontal_splitter = QSplitter(Qt.Horizontal) vertical_splitter = QSplitter(Qt.Vertical) # category_tree self.category_tree_qwidget = QWidget(self) category_tree_verticalLayout = QVBoxLayout() self.category_tree = CategoryTreeView(self) category_tree_verticalLayout.addWidget(self.category_tree) self.category_tree_model = QStandardItemModel() self.category_tree.setModel(self.category_tree_model) category_table_header = [ QCoreApplication.translate("mainwindow_ui_tr", 'Category') ] self.category_tree_model.setHorizontalHeaderLabels( category_table_header) self.category_tree.header().setStretchLastSection(True) self.category_tree.header().setDefaultAlignment(Qt.AlignCenter) # queue_panel self.queue_panel_widget = QWidget(self) queue_panel_verticalLayout_main = QVBoxLayout(self.queue_panel_widget) # queue_panel_show_button self.queue_panel_show_button = QPushButton(self) queue_panel_verticalLayout_main.addWidget(self.queue_panel_show_button) # queue_panel_widget_frame self.queue_panel_widget_frame = QFrame(self) self.queue_panel_widget_frame.setFrameShape(QFrame.StyledPanel) self.queue_panel_widget_frame.setFrameShadow(QFrame.Raised) queue_panel_verticalLayout_main.addWidget( self.queue_panel_widget_frame) queue_panel_verticalLayout = QVBoxLayout(self.queue_panel_widget_frame) queue_panel_verticalLayout_main.setContentsMargins(50, -1, 50, -1) # start_end_frame self.start_end_frame = QFrame(self) # start time start_verticalLayout = QVBoxLayout(self.start_end_frame) self.start_checkBox = QCheckBox(self) start_verticalLayout.addWidget(self.start_checkBox) self.start_frame = QFrame(self) self.start_frame.setFrameShape(QFrame.StyledPanel) self.start_frame.setFrameShadow(QFrame.Raised) start_frame_verticalLayout = QVBoxLayout(self.start_frame) self.start_time_qDataTimeEdit = MyQDateTimeEdit(self.start_frame) self.start_time_qDataTimeEdit.setDisplayFormat('H:mm') start_frame_verticalLayout.addWidget(self.start_time_qDataTimeEdit) start_verticalLayout.addWidget(self.start_frame) # end time self.end_checkBox = QCheckBox(self) start_verticalLayout.addWidget(self.end_checkBox) self.end_frame = QFrame(self) self.end_frame.setFrameShape(QFrame.StyledPanel) self.end_frame.setFrameShadow(QFrame.Raised) end_frame_verticalLayout = QVBoxLayout(self.end_frame) self.end_time_qDateTimeEdit = MyQDateTimeEdit(self.end_frame) self.end_time_qDateTimeEdit.setDisplayFormat('H:mm') end_frame_verticalLayout.addWidget(self.end_time_qDateTimeEdit) start_verticalLayout.addWidget(self.end_frame) self.reverse_checkBox = QCheckBox(self) start_verticalLayout.addWidget(self.reverse_checkBox) queue_panel_verticalLayout.addWidget(self.start_end_frame) # limit_after_frame self.limit_after_frame = QFrame(self) # limit_checkBox limit_verticalLayout = QVBoxLayout(self.limit_after_frame) self.limit_checkBox = QCheckBox(self) limit_verticalLayout.addWidget(self.limit_checkBox) # limit_frame self.limit_frame = QFrame(self) self.limit_frame.setFrameShape(QFrame.StyledPanel) self.limit_frame.setFrameShadow(QFrame.Raised) limit_verticalLayout.addWidget(self.limit_frame) limit_frame_verticalLayout = QVBoxLayout(self.limit_frame) # limit_spinBox limit_frame_horizontalLayout = QHBoxLayout() self.limit_spinBox = QDoubleSpinBox(self) self.limit_spinBox.setMinimum(1) self.limit_spinBox.setMaximum(1023) limit_frame_horizontalLayout.addWidget(self.limit_spinBox) # limit_comboBox self.limit_comboBox = QComboBox(self) self.limit_comboBox.addItem("") self.limit_comboBox.addItem("") limit_frame_horizontalLayout.addWidget(self.limit_comboBox) limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout) # limit_pushButton self.limit_pushButton = QPushButton(self) limit_frame_verticalLayout.addWidget(self.limit_pushButton) # after_checkBox self.after_checkBox = QCheckBox(self) limit_verticalLayout.addWidget(self.after_checkBox) # after_frame self.after_frame = QFrame(self) self.after_frame.setFrameShape(QFrame.StyledPanel) self.after_frame.setFrameShadow(QFrame.Raised) limit_verticalLayout.addWidget(self.after_frame) after_frame_verticalLayout = QVBoxLayout(self.after_frame) # after_comboBox self.after_comboBox = QComboBox(self) self.after_comboBox.addItem("") after_frame_verticalLayout.addWidget(self.after_comboBox) # after_pushButton self.after_pushButton = QPushButton(self) after_frame_verticalLayout.addWidget(self.after_pushButton) queue_panel_verticalLayout.addWidget(self.limit_after_frame) category_tree_verticalLayout.addWidget(self.queue_panel_widget) # keep_awake_checkBox self.keep_awake_checkBox = QCheckBox(self) queue_panel_verticalLayout.addWidget(self.keep_awake_checkBox) self.category_tree_qwidget.setLayout(category_tree_verticalLayout) horizontal_splitter.addWidget(self.category_tree_qwidget) # download table widget self.download_table_content_widget = QWidget(self) download_table_content_widget_verticalLayout = QVBoxLayout( self.download_table_content_widget) # download_table self.download_table = DownloadTableWidget(self) vertical_splitter.addWidget(self.download_table) horizontal_splitter.addWidget(self.download_table_content_widget) self.download_table.setColumnCount(13) self.download_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.download_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.download_table.verticalHeader().hide() # hide column of GID and column of link. self.download_table.setColumnHidden(8, True) self.download_table.setColumnHidden(9, True) download_table_header = [ QCoreApplication.translate("mainwindow_ui_tr", 'File Name'), QCoreApplication.translate("mainwindow_ui_tr", 'Status'), QCoreApplication.translate("mainwindow_ui_tr", 'Size'), QCoreApplication.translate("mainwindow_ui_tr", 'Downloaded'), QCoreApplication.translate("mainwindow_ui_tr", 'Percentage'), QCoreApplication.translate("mainwindow_ui_tr", 'Connections'), QCoreApplication.translate("mainwindow_ui_tr", 'Transfer Rate'), QCoreApplication.translate("mainwindow_ui_tr", 'Estimated Time Left'), 'Gid', QCoreApplication.translate("mainwindow_ui_tr", 'Link'), QCoreApplication.translate("mainwindow_ui_tr", 'First Try Date'), QCoreApplication.translate("mainwindow_ui_tr", 'Last Try Date'), QCoreApplication.translate("mainwindow_ui_tr", 'Category') ] self.download_table.setHorizontalHeaderLabels(download_table_header) # fixing the size of download_table when window is Maximized! self.download_table.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeMode.Interactive) self.download_table.horizontalHeader().setStretchLastSection(True) horizontal_splitter.setStretchFactor(0, 3) # category_tree width horizontal_splitter.setStretchFactor(1, 10) # ratio of tables's width # video_finder_widget self.video_finder_widget = QWidget(self) video_finder_horizontalLayout = QHBoxLayout(self.video_finder_widget) self.muxing_pushButton = QPushButton(self) self.muxing_pushButton.setIcon(QIcon(icons + 'video_finder')) video_finder_horizontalLayout.addWidget(self.muxing_pushButton) video_finder_horizontalLayout.addSpacing(20) video_audio_verticalLayout = QVBoxLayout() self.video_label = QLabel(self) video_audio_verticalLayout.addWidget(self.video_label) self.audio_label = QLabel(self) video_audio_verticalLayout.addWidget(self.audio_label) video_finder_horizontalLayout.addLayout(video_audio_verticalLayout) status_muxing_verticalLayout = QVBoxLayout() self.video_finder_status_label = QLabel(self) status_muxing_verticalLayout.addWidget(self.video_finder_status_label) self.muxing_status_label = QLabel(self) status_muxing_verticalLayout.addWidget(self.muxing_status_label) video_finder_horizontalLayout.addLayout(status_muxing_verticalLayout) vertical_splitter.addWidget(self.video_finder_widget) download_table_content_widget_verticalLayout.addWidget( vertical_splitter) download_table_horizontalLayout.addWidget(horizontal_splitter) self.frame.setLayout(download_table_horizontalLayout) self.verticalLayout.addWidget(self.frame) self.setCentralWidget(self.centralwidget) # menubar self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 600, 24)) self.setMenuBar(self.menubar) fileMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&File')) editMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&Edit')) viewMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&View')) downloadMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&Download')) queueMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&Queue')) videoFinderMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", 'V&ideo Finder')) helpMenu = self.menubar.addMenu( QCoreApplication.translate("mainwindow_ui_tr", '&Help')) # viewMenu submenus sortMenu = viewMenu.addMenu( QCoreApplication.translate("mainwindow_ui_tr", 'Sort by')) # statusbar self.statusbar = QStatusBar(self) self.setStatusBar(self.statusbar) self.statusbar.showMessage( QCoreApplication.translate("mainwindow_ui_tr", "Persepolis Download Manager")) # toolBar self.toolBar2 = QToolBar(self) self.addToolBar(Qt.TopToolBarArea, self.toolBar2) self.toolBar2.setWindowTitle( QCoreApplication.translate("mainwindow_ui_tr", 'Menu')) self.toolBar2.setFloatable(False) self.toolBar2.setMovable(False) self.toolBar = QToolBar(self) self.addToolBar(Qt.TopToolBarArea, self.toolBar) self.toolBar.setWindowTitle( QCoreApplication.translate("mainwindow_ui_tr", 'Toolbar')) self.toolBar.setFloatable(False) self.toolBar.setMovable(False) #toolBar and menubar and actions self.persepolis_setting.beginGroup('settings/shortcuts') # videoFinderAddLinkAction self.videoFinderAddLinkAction = QAction( QIcon(icons + 'video_finder'), QCoreApplication.translate("mainwindow_ui_tr", 'Find Video Links...'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Download video or audio from Youtube, Vimeo, etc.'), triggered=self.showVideoFinderAddLinkWindow) self.videoFinderAddLinkAction_shortcut = QShortcut( self.persepolis_setting.value('video_finder_shortcut'), self, self.showVideoFinderAddLinkWindow) videoFinderMenu.addAction(self.videoFinderAddLinkAction) # stopAllAction self.stopAllAction = QAction(QIcon(icons + 'stop_all'), QCoreApplication.translate( "mainwindow_ui_tr", 'Stop All Active Downloads'), self, statusTip='Stop All Active Downloads', triggered=self.stopAllDownloads) downloadMenu.addAction(self.stopAllAction) # sort_file_name_Action self.sort_file_name_Action = QAction(QCoreApplication.translate( "mainwindow_ui_tr", 'File Name'), self, triggered=self.sortByName) sortMenu.addAction(self.sort_file_name_Action) # sort_file_size_Action self.sort_file_size_Action = QAction(QCoreApplication.translate( "mainwindow_ui_tr", 'File Size'), self, triggered=self.sortBySize) sortMenu.addAction(self.sort_file_size_Action) # sort_first_try_date_Action self.sort_first_try_date_Action = QAction( QCoreApplication.translate("mainwindow_ui_tr", 'First Try Date'), self, triggered=self.sortByFirstTry) sortMenu.addAction(self.sort_first_try_date_Action) # sort_last_try_date_Action self.sort_last_try_date_Action = QAction(QCoreApplication.translate( "mainwindow_ui_tr", 'Last Try Date'), self, triggered=self.sortByLastTry) sortMenu.addAction(self.sort_last_try_date_Action) # sort_download_status_Action self.sort_download_status_Action = QAction(QCoreApplication.translate( "mainwindow_ui_tr", 'Download Status'), self, triggered=self.sortByStatus) sortMenu.addAction(self.sort_download_status_Action) # trayAction self.trayAction = QAction( QCoreApplication.translate("mainwindow_ui_tr", 'Show System Tray Icon'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Show/Hide system tray icon"), triggered=self.showTray) self.trayAction.setCheckable(True) viewMenu.addAction(self.trayAction) # showMenuBarAction self.showMenuBarAction = QAction( QCoreApplication.translate("mainwindow_ui_tr", 'Show Menubar'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Show Menubar'), triggered=self.showMenuBar) self.showMenuBarAction.setCheckable(True) viewMenu.addAction(self.showMenuBarAction) # showSidePanelAction self.showSidePanelAction = QAction( QCoreApplication.translate("mainwindow_ui_tr", 'Show Side Panel'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Show Side Panel'), triggered=self.showSidePanel) self.showSidePanelAction.setCheckable(True) viewMenu.addAction(self.showSidePanelAction) # minimizeAction self.minimizeAction = QAction( QIcon(icons + 'minimize'), QCoreApplication.translate("mainwindow_ui_tr", 'Minimize to System Tray'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Minimize to System Tray"), triggered=self.minMaxTray) self.minimizeAction_shortcut = QShortcut( self.persepolis_setting.value('hide_window_shortcut'), self, self.minMaxTray) viewMenu.addAction(self.minimizeAction) # addlinkAction self.addlinkAction = QAction( QIcon(icons + 'add'), QCoreApplication.translate("mainwindow_ui_tr", 'Add New Download Link...'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Add New Download Link"), triggered=self.addLinkButtonPressed) self.addlinkAction_shortcut = QShortcut( self.persepolis_setting.value('add_new_download_shortcut'), self, self.addLinkButtonPressed) fileMenu.addAction(self.addlinkAction) # importText self.addtextfileAction = QAction( QIcon(icons + 'file'), QCoreApplication.translate("mainwindow_ui_tr", 'Import Links from Text File...'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Create a text file and put links in it, line by line!'), triggered=self.importText) self.addtextfileAction_shortcut = QShortcut( self.persepolis_setting.value('import_text_shortcut'), self, self.importText) fileMenu.addAction(self.addtextfileAction) # resumeAction self.resumeAction = QAction( QIcon(icons + 'play'), QCoreApplication.translate("mainwindow_ui_tr", 'Resume Download'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Resume Download"), triggered=self.resumeButtonPressed) downloadMenu.addAction(self.resumeAction) # pauseAction self.pauseAction = QAction( QIcon(icons + 'pause'), QCoreApplication.translate("mainwindow_ui_tr", 'Pause Download'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Pause Download"), triggered=self.pauseButtonPressed) downloadMenu.addAction(self.pauseAction) # stopAction self.stopAction = QAction( QIcon(icons + 'stop'), QCoreApplication.translate("mainwindow_ui_tr", 'Stop Download'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Stop/Cancel Download"), triggered=self.stopButtonPressed) downloadMenu.addAction(self.stopAction) # propertiesAction self.propertiesAction = QAction( QIcon(icons + 'setting'), QCoreApplication.translate("mainwindow_ui_tr", 'Properties'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Properties"), triggered=self.propertiesButtonPressed) downloadMenu.addAction(self.propertiesAction) # progressAction self.progressAction = QAction( QIcon(icons + 'window'), QCoreApplication.translate("mainwindow_ui_tr", 'Progress'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Progress"), triggered=self.progressButtonPressed) downloadMenu.addAction(self.progressAction) # openFileAction self.openFileAction = QAction( QIcon(icons + 'file'), QCoreApplication.translate("mainwindow_ui_tr", 'Open File...'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Open File...'), triggered=self.openFile) fileMenu.addAction(self.openFileAction) # openDownloadFolderAction self.openDownloadFolderAction = QAction( QIcon(icons + 'folder'), QCoreApplication.translate("mainwindow_ui_tr", 'Open Download Folder'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Open Download Folder'), triggered=self.openDownloadFolder) fileMenu.addAction(self.openDownloadFolderAction) # openDefaultDownloadFolderAction self.openDefaultDownloadFolderAction = QAction( QIcon(icons + 'folder'), QCoreApplication.translate("mainwindow_ui_tr", 'Open Default Download Folder'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Open Default Download Folder'), triggered=self.openDefaultDownloadFolder) fileMenu.addAction(self.openDefaultDownloadFolderAction) # exitAction self.exitAction = QAction( QIcon(icons + 'exit'), QCoreApplication.translate("mainwindow_ui_tr", 'Exit'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Exit"), triggered=self.closeAction) self.exitAction_shortcut = QShortcut( self.persepolis_setting.value('quit_shortcut'), self, self.closeAction) fileMenu.addAction(self.exitAction) # clearAction self.clearAction = QAction(QIcon(icons + 'multi_remove'), QCoreApplication.translate( "mainwindow_ui_tr", 'Clear Download List'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Clear all items in download list'), triggered=self.clearDownloadList) editMenu.addAction(self.clearAction) # removeSelectedAction self.removeSelectedAction = QAction( QIcon(icons + 'remove'), QCoreApplication.translate("mainwindow_ui_tr", 'Remove Selected Downloads from List'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Remove Selected Downloads from List'), triggered=self.removeSelected) self.removeSelectedAction_shortcut = QShortcut( self.persepolis_setting.value('remove_shortcut'), self, self.removeSelected) editMenu.addAction(self.removeSelectedAction) self.removeSelectedAction.setEnabled(False) # deleteSelectedAction self.deleteSelectedAction = QAction( QIcon(icons + 'trash'), QCoreApplication.translate("mainwindow_ui_tr", 'Delete Selected Download Files'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Delete Selected Download Files'), triggered=self.deleteSelected) self.deleteSelectedAction_shortcut = QShortcut( self.persepolis_setting.value('delete_shortcut'), self, self.deleteSelected) editMenu.addAction(self.deleteSelectedAction) self.deleteSelectedAction.setEnabled(False) # moveSelectedDownloadsAction self.moveSelectedDownloadsAction = QAction( QIcon(icons + 'folder'), QCoreApplication.translate( "mainwindow_ui_tr", 'Move Selected Download Files to Another Folder...'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Move Selected Download Files to Another Folder'), triggered=self.moveSelectedDownloads) editMenu.addAction(self.moveSelectedDownloadsAction) self.moveSelectedDownloadsAction.setEnabled(False) # createQueueAction self.createQueueAction = QAction( QIcon(icons + 'add_queue'), QCoreApplication.translate("mainwindow_ui_tr", 'Create New Queue...'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Create new download queue'), triggered=self.createQueue) queueMenu.addAction(self.createQueueAction) # removeQueueAction self.removeQueueAction = QAction( QIcon(icons + 'remove_queue'), QCoreApplication.translate("mainwindow_ui_tr", 'Remove Queue'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Remove this queue'), triggered=self.removeQueue) queueMenu.addAction(self.removeQueueAction) # startQueueAction self.startQueueAction = QAction( QIcon(icons + 'start_queue'), QCoreApplication.translate("mainwindow_ui_tr", 'Start this queue'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Start Queue'), triggered=self.startQueue) queueMenu.addAction(self.startQueueAction) # stopQueueAction self.stopQueueAction = QAction( QIcon(icons + 'stop_queue'), QCoreApplication.translate("mainwindow_ui_tr", 'Stop this queue'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Stop Queue'), triggered=self.stopQueue) queueMenu.addAction(self.stopQueueAction) # moveUpSelectedAction self.moveUpSelectedAction = QAction( QIcon(icons + 'multi_up'), QCoreApplication.translate("mainwindow_ui_tr", 'Move Selected Items Up'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Move currently selected items up by one row'), triggered=self.moveUpSelected) self.moveUpSelectedAction_shortcut = QShortcut( self.persepolis_setting.value('move_up_selection_shortcut'), self, self.moveUpSelected) queueMenu.addAction(self.moveUpSelectedAction) # moveDownSelectedAction self.moveDownSelectedAction = QAction( QIcon(icons + 'multi_down'), QCoreApplication.translate("mainwindow_ui_tr", 'Move Selected Items Down'), self, statusTip=QCoreApplication.translate( "mainwindow_ui_tr", 'Move currently selected items down by one row'), triggered=self.moveDownSelected) self.moveDownSelectedAction_shortcut = QShortcut( self.persepolis_setting.value('move_down_selection_shortcut'), self, self.moveDownSelected) queueMenu.addAction(self.moveDownSelectedAction) # preferencesAction self.preferencesAction = QAction( QIcon(icons + 'preferences'), QCoreApplication.translate("mainwindow_ui_tr", 'Preferences'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Preferences'), triggered=self.openPreferences, menuRole=QAction.MenuRole.PreferencesRole) editMenu.addAction(self.preferencesAction) # aboutAction self.aboutAction = QAction( QIcon(icons + 'about'), QCoreApplication.translate("mainwindow_ui_tr", 'About'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'About'), triggered=self.openAbout, menuRole=QAction.MenuRole.AboutRole) helpMenu.addAction(self.aboutAction) # issueAction self.issueAction = QAction( QIcon(icons + 'about'), QCoreApplication.translate("mainwindow_ui_tr", 'Report an Issue'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Report an issue'), triggered=self.reportIssue) helpMenu.addAction(self.issueAction) # updateAction self.updateAction = QAction( QIcon(icons + 'about'), QCoreApplication.translate("mainwindow_ui_tr", 'Check for Newer Version'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Check for newer release'), triggered=self.newUpdate) helpMenu.addAction(self.updateAction) # logAction self.logAction = QAction( QIcon(icons + 'about'), QCoreApplication.translate("mainwindow_ui_tr", 'Show Log File'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Help'), triggered=self.showLog) helpMenu.addAction(self.logAction) # helpAction self.helpAction = QAction( QIcon(icons + 'about'), QCoreApplication.translate("mainwindow_ui_tr", 'Help'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Help'), triggered=self.persepolisHelp) helpMenu.addAction(self.helpAction) self.persepolis_setting.endGroup() self.qmenu = MenuWidget(self) self.toolBar2.addWidget(self.qmenu) # labels self.queue_panel_show_button.setText( QCoreApplication.translate("mainwindow_ui_tr", "Hide Options")) self.start_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "Start Time")) self.end_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "End Time")) self.reverse_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "Download bottom of\n the list first")) self.limit_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "Limit Speed")) self.limit_comboBox.setItemText(0, "KiB/s") self.limit_comboBox.setItemText(1, "MiB/s") self.limit_pushButton.setText( QCoreApplication.translate("mainwindow_ui_tr", "Apply")) self.after_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "After download")) self.after_comboBox.setItemText( 0, QCoreApplication.translate("mainwindow_ui_tr", "Shut Down")) self.keep_awake_checkBox.setText( QCoreApplication.translate("mainwindow_ui_tr", "Keep System Awake!")) self.keep_awake_checkBox.setToolTip( QCoreApplication.translate( "mainwindow_ui_tr", "<html><head/><body><p>This option will prevent the system from going to sleep.\ It is necessary if your power manager is suspending the system automatically. </p></body></html>" )) self.after_pushButton.setText( QCoreApplication.translate("mainwindow_ui_tr", "Apply")) self.muxing_pushButton.setText( QCoreApplication.translate("mainwindow_ui_tr", "Start Mixing")) self.video_label.setText( QCoreApplication.translate("mainwindow_ui_tr", "<b>Video File Status: </b>")) self.audio_label.setText( QCoreApplication.translate("mainwindow_ui_tr", "<b>Audio File Status: </b>")) self.video_finder_status_label.setText( QCoreApplication.translate("mainwindow_ui_tr", "<b>Status: </b>")) self.muxing_status_label.setText( QCoreApplication.translate("mainwindow_ui_tr", "<b>Mixing status: </b>"))
class Ui_FindAndReplaceDlg(object): def setupUi(self, FindAndReplaceDlg): if not FindAndReplaceDlg.objectName(): FindAndReplaceDlg.setObjectName(u"FindAndReplaceDlg") FindAndReplaceDlg.resize(355, 274) self.hboxLayout = QHBoxLayout(FindAndReplaceDlg) # ifndef Q_OS_MAC self.hboxLayout.setSpacing(6) # endif # ifndef Q_OS_MAC self.hboxLayout.setContentsMargins(9, 9, 9, 9) # endif self.hboxLayout.setObjectName(u"hboxLayout") self.vboxLayout = QVBoxLayout() # ifndef Q_OS_MAC self.vboxLayout.setSpacing(6) # endif # ifndef Q_OS_MAC self.vboxLayout.setContentsMargins(0, 0, 0, 0) # endif self.vboxLayout.setObjectName(u"vboxLayout") self.gridLayout = QGridLayout() # ifndef Q_OS_MAC self.gridLayout.setSpacing(6) # endif # ifndef Q_OS_MAC self.gridLayout.setContentsMargins(0, 0, 0, 0) # endif self.gridLayout.setObjectName(u"gridLayout") self.replaceLineEdit = QLineEdit(FindAndReplaceDlg) self.replaceLineEdit.setObjectName(u"replaceLineEdit") self.gridLayout.addWidget(self.replaceLineEdit, 1, 1, 1, 1) self.findLineEdit = QLineEdit(FindAndReplaceDlg) self.findLineEdit.setObjectName(u"findLineEdit") self.gridLayout.addWidget(self.findLineEdit, 0, 1, 1, 1) self.label_2 = QLabel(FindAndReplaceDlg) self.label_2.setObjectName(u"label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.label = QLabel(FindAndReplaceDlg) self.label.setObjectName(u"label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.vboxLayout.addLayout(self.gridLayout) self.vboxLayout1 = QVBoxLayout() # ifndef Q_OS_MAC self.vboxLayout1.setSpacing(6) # endif self.vboxLayout1.setContentsMargins(0, 0, 0, 0) self.vboxLayout1.setObjectName(u"vboxLayout1") self.caseCheckBox = QCheckBox(FindAndReplaceDlg) self.caseCheckBox.setObjectName(u"caseCheckBox") self.vboxLayout1.addWidget(self.caseCheckBox) self.wholeCheckBox = QCheckBox(FindAndReplaceDlg) self.wholeCheckBox.setObjectName(u"wholeCheckBox") self.wholeCheckBox.setChecked(True) self.vboxLayout1.addWidget(self.wholeCheckBox) self.vboxLayout.addLayout(self.vboxLayout1) self.spacerItem = QSpacerItem(231, 16, QSizePolicy.Minimum, QSizePolicy.Expanding) self.vboxLayout.addItem(self.spacerItem) self.moreFrame = QFrame(FindAndReplaceDlg) self.moreFrame.setObjectName(u"moreFrame") self.moreFrame.setFrameShape(QFrame.StyledPanel) self.moreFrame.setFrameShadow(QFrame.Raised) self.vboxLayout2 = QVBoxLayout(self.moreFrame) # ifndef Q_OS_MAC self.vboxLayout2.setSpacing(6) # endif # ifndef Q_OS_MAC self.vboxLayout2.setContentsMargins(9, 9, 9, 9) # endif self.vboxLayout2.setObjectName(u"vboxLayout2") self.backwardsCheckBox = QCheckBox(self.moreFrame) self.backwardsCheckBox.setObjectName(u"backwardsCheckBox") self.vboxLayout2.addWidget(self.backwardsCheckBox) self.regexCheckBox = QCheckBox(self.moreFrame) self.regexCheckBox.setObjectName(u"regexCheckBox") self.vboxLayout2.addWidget(self.regexCheckBox) self.ignoreNotesCheckBox = QCheckBox(self.moreFrame) self.ignoreNotesCheckBox.setObjectName(u"ignoreNotesCheckBox") self.vboxLayout2.addWidget(self.ignoreNotesCheckBox) self.vboxLayout.addWidget(self.moreFrame) self.hboxLayout.addLayout(self.vboxLayout) self.line = QFrame(FindAndReplaceDlg) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.VLine) self.line.setFrameShadow(QFrame.Sunken) self.hboxLayout.addWidget(self.line) self.vboxLayout3 = QVBoxLayout() # ifndef Q_OS_MAC self.vboxLayout3.setSpacing(6) # endif self.vboxLayout3.setContentsMargins(0, 0, 0, 0) self.vboxLayout3.setObjectName(u"vboxLayout3") self.findButton = QPushButton(FindAndReplaceDlg) self.findButton.setObjectName(u"findButton") self.findButton.setFocusPolicy(Qt.NoFocus) self.vboxLayout3.addWidget(self.findButton) self.replaceButton = QPushButton(FindAndReplaceDlg) self.replaceButton.setObjectName(u"replaceButton") self.replaceButton.setFocusPolicy(Qt.NoFocus) self.vboxLayout3.addWidget(self.replaceButton) self.closeButton = QPushButton(FindAndReplaceDlg) self.closeButton.setObjectName(u"closeButton") self.closeButton.setFocusPolicy(Qt.NoFocus) self.vboxLayout3.addWidget(self.closeButton) self.moreButton = QPushButton(FindAndReplaceDlg) self.moreButton.setObjectName(u"moreButton") self.moreButton.setFocusPolicy(Qt.NoFocus) self.moreButton.setCheckable(True) self.vboxLayout3.addWidget(self.moreButton) self.spacerItem1 = QSpacerItem(21, 16, QSizePolicy.Minimum, QSizePolicy.Expanding) self.vboxLayout3.addItem(self.spacerItem1) self.hboxLayout.addLayout(self.vboxLayout3) # if QT_CONFIG(shortcut) self.label_2.setBuddy(self.replaceLineEdit) self.label.setBuddy(self.findLineEdit) # endif // QT_CONFIG(shortcut) QWidget.setTabOrder(self.findLineEdit, self.replaceLineEdit) QWidget.setTabOrder(self.replaceLineEdit, self.caseCheckBox) QWidget.setTabOrder(self.caseCheckBox, self.wholeCheckBox) QWidget.setTabOrder(self.wholeCheckBox, self.backwardsCheckBox) QWidget.setTabOrder(self.backwardsCheckBox, self.regexCheckBox) QWidget.setTabOrder(self.regexCheckBox, self.ignoreNotesCheckBox) self.retranslateUi(FindAndReplaceDlg) self.closeButton.clicked.connect(FindAndReplaceDlg.reject) self.moreButton.toggled.connect(self.moreFrame.setVisible) QMetaObject.connectSlotsByName(FindAndReplaceDlg) # setupUi def retranslateUi(self, FindAndReplaceDlg): FindAndReplaceDlg.setWindowTitle( QCoreApplication.translate("FindAndReplaceDlg", u"Find and Replace", None)) self.label_2.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Replace w&ith:", None)) self.label.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Find &what:", None)) self.caseCheckBox.setText( QCoreApplication.translate("FindAndReplaceDlg", u"&Case sensitive", None)) self.wholeCheckBox.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Wh&ole words", None)) self.backwardsCheckBox.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Search &Backwards", None)) self.regexCheckBox.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Regular E&xpression", None)) self.ignoreNotesCheckBox.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Ignore foot¬es and endnotes", None)) self.findButton.setText( QCoreApplication.translate("FindAndReplaceDlg", u"&Find", None)) self.replaceButton.setText( QCoreApplication.translate("FindAndReplaceDlg", u"&Replace", None)) self.closeButton.setText( QCoreApplication.translate("FindAndReplaceDlg", u"Close", None)) self.moreButton.setText( QCoreApplication.translate("FindAndReplaceDlg", u"&More", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1120, 700) self.actionOpen_Ops = QAction(MainWindow) self.actionOpen_Ops.setObjectName(u"actionOpen_Ops") self.actionOpen_Demo = QAction(MainWindow) self.actionOpen_Demo.setObjectName(u"actionOpen_Demo") self.actionOpen_Audio = QAction(MainWindow) self.actionOpen_Audio.setObjectName(u"actionOpen_Audio") self.actionImport_Script = QAction(MainWindow) self.actionImport_Script.setObjectName(u"actionImport_Script") self.actionSave_Ops = QAction(MainWindow) self.actionSave_Ops.setObjectName(u"actionSave_Ops") self.actionPreferences = QAction(MainWindow) self.actionPreferences.setObjectName(u"actionPreferences") self.actionView_metadata = QAction(MainWindow) self.actionView_metadata.setObjectName(u"actionView_metadata") self.actionRename = QAction(MainWindow) self.actionRename.setObjectName(u"actionRename") self.actionExport_to_XML = QAction(MainWindow) self.actionExport_to_XML.setObjectName(u"actionExport_to_XML") self.actionOperations = QAction(MainWindow) self.actionOperations.setObjectName(u"actionOperations") self.actionMetadata_editor = QAction(MainWindow) self.actionMetadata_editor.setObjectName(u"actionMetadata_editor") self.actionProduction_editor = QAction(MainWindow) self.actionProduction_editor.setObjectName(u"actionProduction_editor") self.actionAbout = QAction(MainWindow) self.actionAbout.setObjectName(u"actionAbout") self.actionHow_to_use = QAction(MainWindow) self.actionHow_to_use.setObjectName(u"actionHow_to_use") self.actionQuit = QAction(MainWindow) self.actionQuit.setObjectName(u"actionQuit") self.actionPreferences_2 = QAction(MainWindow) self.actionPreferences_2.setObjectName(u"actionPreferences_2") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setSpacing(4) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(4, 4, 4, 4) self.centralTabs = QStackedWidget(self.centralwidget) self.centralTabs.setObjectName(u"centralTabs") self.centralTabs.setMouseTracking(True) self.centralTabs.setAcceptDrops(True) self.centralTabs.setLineWidth(0) self.editStackPage = QWidget() self.editStackPage.setObjectName(u"editStackPage") self.horizontalLayout_3 = QHBoxLayout(self.editStackPage) self.horizontalLayout_3.setSpacing(2) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(4, 4, 4, 4) self.dataView = QTabWidget(self.editStackPage) self.dataView.setObjectName(u"dataView") sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dataView.sizePolicy().hasHeightForWidth()) self.dataView.setSizePolicy(sizePolicy) self.dataView.setMinimumSize(QSize(300, 0)) self.demoDataPage = DemoPage() self.demoDataPage.setObjectName(u"demoDataPage") self.verticalLayout_6 = QVBoxLayout(self.demoDataPage) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(4, 4, 4, 4) self.groupBox_3 = QGroupBox(self.demoDataPage) self.groupBox_3.setObjectName(u"groupBox_3") self.verticalLayout_6.addWidget(self.groupBox_3) self.groupBox_4 = QGroupBox(self.demoDataPage) self.groupBox_4.setObjectName(u"groupBox_4") self.verticalLayout_6.addWidget(self.groupBox_4) self.dataView.addTab(self.demoDataPage, "") self.tab_5 = QWidget() self.tab_5.setObjectName(u"tab_5") self.dataView.addTab(self.tab_5, "") self.horizontalLayout_3.addWidget(self.dataView) self.tabWidget = QTabWidget(self.editStackPage) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setEnabled(False) self.tabWidget.setAcceptDrops(True) self.tabWidget.setElideMode(Qt.ElideNone) self.tabWidget.setDocumentMode(False) self.tabWidget.setTabsClosable(False) self.tabWidget.setMovable(True) self.tabWidget.setTabBarAutoHide(False) self.horizontalLayout_3.addWidget(self.tabWidget) self.viewTabs = QTabWidget(self.editStackPage) self.viewTabs.setObjectName(u"viewTabs") self.viewTabs.setMinimumSize(QSize(0, 0)) self.viewTabs.setMaximumSize(QSize(16555215, 16777215)) self.demoViewTab = QWidget() self.demoViewTab.setObjectName(u"demoViewTab") self.verticalLayout_8 = QVBoxLayout(self.demoViewTab) self.verticalLayout_8.setSpacing(1) self.verticalLayout_8.setObjectName(u"verticalLayout_8") self.verticalLayout_8.setContentsMargins(4, 4, 4, 4) self.groupBox = QGroupBox(self.demoViewTab) self.groupBox.setObjectName(u"groupBox") self.verticalLayout_8.addWidget(self.groupBox) self.groupBox_2 = QGroupBox(self.demoViewTab) self.groupBox_2.setObjectName(u"groupBox_2") self.verticalLayout_8.addWidget(self.groupBox_2) self.viewTabs.addTab(self.demoViewTab, "") self.metadataViewTab = QWidget() self.metadataViewTab.setObjectName(u"metadataViewTab") self.viewTabs.addTab(self.metadataViewTab, "") self.horizontalLayout_3.addWidget(self.viewTabs) self.centralTabs.addWidget(self.editStackPage) self.tabWidget.raise_() self.dataView.raise_() self.viewTabs.raise_() self.centralTabsPage2 = QWidget() self.centralTabsPage2.setObjectName(u"centralTabsPage2") self.horizontalLayout_2 = QHBoxLayout(self.centralTabsPage2) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout_2.addLayout(self.horizontalLayout) self.centralTabs.addWidget(self.centralTabsPage2) self.verticalLayout.addWidget(self.centralTabs) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 1120, 22)) self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName(u"menuFile") self.menuEdit = QMenu(self.menubar) self.menuEdit.setObjectName(u"menuEdit") self.menuDemo = QMenu(self.menubar) self.menuDemo.setObjectName(u"menuDemo") self.menuView = QMenu(self.menubar) self.menuView.setObjectName(u"menuView") self.menuTools = QMenu(self.menubar) self.menuTools.setObjectName(u"menuTools") self.menuWindow = QMenu(self.menubar) self.menuWindow.setObjectName(u"menuWindow") self.menuHelp = QMenu(self.menubar) self.menuHelp.setObjectName(u"menuHelp") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuDemo.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuTools.menuAction()) self.menubar.addAction(self.menuWindow.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.menuFile.addAction(self.actionOpen_Ops) self.menuFile.addAction(self.actionSave_Ops) self.menuFile.addSeparator() self.menuFile.addAction(self.actionOpen_Demo) self.menuFile.addAction(self.actionOpen_Audio) self.menuFile.addAction(self.actionImport_Script) self.menuFile.addSeparator() self.menuEdit.addAction(self.actionPreferences) self.menuDemo.addAction(self.actionView_metadata) self.menuDemo.addAction(self.actionRename) self.menuDemo.addAction(self.actionExport_to_XML) self.menuView.addAction(self.actionOperations) self.menuView.addAction(self.actionMetadata_editor) self.menuView.addAction(self.actionProduction_editor) self.menuTools.addAction(self.actionPreferences_2) self.menuWindow.addAction(self.actionQuit) self.menuHelp.addAction(self.actionAbout) self.menuHelp.addAction(self.actionHow_to_use) self.retranslateUi(MainWindow) self.dataView.setCurrentIndex(1) self.viewTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.actionOpen_Ops.setText(QCoreApplication.translate("MainWindow", u"Open Ops", None)) self.actionOpen_Demo.setText(QCoreApplication.translate("MainWindow", u"Import Demo", None)) self.actionOpen_Audio.setText(QCoreApplication.translate("MainWindow", u"Import Audio", None)) self.actionImport_Script.setText(QCoreApplication.translate("MainWindow", u"Import Script", None)) self.actionSave_Ops.setText(QCoreApplication.translate("MainWindow", u"Save Ops", None)) self.actionPreferences.setText(QCoreApplication.translate("MainWindow", u"Preferences", None)) self.actionView_metadata.setText(QCoreApplication.translate("MainWindow", u"View metadata", None)) self.actionRename.setText(QCoreApplication.translate("MainWindow", u"Rename ", None)) self.actionExport_to_XML.setText(QCoreApplication.translate("MainWindow", u"Export to XML", None)) self.actionOperations.setText(QCoreApplication.translate("MainWindow", u"Operations", None)) self.actionMetadata_editor.setText(QCoreApplication.translate("MainWindow", u"Metadata editor", None)) self.actionProduction_editor.setText(QCoreApplication.translate("MainWindow", u"Production editor", None)) self.actionAbout.setText(QCoreApplication.translate("MainWindow", u"About", None)) self.actionHow_to_use.setText(QCoreApplication.translate("MainWindow", u"How to use", None)) self.actionQuit.setText(QCoreApplication.translate("MainWindow", u"Quit", None)) self.actionPreferences_2.setText(QCoreApplication.translate("MainWindow", u"Preferences", None)) self.groupBox_3.setTitle(QCoreApplication.translate("MainWindow", u"GroupBox", None)) self.groupBox_4.setTitle(QCoreApplication.translate("MainWindow", u"GroupBox", None)) self.dataView.setTabText(self.dataView.indexOf(self.demoDataPage), QCoreApplication.translate("MainWindow", u"Data", None)) self.dataView.setTabText(self.dataView.indexOf(self.tab_5), QCoreApplication.translate("MainWindow", u"Saved", None)) self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Demo Overview", None)) self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow", u"Step Overview", None)) self.viewTabs.setTabText(self.viewTabs.indexOf(self.demoViewTab), QCoreApplication.translate("MainWindow", u"Overview", None)) self.viewTabs.setTabText(self.viewTabs.indexOf(self.metadataViewTab), QCoreApplication.translate("MainWindow", u"Metadata", None)) self.menuFile.setTitle(QCoreApplication.translate("MainWindow", u"File", None)) self.menuEdit.setTitle(QCoreApplication.translate("MainWindow", u"Edit", None)) self.menuDemo.setTitle(QCoreApplication.translate("MainWindow", u"Demo", None)) self.menuView.setTitle(QCoreApplication.translate("MainWindow", u"View", None)) self.menuTools.setTitle(QCoreApplication.translate("MainWindow", u"Tools", None)) self.menuWindow.setTitle(QCoreApplication.translate("MainWindow", u"Window", None)) self.menuHelp.setTitle(QCoreApplication.translate("MainWindow", u"Help", None))
def __init__(self, persepolis_setting): super().__init__() # defining UI self.persepolis_setting = persepolis_setting icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) self.setWindowTitle( QCoreApplication.translate("update_src_ui_tr", 'Checking for newer version')) # installed version self.client_version = '3.20' # first line text self.update_label = QLabel( QCoreApplication.translate( "update_src_ui_tr", "The newest is the best, we recommend to update Persepolis.")) self.update_label.setTextFormat(QtCore.Qt.RichText) self.update_label.setAlignment(QtCore.Qt.AlignCenter) # second line text self.version_label = QLabel( QCoreApplication.translate( "update_src_ui_tr", 'This is Persepolis Download Manager version 3.2.0')) self.version_label.setAlignment(QtCore.Qt.AlignCenter) # release link self.link_label = QLabel( '<a href=https://github.com/persepolisdm/persepolis/releases>https://github.com/persepolisdm/persepolis/releases</a>' ) self.link_label.setAlignment(QtCore.Qt.AlignCenter) self.link_label.setOpenExternalLinks(True) # version status self.status_label = QLabel() self.status_label.setTextFormat(QtCore.Qt.RichText) self.status_label.setAlignment(QtCore.Qt.AlignCenter) # update button self.check_button = QPushButton( QCoreApplication.translate("update_src_ui_tr", "Check for new update")) self.check_button.clicked.connect(self.updateCheck) # verticalLayout vbox = QVBoxLayout() vbox.addWidget(self.update_label) vbox.addWidget(self.version_label) vbox.addWidget(self.link_label) vbox.addWidget(self.check_button) vbox.addWidget(self.status_label) # horizontalLayout hbox = QHBoxLayout() hbox.addLayout(vbox) # window layout self.setLayout(hbox) # window size and position size = self.persepolis_setting.value('checkupdate/size', QSize(360, 250)) position = self.persepolis_setting.value('checkupdate/position', QPoint(300, 300)) self.resize(size) self.move(position)
class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(580, 501) icon = QIcon() icon.addFile(u":/openshot.svg", QSize(), QIcon.Normal, QIcon.Off) Dialog.setWindowIcon(icon) Dialog.setLocale(QLocale(QLocale.English, QLocale.UnitedStates)) self.horizontalLayout = QHBoxLayout(Dialog) self.horizontalLayout.setObjectName(u"horizontalLayout") self.vbox_parent = QVBoxLayout() self.vbox_parent.setObjectName(u"vbox_parent") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.vboxTreeParent = QVBoxLayout() self.vboxTreeParent.setObjectName(u"vboxTreeParent") self.horizontalLayout_6 = QHBoxLayout() self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.btnMoveUp = QPushButton(Dialog) self.btnMoveUp.setObjectName(u"btnMoveUp") icon1 = QIcon() iconThemeName = u"go-up" if QIcon.hasThemeIcon(iconThemeName): icon1 = QIcon.fromTheme(iconThemeName) else: icon1.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnMoveUp.setIcon(icon1) self.horizontalLayout_6.addWidget(self.btnMoveUp) self.btnMoveDown = QPushButton(Dialog) self.btnMoveDown.setObjectName(u"btnMoveDown") icon2 = QIcon() iconThemeName = u"go-down" if QIcon.hasThemeIcon(iconThemeName): icon2 = QIcon.fromTheme(iconThemeName) else: icon2.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnMoveDown.setIcon(icon2) self.horizontalLayout_6.addWidget(self.btnMoveDown) self.btnShuffle = QPushButton(Dialog) self.btnShuffle.setObjectName(u"btnShuffle") icon3 = QIcon() iconThemeName = u"view-refresh" if QIcon.hasThemeIcon(iconThemeName): icon3 = QIcon.fromTheme(iconThemeName) else: icon3.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnShuffle.setIcon(icon3) self.horizontalLayout_6.addWidget(self.btnShuffle) self.btnRemove = QPushButton(Dialog) self.btnRemove.setObjectName(u"btnRemove") icon4 = QIcon() iconThemeName = u"list-remove" if QIcon.hasThemeIcon(iconThemeName): icon4 = QIcon.fromTheme(iconThemeName) else: icon4.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon4) self.horizontalLayout_6.addWidget(self.btnRemove) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_6.addItem(self.horizontalSpacer) self.vboxTreeParent.addLayout(self.horizontalLayout_6) self.horizontalLayout_2.addLayout(self.vboxTreeParent) self.vbox_properties = QVBoxLayout() self.vbox_properties.setObjectName(u"vbox_properties") self.lblTimelineLocation = QLabel(Dialog) self.lblTimelineLocation.setObjectName(u"lblTimelineLocation") self.lblTimelineLocation.setStyleSheet(u"font-weight: bold") self.lblTimelineLocation.setMargin(0) self.vbox_properties.addWidget(self.lblTimelineLocation) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.lblStartTime = QLabel(Dialog) self.lblStartTime.setObjectName(u"lblStartTime") self.lblStartTime.setMinimumSize(QSize(100, 0)) self.lblStartTime.setStyleSheet(u"") self.horizontalLayout_4.addWidget(self.lblStartTime) self.txtStartTime = QDoubleSpinBox(Dialog) self.txtStartTime.setObjectName(u"txtStartTime") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.txtStartTime.sizePolicy().hasHeightForWidth()) self.txtStartTime.setSizePolicy(sizePolicy) self.txtStartTime.setMinimumSize(QSize(150, 0)) self.txtStartTime.setMaximum(999999999.000000000000000) self.horizontalLayout_4.addWidget(self.txtStartTime) self.vbox_properties.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.lblTrack = QLabel(Dialog) self.lblTrack.setObjectName(u"lblTrack") self.lblTrack.setMinimumSize(QSize(100, 0)) self.lblTrack.setStyleSheet(u"") self.horizontalLayout_3.addWidget(self.lblTrack) self.cmbTrack = QComboBox(Dialog) self.cmbTrack.setObjectName(u"cmbTrack") self.cmbTrack.setMinimumSize(QSize(150, 0)) self.horizontalLayout_3.addWidget(self.cmbTrack) self.vbox_properties.addLayout(self.horizontalLayout_3) self.horizontalLayout_11 = QHBoxLayout() self.horizontalLayout_11.setObjectName(u"horizontalLayout_11") self.horizontalLayout_11.setContentsMargins(-1, 0, -1, -1) self.label_3 = QLabel(Dialog) self.label_3.setObjectName(u"label_3") self.label_3.setMinimumSize(QSize(100, 0)) self.horizontalLayout_11.addWidget(self.label_3) self.txtImageLength = QDoubleSpinBox(Dialog) self.txtImageLength.setObjectName(u"txtImageLength") sizePolicy.setHeightForWidth( self.txtImageLength.sizePolicy().hasHeightForWidth()) self.txtImageLength.setSizePolicy(sizePolicy) self.txtImageLength.setMinimumSize(QSize(150, 0)) self.txtImageLength.setMaximum(999999999.000000000000000) self.horizontalLayout_11.addWidget(self.txtImageLength) self.vbox_properties.addLayout(self.horizontalLayout_11) self.lblFade = QLabel(Dialog) self.lblFade.setObjectName(u"lblFade") self.lblFade.setStyleSheet(u"font-weight: bold; margin-top: 15px;") self.lblFade.setMargin(0) self.vbox_properties.addWidget(self.lblFade) self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.lblFade1 = QLabel(Dialog) self.lblFade1.setObjectName(u"lblFade1") self.lblFade1.setStyleSheet(u"") self.horizontalLayout_5.addWidget(self.lblFade1) self.cmbFade = QComboBox(Dialog) self.cmbFade.setObjectName(u"cmbFade") self.cmbFade.setMinimumSize(QSize(150, 0)) self.horizontalLayout_5.addWidget(self.cmbFade) self.vbox_properties.addLayout(self.horizontalLayout_5) self.horizontalLayout_8 = QHBoxLayout() self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.lblFadeLength = QLabel(Dialog) self.lblFadeLength.setObjectName(u"lblFadeLength") self.lblFadeLength.setStyleSheet(u"") self.horizontalLayout_8.addWidget(self.lblFadeLength) self.txtFadeLength = QDoubleSpinBox(Dialog) self.txtFadeLength.setObjectName(u"txtFadeLength") self.txtFadeLength.setMinimumSize(QSize(150, 0)) self.txtFadeLength.setMaximum(999999999.000000000000000) self.txtFadeLength.setValue(2.000000000000000) self.horizontalLayout_8.addWidget(self.txtFadeLength) self.vbox_properties.addLayout(self.horizontalLayout_8) self.label = QLabel(Dialog) self.label.setObjectName(u"label") self.label.setStyleSheet(u"font-weight: bold; margin-top: 15px;") self.vbox_properties.addWidget(self.label) self.horizontalLayout_7 = QHBoxLayout() self.horizontalLayout_7.setObjectName(u"horizontalLayout_7") self.horizontalLayout_7.setContentsMargins(-1, 0, -1, -1) self.label_2 = QLabel(Dialog) self.label_2.setObjectName(u"label_2") self.horizontalLayout_7.addWidget(self.label_2) self.cmbZoom = QComboBox(Dialog) self.cmbZoom.setObjectName(u"cmbZoom") self.cmbZoom.setMinimumSize(QSize(150, 0)) self.horizontalLayout_7.addWidget(self.cmbZoom) self.vbox_properties.addLayout(self.horizontalLayout_7) self.lblTransition = QLabel(Dialog) self.lblTransition.setObjectName(u"lblTransition") self.lblTransition.setStyleSheet( u"font-weight: bold; margin-top: 15px;") self.lblTransition.setMargin(0) self.vbox_properties.addWidget(self.lblTransition) self.horizontalLayout_9 = QHBoxLayout() self.horizontalLayout_9.setObjectName(u"horizontalLayout_9") self.lblTransition1 = QLabel(Dialog) self.lblTransition1.setObjectName(u"lblTransition1") self.lblTransition1.setStyleSheet(u"") self.horizontalLayout_9.addWidget(self.lblTransition1) self.cmbTransition = QComboBox(Dialog) self.cmbTransition.setObjectName(u"cmbTransition") self.cmbTransition.setMinimumSize(QSize(150, 0)) self.cmbTransition.setMaximumSize(QSize(150, 16777215)) self.horizontalLayout_9.addWidget(self.cmbTransition) self.vbox_properties.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QHBoxLayout() self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.lblTransitionLength = QLabel(Dialog) self.lblTransitionLength.setObjectName(u"lblTransitionLength") self.lblTransitionLength.setStyleSheet(u"") self.horizontalLayout_10.addWidget(self.lblTransitionLength) self.txtTransitionLength = QDoubleSpinBox(Dialog) self.txtTransitionLength.setObjectName(u"txtTransitionLength") self.txtTransitionLength.setMinimumSize(QSize(150, 0)) self.txtTransitionLength.setMaximum(999999999.000000000000000) self.txtTransitionLength.setValue(2.000000000000000) self.horizontalLayout_10.addWidget(self.txtTransitionLength) self.vbox_properties.addLayout(self.horizontalLayout_10) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.vbox_properties.addItem(self.verticalSpacer) self.horizontalLayout_2.addLayout(self.vbox_properties) self.verticalLayout.addLayout(self.horizontalLayout_2) self.vbox_parent.addLayout(self.verticalLayout) self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(-1, 0, -1, -1) self.lblTotalLength = QLabel(Dialog) self.lblTotalLength.setObjectName(u"lblTotalLength") sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.lblTotalLength.sizePolicy().hasHeightForWidth()) self.lblTotalLength.setSizePolicy(sizePolicy1) self.lblTotalLength.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.horizontalLayout_12.addWidget(self.lblTotalLength) self.lblTotalLengthValue = QLabel(Dialog) self.lblTotalLengthValue.setObjectName(u"lblTotalLengthValue") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.lblTotalLengthValue.sizePolicy().hasHeightForWidth()) self.lblTotalLengthValue.setSizePolicy(sizePolicy2) self.lblTotalLengthValue.setMinimumSize(QSize(75, 0)) self.lblTotalLengthValue.setStyleSheet(u"font-weight:bold;") self.lblTotalLengthValue.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.horizontalLayout_12.addWidget(self.lblTotalLengthValue) self.vbox_parent.addLayout(self.horizontalLayout_12) self.btnBox = QDialogButtonBox(Dialog) self.btnBox.setObjectName(u"btnBox") self.btnBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.btnBox.setCenterButtons(False) self.vbox_parent.addWidget(self.btnBox) self.horizontalLayout.addLayout(self.vbox_parent) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Add To Timeline", None)) #if QT_CONFIG(tooltip) self.btnMoveUp.setToolTip( QCoreApplication.translate("Dialog", u"Move Up", None)) #endif // QT_CONFIG(tooltip) self.btnMoveUp.setText("") #if QT_CONFIG(tooltip) self.btnMoveDown.setToolTip( QCoreApplication.translate("Dialog", u"Move Down", None)) #endif // QT_CONFIG(tooltip) self.btnMoveDown.setText("") #if QT_CONFIG(tooltip) self.btnShuffle.setToolTip( QCoreApplication.translate("Dialog", u"Shuffle", None)) #endif // QT_CONFIG(tooltip) self.btnShuffle.setText("") #if QT_CONFIG(tooltip) self.btnRemove.setToolTip( QCoreApplication.translate("Dialog", u"Remove", None)) #endif // QT_CONFIG(tooltip) self.btnRemove.setText("") self.lblTimelineLocation.setText( QCoreApplication.translate("Dialog", u"Timeline Location", None)) self.lblStartTime.setText( QCoreApplication.translate("Dialog", u"Start Time (seconds):", None)) self.lblTrack.setText( QCoreApplication.translate("Dialog", u"Track:", None)) self.label_3.setText( QCoreApplication.translate("Dialog", u"Image Length (seconds):", None)) self.lblFade.setText( QCoreApplication.translate("Dialog", u"Fade", None)) self.lblFade1.setText( QCoreApplication.translate("Dialog", u"Fade:", None)) self.lblFadeLength.setText( QCoreApplication.translate("Dialog", u"Length (seconds):", None)) self.label.setText(QCoreApplication.translate("Dialog", u"Zoom", None)) self.label_2.setText( QCoreApplication.translate("Dialog", u"Zoom:", None)) self.lblTransition.setText( QCoreApplication.translate("Dialog", u"Transition", None)) self.lblTransition1.setText( QCoreApplication.translate("Dialog", u"Transition:", None)) self.lblTransitionLength.setText( QCoreApplication.translate("Dialog", u"Length:", None)) self.lblTotalLength.setText( QCoreApplication.translate("Dialog", u"Total Length (seconds):", None)) self.lblTotalLengthValue.setText( QCoreApplication.translate("Dialog", u"0.0", None))
class UIFirstTimeWelcomeWindow(object): configured = QtCore.Signal(str) # the ui constructor function def setup_ui(self, first_time_welcome_window_instance): self.filepath = "" if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" window_icon = QtGui.QIcon() window_icon.addPixmap( QtGui.QPixmap(resource_path("res/images/icon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) # adding icon first_time_welcome_window_instance.setObjectName( "FirstTimeWelcomeWindowInstance") first_time_welcome_window_instance.setWindowIcon(window_icon) first_time_welcome_window_instance.setFixedSize(840, 530) # Create a vertical layout to manage layout in a vertical manner self.window_vertical_layout_box = QVBoxLayout() self.window_vertical_layout_box.setObjectName( "FirstTimeWelcomeWindowInstanceVerticalLayoutBox") # Create a horizontal box to hold the Onko logo & welcome message self.first_time_welcome_logo_message_horizontal_box = QHBoxLayout() self.first_time_welcome_logo_message_horizontal_box.setObjectName( "FirstTimeWelcomeLogoMessageBox") # Set up the Logo Holder self.logo_holder = QtWidgets.QHBoxLayout() self.first_time_welcome_logo = QtWidgets.QLabel() self.first_time_welcome_logo.setPixmap( QtGui.QPixmap(resource_path("res/images/image.png"))) self.first_time_welcome_logo.setScaledContents(True) self.first_time_welcome_logo.setObjectName( "FirstTimeWelcomeWindowLogo") self.first_time_welcome_logo.setFixedSize(240, 130) self.logo_holder.addWidget(self.first_time_welcome_logo) self.first_time_welcome_logo_message_horizontal_box.addLayout( self.logo_holder) # Create a vertical box to hold the welcome message self.first_time_welcome_message_vertical_box = QVBoxLayout() self.first_time_welcome_message_vertical_box.setObjectName( "FirstTimeWelcomeWindowWelcomeMessage") # Set up the Label self.first_time_welcome_message_label = QtWidgets.QLabel() self.first_time_welcome_message_label.setObjectName( "FirstTimeWelcomeWindowLabel") self.first_time_welcome_message_label.setAlignment(Qt.AlignLeft) self.first_time_welcome_message_vertical_box.addWidget( self.first_time_welcome_message_label) # Set up the Slogan self.first_time_welcome_message_slogan = QtWidgets.QLabel() self.first_time_welcome_message_slogan.setObjectName( "FirstTimeWelcomeWindowSlogan") self.first_time_welcome_message_slogan.setAlignment(Qt.AlignLeft) self.first_time_welcome_message_slogan.setWordWrap(True) self.first_time_welcome_message_vertical_box.addWidget( self.first_time_welcome_message_slogan) self.first_time_welcome_message_slogan_widget = QWidget() self.first_time_welcome_message_slogan_widget.setLayout( self.first_time_welcome_message_vertical_box) self.first_time_welcome_logo_message_horizontal_box.addWidget( self.first_time_welcome_message_slogan_widget) self.first_time_welcome_logo_message_widget = QWidget() self.first_time_welcome_logo_message_widget.setLayout( self.first_time_welcome_logo_message_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_welcome_logo_message_widget) # Create a label to prompt the user to enter the path to the default directory self.first_time_welcome_default_dir_prompt = QtWidgets.QLabel() self.first_time_welcome_default_dir_prompt.setObjectName( "FirstTimeWelcomeWindowPrompt") self.first_time_welcome_default_dir_prompt.setAlignment(Qt.AlignLeft) self.window_vertical_layout_box.addWidget( self.first_time_welcome_default_dir_prompt) # Create a horizontal box to hold the input box for the directory and the choose button self.first_time_welcome_input_horizontal_box = QHBoxLayout() self.first_time_welcome_input_horizontal_box.setObjectName( "FirstTimeWelcomeWindowInputHorizontalBox") # Create a textbox to contain the path to the default directory self.first_time_welcome_input_box = UIFirstTimeUserDragAndDropEvent( self) self.first_time_welcome_input_box.setObjectName( "FirstTimeWelcomeWindowInputBox") self.first_time_welcome_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.first_time_welcome_input_horizontal_box.addWidget( self.first_time_welcome_input_box) # Create a choose button to open the file dialog self.first_time_welcome_choose_button = QPushButton() self.first_time_welcome_choose_button.setObjectName( "FirstTimeWelcomeWindowChooseButton") self.first_time_welcome_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.first_time_welcome_choose_button.resize( self.first_time_welcome_choose_button.sizeHint().width(), self.first_time_welcome_input_box.height()) self.first_time_welcome_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.first_time_welcome_input_horizontal_box.addWidget( self.first_time_welcome_choose_button) self.first_time_welcome_choose_button.clicked.connect( self.choose_button_clicked) # Create a widget to hold the input field self.first_time_welcome_input_widget = QWidget() self.first_time_welcome_input_horizontal_box.setStretch(0, 4) self.first_time_welcome_input_widget.setLayout( self.first_time_welcome_input_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_welcome_input_widget) self.window_vertical_layout_box.addStretch(1) # Create widgets for the clinical data CSV file path self.clinical_data_csv_dir_label = QtWidgets.QLabel() self.clinical_data_csv_dir_label.setObjectName("ClinicalDataCSVPrompt") self.clinical_data_csv_dir_label.setAlignment(Qt.AlignLeft) self.window_vertical_layout_box.addWidget( self.clinical_data_csv_dir_label) # Create a horizontal box to hold the input box for the # directory and the choose button self.clinical_data_csv_horizontal_box = QHBoxLayout() self.clinical_data_csv_horizontal_box.setObjectName( "ClinicalDataCSVHorizontalBox") # Create a textbox to contain the path to the default directory self.clinical_data_csv_input_box = \ UIFirstTimeUserDragAndDropEvent(self) self.clinical_data_csv_input_box.setObjectName( "ClinicalDataCSVInputBox") self.clinical_data_csv_input_box.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.clinical_data_csv_horizontal_box.addWidget( self.clinical_data_csv_input_box) # Create a choose button to open the file dialog self.clinical_data_csv_choose_button = QPushButton() self.clinical_data_csv_choose_button.setObjectName( "ClinicalDataCSVChooseButton") self.clinical_data_csv_choose_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.clinical_data_csv_choose_button.resize( self.clinical_data_csv_choose_button.sizeHint().width(), self.clinical_data_csv_input_box.height()) self.clinical_data_csv_choose_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.clinical_data_csv_horizontal_box.addWidget( self.clinical_data_csv_choose_button) self.clinical_data_csv_choose_button.clicked.connect( self.change_clinical_data_csv_button_clicked) # Create a widget to hold the input field self.clinical_data_input_widget = QWidget() self.clinical_data_csv_horizontal_box.setStretch(0, 4) self.clinical_data_input_widget.setLayout( self.clinical_data_csv_horizontal_box) self.window_vertical_layout_box.addWidget( self.clinical_data_input_widget) self.window_vertical_layout_box.addStretch(1) # Create a horizontal box to hold the Skip and Confirm button self.first_time_window_configure_actions_horizontal_box = QHBoxLayout() self.first_time_window_configure_actions_horizontal_box.setObjectName( "FirstTimeWelcomeWindowConfigureActionsHorizontalBox") self.first_time_window_configure_actions_horizontal_box.addStretch(1) # Add a button to skip the configuration setting self.skip_button = QPushButton() self.skip_button.setObjectName("SkipButton") self.skip_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.skip_button.resize(self.skip_button.sizeHint().width(), self.skip_button.sizeHint().height()) self.skip_button.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.skip_button.setProperty("QPushButtonClass", "fail-button") self.first_time_window_configure_actions_horizontal_box.addWidget( self.skip_button) # Add a button to save the default directory self.save_dir_button = QPushButton() self.save_dir_button.setObjectName("SaveDirButton") self.save_dir_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.save_dir_button.resize(self.save_dir_button.sizeHint().width(), self.save_dir_button.sizeHint().height()) self.save_dir_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.save_dir_button.clicked.connect(self.save_options) self.save_dir_button.setProperty("QPushButtonClass", "success-button") self.first_time_window_configure_actions_horizontal_box.addWidget( self.save_dir_button) # Create a widget to house all of the actions button for first-time window self.first_time_window_configure_actions_widget = QWidget() self.first_time_window_configure_actions_widget.setLayout( self.first_time_window_configure_actions_horizontal_box) self.window_vertical_layout_box.addWidget( self.first_time_window_configure_actions_widget) self.first_time_window_instance_central_widget = QWidget() self.first_time_window_instance_central_widget.setLayout( self.window_vertical_layout_box) first_time_welcome_window_instance.setCentralWidget( self.first_time_window_instance_central_widget) # Set the current stylesheet to the instance and connect it back to the caller through slot _stylesheet = open(resource_path(self.stylesheet_path)).read() first_time_welcome_window_instance.setStyleSheet(_stylesheet) self.retranslate_ui(first_time_welcome_window_instance) QtCore.QMetaObject.connectSlotsByName( first_time_welcome_window_instance) # this function inserts all the text in the first time page def retranslate_ui(self, first_time_welcome_window_instance): _translate = QtCore.QCoreApplication.translate first_time_welcome_window_instance.setWindowTitle( _translate("FirstTimeWelcomeWindowInstance", "OnkoDICOM - First-time User Setting")) self.first_time_welcome_message_label.setText( _translate("FirstTimeWelcomeWindowInstance", "Welcome to OnkoDICOM!")) self.first_time_welcome_message_slogan.setText( _translate( "FirstTimeWelcomeWindowInstance", "OnkoDICOM - the solution for producing data for analysis from your oncology plans and scans." )) self.first_time_welcome_default_dir_prompt.setText( _translate( "FirstTimeWelcomeWindowInstance", "Choose the path of the default directory containing all DICOM files:" )) self.first_time_welcome_input_box.setPlaceholderText( _translate( "FirstTimeWelcomeWindowInstance", "Enter DICOM Files Path (For example, C:\path\\to\your\DICOM\Files)" )) self.first_time_welcome_choose_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Choose")) # Clinical data CSV widgets self.clinical_data_csv_dir_label.setText( _translate( "FirstTimeWelcomeWindowInstance", "Choose the CSV file containing patient clinical data:")) self.clinical_data_csv_input_box.setPlaceholderText( _translate("FirstTimeWelcomeWindowInstance", "Enter CSV File Path (for example, C:\CSV\\file.csv)")) self.clinical_data_csv_choose_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Choose")) self.save_dir_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Confirm")) self.skip_button.setText( _translate("FirstTimeWelcomeWindowInstance", "Skip")) def save_options(self): """ Saves options selected in the first time welcome window. """ self.filepath = self.first_time_welcome_input_box.text() self.csv_path = self.clinical_data_csv_input_box.text() if self.filepath == "" and self.csv_path == "": QMessageBox.about(self, "Unable to proceed", "No directories selected.") elif not os.path.exists(self.filepath) or not \ os.path.exists(self.csv_path): QMessageBox.about(self, "Unable to proceed", "Directories do not exist") else: config = Configuration() try: config.update_default_directory(self.filepath) # Update CSV path if it exists if self.csv_path != "" and os.path.exists(self.csv_path): config.update_clinical_data_csv_dir(self.csv_path) except SqlError: config.set_up_config_db() QMessageBox.critical( self, "Config file error", "Failed to access configuration file.\nPlease try again.") else: self.configured.emit(self.filepath) def choose_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user and loads all files and subdirectories. """ # Get folder path from pop up dialog box self.filepath = QtWidgets.QFileDialog.getExistingDirectory( None, 'Select default directory...', '') self.first_time_welcome_input_box.setText(self.filepath) def change_clinical_data_csv_button_clicked(self): """ Executes when the choose button is clicked. Gets filepath from the user. """ # Get folder path from pop up dialog box self.csv_path = QtWidgets.QFileDialog.getOpenFileName( None, "Open Clinical Data File", "", "CSV data files (*.csv)")[0] if len(self.csv_path) > 0: self.clinical_data_csv_input_box.setText(self.csv_path)
class Ui_Form(object): def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(600, 500) Form.setStyleSheet(u"QWidget#Form{\n" " background-color: rgb(225, 243, 254);\n" "}") self.verticalLayout_2 = QVBoxLayout(Form) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setSpacing(6) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.lineEdit_headers_path = HeaderFileQLineEdit(Form) self.lineEdit_headers_path.setObjectName(u"lineEdit_headers_path") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_headers_path.sizePolicy().hasHeightForWidth()) self.lineEdit_headers_path.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_headers_path) self.pushButton_select = QPushButton(Form) self.pushButton_select.setObjectName(u"pushButton_select") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.pushButton_select.sizePolicy().hasHeightForWidth()) self.pushButton_select.setSizePolicy(sizePolicy1) self.pushButton_select.setMaximumSize(QSize(16777215, 40)) self.horizontalLayout_2.addWidget(self.pushButton_select) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName(u"horizontalLayout") self.textEdit_headers_content = HeadersQTextEdit(Form) self.textEdit_headers_content.setObjectName( u"textEdit_headers_content") self.horizontalLayout.addWidget(self.textEdit_headers_content) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(u"verticalLayout") self.pushButton_save = QPushButton(Form) self.pushButton_save.setObjectName(u"pushButton_save") sizePolicy1.setHeightForWidth( self.pushButton_save.sizePolicy().hasHeightForWidth()) self.pushButton_save.setSizePolicy(sizePolicy1) self.pushButton_save.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_save) self.pushButton_add = QPushButton(Form) self.pushButton_add.setObjectName(u"pushButton_add") sizePolicy1.setHeightForWidth( self.pushButton_add.sizePolicy().hasHeightForWidth()) self.pushButton_add.setSizePolicy(sizePolicy1) self.pushButton_add.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_add) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2.addLayout(self.horizontalLayout) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.listWidget_headers_key = QListWidget(Form) self.listWidget_headers_key.setObjectName(u"listWidget_headers_key") self.horizontalLayout_3.addWidget(self.listWidget_headers_key) self.listWidget_headers_value = QListWidget(Form) self.listWidget_headers_value.setObjectName( u"listWidget_headers_value") self.horizontalLayout_3.addWidget(self.listWidget_headers_value) self.horizontalLayout_3.setStretch(0, 1) self.horizontalLayout_3.setStretch(1, 4) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.verticalLayout_2.setStretch(0, 1) self.verticalLayout_2.setStretch(1, 3) self.verticalLayout_2.setStretch(2, 6) self.retranslateUi(Form) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, Form): Form.setWindowTitle( QCoreApplication.translate("Form", u"headers editor", None)) self.lineEdit_headers_path.setPlaceholderText( QCoreApplication.translate("Form", u"headers.json", None)) #if QT_CONFIG(tooltip) self.pushButton_select.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>load headers.json file</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_select.setText( QCoreApplication.translate("Form", u"select", None)) #if QT_CONFIG(tooltip) self.pushButton_save.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>save to headers.json</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_save.setText( QCoreApplication.translate("Form", u"save", None)) #if QT_CONFIG(tooltip) self.pushButton_add.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>add a group of header key-value</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_add.setText( QCoreApplication.translate("Form", u"add", None))
class Widget(QWidget): def __init__(self): QWidget.__init__(self) self.items = 0 # Example data self._data = { "Water": 24.5, "Electricity": 55.1, "Rent": 850.0, "Supermarket": 230.4, "Internet": 29.99, "Spätkauf": 21.85, "BVG Ticket": 60.0, "Coffee": 22.45, "Meetup": 0.0 } # Left self.table = QTableWidget() self.table.setColumnCount(2) self.table.setHorizontalHeaderLabels(["Description", "Quantity"]) self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # Chart self.chart_view = QChartView() self.chart_view.setRenderHint(QPainter.Antialiasing) # Right self.description = QLineEdit() self.quantity = QLineEdit() self.add = QPushButton("Add") self.clear = QPushButton("Clear") self.quit = QPushButton("Quit") self.plot = QPushButton("Plot") # Disabling 'Add' button self.add.setEnabled(False) self.right = QVBoxLayout() self.right.setContentsMargins(10, 10, 10, 10) self.right.addWidget(QLabel("Description")) self.right.addWidget(self.description) self.right.addWidget(QLabel("Quantity")) self.right.addWidget(self.quantity) self.right.addWidget(self.add) self.right.addWidget(self.plot) self.right.addWidget(self.chart_view) self.right.addWidget(self.clear) self.right.addWidget(self.quit) # QWidget Layout self.layout = QHBoxLayout() self.layout.addWidget(self.table) self.layout.addLayout(self.right) # Set the layout to the QWidget self.setLayout(self.layout) # Signals and Slots self.add.clicked.connect(self.add_element) self.quit.clicked.connect(self.quit_application) self.plot.clicked.connect(self.plot_data) self.clear.clicked.connect(self.clear_table) self.description.textChanged[str].connect(self.check_disable) self.quantity.textChanged[str].connect(self.check_disable) # Fill example data self.fill_table() @Slot() def add_element(self): des = self.description.text() qty = self.quantity.text() self.table.insertRow(self.items) self.table.setItem(self.items, 0, QTableWidgetItem(des)) self.table.setItem(self.items, 1, QTableWidgetItem(qty)) self.description.setText("") self.quantity.setText("") self.items += 1 @Slot() def check_disable(self, s): if not self.description.text() or not self.quantity.text(): self.add.setEnabled(False) else: self.add.setEnabled(True) @Slot() def plot_data(self): # Get table information series = QPieSeries() for i in range(self.table.rowCount()): text = self.table.item(i, 0).text() number = float(self.table.item(i, 1).text()) series.append(text, number) chart = QChart() chart.addSeries(series) chart.legend().setAlignment(Qt.AlignLeft) self.chart_view.setChart(chart) @Slot() def quit_application(self): QApplication.quit() def fill_table(self, data=None): data = self._data if not data else data for desc, price in data.items(): self.table.insertRow(self.items) self.table.setItem(self.items, 0, QTableWidgetItem(desc)) self.table.setItem(self.items, 1, QTableWidgetItem(str(price))) self.items += 1 @Slot() def clear_table(self): self.table.setRowCount(0) self.items = 0
class UIManipulateROIWindow: def setup_ui(self, manipulate_roi_window_instance, rois, dataset_rtss, roi_color, signal_roi_manipulated): self.patient_dict_container = PatientDictContainer() self.rois = rois self.dataset_rtss = dataset_rtss self.signal_roi_manipulated = signal_roi_manipulated self.roi_color = roi_color self.roi_names = [] # Names of selected ROIs self.all_roi_names = [] # Names of all existing ROIs for roi_id, roi_dict in self.rois.items(): self.all_roi_names.append(roi_dict['name']) # Operation names self.single_roi_operation_names = [ "Expand", "Contract", "Inner Rind (annulus)", "Outer Rind (annulus)" ] self.multiple_roi_operation_names = [ "Union", "Intersection", "Difference" ] self.operation_names = self.multiple_roi_operation_names + \ self.single_roi_operation_names self.new_ROI_contours = None self.manipulate_roi_window_instance = manipulate_roi_window_instance self.dicom_view = DicomAxialView(metadata_formatted=True, is_four_view=True) self.dicom_preview = DicomAxialView(metadata_formatted=True, is_four_view=True) self.dicom_view.slider.valueChanged.connect( self.dicom_view_slider_value_changed) self.dicom_preview.slider.valueChanged.connect( self.dicom_preview_slider_value_changed) self.init_layout() QtCore.QMetaObject.connectSlotsByName(manipulate_roi_window_instance) def retranslate_ui(self, manipulate_roi_window_instance): _translate = QtCore.QCoreApplication.translate manipulate_roi_window_instance.setWindowTitle( _translate("ManipulateRoiWindowInstance", "OnkoDICOM - Draw Region Of Interest")) self.first_roi_name_label.setText( _translate("FirstROINameLabel", "ROI 1: ")) self.first_roi_name_dropdown_list.setPlaceholderText("ROI 1") self.first_roi_name_dropdown_list.addItems(self.all_roi_names) self.operation_name_label.setText( _translate("OperationNameLabel", "Operation")) self.operation_name_dropdown_list.setPlaceholderText("Operation") self.operation_name_dropdown_list.addItems(self.operation_names) self.second_roi_name_label.setText( _translate("SecondROINameLabel", "ROI 2: ")) self.second_roi_name_dropdown_list.setPlaceholderText("ROI 2") self.second_roi_name_dropdown_list.addItems(self.all_roi_names) self.manipulate_roi_window_instance_draw_button.setText( _translate("ManipulateRoiWindowInstanceDrawButton", "Draw")) self.manipulate_roi_window_instance_save_button.setText( _translate("ManipulateRoiWindowInstanceSaveButton", "Save")) self.manipulate_roi_window_instance_cancel_button.setText( _translate("ManipulateRoiWindowInstanceCancelButton", "Cancel")) self.margin_label.setText(_translate("MarginLabel", "Margin (mm): ")) self.new_roi_name_label.setText( _translate("NewROINameLabel", "New ROI Name")) self.ROI_view_box_label.setText("ROI") self.preview_box_label.setText("Preview") def init_layout(self): """ Initialize the layout for the DICOM View tab. Add the view widget and the slider in the layout. Add the whole container 'tab2_view' as a tab in the main page. """ # Initialise a ManipulateROIWindow if platform.system() == 'Darwin': self.stylesheet_path = "res/stylesheet.qss" else: self.stylesheet_path = "res/stylesheet-win-linux.qss" stylesheet = open(resource_path(self.stylesheet_path)).read() window_icon = QIcon() window_icon.addPixmap(QPixmap(resource_path("res/images/icon.ico")), QIcon.Normal, QIcon.Off) self.manipulate_roi_window_instance.setObjectName( "ManipulateRoiWindowInstance") self.manipulate_roi_window_instance.setWindowIcon(window_icon) # Creating a form box to hold all buttons and input fields self.manipulate_roi_window_input_container_box = QFormLayout() self.manipulate_roi_window_input_container_box.setObjectName( "ManipulateRoiWindowInputContainerBox") self.manipulate_roi_window_input_container_box.setLabelAlignment( Qt.AlignLeft) # Create a label for denoting the first ROI name self.first_roi_name_label = QLabel() self.first_roi_name_label.setObjectName("FirstROINameLabel") self.first_roi_name_dropdown_list = QComboBox() # Create an dropdown list for ROI name self.first_roi_name_dropdown_list.setObjectName( "FirstROINameDropdownList") self.first_roi_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.first_roi_name_dropdown_list.resize( self.first_roi_name_dropdown_list.sizeHint().width(), self.first_roi_name_dropdown_list.sizeHint().height()) self.first_roi_name_dropdown_list.activated.connect( self.update_selected_rois) self.manipulate_roi_window_input_container_box.addRow( self.first_roi_name_label, self.first_roi_name_dropdown_list) # Create a label for denoting the operation self.operation_name_label = QLabel() self.operation_name_label.setObjectName("OperationNameLabel") self.operation_name_dropdown_list = QComboBox() # Create an dropdown list for operation name self.operation_name_dropdown_list.setObjectName( "OperationNameDropdownList") self.operation_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.operation_name_dropdown_list.resize( self.operation_name_dropdown_list.sizeHint().width(), self.operation_name_dropdown_list.sizeHint().height()) self.operation_name_dropdown_list.activated.connect( self.operation_changed) self.manipulate_roi_window_input_container_box.addRow( self.operation_name_label, self.operation_name_dropdown_list) # Create a label for denoting the second ROI name self.second_roi_name_label = QLabel() self.second_roi_name_label.setObjectName("SecondROINameLabel") self.second_roi_name_label.setVisible(False) self.second_roi_name_dropdown_list = QComboBox() # Create an dropdown list for ROI name self.second_roi_name_dropdown_list.setObjectName( "SecondROINameDropdownList") self.second_roi_name_dropdown_list.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) self.second_roi_name_dropdown_list.resize( self.second_roi_name_dropdown_list.sizeHint().width(), self.second_roi_name_dropdown_list.sizeHint().height()) self.second_roi_name_dropdown_list.setVisible(False) self.second_roi_name_dropdown_list.activated.connect( self.update_selected_rois) self.manipulate_roi_window_input_container_box.addRow( self.second_roi_name_label, self.second_roi_name_dropdown_list) # Create a label for denoting the margin self.margin_label = QLabel() self.margin_label.setObjectName("MarginLabel") self.margin_label.setVisible(False) # Create input for the new ROI name self.margin_line_edit = QLineEdit() self.margin_line_edit.setObjectName("MarginInput") self.margin_line_edit.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.margin_line_edit.resize(self.margin_line_edit.sizeHint().width(), self.margin_line_edit.sizeHint().height()) self.margin_line_edit.setVisible(False) self.margin_line_edit.setValidator( QRegularExpressionValidator( QRegularExpression("^[0-9]*[.]?[0-9]*$"))) self.manipulate_roi_window_input_container_box.addRow( self.margin_label, self.margin_line_edit) # Create a label for denoting the new ROI name self.new_roi_name_label = QLabel() self.new_roi_name_label.setObjectName("NewROINameLabel") # Create input for the new ROI name self.new_roi_name_line_edit = QLineEdit() self.new_roi_name_line_edit.setObjectName("NewROINameInput") self.new_roi_name_line_edit.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.new_roi_name_line_edit.resize( self.new_roi_name_line_edit.sizeHint().width(), self.new_roi_name_line_edit.sizeHint().height()) self.manipulate_roi_window_input_container_box.addRow( self.new_roi_name_label, self.new_roi_name_line_edit) # Create a spacer between inputs and buttons spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) spacer.setFocusPolicy(Qt.NoFocus) self.manipulate_roi_window_input_container_box.addRow(spacer) # Create a warning message when missing inputs self.warning_message = QWidget() self.warning_message.setContentsMargins(8, 5, 8, 5) warning_message_layout = QHBoxLayout() warning_message_layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignLeft) warning_message_icon = QLabel() warning_message_icon.setPixmap( QtGui.QPixmap( resource_path("res/images/btn-icons/alert_icon.png"))) warning_message_layout.addWidget(warning_message_icon) self.warning_message_text = QLabel() self.warning_message_text.setStyleSheet("color: red") warning_message_layout.addWidget(self.warning_message_text) self.warning_message.setLayout(warning_message_layout) self.warning_message.setVisible(False) self.manipulate_roi_window_input_container_box.addRow( self.warning_message) # Create a draw button self.manipulate_roi_window_instance_draw_button = QPushButton() self.manipulate_roi_window_instance_draw_button.setObjectName( "ManipulateRoiWindowInstanceDrawButton") self.manipulate_roi_window_instance_draw_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_draw_button.resize( self.manipulate_roi_window_instance_draw_button.sizeHint().width(), self.manipulate_roi_window_instance_draw_button.sizeHint().height( )) self.manipulate_roi_window_instance_draw_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.manipulate_roi_window_instance_draw_button.clicked.connect( self.onDrawButtonClicked) self.manipulate_roi_window_input_container_box.addRow( self.manipulate_roi_window_instance_draw_button) # Create a horizontal box for saving and cancel the drawing self.manipulate_roi_window_cancel_save_box = QHBoxLayout() self.manipulate_roi_window_cancel_save_box.setObjectName( "ManipulateRoiWindowCancelSaveBox") # Create an exit button to cancel the drawing # Add a button to go back/exit from the application self.manipulate_roi_window_instance_cancel_button = QPushButton() self.manipulate_roi_window_instance_cancel_button.setObjectName( "ManipulateRoiWindowInstanceCancelButton") self.manipulate_roi_window_instance_cancel_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_cancel_button.resize( self.manipulate_roi_window_instance_cancel_button.sizeHint().width( ), self.manipulate_roi_window_instance_cancel_button.sizeHint(). height()) self.manipulate_roi_window_instance_cancel_button.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.manipulate_roi_window_instance_cancel_button.clicked.connect( self.onCancelButtonClicked) self.manipulate_roi_window_instance_cancel_button.setProperty( "QPushButtonClass", "fail-button") icon_cancel = QtGui.QIcon() icon_cancel.addPixmap( QtGui.QPixmap( resource_path('res/images/btn-icons/cancel_icon.png'))) self.manipulate_roi_window_instance_cancel_button.setIcon(icon_cancel) self.manipulate_roi_window_cancel_save_box.addWidget( self.manipulate_roi_window_instance_cancel_button) # Create a save button to save all the changes self.manipulate_roi_window_instance_save_button = QPushButton() self.manipulate_roi_window_instance_save_button.setObjectName( "ManipulateRoiWindowInstanceSaveButton") self.manipulate_roi_window_instance_save_button.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.manipulate_roi_window_instance_save_button.resize( self.manipulate_roi_window_instance_save_button.sizeHint().width(), self.manipulate_roi_window_instance_save_button.sizeHint().height( )) self.manipulate_roi_window_instance_save_button.setProperty( "QPushButtonClass", "success-button") icon_save = QtGui.QIcon() icon_save.addPixmap( QtGui.QPixmap(resource_path('res/images/btn-icons/save_icon.png'))) self.manipulate_roi_window_instance_save_button.setIcon(icon_save) self.manipulate_roi_window_instance_save_button.clicked.connect( self.onSaveClicked) self.manipulate_roi_window_cancel_save_box.addWidget( self.manipulate_roi_window_instance_save_button) self.manipulate_roi_window_input_container_box.addRow( self.manipulate_roi_window_cancel_save_box) # Creating a horizontal box to hold the ROI view and the preview self.manipulate_roi_window_instance_view_box = QHBoxLayout() self.manipulate_roi_window_instance_view_box.setObjectName( "ManipulateRoiWindowInstanceViewBoxes") # Font for the ROI view and preview's labels font = QFont() font.setBold(True) font.setPixelSize(20) # Creating the ROI view self.ROI_view_box_layout = QVBoxLayout() self.ROI_view_box_label = QLabel() self.ROI_view_box_label.setFont(font) self.ROI_view_box_label.setAlignment(Qt.AlignHCenter) self.ROI_view_box_layout.addWidget(self.ROI_view_box_label) self.ROI_view_box_layout.addWidget(self.dicom_view) self.ROI_view_box_widget = QWidget() self.ROI_view_box_widget.setLayout(self.ROI_view_box_layout) # Creating the preview self.preview_box_layout = QVBoxLayout() self.preview_box_label = QLabel() self.preview_box_label.setFont(font) self.preview_box_label.setAlignment(Qt.AlignHCenter) self.preview_box_layout.addWidget(self.preview_box_label) self.preview_box_layout.addWidget(self.dicom_preview) self.preview_box_widget = QWidget() self.preview_box_widget.setLayout(self.preview_box_layout) # Add View and Slider into horizontal box self.manipulate_roi_window_instance_view_box.addWidget( self.ROI_view_box_widget) self.manipulate_roi_window_instance_view_box.addWidget( self.preview_box_widget) # Create a widget to hold the image slice box self.manipulate_roi_window_instance_view_widget = QWidget() self.manipulate_roi_window_instance_view_widget.setObjectName( "ManipulateRoiWindowInstanceActionWidget") self.manipulate_roi_window_instance_view_widget.setLayout( self.manipulate_roi_window_instance_view_box) # Create a horizontal box for containing the input fields and the # viewports self.manipulate_roi_window_main_box = QHBoxLayout() self.manipulate_roi_window_main_box.setObjectName( "ManipulateRoiWindowMainBox") self.manipulate_roi_window_main_box.addLayout( self.manipulate_roi_window_input_container_box, 1) self.manipulate_roi_window_main_box.addWidget( self.manipulate_roi_window_instance_view_widget, 11) # Create a new central widget to hold the horizontal box layout self.manipulate_roi_window_instance_central_widget = QWidget() self.manipulate_roi_window_instance_central_widget.setObjectName( "ManipulateRoiWindowInstanceCentralWidget") self.manipulate_roi_window_instance_central_widget.setLayout( self.manipulate_roi_window_main_box) self.retranslate_ui(self.manipulate_roi_window_instance) self.manipulate_roi_window_instance.setStyleSheet(stylesheet) self.manipulate_roi_window_instance.setCentralWidget( self.manipulate_roi_window_instance_central_widget) QtCore.QMetaObject.connectSlotsByName( self.manipulate_roi_window_instance) def dicom_view_slider_value_changed(self): """ Display selected ROIs in dropbox when moving to another image slice """ self.display_selected_roi() if self.dicom_preview.slider.value() != self.dicom_view.slider.value(): self.dicom_preview.slider.setValue(self.dicom_view.slider.value()) def dicom_preview_slider_value_changed(self): """ Display generated ROI when moving to another image slice """ self.draw_roi() if self.dicom_preview.slider.value() != self.dicom_view.slider.value(): self.dicom_view.slider.setValue(self.dicom_preview.slider.value()) def onCancelButtonClicked(self): """ This function is used for canceling the drawing """ self.close() def onDrawButtonClicked(self): """ Function triggered when the Draw button is pressed from the menu. """ # Hide warning message self.warning_message.setVisible(False) # Check inputs selected_operation = self.operation_name_dropdown_list.currentText() roi_1 = self.first_roi_name_dropdown_list.currentText() roi_2 = self.second_roi_name_dropdown_list.currentText() new_roi_name = self.new_roi_name_line_edit.text() # Check the selected inputs and execute the operations if roi_1 != "" and new_roi_name != "" and \ self.margin_line_edit.text() != "" and \ selected_operation in self.single_roi_operation_names: # Single ROI operations dict_rois_contours = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), [roi_1], self.patient_dict_container.get("pixluts")) roi_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_1]) margin = float(self.margin_line_edit.text()) if selected_operation == self.single_roi_operation_names[0]: new_geometry = ROI.scale_roi(roi_geometry, margin) elif selected_operation == self.single_roi_operation_names[1]: new_geometry = ROI.scale_roi(roi_geometry, -margin) elif selected_operation == self.single_roi_operation_names[2]: new_geometry = ROI.rind_roi(roi_geometry, -margin) else: new_geometry = ROI.rind_roi(roi_geometry, margin) self.new_ROI_contours = ROI.geometry_to_roi(new_geometry) self.draw_roi() return True elif roi_1 != "" and roi_2 != "" and new_roi_name != "" and \ selected_operation in self.multiple_roi_operation_names: # Multiple ROI operations dict_rois_contours = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), [roi_1, roi_2], self.patient_dict_container.get("pixluts")) roi_1_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_1]) roi_2_geometry = ROI.roi_to_geometry(dict_rois_contours[roi_2]) # Execute the selected operation new_geometry = ROI.manipulate_rois(roi_1_geometry, roi_2_geometry, selected_operation.upper()) self.new_ROI_contours = ROI.geometry_to_roi(new_geometry) self.draw_roi() return True self.warning_message_text.setText("Not all values are specified.") self.warning_message.setVisible(True) return False def onSaveClicked(self): """ Save the new ROI """ # Get the name of the new ROI new_roi_name = self.new_roi_name_line_edit.text() # If the new ROI hasn't been drawn, draw the new ROI. Then if the new # ROI is drawn successfully, proceed to save the new ROI. if self.new_ROI_contours is None: if not self.onDrawButtonClicked(): return # Get a dict to convert SOPInstanceUID to slice id slice_ids_dict = get_dict_slice_to_uid(PatientDictContainer()) # Transform new_ROI_contours to a list of roi information rois_to_save = {} for uid, contour_sequence in self.new_ROI_contours.items(): slider_id = slice_ids_dict[uid] location = self.patient_dict_container.filepaths[slider_id] ds = pydicom.dcmread(location) slice_info = {'coords': contour_sequence, 'ds': ds} rois_to_save[slider_id] = slice_info roi_list = ROI.convert_hull_list_to_contours_data( rois_to_save, self.patient_dict_container) connectSaveROIProgress(self, roi_list, self.dataset_rtss, new_roi_name, self.roi_saved) def draw_roi(self): """ Draw the new ROI """ # Get the new ROI's name new_roi_name = self.new_roi_name_line_edit.text() # Check if the new ROI contour is None if self.new_ROI_contours is None: return # Get the info required to draw the new ROI slider_id = self.dicom_preview.slider.value() curr_slice = self.patient_dict_container.get("dict_uid")[slider_id] # Calculate the new ROI's polygon dict_ROI_contours = {} dict_ROI_contours[new_roi_name] = self.new_ROI_contours polygons = ROI.calc_roi_polygon(new_roi_name, curr_slice, dict_ROI_contours) # Set the new ROI color color = QtGui.QColor() color.setRgb(90, 250, 175, 200) pen_color = QtGui.QColor(color.red(), color.green(), color.blue()) pen = QtGui.QPen(pen_color) pen.setStyle(QtCore.Qt.PenStyle(1)) pen.setWidthF(2.0) # Draw the new ROI self.dicom_preview.update_view() for i in range(len(polygons)): self.dicom_preview.scene.addPolygon(polygons[i], pen, QtGui.QBrush(color)) def update_selected_rois(self): """ Get the names of selected ROIs """ # Hide warning message self.warning_message.setVisible(False) self.roi_names = [] if self.first_roi_name_dropdown_list.currentText() != "": self.roi_names.append( self.first_roi_name_dropdown_list.currentText()) if self.second_roi_name_dropdown_list.currentText() != "" and \ self.second_roi_name_dropdown_list.isVisible(): self.roi_names.append( self.second_roi_name_dropdown_list.currentText()) self.dict_rois_contours_axial = ROI.get_roi_contour_pixel( self.patient_dict_container.get("raw_contour"), self.roi_names, self.patient_dict_container.get("pixluts")) self.display_selected_roi() def display_selected_roi(self): """ Display selected ROIs """ # Get the info required to display the selected ROIs slider_id = self.dicom_view.slider.value() curr_slice = self.patient_dict_container.get("dict_uid")[slider_id] self.rois = self.patient_dict_container.get("rois") # Display the selected ROIs self.dicom_view.update_view() for roi_id, roi_dict in self.rois.items(): roi_name = roi_dict['name'] if roi_name in self.roi_names: polygons = ROI.calc_roi_polygon(roi_name, curr_slice, self.dict_rois_contours_axial) self.dicom_view.draw_roi_polygons(roi_id, polygons, self.roi_color) def operation_changed(self): """ Change the form when users select different operations """ # Hide warning message self.warning_message.setVisible(False) selected_operation = self.operation_name_dropdown_list.currentText() if selected_operation in self.single_roi_operation_names: self.second_roi_name_label.setVisible(False) self.second_roi_name_dropdown_list.setVisible(False) self.margin_label.setVisible(True) self.margin_line_edit.setVisible(True) self.update_selected_rois() else: self.second_roi_name_label.setVisible(True) self.second_roi_name_dropdown_list.setVisible(True) self.margin_label.setVisible(False) self.margin_line_edit.setVisible(False) self.update_selected_rois() def roi_saved(self, new_rtss): """ Create a new ROI in Structure Tab and notify user """ new_roi_name = self.new_roi_name_line_edit.text() self.signal_roi_manipulated.emit((new_rtss, {"draw": new_roi_name})) QMessageBox.about(self.manipulate_roi_window_instance, "Saved", "New contour successfully created!") self.close()
def __init__(self): QMainWindow.__init__(self) # Title and dimensions self.setWindowTitle("Patterns detection") self.setGeometry(0, 0, 800, 500) # Main menu bar self.menu = self.menuBar() self.menu_file = self.menu.addMenu("File") exit = QAction("Exit", self, triggered=qApp.quit) self.menu_file.addAction(exit) self.menu_about = self.menu.addMenu("&About") about = QAction("About Qt", self, shortcut=QKeySequence(QKeySequence.HelpContents), triggered=qApp.aboutQt) self.menu_about.addAction(about) # Create a label for the display camera self.label = QLabel(self) self.label.setFixedSize(640, 480) # Thread in charge of updating the image self.th = Thread(self) self.th.finished.connect(self.close) self.th.updateFrame.connect(self.setImage) # Model group self.group_model = QGroupBox("Trained model") self.group_model.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) model_layout = QHBoxLayout() self.combobox = QComboBox() for xml_file in os.listdir(cv2.data.haarcascades): if xml_file.endswith(".xml"): self.combobox.addItem(xml_file) model_layout.addWidget(QLabel("File:"), 10) model_layout.addWidget(self.combobox, 90) self.group_model.setLayout(model_layout) # Buttons layout buttons_layout = QHBoxLayout() self.button1 = QPushButton("Start") self.button2 = QPushButton("Stop/Close") self.button1.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.button2.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) buttons_layout.addWidget(self.button2) buttons_layout.addWidget(self.button1) right_layout = QHBoxLayout() right_layout.addWidget(self.group_model, 1) right_layout.addLayout(buttons_layout, 1) # Main layout layout = QVBoxLayout() layout.addWidget(self.label) layout.addLayout(right_layout) # Central widget widget = QWidget(self) widget.setLayout(layout) self.setCentralWidget(widget) # Connections self.button1.clicked.connect(self.start) self.button2.clicked.connect(self.kill_thread) self.button2.setEnabled(False) self.combobox.currentTextChanged.connect(self.set_model)
class Widget(QWidget): def __init__(self): QWidget.__init__(self) self.items = 0 # Left self.table = QTableWidget() self.table.setColumnCount(2) self.table.setHorizontalHeaderLabels(["Description", "Quantity"]) self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # Chart self.chart_view = QChartView() self.chart_view.setRenderHint(QPainter.Antialiasing) # Right self.description = QLineEdit() self.quantity = QLineEdit() self.add = QPushButton("Add") self.clear = QPushButton("Clear") self.quit = QPushButton("Quit") self.plot = QPushButton("Plot") # Disabling 'Add' button self.add.setEnabled(False) self.right = QVBoxLayout() self.right.setContentsMargins(10, 10, 10, 10) self.right_top = QGridLayout() self.right_top.addWidget(QLabel("Description"), 0, 0, 1, 1) self.right_top.addWidget(self.description, 0, 1, 1, 3) self.right_top.addWidget(QLabel("Quantity"), 1, 0, 1, 1) self.right_top.addWidget(self.quantity, 1, 1, 1, 1) self.right_top.addWidget(self.add, 1, 2, 1, 2) self.right.addLayout(self.right_top) self.right.addWidget(self.chart_view) self.right_bottom = QGridLayout() self.right_bottom.addWidget(self.plot, 0, 0, 1, 2) self.right_bottom.addWidget(self.clear, 1, 0) self.right_bottom.addWidget(self.quit, 1, 1) self.right.addLayout(self.right_bottom) # QWidget Layout self.layout = QHBoxLayout() self.layout.addWidget(self.table) self.layout.addLayout(self.right) # Set the layout to the QWidget self.setLayout(self.layout) # Signals and Slots self.add.clicked.connect(self.add_element) self.quit.clicked.connect(self.quit_application) self.plot.clicked.connect(self.plot_data) self.clear.clicked.connect(self.clear_table) self.description.textChanged[str].connect(self.check_disable) self.quantity.textChanged[str].connect(self.check_disable) @Slot() def add_element(self): des = self.description.text() qty = self.quantity.text() self.table.insertRow(self.items) self.table.setItem(self.items, 0, QTableWidgetItem(des)) self.table.setItem(self.items, 1, QTableWidgetItem(qty)) self.description.setText("") self.quantity.setText("") self.items += 1 @Slot() def check_disable(self, s): if not self.description.text() or not self.quantity.text(): self.add.setEnabled(False) else: self.add.setEnabled(True) @Slot() def plot_data(self): # Get table information series = QBarSeries() for i in range(self.table.rowCount()): text = self.table.item(i, 0).text() number = float(self.table.item(i, 1).text()) bar_set = QBarSet(text) bar_set.append(number) series.append(bar_set) chart = QChart() chart.addSeries(series) chart.legend().setAlignment(Qt.AlignLeft) self.chart_view.setChart(chart) @Slot() def quit_application(self): QApplication.quit() @Slot() def clear_table(self): self.table.setRowCount(0) self.items = 0
def __init__(self, parent=None): QMainWindow.__init__(self, parent) self.column_names = ["Column A", "Column B", "Column C"] # Central widget self._main = QWidget() self.setCentralWidget(self._main) # Main menu bar self.menu = self.menuBar() self.menu_file = self.menu.addMenu("File") exit = QAction("Exit", self, triggered=qApp.quit) self.menu_file.addAction(exit) self.menu_about = self.menu.addMenu("&About") about = QAction("About Qt", self, shortcut=QKeySequence(QKeySequence.HelpContents), triggered=qApp.aboutQt) self.menu_about.addAction(about) # Figure (Left) self.fig = Figure(figsize=(5, 3)) self.canvas = FigureCanvas(self.fig) # Sliders (Left) self.slider_azim = QSlider(minimum=0, maximum=360, orientation=Qt.Horizontal) self.slider_elev = QSlider(minimum=0, maximum=360, orientation=Qt.Horizontal) self.slider_azim_layout = QHBoxLayout() self.slider_azim_layout.addWidget( QLabel("{}".format(self.slider_azim.minimum()))) self.slider_azim_layout.addWidget(self.slider_azim) self.slider_azim_layout.addWidget( QLabel("{}".format(self.slider_azim.maximum()))) self.slider_elev_layout = QHBoxLayout() self.slider_elev_layout.addWidget( QLabel("{}".format(self.slider_elev.minimum()))) self.slider_elev_layout.addWidget(self.slider_elev) self.slider_elev_layout.addWidget( QLabel("{}".format(self.slider_elev.maximum()))) # Table (Right) self.table = QTableWidget() header = self.table.horizontalHeader() header.setSectionResizeMode(QHeaderView.Stretch) # ComboBox (Right) self.combo = QComboBox() self.combo.addItems( ["Wired", "Surface", "Triangular Surface", "Sphere"]) # Right layout rlayout = QVBoxLayout() rlayout.setContentsMargins(1, 1, 1, 1) rlayout.addWidget(QLabel("Plot type:")) rlayout.addWidget(self.combo) rlayout.addWidget(self.table) # Left layout llayout = QVBoxLayout() rlayout.setContentsMargins(1, 1, 1, 1) llayout.addWidget(self.canvas, 88) llayout.addWidget(QLabel("Azimuth:"), 1) llayout.addLayout(self.slider_azim_layout, 5) llayout.addWidget(QLabel("Elevation:"), 1) llayout.addLayout(self.slider_elev_layout, 5) # Main layout layout = QHBoxLayout(self._main) layout.addLayout(llayout, 70) layout.addLayout(rlayout, 30) # Signal and Slots connections self.combo.currentTextChanged.connect(self.combo_option) self.slider_azim.valueChanged.connect(self.rotate_azim) self.slider_elev.valueChanged.connect(self.rotate_elev) # Initial setup self.plot_wire() self._ax.view_init(30, 30) self.slider_azim.setValue(30) self.slider_elev.setValue(30) self.fig.canvas.mpl_connect("button_release_event", self.on_click)
class Widget(QWidget): def __init__(self): QWidget.__init__(self) self.items = 0 # Example data self._data = { "Water": 24.5, "Electricity": 55.1, "Rent": 850.0, "Supermarket": 230.4, "Internet": 29.99, "Spätkauf": 21.85, "BVG Ticket": 60.0, "Coffee": 22.45, "Meetup": 0.0 } # Left self.table = QTableWidget() self.table.setColumnCount(2) self.table.setHorizontalHeaderLabels(["Description", "Quantity"]) self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # Right self.description = QLineEdit() self.quantity = QLineEdit() self.add = QPushButton("Add") self.clear = QPushButton("Clear") self.quit = QPushButton("Quit") self.right = QVBoxLayout() self.right.setContentsMargins(10, 10, 10, 10) self.right.addWidget(QLabel("Description")) self.right.addWidget(self.description) self.right.addWidget(QLabel("Quantity")) self.right.addWidget(self.quantity) self.right.addWidget(self.add) self.right.addStretch() self.right.addWidget(self.clear) self.right.addWidget(self.quit) # QWidget Layout self.layout = QHBoxLayout() self.layout.addWidget(self.table) self.layout.addLayout(self.right) # Set the layout to the QWidget self.setLayout(self.layout) # Fill example data self.fill_table() def fill_table(self, data=None): data = self._data if not data else data for desc, price in data.items(): self.table.insertRow(self.items) self.table.setItem(self.items, 0, QTableWidgetItem(desc)) self.table.setItem(self.items, 1, QTableWidgetItem(str(price))) self.items += 1
class Ui_CalcyOption(object): def setupUi(self, CalcyOption): if not CalcyOption.objectName(): CalcyOption.setObjectName(u"CalcyOption") CalcyOption.resize(516, 262) self.horizontalLayout_2 = QHBoxLayout(CalcyOption) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.tabWidget = QTabWidget(CalcyOption) self.tabWidget.setObjectName(u"tabWidget") font = QFont() font.setFamilies([u"Verdana"]) font.setPointSize(10) self.tabWidget.setFont(font) self.tabOutput = QWidget() self.tabOutput.setObjectName(u"tabOutput") self.formLayout = QFormLayout(self.tabOutput) self.formLayout.setObjectName(u"formLayout") self.verticalLayout_5 = QVBoxLayout() self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.groupBox_2 = QGroupBox(self.tabOutput) self.groupBox_2.setObjectName(u"groupBox_2") self.verticalLayout_6 = QVBoxLayout(self.groupBox_2) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.radioButtonDecSepSystem = QRadioButton(self.groupBox_2) self.radioButtonDecSepSystem.setObjectName(u"radioButtonDecSepSystem") self.radioButtonDecSepSystem.setChecked(True) self.verticalLayout_6.addWidget(self.radioButtonDecSepSystem) self.radioButtonDecSepComa = QRadioButton(self.groupBox_2) self.radioButtonDecSepComa.setObjectName(u"radioButtonDecSepComa") self.verticalLayout_6.addWidget(self.radioButtonDecSepComa) self.radioButtonDecSepDot = QRadioButton(self.groupBox_2) self.radioButtonDecSepDot.setObjectName(u"radioButtonDecSepDot") self.verticalLayout_6.addWidget(self.radioButtonDecSepDot) self.verticalLayout_5.addWidget(self.groupBox_2) self.verticalLayout_4 = QVBoxLayout() self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.label = QLabel(self.tabOutput) self.label.setObjectName(u"label") self.horizontalLayout_3.addWidget(self.label) self.spinBoxOutputPrecision = QSpinBox(self.tabOutput) self.spinBoxOutputPrecision.setObjectName(u"spinBoxOutputPrecision") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spinBoxOutputPrecision.sizePolicy().hasHeightForWidth()) self.spinBoxOutputPrecision.setSizePolicy(sizePolicy) self.spinBoxOutputPrecision.setMinimumSize(QSize(55, 0)) self.spinBoxOutputPrecision.setMaximumSize(QSize(60, 30)) self.spinBoxOutputPrecision.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.spinBoxOutputPrecision.setMinimum(1) self.spinBoxOutputPrecision.setMaximum(10) self.spinBoxOutputPrecision.setValue(3) self.horizontalLayout_3.addWidget(self.spinBoxOutputPrecision) self.verticalLayout_4.addLayout(self.horizontalLayout_3) self.checkBoxShowGrpSep = QCheckBox(self.tabOutput) self.checkBoxShowGrpSep.setObjectName(u"checkBoxShowGrpSep") self.checkBoxShowGrpSep.setChecked(False) self.verticalLayout_4.addWidget(self.checkBoxShowGrpSep) self.checkBoxCopyToClipboard = QCheckBox(self.tabOutput) self.checkBoxCopyToClipboard.setObjectName(u"checkBoxCopyToClipboard") self.checkBoxCopyToClipboard.setChecked(True) self.verticalLayout_4.addWidget(self.checkBoxCopyToClipboard) self.verticalLayout_5.addLayout(self.verticalLayout_4) self.formLayout.setLayout(0, QFormLayout.LabelRole, self.verticalLayout_5) self.tabWidget.addTab(self.tabOutput, "") self.tabRadix = QWidget() self.tabRadix.setObjectName(u"tabRadix") self.horizontalLayout_6 = QHBoxLayout(self.tabRadix) self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.verticalLayout_3 = QVBoxLayout() self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.groupBox_3 = QGroupBox(self.tabRadix) self.groupBox_3.setObjectName(u"groupBox_3") self.horizontalLayout = QHBoxLayout(self.groupBox_3) self.horizontalLayout.setObjectName(u"horizontalLayout") self.checkBoxBinOut = QCheckBox(self.groupBox_3) self.checkBoxBinOut.setObjectName(u"checkBoxBinOut") self.checkBoxBinOut.setChecked(True) self.horizontalLayout.addWidget(self.checkBoxBinOut) self.checkBoxOctOut = QCheckBox(self.groupBox_3) self.checkBoxOctOut.setObjectName(u"checkBoxOctOut") self.checkBoxOctOut.setChecked(True) self.horizontalLayout.addWidget(self.checkBoxOctOut) self.checkBoxHexOut = QCheckBox(self.groupBox_3) self.checkBoxHexOut.setObjectName(u"checkBoxHexOut") self.checkBoxHexOut.setChecked(True) self.horizontalLayout.addWidget(self.checkBoxHexOut) self.checkBoxSizeOut = QCheckBox(self.groupBox_3) self.checkBoxSizeOut.setObjectName(u"checkBoxSizeOut") self.checkBoxSizeOut.setChecked(True) self.horizontalLayout.addWidget(self.checkBoxSizeOut) self.verticalLayout_3.addWidget(self.groupBox_3) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.checkBoxShowBasePrefix = QCheckBox(self.tabRadix) self.checkBoxShowBasePrefix.setObjectName(u"checkBoxShowBasePrefix") self.checkBoxShowBasePrefix.setChecked(True) self.verticalLayout.addWidget(self.checkBoxShowBasePrefix) self.checkBoxShowLeadingZerosBin = QCheckBox(self.tabRadix) self.checkBoxShowLeadingZerosBin.setObjectName(u"checkBoxShowLeadingZerosBin") self.checkBoxShowLeadingZerosBin.setChecked(True) self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosBin) self.checkBoxShowLeadingZerosOct = QCheckBox(self.tabRadix) self.checkBoxShowLeadingZerosOct.setObjectName(u"checkBoxShowLeadingZerosOct") self.checkBoxShowLeadingZerosOct.setChecked(True) self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosOct) self.checkBoxShowLeadingZerosHex = QCheckBox(self.tabRadix) self.checkBoxShowLeadingZerosHex.setObjectName(u"checkBoxShowLeadingZerosHex") self.checkBoxShowLeadingZerosHex.setChecked(True) self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosHex) self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout.addItem(self.verticalSpacer_2) self.verticalLayout_3.addLayout(self.verticalLayout) self.horizontalLayout_6.addLayout(self.verticalLayout_3) self.verticalLayout_2 = QVBoxLayout() self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.groupBoxBW = QGroupBox(self.tabRadix) self.groupBoxBW.setObjectName(u"groupBoxBW") self.horizontalLayout_5 = QHBoxLayout(self.groupBoxBW) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.radioButtonBW64 = QRadioButton(self.groupBoxBW) self.radioButtonBW64.setObjectName(u"radioButtonBW64") self.horizontalLayout_5.addWidget(self.radioButtonBW64) self.radioButtonBW32 = QRadioButton(self.groupBoxBW) self.radioButtonBW32.setObjectName(u"radioButtonBW32") self.horizontalLayout_5.addWidget(self.radioButtonBW32) self.radioButtonBW16 = QRadioButton(self.groupBoxBW) self.radioButtonBW16.setObjectName(u"radioButtonBW16") self.radioButtonBW16.setChecked(True) self.horizontalLayout_5.addWidget(self.radioButtonBW16) self.radioButtonBW8 = QRadioButton(self.groupBoxBW) self.radioButtonBW8.setObjectName(u"radioButtonBW8") self.horizontalLayout_5.addWidget(self.radioButtonBW8) self.verticalLayout_2.addWidget(self.groupBoxBW) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_2.addItem(self.verticalSpacer) self.horizontalLayout_6.addLayout(self.verticalLayout_2) self.tabWidget.addTab(self.tabRadix, "") self.horizontalLayout_2.addWidget(self.tabWidget) self.retranslateUi(CalcyOption) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(CalcyOption) # setupUi def retranslateUi(self, CalcyOption): CalcyOption.setWindowTitle(QCoreApplication.translate("CalcyOption", u"CalcyPy - Simple calculator", None)) self.groupBox_2.setTitle(QCoreApplication.translate("CalcyOption", u"Decimal point and group separator", None)) #if QT_CONFIG(tooltip) self.radioButtonDecSepSystem.setToolTip(QCoreApplication.translate("CalcyOption", u"Use system locale settings", None)) #endif // QT_CONFIG(tooltip) self.radioButtonDecSepSystem.setText(QCoreApplication.translate("CalcyOption", u"System default", None)) self.radioButtonDecSepComa.setText(QCoreApplication.translate("CalcyOption", u"Coma as decimal point and dot as group separator", None)) self.radioButtonDecSepDot.setText(QCoreApplication.translate("CalcyOption", u"Dot as decimal point and coma as group separator", None)) self.label.setText(QCoreApplication.translate("CalcyOption", u"Decimal output Precision", None)) #if QT_CONFIG(tooltip) self.spinBoxOutputPrecision.setToolTip(QCoreApplication.translate("CalcyOption", u"<html><head/><body><p>Sets the maximal number of digits</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.checkBoxShowGrpSep.setText(QCoreApplication.translate("CalcyOption", u"Show group separator in result", None)) #if QT_CONFIG(tooltip) self.checkBoxCopyToClipboard.setToolTip(QCoreApplication.translate("CalcyOption", u"If this option is enabled, pressing enter key will copy calculation result to clipboard.", None)) #endif // QT_CONFIG(tooltip) self.checkBoxCopyToClipboard.setText(QCoreApplication.translate("CalcyOption", u"Use Enter key to Copy result to Clipboard", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabOutput), QCoreApplication.translate("CalcyOption", u"General", None)) self.groupBox_3.setTitle(QCoreApplication.translate("CalcyOption", u"Show result as", None)) self.checkBoxBinOut.setText(QCoreApplication.translate("CalcyOption", u"Bin", None)) self.checkBoxOctOut.setText(QCoreApplication.translate("CalcyOption", u"Oct", None)) self.checkBoxHexOut.setText(QCoreApplication.translate("CalcyOption", u"Hex", None)) self.checkBoxSizeOut.setText(QCoreApplication.translate("CalcyOption", u"Size", None)) #if QT_CONFIG(tooltip) self.checkBoxShowBasePrefix.setToolTip(QCoreApplication.translate("CalcyOption", u"Show prefix for given number base in results (i.e. \"0x\" for hexadecimal numbers)", None)) #endif // QT_CONFIG(tooltip) self.checkBoxShowBasePrefix.setText(QCoreApplication.translate("CalcyOption", u"Show base prefix in result", None)) self.checkBoxShowLeadingZerosBin.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in bin output", None)) self.checkBoxShowLeadingZerosOct.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in oct output", None)) self.checkBoxShowLeadingZerosHex.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in hex output", None)) self.groupBoxBW.setTitle(QCoreApplication.translate("CalcyOption", u"Calculation bit width", None)) self.radioButtonBW64.setText(QCoreApplication.translate("CalcyOption", u"64", None)) self.radioButtonBW32.setText(QCoreApplication.translate("CalcyOption", u"32", None)) self.radioButtonBW16.setText(QCoreApplication.translate("CalcyOption", u"16", None)) self.radioButtonBW8.setText(QCoreApplication.translate("CalcyOption", u"8", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabRadix), QCoreApplication.translate("CalcyOption", u"Radix", None))