def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(659, 477) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(50, -1, 50, -1) self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(16) self.pushButton.setFont(font) self.verticalLayout.addWidget(self.pushButton) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 659, 27)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, base): TritonWidget.__init__(self, base) self.addOTP = None self.closeEvent = self.widgetDeleted self.setWindowTitle('TritonAuth') self.setBackgroundColor(self, Qt.white) self.menu = QMenuBar() self.addMenu = self.menu.addMenu('Add') self.authAction = QAction('Authenticator', self) self.authAction.triggered.connect(self.openAddOTP) self.steamAction = QAction('Steam', self) self.steamAction.triggered.connect(self.openAddSteam) self.addMenu.addAction(self.authAction) self.addMenu.addAction(self.steamAction) self.sortMenu = self.menu.addMenu('Sort') self.nameAction = QAction('Sort by name', self) self.nameAction.triggered.connect(self.sortByName) self.sortMenu.addAction(self.nameAction) self.exportMenu = self.menu.addMenu('Export') self.andOTPAction = QAction('Export to andOTP', self) self.andOTPAction.triggered.connect(self.exportToAndOTP) self.exportMenu.addAction(self.andOTPAction) self.widget = QWidget() self.widget.setContentsMargins(10, 10, 10, 10) self.scrollArea = QScrollArea() self.scrollArea.setFixedSize(400, 495) self.scrollArea.setWidgetResizable(True) self.scrollWidget = QWidget() self.scrollLayout = QVBoxLayout(self.scrollWidget) self.scrollLayout.setAlignment(Qt.AlignTop) self.createAccounts() self.scrollArea.setWidget(self.scrollWidget) self.widgetLayout = QVBoxLayout(self.widget) self.widgetLayout.addWidget(self.scrollArea) self.boxLayout = QVBoxLayout(self) self.boxLayout.setContentsMargins(0, 5, 0, 0) self.boxLayout.addWidget(self.menu) self.boxLayout.addWidget(self.widget) self.setFixedSize(self.sizeHint()) self.center() self.show()
def add_encrypt_menu(menubar: QMenuBar, parent: QMainWindow): def _open_key_mgr_dialog(): open_key_mgr_dialog(parent) def _open_encrypt_dialog(): open_encrypt_dialog(parent) def _open_decrypt_dialog(): open_decrypt_dialog(parent) encryptMenu = menubar.addMenu("加密/解密") key_mgr_act = QAction("密钥管理", parent) key_mgr_act.triggered.connect(_open_key_mgr_dialog) encrypt_act = QAction("加密图片", parent) encrypt_act.triggered.connect(_open_encrypt_dialog) decrypt_act = QAction("解密图片", parent) decrypt_act.triggered.connect(_open_decrypt_dialog) encryptMenu.addAction(key_mgr_act) encryptMenu.addAction(encrypt_act) encryptMenu.addAction(decrypt_act)
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(353, 223) self.actionsetting = QAction(MainWindow) self.actionsetting.setObjectName(u"actionsetting") self.actionabout = QAction(MainWindow) self.actionabout.setObjectName(u"actionabout") self.actionimg_convert = QAction(MainWindow) self.actionimg_convert.setObjectName(u"actionimg_convert") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout_4 = QGridLayout(self.centralwidget) self.gridLayout_4.setObjectName(u"gridLayout_4") self.gridLayout_3 = QGridLayout() self.gridLayout_3.setObjectName(u"gridLayout_3") self.stackedWidget = QStackedWidget(self.centralwidget) self.stackedWidget.setObjectName(u"stackedWidget") self.stackedWidget.setMinimumSize(QSize(0, 0)) self.gridLayout_3.addWidget(self.stackedWidget, 0, 0, 1, 1) self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 353, 22)) self.menuabout = QMenu(self.menubar) self.menuabout.setObjectName(u"menuabout") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuabout.menuAction()) self.menuabout.addAction(self.actionabout) self.retranslateUi(MainWindow) self.stackedWidget.setCurrentIndex(-1) QMetaObject.connectSlotsByName(MainWindow)
def menu(self): menubar = QMenuBar(self) file_menu = menubar.addMenu('File') open_act = QtGui.QAction('Open', self) biorobots = QtGui.QAction('Load biorobots', self) save_act = QtGui.QAction('Save', self) saveas_act = QtGui.QAction('Save As', self) # open_act = QtGui.QAction('Open', self, checkable=True) file_menu.setStatusTip('enable/disable Dark mode') file_menu.addAction(open_act) file_menu.addAction(biorobots) file_menu.addAction(save_act) file_menu.addAction(saveas_act) tools_menu = menubar.addMenu('Tools') email = QtGui.QAction('Validate', self) tools_menu.addAction(email)
def initActions(self): self.newEntryAction = QAction("New entry", self) self.newEntryAction.setShortcut(QKeySequence.New) self.newEntryAction.triggered.connect(self.addNewEntry) self.removeEntryAction = QAction("Remove entry", self) self.removeEntryAction.setShortcut(QKeySequence.Delete) self.removeEntryAction.triggered.connect(self.removeEntry) self.demoAction = QAction("Demo entry", self) self.demoAction.triggered.connect(self.addDemoEntry) self.printAction = QAction("Print Preview...", self) self.printAction.triggered.connect(self.printPreview) self.zoomInAction = QAction("Zoom In", self) self.zoomInAction.setShortcut(QKeySequence.ZoomIn) self.zoomInAction.triggered.connect(self.zoomIn) self.zoomOutAction = QAction("Zoom Out", self) self.zoomOutAction.setShortcut(QKeySequence.ZoomOut) self.zoomOutAction.triggered.connect(self.zoomOut) self.ui.ganttView.leftView().setContextMenuPolicy(Qt.CustomContextMenu) self.ui.ganttView.leftView().addAction(self.newEntryAction) self.ui.ganttView.leftView().addAction(self.removeEntryAction) menuBar = QMenuBar(self) self.setMenuBar(menuBar) entryMenu = menuBar.addMenu("Entry") entryMenu.addAction(self.newEntryAction) entryMenu.addAction(self.removeEntryAction) entryMenu.addSeparator() entryMenu.addAction(self.demoAction) entryMenu.addSeparator() entryMenu.addAction(self.printAction) zoomMenu = menuBar.addMenu("Zoom") zoomMenu.addAction(self.zoomInAction) zoomMenu.addAction(self.zoomOutAction)
def constructMenu(self): menuBar = QMenuBar() self.window.setMenuBar(menuBar) file = menuBar.addMenu('File') edit = menuBar.addMenu('Edit') file.addAction('New Game').triggered.connect( functools.partial(self.newGame, )) self.undo = edit.addAction('Undo') self.undo.triggered.connect(lambda _: self.game.undo()) self.redo = edit.addAction('Redo') self.redo.triggered.connect(lambda _: self.game.redo()) sv = file.addMenu('Save') sv.addAction('as text').triggered.connect( functools.partial(self.save, self.game.saveAsText)) sv.addAction('as PGN').triggered.connect( functools.partial(self.save, self.game.saveAsPGN)) sv.addAction('as JSON').triggered.connect( functools.partial(self.save, self.game.saveAsJSON)) sva = file.addMenu('Save As') sva.addAction('as text').triggered.connect( functools.partial(self.saveAs, self.game.saveAsText)) sva.addAction('as PGN').triggered.connect( functools.partial(self.saveAs, self.game.saveAsPGN)) sva.addAction('as JSON').triggered.connect( functools.partial(self.saveAs, self.game.saveAsJSON)) file.addAction('Load Game').triggered.connect( functools.partial(self.load, self.game.loadJson)) file.addAction('Abandon').triggered.connect( functools.partial(self.showDialog, "Do you want really to abandon?", "Warning", QMessageBox.No | QMessageBox.Yes, self.abandon)) file.addAction('Draw').triggered.connect( functools.partial(self.showDialog, ("White" if self.game.player else "Black") + " is proposing draw", "Info", QMessageBox.No | QMessageBox.Yes, self.proposeDraw)) file.addAction('Quit').triggered.connect(lambda _: exit(0))
def __init__(self): QMainWindow.__init__(self) self.inicializar_db() self.setWindowTitle("Tião Automecânica - Clientes") self.widget = QWidget() # Janelas w1, w2 = Buscador(), NovoCliente() w1.status_signal.connect(self.atualizar_status) w2.status_signal.connect(self.atualizar_status) # Leiaute self.line = QFrame() self.line.setFrameShape(QFrame.VLine) self.line.setFrameShadow(QFrame.Sunken) self.line.setLineWidth(0) self.line.setMidLineWidth(1) self.layout = QGridLayout() self.layout.addWidget(w1, 0, 0, 1, 1) self.layout.addWidget(self.line, 0, 1, 1, 1) self.layout.addWidget(w2, 0, 1, 1, 2) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) # Menu self.menu = QMenuBar() self.setMenuBar(self.menu) self.sobre = QAction("Sobre", self) self.sobre.setShortcut("F1") self.menu.addAction(self.sobre) self.sobre.triggered.connect(self.info) # Status self.status = QStatusBar() self.setStatusBar(self.status) self.status_label = QLabel("Pronto") self.status.addWidget(self.status_label)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(353, 223) self.actionsetting = QAction(MainWindow) self.actionsetting.setObjectName(u"actionsetting") self.actionabout = QAction(MainWindow) self.actionabout.setObjectName(u"actionabout") self.actionimg_convert = QAction(MainWindow) self.actionimg_convert.setObjectName(u"actionimg_convert") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout_4 = QGridLayout(self.centralwidget) self.gridLayout_4.setObjectName(u"gridLayout_4") self.gridLayout_3 = QGridLayout() self.gridLayout_3.setObjectName(u"gridLayout_3") self.stackedWidget = QStackedWidget(self.centralwidget) self.stackedWidget.setObjectName(u"stackedWidget") self.stackedWidget.setMinimumSize(QSize(0, 0)) self.gridLayout_3.addWidget(self.stackedWidget, 0, 0, 1, 1) self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 353, 22)) self.menuabout = QMenu(self.menubar) self.menuabout.setObjectName(u"menuabout") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuabout.menuAction()) self.menuabout.addAction(self.actionabout) self.retranslateUi(MainWindow) self.stackedWidget.setCurrentIndex(-1) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Waifu2x-GUI", None)) self.actionsetting.setText(QCoreApplication.translate("MainWindow", u"setting", None)) self.actionabout.setText(QCoreApplication.translate("MainWindow", u"about", None)) self.actionimg_convert.setText(QCoreApplication.translate("MainWindow", u"img convert", None)) self.menuabout.setTitle(QCoreApplication.translate("MainWindow", u"\u5de5\u5177", None))
def _createMenuBar(self): # Settings and stuff for the toolbar menubar = QMenuBar(self) file_menu = QMenu("&File", self) file_menu.addAction("Create Team(s)", self.CreateTeamsWindow) file_menu.addAction("Edit Team(s)", self.EditTeamsWindow) file_menu.addAction("Exit", self.close) settings_menu = QMenu("&Settings", self) settings_menu.addAction("Version", self.SeeVersion) settings_menu.addAction("Help", self.GetHelp) menubar.addMenu(file_menu) menubar.addMenu(settings_menu) self.setMenuBar(menubar)
def __init__(self, _settings: settings.Settings, parent=None): super(MainWindow, self).__init__(parent) self.formation_extrapolator_windows = [] self.formation_list_windows = [] self.settings = _settings self.stepgraph = stepgraph.Stepgraph(self) self.hook = hook.Hook(self) self.current_step_state: State = State(field_id=117, step=Step(0, 0), danger=0, step_fraction=0, formation_value=0) self.setWindowTitle(self.settings.WINDOW_TITLE) self.setWindowIcon(QIcon(self.settings.WINDOW_ICON)) menubar = QMenuBar() menu_file = QMenu("File") menu_file_exit = QAction("Exit", self) menu_file_exit.triggered.connect(exit) menu_file.addAction(menu_file_exit) menu_connect = QMenu("Connect") menu_connect_connect_emulator = QAction("Connect to Emulator", self) menu_connect_connect_emulator.triggered.connect(self.connect_emulator) menu_connect.addAction(menu_connect_connect_emulator) menu_connect_connect_pc = QAction("Connect to PC", self) menu_connect_connect_pc.triggered.connect(self.connect_pc) menu_connect.addAction(menu_connect_connect_pc) menu_connect.addSeparator() menu_connect_disconnect = QAction("Disconnect", self) menu_connect_disconnect.triggered.connect(self.disconnect) menu_connect.addAction(menu_connect_disconnect) menu_window = QMenu("Window") menu_window_toggle_stepgraph = QAction("Toggle Stepgraph", self) menu_window_toggle_stepgraph.triggered.connect(self.stepgraph.toggle) menu_window.addAction(menu_window_toggle_stepgraph) menu_window_open_formation_window = QAction("Open Formation Window", self) menu_window_open_formation_window.triggered.connect( self.open_formation_extrapolator) menu_window.addAction(menu_window_open_formation_window) menubar.addMenu(menu_file) menubar.addMenu(menu_connect) menubar.addMenu(menu_window) # self.master.config(menu=menubar) self.setMenuBar(menubar) main_frame = QFrame() layout = QVBoxLayout() rows = [ "Step ID", "Step Fraction", "Offset", "Danger", "Formation Accumulator", "Field ID", "Table Index", "Danger Divisor Multiplier", "Lure Rate", "Preempt Rate", "Last Encounter Formation" ] self.memory_view = QTableWidget(len(rows), 2) self.memory_view.setEditTriggers(QAbstractItemView.NoEditTriggers) self.memory_view.setFocusPolicy(Qt.NoFocus) self.memory_view.setSelectionMode(QAbstractItemView.NoSelection) self.memory_view.setHorizontalHeaderItem(0, QTableWidgetItem("Address")) self.memory_view.setHorizontalHeaderItem( 1, QTableWidgetItem(" Value ")) self.memory_view.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.memory_view.verticalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) for rowNum in range(len(rows)): self.memory_view.setVerticalHeaderItem(rowNum, QTableWidgetItem("")) _l = QLabel(" " + rows[rowNum] + " ") _l.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.memory_view.setCellWidget(rowNum, 0, _l) _l = QLabel("") _l.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.memory_view.setCellWidget(rowNum, 1, _l) self.memory_view.resizeColumnsToContents() self.memory_view.setMinimumHeight(350) self.memory_view.setMinimumWidth(300) layout.addWidget(self.memory_view) self.connected_text = QLabel(self.settings.DISCONNECTED_TEXT) self.connected_text.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) layout.addWidget(self.connected_text) main_frame.setLayout(layout) self.setCentralWidget(main_frame) self.setMinimumHeight(420)
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(983, 807) MainWindow.setWindowOpacity(0.000000000000000) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.groupBox = QGroupBox(self.centralwidget) self.groupBox.setObjectName(u"groupBox") self.groupBox.setGeometry(QRect(10, 10, 961, 191)) self.horizontalLayoutWidget = QWidget(self.groupBox) self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget") self.horizontalLayoutWidget.setGeometry(QRect(10, 30, 211, 41)) self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.label = QLabel(self.horizontalLayoutWidget) self.label.setObjectName(u"label") self.horizontalLayout.addWidget(self.label) self.lineEdit = QLineEdit(self.horizontalLayoutWidget) self.lineEdit.setObjectName(u"lineEdit") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.horizontalLayout.addWidget(self.lineEdit) self.horizontalLayoutWidget_2 = QWidget(self.groupBox) self.horizontalLayoutWidget_2.setObjectName( u"horizontalLayoutWidget_2") self.horizontalLayoutWidget_2.setGeometry(QRect(10, 70, 211, 41)) self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.label_2 = QLabel(self.horizontalLayoutWidget_2) self.label_2.setObjectName(u"label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_2) self.lineEdit_2.setObjectName(u"lineEdit_2") sizePolicy.setHeightForWidth( self.lineEdit_2.sizePolicy().hasHeightForWidth()) self.lineEdit_2.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_2) self.horizontalLayoutWidget_3 = QWidget(self.groupBox) self.horizontalLayoutWidget_3.setObjectName( u"horizontalLayoutWidget_3") self.horizontalLayoutWidget_3.setGeometry(QRect(10, 110, 211, 41)) self.horizontalLayout_3 = QHBoxLayout(self.horizontalLayoutWidget_3) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) self.label_3 = QLabel(self.horizontalLayoutWidget_3) self.label_3.setObjectName(u"label_3") self.horizontalLayout_3.addWidget(self.label_3) self.lineEdit_3 = QLineEdit(self.horizontalLayoutWidget_3) self.lineEdit_3.setObjectName(u"lineEdit_3") sizePolicy.setHeightForWidth( self.lineEdit_3.sizePolicy().hasHeightForWidth()) self.lineEdit_3.setSizePolicy(sizePolicy) self.horizontalLayout_3.addWidget(self.lineEdit_3) self.horizontalLayoutWidget_4 = QWidget(self.groupBox) self.horizontalLayoutWidget_4.setObjectName( u"horizontalLayoutWidget_4") self.horizontalLayoutWidget_4.setGeometry(QRect(230, 30, 238, 41)) self.horizontalLayout_4 = QHBoxLayout(self.horizontalLayoutWidget_4) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.label_4 = QLabel(self.horizontalLayoutWidget_4) self.label_4.setObjectName(u"label_4") self.horizontalLayout_4.addWidget(self.label_4) self.lineEdit_4 = QLineEdit(self.horizontalLayoutWidget_4) self.lineEdit_4.setObjectName(u"lineEdit_4") sizePolicy.setHeightForWidth( self.lineEdit_4.sizePolicy().hasHeightForWidth()) self.lineEdit_4.setSizePolicy(sizePolicy) self.horizontalLayout_4.addWidget(self.lineEdit_4) self.horizontalLayoutWidget_5 = QWidget(self.groupBox) self.horizontalLayoutWidget_5.setObjectName( u"horizontalLayoutWidget_5") self.horizontalLayoutWidget_5.setGeometry(QRect(230, 70, 240, 41)) self.horizontalLayout_5 = QHBoxLayout(self.horizontalLayoutWidget_5) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) self.label_5 = QLabel(self.horizontalLayoutWidget_5) self.label_5.setObjectName(u"label_5") self.horizontalLayout_5.addWidget(self.label_5) self.lineEdit_5 = QLineEdit(self.horizontalLayoutWidget_5) self.lineEdit_5.setObjectName(u"lineEdit_5") sizePolicy.setHeightForWidth( self.lineEdit_5.sizePolicy().hasHeightForWidth()) self.lineEdit_5.setSizePolicy(sizePolicy) self.horizontalLayout_5.addWidget(self.lineEdit_5) self.groupBox_2 = QGroupBox(self.centralwidget) self.groupBox_2.setObjectName(u"groupBox_2") self.groupBox_2.setGeometry(QRect(10, 210, 961, 171)) self.textBrowser = QTextBrowser(self.centralwidget) self.textBrowser.setObjectName(u"textBrowser") self.textBrowser.setGeometry(QRect(10, 440, 961, 311)) self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setGeometry(QRect(858, 400, 111, 25)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 983, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
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)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(514, 693) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName(u"gridLayout") self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout.addWidget(self.pushButton, 0, 1, 1, 1) self.tabWidget = QTabWidget(self.centralwidget) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setStyleSheet(u"") self.tab = QWidget() self.tab.setObjectName(u"tab") self.gridLayout_2 = QGridLayout(self.tab) self.gridLayout_2.setObjectName(u"gridLayout_2") self.tableWidget = QTableWidget(self.tab) if (self.tableWidget.columnCount() < 3): self.tableWidget.setColumnCount(3) __qtablewidgetitem = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, __qtablewidgetitem) __qtablewidgetitem1 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, __qtablewidgetitem1) __qtablewidgetitem2 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, __qtablewidgetitem2) self.tableWidget.setObjectName(u"tableWidget") self.tableWidget.setStyleSheet(u"") self.tableWidget.horizontalHeader().setCascadingSectionResizes(False) self.tableWidget.verticalHeader().setVisible(False) self.gridLayout_2.addWidget(self.tableWidget, 0, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QWidget() self.tab_2.setObjectName(u"tab_2") self.gridLayout_3 = QGridLayout(self.tab_2) self.gridLayout_3.setObjectName(u"gridLayout_3") self.tableWidget_2 = QTableWidget(self.tab_2) self.tableWidget_2.setObjectName(u"tableWidget_2") self.gridLayout_3.addWidget(self.tableWidget_2, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 2) self.lineEdit = QLineEdit(self.centralwidget) self.lineEdit.setObjectName(u"lineEdit") self.lineEdit.setReadOnly(True) self.gridLayout.addWidget(self.lineEdit, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 514, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"HyperV_controller", None)) self.pushButton.setText( QCoreApplication.translate("MainWindow", u"\u5237\u65b0", None)) ___qtablewidgetitem = self.tableWidget.horizontalHeaderItem(0) ___qtablewidgetitem.setText( QCoreApplication.translate("MainWindow", u"\u540d\u79f0", None)) ___qtablewidgetitem1 = self.tableWidget.horizontalHeaderItem(1) ___qtablewidgetitem1.setText( QCoreApplication.translate("MainWindow", u"\u72b6\u6001", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"\u865a\u62df\u673a", None)) self.tabWidget.setTabText( self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"\u529f\u80fd", None))
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(514, 693) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName(u"gridLayout") self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout.addWidget(self.pushButton, 0, 1, 1, 1) self.tabWidget = QTabWidget(self.centralwidget) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setStyleSheet(u"") self.tab = QWidget() self.tab.setObjectName(u"tab") self.gridLayout_2 = QGridLayout(self.tab) self.gridLayout_2.setObjectName(u"gridLayout_2") self.tableWidget = QTableWidget(self.tab) if (self.tableWidget.columnCount() < 3): self.tableWidget.setColumnCount(3) __qtablewidgetitem = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, __qtablewidgetitem) __qtablewidgetitem1 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, __qtablewidgetitem1) __qtablewidgetitem2 = QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, __qtablewidgetitem2) self.tableWidget.setObjectName(u"tableWidget") self.tableWidget.setStyleSheet(u"") self.tableWidget.horizontalHeader().setCascadingSectionResizes(False) self.tableWidget.verticalHeader().setVisible(False) self.gridLayout_2.addWidget(self.tableWidget, 0, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QWidget() self.tab_2.setObjectName(u"tab_2") self.gridLayout_3 = QGridLayout(self.tab_2) self.gridLayout_3.setObjectName(u"gridLayout_3") self.tableWidget_2 = QTableWidget(self.tab_2) self.tableWidget_2.setObjectName(u"tableWidget_2") self.gridLayout_3.addWidget(self.tableWidget_2, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 2) self.lineEdit = QLineEdit(self.centralwidget) self.lineEdit.setObjectName(u"lineEdit") self.lineEdit.setReadOnly(True) self.gridLayout.addWidget(self.lineEdit, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 514, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(MainWindow)
class MainWindow(QMainWindow): """Main application window""" def __init__(self) -> None: QMainWindow.__init__(self) self.setSizePolicy( QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)) self.setMaximumSize(QSize(1920, 1080)) self.setStyleSheet("padding: 0px; margin: 0px;") self.setIconSize(QSize(32, 32)) self.setWindowTitle("BossyBot 2000 - Image Tagger") self.setWindowIcon(self.load_icon(icon)) self.menubar = QMenuBar(self) self.menubar.setSizePolicy(EXP_MAX) self.menubar.setMaximumSize(QSize(INFINITE, 30)) self.menu_file = QMenu('File', self.menubar) self.menu_options = QMenu('Options', self.menubar) self.menu_help = QMenu('Help', self.menubar) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_options.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.open = QAction('Open', self) self.menu_file.addAction(self.open) self.open.triggered.connect(self.open_file) self.exit_button = QAction('Exit', self) self.exit_button.triggered.connect(lambda: sys.exit(0), Qt.QueuedConnection) self.menu_file.addAction(self.exit_button) self.setMenuBar(self.menubar) self.previous_button = QAction(self.load_icon(previous), '<<', self) self.next_button = QAction(self.load_icon(next_icon), '>>', self) self.rotate_left_button = QAction(self.load_icon(left), '', self) self.rotate_right_button = QAction(self.load_icon(right), '', self) self.play_button = QAction(self.load_icon(play), '', self) self.play_button.setCheckable(True) self.delete_button = QAction(self.load_icon(delete), '', self) self.reload_button = QAction(self.load_icon(reload), '', self) self.mirror_button = QAction('Mirror', self) self.actual_size_button = QAction('Actual Size', self) self.browser_button = QAction('Browser', self) self.browser_button.setCheckable(True) self.browser_button.setChecked(True) self.crop_button = QAction('Crop', self) self.crop_button.setCheckable(True) self.toolbuttons = { self.rotate_left_button: { 'shortcut': ',', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() - 90) }, self.rotate_right_button: { 'shortcut': '.', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() + 90) }, self.delete_button: { 'shortcut': 'Del', 'connect': self.delete }, self.previous_button: { 'shortcut': 'Left', 'connect': self.previous }, self.play_button: { 'shortcut': 'Space', 'connect': self.play }, self.next_button: { 'shortcut': 'Right', 'connect': self.next }, self.reload_button: { 'shortcut': 'F5', 'connect': self.reload } } self.toolbar = QToolBar(self) self.toolbar.setSizePolicy(EXP_MAX) self.toolbar.setMaximumSize(QSize(INFINITE, 27)) for _ in (self.browser_button, self.crop_button, self.mirror_button, self.actual_size_button): self.toolbar.addAction(_) self.addToolBar(Qt.TopToolBarArea, self.toolbar) for button in self.toolbuttons: button.setShortcut(self.toolbuttons[button]['shortcut']) button.triggered.connect(self.toolbuttons[button]['connect']) self.toolbar.addAction(button) self.centralwidget = QWidget(self) self.centralwidget.setSizePolicy(EXP_EXP) self.setCentralWidget(self.centralwidget) self.grid = QGridLayout(self.centralwidget) self.media = QGraphicsScene(self) self.media.setItemIndexMethod(QGraphicsScene.NoIndex) self.media.setBackgroundBrush(QBrush(Qt.black)) self.view = MyView(self.media, self) self.view.setSizePolicy(EXP_EXP) self.media.setSceneRect(0, 0, self.view.width(), self.view.height()) self.grid.addWidget(self.view, 0, 0, 1, 1) self.frame = QFrame(self.centralwidget) self.frame.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)) self.frame.setMinimumSize(QSize(325, 500)) self.frame.setStyleSheet( "QFrame { border: 4px inset #222; border-radius: 10; }") self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 400, 321, 91)) self.layout_widget.setContentsMargins(15, 15, 15, 15) self.grid2 = QGridLayout(self.layout_widget) self.grid2.setContentsMargins(0, 0, 0, 0) self.save_button = QPushButton('Yes (Save)', self.layout_widget) self.save_button.setSizePolicy(FIX_FIX) self.save_button.setMaximumSize(QSize(120, 26)) self.save_button.setVisible(False) self.grid2.addWidget(self.save_button, 1, 0, 1, 1) self.no_save_button = QPushButton('No (Reload)', self.layout_widget) self.no_save_button.setSizePolicy(FIX_FIX) self.no_save_button.setMaximumSize(QSize(120, 26)) self.no_save_button.setVisible(False) self.grid2.addWidget(self.no_save_button, 1, 1, 1, 1) self.label = QLabel("Current image modified, save it?", self.layout_widget) self.label.setSizePolicy(FIX_FIX) self.label.setMaximumSize(QSize(325, 60)) self.label.setVisible(False) self.label.setAlignment(Qt.AlignCenter) self.grid2.addWidget(self.label, 0, 0, 1, 2) self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 0, 321, 213)) self.ass = QRadioButton('Ass', self.layout_widget) self.ass_exposed = QRadioButton('Ass (exposed)', self.layout_widget) self.ass_reset = QRadioButton(self.frame) self.ass_group = QButtonGroup(self) self.breasts = QRadioButton('Breasts', self.layout_widget) self.breasts_exposed = QRadioButton('Breasts (exposed)', self.layout_widget) self.breasts_reset = QRadioButton(self.frame) self.breasts_group = QButtonGroup(self) self.pussy = QRadioButton('Pussy', self.layout_widget) self.pussy_exposed = QRadioButton('Pussy (exposed)', self.layout_widget) self.pussy_reset = QRadioButton(self.frame) self.pussy_group = QButtonGroup(self) self.fully_clothed = QRadioButton('Fully Clothed', self.layout_widget) self.fully_nude = QRadioButton('Fully Nude', self.layout_widget) self.nudity_reset = QRadioButton(self.frame) self.nudity = QButtonGroup(self) self.smiling = QRadioButton('Smiling', self.layout_widget) self.glaring = QRadioButton('Glaring', self.layout_widget) self.expression_reset = QRadioButton(self.frame) self.expression = QButtonGroup(self) self.grid3 = QGridLayout(self.layout_widget) self.grid3.setVerticalSpacing(15) self.grid3.setContentsMargins(0, 15, 0, 0) self.radios = { self.ass: { 'this': 'ass', 'that': 'ass_exposed', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 0, 1, 1) }, self.ass_exposed: { 'this': 'ass_exposed', 'that': 'ass', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 1, 1, 1) }, self.breasts: { 'this': 'breasts', 'that': 'breasts_exposed', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 0, 1, 1) }, self.breasts_exposed: { 'this': 'breasts_exposed', 'that': 'breasts', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 1, 1, 1) }, self.pussy: { 'this': 'pussy', 'that': 'pussy_exposed', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 0, 1, 1) }, self.pussy_exposed: { 'this': 'pussy_exposed', 'that': 'pussy', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 1, 1, 1) }, self.fully_clothed: { 'this': 'fully_clothed', 'that': 'fully_nude', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 0, 1, 1) }, self.fully_nude: { 'this': 'fully_nude', 'that': 'fully_clothed', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 1, 1, 1) }, self.smiling: { 'this': 'smiling', 'that': 'glaring', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 0, 1, 1) }, self.glaring: { 'this': 'glaring', 'that': 'smiling', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 1, 1, 1) }, } for radio in self.radios: radio.setSizePolicy(FIX_FIX) radio.setMaximumSize(QSize(150, 22)) self.radios[radio]['reset'].setGeometry(QRect(0, 0, 0, 0)) self.grid3.addWidget(radio, *self.radios[radio]['grid']) if self.radios[radio]['group'] != self.nudity: radio.toggled.connect( lambda x=_, y=radio: self.annotate(self.radios[y]['this'])) self.radios[radio]['group'].addButton(radio) self.radios[radio]['group'].addButton(self.radios[radio]['reset']) self.save_tags_button = QPushButton('Save Tags', self.layout_widget) self.save_tags_button.setSizePolicy(FIX_FIX) self.save_tags_button.setMaximumSize(QSize(120, 26)) self.grid3.addWidget(self.save_tags_button, 5, 1, 1, 1) self.grid.addWidget(self.frame, 0, 1, 1, 1) self.browse_bar = QLabel(self.centralwidget) self.browse_bar.setSizePolicy(EXP_FIX) self.browse_bar.setMinimumSize(QSize(0, 100)) self.browse_bar.setMaximumSize(QSize(INFINITE, 100)) self.browse_bar.setStyleSheet("background: #000;") self.browse_bar.setAlignment(Qt.AlignCenter) self.h_box2 = QHBoxLayout(self.browse_bar) self.h_box2.setContentsMargins(4, 0, 0, 0) self.grid.addWidget(self.browse_bar, 1, 0, 1, 2) hiders = [ self.no_save_button.clicked, self.save_button.clicked, self.reload_button.triggered ] for hider in hiders: hider.connect(self.save_button.hide) hider.connect(self.no_save_button.hide) hider.connect(self.label.hide) showers = [ self.mirror_button.triggered, self.rotate_right_button.triggered, self.rotate_left_button.triggered ] for shower in showers: shower.connect(self.save_button.show) shower.connect(self.no_save_button.show) shower.connect(self.label.show) self.no_save_button.clicked.connect(self.reload) self.browser_button.toggled.connect(self.browse_bar.setVisible) self.play_button.toggled.connect(lambda: self.frame.setVisible( (True, False)[self.frame.isVisible()])) self.reload_button.triggered.connect(self.reload) self.mirror_button.triggered.connect(lambda: self.pixmap.setScale(-1)) self.save_button.clicked.connect(self.save_image) self.play_button.toggled.connect( lambda: self.browser_button.setChecked( (True, False)[self.browse_bar.isVisible()])) self.crop_button.toggled.connect(self.view.reset) self.actual_size_button.triggered.connect(self.actual_size) self.browser_button.triggered.connect(self.browser) self.save_tags_button.clicked.connect(self.save_tags) self.view.got_rect.connect(self.set_rect) self.crop_rect = QRect(QPoint(0, 0), QSize(0, 0)) self.dir_now = os.getcwd() self.files = [] self.index = 0 self.refresh_files() self.pixmap_is_scaled = False self.pixmap = QGraphicsPixmapItem() self.active_tag = '' self.reset_browser = False self.txt = PngInfo() def set_rect(self, rect: tuple[QPointF, QPointF]): """Converts the crop rectangle to a QRect after a crop action""" self.crop_rect = QRect(rect[0].toPoint(), rect[1].toPoint()) def keyPressEvent(self, event: QKeyEvent): # pylint: disable=invalid-name; """Keyboard event handler.""" if event.key() == Qt.Key_Escape and self.play_button.isChecked(): self.play_button.toggle() self.browser_button.setChecked((True, False)[self.reset_browser]) elif (event.key() in [16777220, 16777221] and self.view.g_rect.rect().width() > 0): self.view.got_rect.emit((self.view.g_rect.rect().topLeft(), self.view.g_rect.rect().bottomRight())) if self.view.g_rect.pen().color() == Qt.red: new_pix = self.pixmap.pixmap().copy(self.crop_rect) if self.pixmap_is_scaled: new_pix = new_pix.transformed( self.view.transform().inverted()[0], Qt.SmoothTransformation) self.update_pixmap(new_pix) elif self.view.g_rect.pen().color() == Qt.magenta: self.annotate_rect() self.view.annotation = False for _ in (self.label, self.save_button, self.no_save_button): _.show() self.view.reset() def play(self): """Starts a slideshow.""" if self.play_button.isChecked(): if self.browser_button.isChecked(): self.reset_browser = True else: self.reset_browser = False QTimer.singleShot(3000, self.play) self.next() def _yield_radio(self): """Saves code connecting signals from all the radio buttons.""" yield from self.radios.keys().__str__() def load_icon(self, icon_file): """Loads an icon from Base64 encoded strings in icons.py.""" pix = QPixmap() pix.loadFromData(icon_file) return QIcon(pix) def open_file(self, file: str) -> None: """ Open an image file and display it. :param file: The filename of the image to open """ if not os.path.isfile(file): file = QFileDialog(self, self.dir_now, self.dir_now).getOpenFileName()[0] self.dir_now = os.path.dirname(file) self.refresh_files() for i, index_file in enumerate(self.files): if file.split('/')[-1] == index_file: self.index = i self.view.setTransform(QTransform()) self.update_pixmap(QPixmap(file)) self.browser() self.load_tags() def refresh_files(self) -> list[str]: """Updates the file list when the directory is changed. Returns a list of image files available in the current directory.""" files = os.listdir(self.dir_now) self.files = [ file for file in sorted(files, key=lambda x: x.lower()) if file.endswith((".png", ".jpg", ".gif", ".bmp", ".jpeg")) ] def next(self) -> None: """Opens the next image in the file list.""" self.index = (self.index + 1) % len(self.files) self.reload() def previous(self) -> None: """Opens the previous image in the file list.""" self.index = (self.index + (len(self.files) - 1)) % len(self.files) self.reload() def save_image(self) -> None: """ Save the modified image file. If the current pixmap has been scaled, we need to load a non-scaled pixmap from the original file and re-apply the transformations that have been performed to prevent it from being saved as the scaled-down image. """ if self.pixmap_is_scaled: rotation = self.pixmap.rotation() mirror = self.pixmap.scale() < 0 pix = QPixmap(self.files[self.index]) pix = pix.transformed(QTransform().rotate(rotation)) if mirror: pix = pix.transformed(QTransform().scale(-1, 1)) pix.save(self.files[self.index], quality=-1) else: self.pixmap.pixmap().save(self.files[self.index], quality=-1) self.save_tags() def delete(self) -> None: """Deletes the current image from the file system.""" with suppress(OSError): os.remove(f"{self.dir_now}/{self.files.pop(self.index)}") self.refresh_files() def reload(self) -> None: """Reloads the current pixmap; used to update the screen when the current file is changed.""" self.open_file(f"{self.dir_now}/{self.files[self.index]}") def annotate(self, tag): """Starts an annotate action""" self.txt = PngInfo() self.view.annotation = True self.active_tag = tag self.view.reset() def wheelEvent(self, event: QWheelEvent) -> None: # pylint: disable=invalid-name """With Ctrl depressed, zoom the current image, otherwise fire the next/previous functions.""" modifiers = QApplication.keyboardModifiers() if event.angleDelta().y() == 120 and modifiers == Qt.ControlModifier: self.view.scale(0.75, 0.75) elif event.angleDelta().y() == 120: self.previous() elif event.angleDelta().y( ) == -120 and modifiers == Qt.ControlModifier: self.view.scale(1.25, 1.25) elif event.angleDelta().y() == -120: self.next() def actual_size(self) -> None: """Display the current image at its actual size, rather than scaled to fit the viewport.""" self.update_pixmap(QPixmap(self.files[self.index]), False) self.view.setDragMode(QGraphicsView.ScrollHandDrag) def mousePressEvent(self, event: QMouseEvent) -> None: # pylint: disable=invalid-name """Event handler for mouse button presses.""" if event.button() == Qt.MouseButton.ForwardButton: self.next() elif event.button() == Qt.MouseButton.BackButton: self.previous() def update_pixmap(self, new: QPixmap, scaled: bool = True) -> None: """ Updates the currently displayed image. :param new: The new `QPixmap` to be displayed. :param scaled: If False, don't scale the image to fit the viewport. """ self.pixmap_is_scaled = scaled self.media.clear() self.pixmap = self.media.addPixmap(new) self.pixmap.setTransformOriginPoint( self.pixmap.boundingRect().width() / 2, self.pixmap.boundingRect().height() / 2) if scaled and (new.size().width() > self.view.width() or new.size().height() > self.view.height()): self.view.fitInView(self.pixmap, Qt.KeepAspectRatio) self.media.setSceneRect(self.pixmap.boundingRect()) def annotate_rect(self): """Creates image coordinate annotation data.""" self.txt.add_itxt( f'{str(self.active_tag)}-rect', f'{str(self.crop_rect.x())}, {str(self.crop_rect.y())}, {str(self.crop_rect.width())}, {str(self.crop_rect.height())}' ) def browser(self): """Slot function to initialize image thumbnails for the 'browse mode.'""" while self.h_box2.itemAt(0): self.h_box2.takeAt(0).widget().deleteLater() index = (self.index + (len(self.files) - 2)) % len(self.files) for i, file in enumerate(self.files): file = self.dir_now + '/' + self.files[index] label = ClickableLabel(self, file) self.h_box2.addWidget(label) pix = QPixmap(file) if (pix.size().width() > self.browse_bar.width() / 5 or pix.size().height() > 100): pix = pix.scaled(self.browse_bar.width() / 5, 100, Qt.KeepAspectRatio) label.setPixmap(pix) index = (index + 1) % len(self.files) if i == 4: break def save_tags(self): """Save tags for currently loaded image into its iTxt data.""" file = self.files[self.index] img = Image.open(file) img.load() for key, value, in img.text.items(): self.txt.add_itxt(key, value) for key in self.radios: if key.isChecked(): self.txt.add_itxt(self.radios[key]['this'], 'True') self.txt.add_itxt(self.radios[key]['that'], 'False') img.save(file, pnginfo=self.txt) def load_tags(self): """Load tags from iTxt data.""" for radio in self.radios: if radio.isChecked(): self.radios[radio]['reset'].setChecked(True) filename = self.files[self.index] fqp = filename img = Image.open(fqp) img.load() with suppress(AttributeError): for key, value in img.text.items(): if value == 'True': for radio in self.radios: if key == self.radios[radio]['this']: radio.setChecked(True) self.view.annotation = False self.active_tag = '' self.view.reset() for key, value in img.text.items(): if key.endswith('-rect'): btn = [ radio for radio in self.radios if self.radios[radio]['this'] == key.split('-')[0] ] print(key, value) if btn[0].isChecked(): coords = [int(coord) for coord in value.split(', ')] rect = QGraphicsRectItem(*coords) rect.setPen(QPen(Qt.magenta, 1, Qt.SolidLine)) rect.setBrush(QBrush(Qt.magenta, Qt.Dense4Pattern)) self.view.scene().addItem(rect) text = self.view.scene().addText( key.split('-')[0], QFont('monospace', 20, 400, False)) text.font().setPointSize(text.font().pointSize() * 2) text.update() text.setX(rect.rect().x() + 10) text.setY(rect.rect().y() + 10) print(f'set {key}')
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(671, 496) self.help = QAction(MainWindow) self.help.setObjectName(u"help") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.log_text = QTextEdit(self.centralwidget) self.log_text.setObjectName(u"log_text") self.log_text.setGeometry(QRect(0, 190, 671, 291)) self.labe = QLabel(self.centralwidget) self.labe.setObjectName(u"labe") self.labe.setGeometry(QRect(30, 20, 54, 12)) self.ssid = QLineEdit(self.centralwidget) self.ssid.setObjectName(u"ssid") self.ssid.setGeometry(QRect(70, 20, 131, 20)) self.time = QLineEdit(self.centralwidget) self.time.setObjectName(u"time") self.time.setGeometry(QRect(540, 20, 91, 20)) self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(470, 20, 54, 12)) self.password = QLineEdit(self.centralwidget) self.password.setObjectName(u"password") self.password.setGeometry(QRect(310, 20, 131, 20)) self.label_3 = QLabel(self.centralwidget) self.label_3.setObjectName(u"label_3") self.label_3.setGeometry(QRect(240, 20, 54, 12)) self.connect = QPushButton(self.centralwidget) self.connect.setObjectName(u"connect") self.connect.setGeometry(QRect(140, 60, 75, 23)) self.disconnect = QPushButton(self.centralwidget) self.disconnect.setObjectName(u"disconnect") self.disconnect.setGeometry(QRect(250, 60, 75, 23)) self.labe_2 = QLabel(self.centralwidget) self.labe_2.setObjectName(u"labe_2") self.labe_2.setGeometry(QRect(30, 120, 91, 16)) self.cur_ssid = QTextEdit(self.centralwidget) self.cur_ssid.setObjectName(u"cur_ssid") self.cur_ssid.setGeometry(QRect(140, 110, 241, 31)) self.label = QLabel(self.centralwidget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(30, 160, 101, 16)) self.interface_name = QTextEdit(self.centralwidget) self.interface_name.setObjectName(u"interface_name") self.interface_name.setGeometry(QRect(140, 150, 241, 31)) self.label_4 = QLabel(self.centralwidget) self.label_4.setObjectName(u"label_4") self.label_4.setGeometry(QRect(450, 70, 54, 12)) self.frequency = QLineEdit(self.centralwidget) self.frequency.setObjectName(u"frequency") self.frequency.setGeometry(QRect(540, 70, 91, 20)) self.test = QPushButton(self.centralwidget) self.test.setObjectName(u"test") self.test.setGeometry(QRect(550, 110, 75, 23)) self.label_5 = QLabel(self.centralwidget) self.label_5.setObjectName(u"label_5") self.label_5.setGeometry(QRect(470, 70, 61, 16)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 671, 22)) self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName(u"menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuFile.menuAction()) self.menuFile.addAction(self.help) self.menuFile.addSeparator() self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"WIFI-Test", None)) self.help.setText( QCoreApplication.translate("MainWindow", u"\u5e2e\u52a9\u4fe1\u606f", None)) self.labe.setText( QCoreApplication.translate("MainWindow", u"SSID:", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"Time(s):", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"Password:"******"MainWindow", u"Connect", None)) self.disconnect.setText( QCoreApplication.translate("MainWindow", u"Disconnect", None)) self.labe_2.setText( QCoreApplication.translate("MainWindow", u"Connected SSID:", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Interface Name:", None)) self.label_4.setText("") self.test.setText( QCoreApplication.translate("MainWindow", u"Test", None)) self.label_5.setText( QCoreApplication.translate("MainWindow", u"Frequency:", None)) self.menuFile.setTitle( QCoreApplication.translate("MainWindow", u"help", None))
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1020, 588) self.actionSave = QAction(MainWindow) self.actionSave.setObjectName(u"actionSave") self.actionExit = QAction(MainWindow) self.actionExit.setObjectName(u"actionExit") self.actionExit_2 = QAction(MainWindow) self.actionExit_2.setObjectName(u"actionExit_2") self.openini = QAction(MainWindow) self.openini.setObjectName(u"openini") self.openjson = QAction(MainWindow) self.openjson.setObjectName(u"openjson") self.main_widget = QWidget(MainWindow) self.main_widget.setObjectName(u"main_widget") self.ini_widget = QWidget(self.main_widget) self.ini_widget.setObjectName(u"ini_widget") self.ini_widget.setGeometry(QRect(670, 10, 341, 551)) self.initable = QTableWidget(self.ini_widget) if (self.initable.columnCount() < 2): self.initable.setColumnCount(2) self.initable.setObjectName(u"initable") self.initable.setEnabled(True) self.initable.setGeometry(QRect(10, 60, 321, 451)) font = QFont() self.initable.setFont(font) self.initable.setEditTriggers(QAbstractItemView.DoubleClicked) self.initable.setDragEnabled(False) self.initable.setSelectionMode(QAbstractItemView.ExtendedSelection) self.initable.setSelectionBehavior(QAbstractItemView.SelectRows) self.initable.setWordWrap(False) self.initable.setRowCount(0) self.initable.setColumnCount(2) self.initable.horizontalHeader().setDefaultSectionSize(110) self.initable.horizontalHeader().setProperty("showSortIndicator", False) self.initable.horizontalHeader().setStretchLastSection(True) self.initable.verticalHeader().setDefaultSectionSize(21) self.inilabel = QLabel(self.ini_widget) self.inilabel.setObjectName(u"inilabel") self.inilabel.setGeometry(QRect(10, 10, 181, 16)) self.inipath = QTextBrowser(self.ini_widget) self.inipath.setObjectName(u"inipath") self.inipath.setEnabled(True) self.inipath.setGeometry(QRect(10, 30, 321, 22)) self.inipath.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.iniapply = QPushButton(self.ini_widget) self.iniapply.setObjectName(u"iniapply") self.iniapply.setEnabled(True) self.iniapply.setGeometry(QRect(250, 520, 80, 21)) self.inidel = QPushButton(self.ini_widget) self.inidel.setObjectName(u"inidel") self.inidel.setEnabled(False) self.inidel.setGeometry(QRect(10, 520, 80, 21)) self.iniadd = QPushButton(self.ini_widget) self.iniadd.setObjectName(u"iniadd") self.iniadd.setEnabled(False) self.iniadd.setGeometry(QRect(100, 520, 80, 21)) self.json_widget = QWidget(self.main_widget) self.json_widget.setObjectName(u"json_widget") self.json_widget.setGeometry(QRect(0, 10, 661, 551)) self.checkBox = QCheckBox(self.json_widget) self.checkBox.setObjectName(u"checkBox") self.checkBox.setEnabled(True) self.checkBox.setGeometry(QRect(20, 100, 131, 20)) self.checkBox.setChecked(True) self.delentry = QPushButton(self.json_widget) self.delentry.setObjectName(u"delentry") self.delentry.setEnabled(False) self.delentry.setGeometry(QRect(10, 520, 80, 21)) self.remote = QLineEdit(self.json_widget) self.remote.setObjectName(u"remote") self.remote.setEnabled(True) self.remote.setGeometry(QRect(20, 130, 601, 22)) self.textBrowser = QTextBrowser(self.json_widget) self.textBrowser.setObjectName(u"textBrowser") self.textBrowser.setEnabled(True) self.textBrowser.setGeometry(QRect(20, 30, 601, 22)) self.textBrowser.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.addButton = QPushButton(self.json_widget) self.addButton.setObjectName(u"addButton") self.addButton.setEnabled(True) self.addButton.setGeometry(QRect(280, 160, 61, 22)) self.table = QTableWidget(self.json_widget) if (self.table.columnCount() < 2): self.table.setColumnCount(2) self.table.setObjectName(u"table") self.table.setEnabled(True) self.table.setGeometry(QRect(10, 200, 641, 311)) self.table.setFont(font) self.table.setEditTriggers(QAbstractItemView.DoubleClicked) self.table.setDragEnabled(False) self.table.setSelectionMode(QAbstractItemView.ExtendedSelection) self.table.setSelectionBehavior(QAbstractItemView.SelectRows) self.table.setWordWrap(False) self.table.setRowCount(0) self.table.setColumnCount(2) self.table.horizontalHeader().setDefaultSectionSize(80) self.table.horizontalHeader().setProperty("showSortIndicator", False) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setDefaultSectionSize(21) self.path = QLineEdit(self.json_widget) self.path.setObjectName(u"path") self.path.setEnabled(True) self.path.setGeometry(QRect(20, 70, 531, 22)) self.apply = QPushButton(self.json_widget) self.apply.setObjectName(u"apply") self.apply.setEnabled(True) self.apply.setGeometry(QRect(570, 520, 80, 21)) self.label = QLabel(self.json_widget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(20, 10, 181, 16)) self.browse = QPushButton(self.json_widget) self.browse.setObjectName(u"browse") self.browse.setGeometry(QRect(560, 70, 61, 22)) MainWindow.setCentralWidget(self.main_widget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 1020, 19)) self.File = QMenu(self.menubar) self.File.setObjectName(u"File") self.menuOpen = QMenu(self.File) self.menuOpen.setObjectName(u"menuOpen") MainWindow.setMenuBar(self.menubar) self.menubar.addAction(self.File.menuAction()) self.File.addAction(self.menuOpen.menuAction()) self.File.addAction(self.actionSave) self.File.addSeparator() self.File.addAction(self.actionExit_2) self.menuOpen.addAction(self.openini) self.menuOpen.addAction(self.openjson) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
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>"))
def setupUi(self, testGlWindow): if not testGlWindow.objectName(): testGlWindow.setObjectName(u"testGlWindow") testGlWindow.resize(952, 847) testGlWindow.setAcceptDrops(True) icon = QIcon() icon.addFile(u":/images/candle_256.png", QSize(), QIcon.Normal, QIcon.Off) testGlWindow.setWindowIcon(icon) testGlWindow.setStyleSheet(u"") self.centralWidget = QWidget(testGlWindow) self.centralWidget.setObjectName(u"centralWidget") self.horizontalLayout_5 = QHBoxLayout(self.centralWidget) self.horizontalLayout_5.setSpacing(9) self.horizontalLayout_5.setContentsMargins(11, 11, 11, 11) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.horizontalLayout_5.setContentsMargins(9, 9, 5, 9) self.grpProgram = QGroupBox(self.centralWidget) self.grpProgram.setObjectName(u"grpProgram") self.grpProgram.setFlat(False) self.verticalLayout_17 = QVBoxLayout(self.grpProgram) self.verticalLayout_17.setSpacing(7) self.verticalLayout_17.setContentsMargins(11, 11, 11, 11) self.verticalLayout_17.setObjectName(u"verticalLayout_17") self.verticalLayout_17.setContentsMargins(8, 8, 8, 8) self.splitter = QSplitter(self.grpProgram) self.splitter.setObjectName(u"splitter") self.splitter.setOrientation(Qt.Vertical) self.splitter.setHandleWidth(12) self.frame = QWidget(self.splitter) self.frame.setObjectName(u"frame") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy) self.frame.setMinimumSize(QSize(0, 600)) self.frame.setStyleSheet(u"border: 1px solid gray;") self.verticalLayout_8 = QVBoxLayout(self.frame) self.verticalLayout_8.setSpacing(6) self.verticalLayout_8.setContentsMargins(11, 11, 11, 11) self.verticalLayout_8.setObjectName(u"verticalLayout_8") self.verticalLayout_8.setContentsMargins(1, 1, 1, 1) self.splitter.addWidget(self.frame) self.layoutWidget = QWidget(self.splitter) self.layoutWidget.setObjectName(u"layoutWidget") self.verticalLayout_7 = QVBoxLayout(self.layoutWidget) self.verticalLayout_7.setSpacing(9) self.verticalLayout_7.setContentsMargins(11, 11, 11, 11) self.verticalLayout_7.setObjectName(u"verticalLayout_7") self.verticalLayout_7.setContentsMargins(0, 0, 0, 0) self.tblProgram = QTableView(self.layoutWidget) self.tblProgram.setObjectName(u"tblProgram") font = QFont() font.setPointSize(9) self.tblProgram.setFont(font) self.tblProgram.setContextMenuPolicy(Qt.CustomContextMenu) self.tblProgram.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.tblProgram.setSelectionMode(QAbstractItemView.ContiguousSelection) self.tblProgram.setSelectionBehavior(QAbstractItemView.SelectRows) self.tblProgram.setGridStyle(Qt.DashLine) self.tblProgram.horizontalHeader().setMinimumSectionSize(50) self.tblProgram.horizontalHeader().setHighlightSections(False) self.tblProgram.verticalHeader().setVisible(False) self.verticalLayout_7.addWidget(self.tblProgram) self.splitter.addWidget(self.layoutWidget) self.verticalLayout_17.addWidget(self.splitter) self.verticalLayout_17.setStretch(0, 1) self.horizontalLayout_5.addWidget(self.grpProgram) self.horizontalLayout_5.setStretch(0, 100) testGlWindow.setCentralWidget(self.centralWidget) self.menuBar = QMenuBar(testGlWindow) self.menuBar.setObjectName(u"menuBar") self.menuBar.setGeometry(QRect(0, 0, 952, 21)) testGlWindow.setMenuBar(self.menuBar) self.retranslateUi(testGlWindow) QMetaObject.connectSlotsByName(testGlWindow)
def menu(self): menubar = QMenuBar(self) #-------------- file_menu = menubar.addMenu('File') # open_act = QtGui.QAction('Open', self, checkable=True) # open_act = QtGui.QAction('Open', self) # open_act.triggered.connect(self.open_as_cb) file_menu.addAction("New (template)", self.new_model_cb, QtGui.QKeySequence('Ctrl+n')) file_menu.addAction("Open", self.open_as_cb, QtGui.QKeySequence('Ctrl+o')) file_menu.addAction("Save", self.save_cb, QtGui.QKeySequence('Ctrl+s')) # recent_act = QtGui.QAction('Recent', self) # save_act = QtGui.QAction('Save', self) # save_act.triggered.connect(self.save_cb) # saveas_act = QtGui.QAction('Save As my.xml', self) # file_menu.setStatusTip('enable/disable Dark mode') # new_model_act = QtGui.QAction('', self) # file_menu.addAction(new_model_act) # new_model_act.triggered.connect(self.new_model_cb) #-------------- samples_menu = file_menu.addMenu("Samples (copy of)") biorobots_act = QtGui.QAction('biorobots', self) samples_menu.addAction(biorobots_act) biorobots_act.triggered.connect(self.biorobots_cb) cancer_biorobots_act = QtGui.QAction('cancer biorobots', self) samples_menu.addAction(cancer_biorobots_act) cancer_biorobots_act.triggered.connect(self.cancer_biorobots_cb) hetero_act = QtGui.QAction('heterogeneity', self) samples_menu.addAction(hetero_act) hetero_act.triggered.connect(self.hetero_cb) pred_prey_act = QtGui.QAction('predator-prey-farmer', self) samples_menu.addAction(pred_prey_act) pred_prey_act.triggered.connect(self.pred_prey_cb) virus_mac_act = QtGui.QAction('virus-macrophage', self) samples_menu.addAction(virus_mac_act) virus_mac_act.triggered.connect(self.virus_mac_cb) worm_act = QtGui.QAction('worm', self) samples_menu.addAction(worm_act) worm_act.triggered.connect(self.worm_cb) cancer_immune_act = QtGui.QAction('cancer immune (3D)', self) samples_menu.addAction(cancer_immune_act) cancer_immune_act.triggered.connect(self.cancer_immune_cb) template_act = QtGui.QAction('template', self) samples_menu.addAction(template_act) template_act.triggered.connect(self.template_cb) subcell_act = QtGui.QAction('subcellular', self) samples_menu.addAction(subcell_act) subcell_act.triggered.connect(self.subcell_cb) #-------------- # file_menu.addAction(open_act) # file_menu.addAction(recent_act) # file_menu.addAction(save_act) # file_menu.addAction(save_act, self.save_act, QtGui.QKeySequence("Ctrl+s")) # file_menu.addAction(saveas_act) #-------------- self.models_menu = menubar.addMenu('Models') models_menu_act = QtGui.QAction('-----', self) self.models_menu.addAction(models_menu_act) models_menu_act.triggered.connect(self.select_current_model_cb) # self.models_menu.addAction('Load sample', self.select_current_model_cb) #-------------- tools_menu = menubar.addMenu('Tools') tools_menu_act = QtGui.QAction('Validate', self) tools_menu.addAction(tools_menu_act)
def __init__(self) -> None: QMainWindow.__init__(self) self.setSizePolicy( QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)) self.setMaximumSize(QSize(1920, 1080)) self.setStyleSheet("padding: 0px; margin: 0px;") self.setIconSize(QSize(32, 32)) self.setWindowTitle("BossyBot 2000 - Image Tagger") self.setWindowIcon(self.load_icon(icon)) self.menubar = QMenuBar(self) self.menubar.setSizePolicy(EXP_MAX) self.menubar.setMaximumSize(QSize(INFINITE, 30)) self.menu_file = QMenu('File', self.menubar) self.menu_options = QMenu('Options', self.menubar) self.menu_help = QMenu('Help', self.menubar) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_options.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.open = QAction('Open', self) self.menu_file.addAction(self.open) self.open.triggered.connect(self.open_file) self.exit_button = QAction('Exit', self) self.exit_button.triggered.connect(lambda: sys.exit(0), Qt.QueuedConnection) self.menu_file.addAction(self.exit_button) self.setMenuBar(self.menubar) self.previous_button = QAction(self.load_icon(previous), '<<', self) self.next_button = QAction(self.load_icon(next_icon), '>>', self) self.rotate_left_button = QAction(self.load_icon(left), '', self) self.rotate_right_button = QAction(self.load_icon(right), '', self) self.play_button = QAction(self.load_icon(play), '', self) self.play_button.setCheckable(True) self.delete_button = QAction(self.load_icon(delete), '', self) self.reload_button = QAction(self.load_icon(reload), '', self) self.mirror_button = QAction('Mirror', self) self.actual_size_button = QAction('Actual Size', self) self.browser_button = QAction('Browser', self) self.browser_button.setCheckable(True) self.browser_button.setChecked(True) self.crop_button = QAction('Crop', self) self.crop_button.setCheckable(True) self.toolbuttons = { self.rotate_left_button: { 'shortcut': ',', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() - 90) }, self.rotate_right_button: { 'shortcut': '.', 'connect': lambda: self.pixmap.setRotation(self.pixmap.rotation() + 90) }, self.delete_button: { 'shortcut': 'Del', 'connect': self.delete }, self.previous_button: { 'shortcut': 'Left', 'connect': self.previous }, self.play_button: { 'shortcut': 'Space', 'connect': self.play }, self.next_button: { 'shortcut': 'Right', 'connect': self.next }, self.reload_button: { 'shortcut': 'F5', 'connect': self.reload } } self.toolbar = QToolBar(self) self.toolbar.setSizePolicy(EXP_MAX) self.toolbar.setMaximumSize(QSize(INFINITE, 27)) for _ in (self.browser_button, self.crop_button, self.mirror_button, self.actual_size_button): self.toolbar.addAction(_) self.addToolBar(Qt.TopToolBarArea, self.toolbar) for button in self.toolbuttons: button.setShortcut(self.toolbuttons[button]['shortcut']) button.triggered.connect(self.toolbuttons[button]['connect']) self.toolbar.addAction(button) self.centralwidget = QWidget(self) self.centralwidget.setSizePolicy(EXP_EXP) self.setCentralWidget(self.centralwidget) self.grid = QGridLayout(self.centralwidget) self.media = QGraphicsScene(self) self.media.setItemIndexMethod(QGraphicsScene.NoIndex) self.media.setBackgroundBrush(QBrush(Qt.black)) self.view = MyView(self.media, self) self.view.setSizePolicy(EXP_EXP) self.media.setSceneRect(0, 0, self.view.width(), self.view.height()) self.grid.addWidget(self.view, 0, 0, 1, 1) self.frame = QFrame(self.centralwidget) self.frame.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)) self.frame.setMinimumSize(QSize(325, 500)) self.frame.setStyleSheet( "QFrame { border: 4px inset #222; border-radius: 10; }") self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 400, 321, 91)) self.layout_widget.setContentsMargins(15, 15, 15, 15) self.grid2 = QGridLayout(self.layout_widget) self.grid2.setContentsMargins(0, 0, 0, 0) self.save_button = QPushButton('Yes (Save)', self.layout_widget) self.save_button.setSizePolicy(FIX_FIX) self.save_button.setMaximumSize(QSize(120, 26)) self.save_button.setVisible(False) self.grid2.addWidget(self.save_button, 1, 0, 1, 1) self.no_save_button = QPushButton('No (Reload)', self.layout_widget) self.no_save_button.setSizePolicy(FIX_FIX) self.no_save_button.setMaximumSize(QSize(120, 26)) self.no_save_button.setVisible(False) self.grid2.addWidget(self.no_save_button, 1, 1, 1, 1) self.label = QLabel("Current image modified, save it?", self.layout_widget) self.label.setSizePolicy(FIX_FIX) self.label.setMaximumSize(QSize(325, 60)) self.label.setVisible(False) self.label.setAlignment(Qt.AlignCenter) self.grid2.addWidget(self.label, 0, 0, 1, 2) self.layout_widget = QWidget(self.frame) self.layout_widget.setGeometry(QRect(0, 0, 321, 213)) self.ass = QRadioButton('Ass', self.layout_widget) self.ass_exposed = QRadioButton('Ass (exposed)', self.layout_widget) self.ass_reset = QRadioButton(self.frame) self.ass_group = QButtonGroup(self) self.breasts = QRadioButton('Breasts', self.layout_widget) self.breasts_exposed = QRadioButton('Breasts (exposed)', self.layout_widget) self.breasts_reset = QRadioButton(self.frame) self.breasts_group = QButtonGroup(self) self.pussy = QRadioButton('Pussy', self.layout_widget) self.pussy_exposed = QRadioButton('Pussy (exposed)', self.layout_widget) self.pussy_reset = QRadioButton(self.frame) self.pussy_group = QButtonGroup(self) self.fully_clothed = QRadioButton('Fully Clothed', self.layout_widget) self.fully_nude = QRadioButton('Fully Nude', self.layout_widget) self.nudity_reset = QRadioButton(self.frame) self.nudity = QButtonGroup(self) self.smiling = QRadioButton('Smiling', self.layout_widget) self.glaring = QRadioButton('Glaring', self.layout_widget) self.expression_reset = QRadioButton(self.frame) self.expression = QButtonGroup(self) self.grid3 = QGridLayout(self.layout_widget) self.grid3.setVerticalSpacing(15) self.grid3.setContentsMargins(0, 15, 0, 0) self.radios = { self.ass: { 'this': 'ass', 'that': 'ass_exposed', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 0, 1, 1) }, self.ass_exposed: { 'this': 'ass_exposed', 'that': 'ass', 'group': self.ass_group, 'reset': self.ass_reset, 'grid': (0, 1, 1, 1) }, self.breasts: { 'this': 'breasts', 'that': 'breasts_exposed', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 0, 1, 1) }, self.breasts_exposed: { 'this': 'breasts_exposed', 'that': 'breasts', 'group': self.breasts_group, 'reset': self.breasts_reset, 'grid': (1, 1, 1, 1) }, self.pussy: { 'this': 'pussy', 'that': 'pussy_exposed', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 0, 1, 1) }, self.pussy_exposed: { 'this': 'pussy_exposed', 'that': 'pussy', 'group': self.pussy_group, 'reset': self.pussy_reset, 'grid': (2, 1, 1, 1) }, self.fully_clothed: { 'this': 'fully_clothed', 'that': 'fully_nude', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 0, 1, 1) }, self.fully_nude: { 'this': 'fully_nude', 'that': 'fully_clothed', 'group': self.nudity, 'reset': self.nudity_reset, 'grid': (3, 1, 1, 1) }, self.smiling: { 'this': 'smiling', 'that': 'glaring', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 0, 1, 1) }, self.glaring: { 'this': 'glaring', 'that': 'smiling', 'group': self.expression, 'reset': self.expression_reset, 'grid': (4, 1, 1, 1) }, } for radio in self.radios: radio.setSizePolicy(FIX_FIX) radio.setMaximumSize(QSize(150, 22)) self.radios[radio]['reset'].setGeometry(QRect(0, 0, 0, 0)) self.grid3.addWidget(radio, *self.radios[radio]['grid']) if self.radios[radio]['group'] != self.nudity: radio.toggled.connect( lambda x=_, y=radio: self.annotate(self.radios[y]['this'])) self.radios[radio]['group'].addButton(radio) self.radios[radio]['group'].addButton(self.radios[radio]['reset']) self.save_tags_button = QPushButton('Save Tags', self.layout_widget) self.save_tags_button.setSizePolicy(FIX_FIX) self.save_tags_button.setMaximumSize(QSize(120, 26)) self.grid3.addWidget(self.save_tags_button, 5, 1, 1, 1) self.grid.addWidget(self.frame, 0, 1, 1, 1) self.browse_bar = QLabel(self.centralwidget) self.browse_bar.setSizePolicy(EXP_FIX) self.browse_bar.setMinimumSize(QSize(0, 100)) self.browse_bar.setMaximumSize(QSize(INFINITE, 100)) self.browse_bar.setStyleSheet("background: #000;") self.browse_bar.setAlignment(Qt.AlignCenter) self.h_box2 = QHBoxLayout(self.browse_bar) self.h_box2.setContentsMargins(4, 0, 0, 0) self.grid.addWidget(self.browse_bar, 1, 0, 1, 2) hiders = [ self.no_save_button.clicked, self.save_button.clicked, self.reload_button.triggered ] for hider in hiders: hider.connect(self.save_button.hide) hider.connect(self.no_save_button.hide) hider.connect(self.label.hide) showers = [ self.mirror_button.triggered, self.rotate_right_button.triggered, self.rotate_left_button.triggered ] for shower in showers: shower.connect(self.save_button.show) shower.connect(self.no_save_button.show) shower.connect(self.label.show) self.no_save_button.clicked.connect(self.reload) self.browser_button.toggled.connect(self.browse_bar.setVisible) self.play_button.toggled.connect(lambda: self.frame.setVisible( (True, False)[self.frame.isVisible()])) self.reload_button.triggered.connect(self.reload) self.mirror_button.triggered.connect(lambda: self.pixmap.setScale(-1)) self.save_button.clicked.connect(self.save_image) self.play_button.toggled.connect( lambda: self.browser_button.setChecked( (True, False)[self.browse_bar.isVisible()])) self.crop_button.toggled.connect(self.view.reset) self.actual_size_button.triggered.connect(self.actual_size) self.browser_button.triggered.connect(self.browser) self.save_tags_button.clicked.connect(self.save_tags) self.view.got_rect.connect(self.set_rect) self.crop_rect = QRect(QPoint(0, 0), QSize(0, 0)) self.dir_now = os.getcwd() self.files = [] self.index = 0 self.refresh_files() self.pixmap_is_scaled = False self.pixmap = QGraphicsPixmapItem() self.active_tag = '' self.reset_browser = False self.txt = PngInfo()
class Principal(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.inicializar_db() self.setWindowTitle("Tião Automecânica - Clientes") self.widget = QWidget() # Janelas w1, w2 = Buscador(), NovoCliente() w1.status_signal.connect(self.atualizar_status) w2.status_signal.connect(self.atualizar_status) # Leiaute self.line = QFrame() self.line.setFrameShape(QFrame.VLine) self.line.setFrameShadow(QFrame.Sunken) self.line.setLineWidth(0) self.line.setMidLineWidth(1) self.layout = QGridLayout() self.layout.addWidget(w1, 0, 0, 1, 1) self.layout.addWidget(self.line, 0, 1, 1, 1) self.layout.addWidget(w2, 0, 1, 1, 2) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) # Menu self.menu = QMenuBar() self.setMenuBar(self.menu) self.sobre = QAction("Sobre", self) self.sobre.setShortcut("F1") self.menu.addAction(self.sobre) self.sobre.triggered.connect(self.info) # Status self.status = QStatusBar() self.setStatusBar(self.status) self.status_label = QLabel("Pronto") self.status.addWidget(self.status_label) @Slot() def info(self): self.popup = QMessageBox(QMessageBox.Information, "Sobre", "Informações") self.popup.setInformativeText("""Clientes \nVersão 0.5 \nFeito com S2 por Zero \nMIT License""") self.popup.addButton(QMessageBox.Ok) self.popup.exec() @Slot() def atualizar_status(self, msg: str): self.status_label.setText(msg) @staticmethod def inicializar_db(): try: init_db() except NameError: popup = QMessageBox(QMessageBox.Critical, "Erro", "Erro") popup.setInformativeText( "Arquivo de configuração não foi encontrado") popup.addButton(QMessageBox.Ok) popup.exec() exit(1)
class MainWidget(TritonWidget): def __init__(self, base): TritonWidget.__init__(self, base) self.addOTP = None self.closeEvent = self.widgetDeleted self.setWindowTitle('TritonAuth') self.setBackgroundColor(self, Qt.white) self.menu = QMenuBar() self.addMenu = self.menu.addMenu('Add') self.authAction = QAction('Authenticator', self) self.authAction.triggered.connect(self.openAddOTP) self.steamAction = QAction('Steam', self) self.steamAction.triggered.connect(self.openAddSteam) self.addMenu.addAction(self.authAction) self.addMenu.addAction(self.steamAction) self.sortMenu = self.menu.addMenu('Sort') self.nameAction = QAction('Sort by name', self) self.nameAction.triggered.connect(self.sortByName) self.sortMenu.addAction(self.nameAction) self.exportMenu = self.menu.addMenu('Export') self.andOTPAction = QAction('Export to andOTP', self) self.andOTPAction.triggered.connect(self.exportToAndOTP) self.exportMenu.addAction(self.andOTPAction) self.widget = QWidget() self.widget.setContentsMargins(10, 10, 10, 10) self.scrollArea = QScrollArea() self.scrollArea.setFixedSize(400, 495) self.scrollArea.setWidgetResizable(True) self.scrollWidget = QWidget() self.scrollLayout = QVBoxLayout(self.scrollWidget) self.scrollLayout.setAlignment(Qt.AlignTop) self.createAccounts() self.scrollArea.setWidget(self.scrollWidget) self.widgetLayout = QVBoxLayout(self.widget) self.widgetLayout.addWidget(self.scrollArea) self.boxLayout = QVBoxLayout(self) self.boxLayout.setContentsMargins(0, 5, 0, 0) self.boxLayout.addWidget(self.menu) self.boxLayout.addWidget(self.widget) self.setFixedSize(self.sizeHint()) self.center() self.show() def keyPressEvent(self, event): if type(event) != QKeyEvent: return letter = event.text().strip().lower() for i in range(self.scrollLayout.count()): widget = self.scrollLayout.itemAt(i).widget() if widget is not None and widget.name[0].lower() == letter: self.scrollArea.verticalScrollBar().setValue( widget.geometry().top()) return def widgetDeleted(self, arg): self.closeAddOTP() def closeAddOTP(self): if self.addOTP: self.addOTP.close() self.addOTP = None def addAccount(self, account): entry = EntryWidget(self.base, account) self.scrollLayout.addWidget(entry) def deleteAccount(self, account): for i in range(self.scrollLayout.count()): widget = self.scrollLayout.itemAt(i).widget() if widget.account == account: widget.close() def clearAccounts(self): for i in range(self.scrollLayout.count()): self.scrollLayout.itemAt(i).widget().close() def createAccounts(self): for account in self.base.getAccounts(): self.addAccount(account) def openAddOTP(self): self.closeAddOTP() self.addOTP = AddOTPWidget(self.base) def openAddSteam(self): self.closeAddOTP() self.addOTP = AddSteamWidget(self.base) def sortByName(self): self.base.sortAccountsByName() self.clearAccounts() self.createAccounts() def exportToAndOTP(self): accounts = [] for account in self.base.getAccounts(): type = account['type'] if type == Globals.OTPAuth: accounts.append({ 'secret': account['key'], 'digits': 6, 'period': 30, 'label': account['name'], 'type': 'TOTP', 'algorithm': 'SHA1', 'thumbnail': 'Default', 'last_used': 0, 'tags': [] }) elif type == Globals.SteamAuth: accounts.append({ 'secret': base64.b32encode(base64.b64decode( account['sharedSecret'])).decode('utf-8'), 'digits': 5, 'period': 30, 'label': account['name'], 'type': 'STEAM', 'algorithm': 'SHA1', 'thumbnail': 'Default', 'last_used': 0, 'tags': [] }) accounts = json.dumps(accounts) filename, _ = QFileDialog.getSaveFileName( self, 'Export to andOTP JSON file', '', 'All Files (*)') if filename: with open(filename, 'w') as file: file.write(accounts)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(983, 807) MainWindow.setWindowOpacity(0.000000000000000) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.groupBox = QGroupBox(self.centralwidget) self.groupBox.setObjectName(u"groupBox") self.groupBox.setGeometry(QRect(10, 10, 961, 191)) self.horizontalLayoutWidget = QWidget(self.groupBox) self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget") self.horizontalLayoutWidget.setGeometry(QRect(10, 30, 211, 41)) self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.label = QLabel(self.horizontalLayoutWidget) self.label.setObjectName(u"label") self.horizontalLayout.addWidget(self.label) self.lineEdit = QLineEdit(self.horizontalLayoutWidget) self.lineEdit.setObjectName(u"lineEdit") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.horizontalLayout.addWidget(self.lineEdit) self.horizontalLayoutWidget_2 = QWidget(self.groupBox) self.horizontalLayoutWidget_2.setObjectName( u"horizontalLayoutWidget_2") self.horizontalLayoutWidget_2.setGeometry(QRect(10, 70, 211, 41)) self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.label_2 = QLabel(self.horizontalLayoutWidget_2) self.label_2.setObjectName(u"label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_2) self.lineEdit_2.setObjectName(u"lineEdit_2") sizePolicy.setHeightForWidth( self.lineEdit_2.sizePolicy().hasHeightForWidth()) self.lineEdit_2.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_2) self.horizontalLayoutWidget_3 = QWidget(self.groupBox) self.horizontalLayoutWidget_3.setObjectName( u"horizontalLayoutWidget_3") self.horizontalLayoutWidget_3.setGeometry(QRect(10, 110, 211, 41)) self.horizontalLayout_3 = QHBoxLayout(self.horizontalLayoutWidget_3) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) self.label_3 = QLabel(self.horizontalLayoutWidget_3) self.label_3.setObjectName(u"label_3") self.horizontalLayout_3.addWidget(self.label_3) self.lineEdit_3 = QLineEdit(self.horizontalLayoutWidget_3) self.lineEdit_3.setObjectName(u"lineEdit_3") sizePolicy.setHeightForWidth( self.lineEdit_3.sizePolicy().hasHeightForWidth()) self.lineEdit_3.setSizePolicy(sizePolicy) self.horizontalLayout_3.addWidget(self.lineEdit_3) self.horizontalLayoutWidget_4 = QWidget(self.groupBox) self.horizontalLayoutWidget_4.setObjectName( u"horizontalLayoutWidget_4") self.horizontalLayoutWidget_4.setGeometry(QRect(230, 30, 238, 41)) self.horizontalLayout_4 = QHBoxLayout(self.horizontalLayoutWidget_4) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.label_4 = QLabel(self.horizontalLayoutWidget_4) self.label_4.setObjectName(u"label_4") self.horizontalLayout_4.addWidget(self.label_4) self.lineEdit_4 = QLineEdit(self.horizontalLayoutWidget_4) self.lineEdit_4.setObjectName(u"lineEdit_4") sizePolicy.setHeightForWidth( self.lineEdit_4.sizePolicy().hasHeightForWidth()) self.lineEdit_4.setSizePolicy(sizePolicy) self.horizontalLayout_4.addWidget(self.lineEdit_4) self.horizontalLayoutWidget_5 = QWidget(self.groupBox) self.horizontalLayoutWidget_5.setObjectName( u"horizontalLayoutWidget_5") self.horizontalLayoutWidget_5.setGeometry(QRect(230, 70, 240, 41)) self.horizontalLayout_5 = QHBoxLayout(self.horizontalLayoutWidget_5) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) self.label_5 = QLabel(self.horizontalLayoutWidget_5) self.label_5.setObjectName(u"label_5") self.horizontalLayout_5.addWidget(self.label_5) self.lineEdit_5 = QLineEdit(self.horizontalLayoutWidget_5) self.lineEdit_5.setObjectName(u"lineEdit_5") sizePolicy.setHeightForWidth( self.lineEdit_5.sizePolicy().hasHeightForWidth()) self.lineEdit_5.setSizePolicy(sizePolicy) self.horizontalLayout_5.addWidget(self.lineEdit_5) self.groupBox_2 = QGroupBox(self.centralwidget) self.groupBox_2.setObjectName(u"groupBox_2") self.groupBox_2.setGeometry(QRect(10, 210, 961, 171)) self.textBrowser = QTextBrowser(self.centralwidget) self.textBrowser.setObjectName(u"textBrowser") self.textBrowser.setGeometry(QRect(10, 440, 961, 311)) self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setGeometry(QRect(858, 400, 111, 25)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 983, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u043f\u043e\u0440\u0442 \u0413\u0410\u0420", None)) self.groupBox.setTitle( QCoreApplication.translate( "MainWindow", u"\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"URL", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"\u041f\u043e\u0440\u0442", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"\u0418\u043c\u044f \u0411\u0414", None)) self.label_4.setText( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u044f \u0440\u043e\u043b\u0438", None)) self.label_5.setText( QCoreApplication.translate( "MainWindow", u"\u041f\u0430\u0440\u043e\u043b\u044c", None)) self.groupBox_2.setTitle( QCoreApplication.translate( "MainWindow", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0430", None)) self.pushButton.setText( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u043f\u043e\u0440\u0442", None))
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(911, 607) self.action_open = QAction(MainWindow) self.action_open.setObjectName(u"action_open") self.action_open.setVisible(False) self.action_comparison = QAction(MainWindow) self.action_comparison.setObjectName(u"action_comparison") self.action_comparison.setVisible(False) self.action_plot = QAction(MainWindow) self.action_plot.setObjectName(u"action_plot") self.action_training_session = QAction(MainWindow) self.action_training_session.setObjectName(u"action_training_session") self.action_training_session.setVisible(False) self.action_game = QAction(MainWindow) self.action_game.setObjectName(u"action_game") self.action_save = QAction(MainWindow) self.action_save.setObjectName(u"action_save") self.action_save.setVisible(False) self.action_save_log = QAction(MainWindow) self.action_save_log.setObjectName(u"action_save_log") self.action_save_log.setVisible(False) self.action_coordinates = QAction(MainWindow) self.action_coordinates.setObjectName(u"action_coordinates") self.action_coordinates.setCheckable(True) self.action_about = QAction(MainWindow) self.action_about.setObjectName(u"action_about") self.action_new_db = QAction(MainWindow) self.action_new_db.setObjectName(u"action_new_db") self.action_open_db = QAction(MainWindow) self.action_open_db.setObjectName(u"action_open_db") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout_2 = QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.stacked_widget = QStackedWidget(self.centralwidget) self.stacked_widget.setObjectName(u"stacked_widget") self.game_page = QWidget() self.game_page.setObjectName(u"game_page") self.gridLayout_3 = QGridLayout(self.game_page) self.gridLayout_3.setObjectName(u"gridLayout_3") self.connect4 = QPushButton(self.game_page) self.connect4.setObjectName(u"connect4") sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.connect4.sizePolicy().hasHeightForWidth()) self.connect4.setSizePolicy(sizePolicy) self.gridLayout_3.addWidget(self.connect4, 0, 1, 1, 1) self.tic_tac_toe = QPushButton(self.game_page) self.tic_tac_toe.setObjectName(u"tic_tac_toe") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.tic_tac_toe.sizePolicy().hasHeightForWidth()) self.tic_tac_toe.setSizePolicy(sizePolicy1) self.gridLayout_3.addWidget(self.tic_tac_toe, 0, 0, 1, 1) self.othello = QPushButton(self.game_page) self.othello.setObjectName(u"othello") sizePolicy.setHeightForWidth( self.othello.sizePolicy().hasHeightForWidth()) self.othello.setSizePolicy(sizePolicy) self.gridLayout_3.addWidget(self.othello, 1, 0, 1, 1) self.stacked_widget.addWidget(self.game_page) self.players_page = QWidget() self.players_page.setObjectName(u"players_page") self.verticalLayout = QVBoxLayout(self.players_page) self.verticalLayout.setObjectName(u"verticalLayout") self.player_layout = QGridLayout() self.player_layout.setObjectName(u"player_layout") self.searches_lock2 = QCheckBox(self.players_page) self.searches_lock2.setObjectName(u"searches_lock2") self.player_layout.addWidget(self.searches_lock2, 2, 4, 1, 1) self.player1 = QComboBox(self.players_page) self.player1.setObjectName(u"player1") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.player1.sizePolicy().hasHeightForWidth()) self.player1.setSizePolicy(sizePolicy2) self.player_layout.addWidget(self.player1, 1, 1, 1, 1) self.cancel = QPushButton(self.players_page) self.cancel.setObjectName(u"cancel") self.player_layout.addWidget(self.cancel, 4, 0, 1, 1) self.searches_label1 = QLabel(self.players_page) self.searches_label1.setObjectName(u"searches_label1") sizePolicy3 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth( self.searches_label1.sizePolicy().hasHeightForWidth()) self.searches_label1.setSizePolicy(sizePolicy3) self.player_layout.addWidget(self.searches_label1, 1, 3, 1, 1) self.player2 = QComboBox(self.players_page) self.player2.setObjectName(u"player2") sizePolicy2.setHeightForWidth( self.player2.sizePolicy().hasHeightForWidth()) self.player2.setSizePolicy(sizePolicy2) self.player_layout.addWidget(self.player2, 2, 1, 1, 1) self.searches_lock1 = QCheckBox(self.players_page) self.searches_lock1.setObjectName(u"searches_lock1") self.player_layout.addWidget(self.searches_lock1, 1, 4, 1, 1) self.game_label = QLabel(self.players_page) self.game_label.setObjectName(u"game_label") sizePolicy4 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth( self.game_label.sizePolicy().hasHeightForWidth()) self.game_label.setSizePolicy(sizePolicy4) self.player_layout.addWidget(self.game_label, 0, 0, 1, 1) self.game_name = QLabel(self.players_page) self.game_name.setObjectName(u"game_name") self.player_layout.addWidget(self.game_name, 0, 1, 1, 4) self.searches_label2 = QLabel(self.players_page) self.searches_label2.setObjectName(u"searches_label2") self.player_layout.addWidget(self.searches_label2, 2, 3, 1, 1) self.player_label1 = QLabel(self.players_page) self.player_label1.setObjectName(u"player_label1") sizePolicy4.setHeightForWidth( self.player_label1.sizePolicy().hasHeightForWidth()) self.player_label1.setSizePolicy(sizePolicy4) self.player_layout.addWidget(self.player_label1, 1, 0, 1, 1) self.searches1 = QSpinBox(self.players_page) self.searches1.setObjectName(u"searches1") sizePolicy5 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy5.setHorizontalStretch(0) sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth( self.searches1.sizePolicy().hasHeightForWidth()) self.searches1.setSizePolicy(sizePolicy5) self.searches1.setMaximum(1000000) self.player_layout.addWidget(self.searches1, 1, 2, 1, 1) self.player_label2 = QLabel(self.players_page) self.player_label2.setObjectName(u"player_label2") self.player_layout.addWidget(self.player_label2, 2, 0, 1, 1) self.shuffle_players = QCheckBox(self.players_page) self.shuffle_players.setObjectName(u"shuffle_players") self.player_layout.addWidget(self.shuffle_players, 3, 1, 1, 4) self.searches2 = QSpinBox(self.players_page) self.searches2.setObjectName(u"searches2") sizePolicy5.setHeightForWidth( self.searches2.sizePolicy().hasHeightForWidth()) self.searches2.setSizePolicy(sizePolicy5) self.searches2.setMaximum(1000000) self.player_layout.addWidget(self.searches2, 2, 2, 1, 1) self.start = QPushButton(self.players_page) self.start.setObjectName(u"start") self.player_layout.addWidget(self.start, 4, 1, 1, 4) self.player_layout.setColumnStretch(1, 10) self.player_layout.setColumnStretch(2, 1) self.verticalLayout.addLayout(self.player_layout) self.stacked_widget.addWidget(self.players_page) self.humans_page = QWidget() self.humans_page.setObjectName(u"humans_page") self.gridLayout = QGridLayout(self.humans_page) self.gridLayout.setObjectName(u"gridLayout") self.close_humans = QPushButton(self.humans_page) self.close_humans.setObjectName(u"close_humans") sizePolicy4.setHeightForWidth( self.close_humans.sizePolicy().hasHeightForWidth()) self.close_humans.setSizePolicy(sizePolicy4) self.gridLayout.addWidget(self.close_humans, 1, 1, 1, 1) self.players_label = QLabel(self.humans_page) self.players_label.setObjectName(u"players_label") self.gridLayout.addWidget(self.players_label, 0, 0, 1, 1) self.new_human = QPushButton(self.humans_page) self.new_human.setObjectName(u"new_human") sizePolicy4.setHeightForWidth( self.new_human.sizePolicy().hasHeightForWidth()) self.new_human.setSizePolicy(sizePolicy4) self.gridLayout.addWidget(self.new_human, 1, 3, 1, 1) self.players_table = QTableWidget(self.humans_page) self.players_table.setObjectName(u"players_table") self.gridLayout.addWidget(self.players_table, 0, 1, 1, 3) self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout.addItem(self.spacer, 1, 2, 1, 1) self.stacked_widget.addWidget(self.humans_page) self.rules_page = QWidget() self.rules_page.setObjectName(u"rules_page") self.gridLayout_4 = QGridLayout(self.rules_page) self.gridLayout_4.setObjectName(u"gridLayout_4") self.rules_text = QTextBrowser(self.rules_page) self.rules_text.setObjectName(u"rules_text") self.gridLayout_4.addWidget(self.rules_text, 0, 0, 1, 1) self.rules_close = QPushButton(self.rules_page) self.rules_close.setObjectName(u"rules_close") sizePolicy4.setHeightForWidth( self.rules_close.sizePolicy().hasHeightForWidth()) self.rules_close.setSizePolicy(sizePolicy4) self.gridLayout_4.addWidget(self.rules_close, 1, 0, 1, 1) self.stacked_widget.addWidget(self.rules_page) self.display_page = QWidget() self.display_page.setObjectName(u"display_page") self.gridLayout_2 = QGridLayout(self.display_page) self.gridLayout_2.setObjectName(u"gridLayout_2") self.toggle_review = QPushButton(self.display_page) self.toggle_review.setObjectName(u"toggle_review") sizePolicy4.setHeightForWidth( self.toggle_review.sizePolicy().hasHeightForWidth()) self.toggle_review.setSizePolicy(sizePolicy4) self.gridLayout_2.addWidget(self.toggle_review, 3, 2, 1, 1) self.move_history = QComboBox(self.display_page) self.move_history.setObjectName(u"move_history") sizePolicy6 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy6.setHorizontalStretch(1) sizePolicy6.setVerticalStretch(0) sizePolicy6.setHeightForWidth( self.move_history.sizePolicy().hasHeightForWidth()) self.move_history.setSizePolicy(sizePolicy6) self.gridLayout_2.addWidget(self.move_history, 3, 1, 1, 1) self.choices = QTableWidget(self.display_page) self.choices.setObjectName(u"choices") sizePolicy7 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy7.setHorizontalStretch(0) sizePolicy7.setVerticalStretch(0) sizePolicy7.setHeightForWidth( self.choices.sizePolicy().hasHeightForWidth()) self.choices.setSizePolicy(sizePolicy7) self.gridLayout_2.addWidget(self.choices, 1, 0, 1, 3) self.resume_here = QPushButton(self.display_page) self.resume_here.setObjectName(u"resume_here") sizePolicy5.setHeightForWidth( self.resume_here.sizePolicy().hasHeightForWidth()) self.resume_here.setSizePolicy(sizePolicy5) self.gridLayout_2.addWidget(self.resume_here, 3, 0, 1, 1) self.game_display = QLabel(self.display_page) self.game_display.setObjectName(u"game_display") self.gridLayout_2.addWidget(self.game_display, 0, 0, 1, 3) self.stacked_widget.addWidget(self.display_page) self.plot_strength_page = QWidget() self.plot_strength_page.setObjectName(u"plot_strength_page") self.gridLayout_5 = QGridLayout(self.plot_strength_page) self.gridLayout_5.setObjectName(u"gridLayout_5") self.label = QLabel(self.plot_strength_page) self.label.setObjectName(u"label") self.gridLayout_5.addWidget(self.label, 0, 0, 1, 1) self.plot_game = QComboBox(self.plot_strength_page) self.plot_game.setObjectName(u"plot_game") self.gridLayout_5.addWidget(self.plot_game, 0, 1, 1, 2) self.lineEdit = QLineEdit(self.plot_strength_page) self.lineEdit.setObjectName(u"lineEdit") self.gridLayout_5.addWidget(self.lineEdit, 2, 1, 1, 2) self.label_2 = QLabel(self.plot_strength_page) self.label_2.setObjectName(u"label_2") self.gridLayout_5.addWidget(self.label_2, 3, 0, 1, 1) self.lineEdit_2 = QLineEdit(self.plot_strength_page) self.lineEdit_2.setObjectName(u"lineEdit_2") self.gridLayout_5.addWidget(self.lineEdit_2, 3, 1, 1, 2) self.reset_plot = QPushButton(self.plot_strength_page) self.reset_plot.setObjectName(u"reset_plot") self.gridLayout_5.addWidget(self.reset_plot, 6, 2, 1, 1) self.start_stop_plot = QPushButton(self.plot_strength_page) self.start_stop_plot.setObjectName(u"start_stop_plot") self.gridLayout_5.addWidget(self.start_stop_plot, 6, 1, 1, 1) self.strengths_label = QLabel(self.plot_strength_page) self.strengths_label.setObjectName(u"strengths_label") self.gridLayout_5.addWidget(self.strengths_label, 2, 0, 1, 1) self.label_3 = QLabel(self.plot_strength_page) self.label_3.setObjectName(u"label_3") self.gridLayout_5.addWidget(self.label_3, 4, 0, 1, 1) self.lineEdit_3 = QLineEdit(self.plot_strength_page) self.lineEdit_3.setObjectName(u"lineEdit_3") self.gridLayout_5.addWidget(self.lineEdit_3, 4, 1, 1, 2) self.stacked_widget.addWidget(self.plot_strength_page) self.plot_history_page = QWidget() self.plot_history_page.setObjectName(u"plot_history_page") self.gridLayout_6 = QGridLayout(self.plot_history_page) self.gridLayout_6.setObjectName(u"gridLayout_6") self.label_4 = QLabel(self.plot_history_page) self.label_4.setObjectName(u"label_4") self.gridLayout_6.addWidget(self.label_4, 0, 0, 1, 1) self.history_game = QComboBox(self.plot_history_page) self.history_game.setObjectName(u"history_game") self.gridLayout_6.addWidget(self.history_game, 0, 1, 1, 1) self.gridLayout_6.setColumnStretch(0, 1) self.gridLayout_6.setColumnStretch(1, 8) self.stacked_widget.addWidget(self.plot_history_page) self.verticalLayout_2.addWidget(self.stacked_widget) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 911, 22)) self.menu_file = QMenu(self.menubar) self.menu_file.setObjectName(u"menu_file") self.menu_new = QMenu(self.menu_file) self.menu_new.setObjectName(u"menu_new") self.menu_view = QMenu(self.menubar) self.menu_view.setObjectName(u"menu_view") self.menu_help = QMenu(self.menubar) self.menu_help.setObjectName(u"menu_help") self.menu_rules = QMenu(self.menu_help) self.menu_rules.setObjectName(u"menu_rules") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_view.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.menu_file.addAction(self.menu_new.menuAction()) self.menu_file.addAction(self.action_open) self.menu_file.addAction(self.action_save) self.menu_file.addAction(self.action_save_log) self.menu_file.addAction(self.action_new_db) self.menu_file.addAction(self.action_open_db) self.menu_new.addAction(self.action_game) self.menu_new.addAction(self.action_comparison) self.menu_new.addAction(self.action_plot) self.menu_new.addAction(self.action_training_session) self.menu_view.addAction(self.action_coordinates) self.menu_help.addAction(self.action_about) self.menu_help.addAction(self.menu_rules.menuAction()) self.retranslateUi(MainWindow) self.stacked_widget.setCurrentIndex(2) QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(671, 496) self.help = QAction(MainWindow) self.help.setObjectName(u"help") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.log_text = QTextEdit(self.centralwidget) self.log_text.setObjectName(u"log_text") self.log_text.setGeometry(QRect(0, 190, 671, 291)) self.labe = QLabel(self.centralwidget) self.labe.setObjectName(u"labe") self.labe.setGeometry(QRect(30, 20, 54, 12)) self.ssid = QLineEdit(self.centralwidget) self.ssid.setObjectName(u"ssid") self.ssid.setGeometry(QRect(70, 20, 131, 20)) self.time = QLineEdit(self.centralwidget) self.time.setObjectName(u"time") self.time.setGeometry(QRect(540, 20, 91, 20)) self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(470, 20, 54, 12)) self.password = QLineEdit(self.centralwidget) self.password.setObjectName(u"password") self.password.setGeometry(QRect(310, 20, 131, 20)) self.label_3 = QLabel(self.centralwidget) self.label_3.setObjectName(u"label_3") self.label_3.setGeometry(QRect(240, 20, 54, 12)) self.connect = QPushButton(self.centralwidget) self.connect.setObjectName(u"connect") self.connect.setGeometry(QRect(140, 60, 75, 23)) self.disconnect = QPushButton(self.centralwidget) self.disconnect.setObjectName(u"disconnect") self.disconnect.setGeometry(QRect(250, 60, 75, 23)) self.labe_2 = QLabel(self.centralwidget) self.labe_2.setObjectName(u"labe_2") self.labe_2.setGeometry(QRect(30, 120, 91, 16)) self.cur_ssid = QTextEdit(self.centralwidget) self.cur_ssid.setObjectName(u"cur_ssid") self.cur_ssid.setGeometry(QRect(140, 110, 241, 31)) self.label = QLabel(self.centralwidget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(30, 160, 101, 16)) self.interface_name = QTextEdit(self.centralwidget) self.interface_name.setObjectName(u"interface_name") self.interface_name.setGeometry(QRect(140, 150, 241, 31)) self.label_4 = QLabel(self.centralwidget) self.label_4.setObjectName(u"label_4") self.label_4.setGeometry(QRect(450, 70, 54, 12)) self.frequency = QLineEdit(self.centralwidget) self.frequency.setObjectName(u"frequency") self.frequency.setGeometry(QRect(540, 70, 91, 20)) self.test = QPushButton(self.centralwidget) self.test.setObjectName(u"test") self.test.setGeometry(QRect(550, 110, 75, 23)) self.label_5 = QLabel(self.centralwidget) self.label_5.setObjectName(u"label_5") self.label_5.setGeometry(QRect(470, 70, 61, 16)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 671, 22)) self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName(u"menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuFile.menuAction()) self.menuFile.addAction(self.help) self.menuFile.addSeparator() self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
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)
def setup(self, main_window: QMainWindow) -> None: """ Initialize the UI. :param main_window: An instance of the `QMainWindow` class. :type main_window: :class:`QMainWindow` """ main_window.setObjectName("main_window") main_window.setWindowTitle("TeaseAI") main_window.resize(1137, 751) main_window.setSizePolicy(*EXP_EXP) main_window.setTabShape(QTabWidget.Rounded) self.menubar = QMenuBar(main_window) self.menubar.setObjectName("menubar") self.menubar.setGeometry(0, 0, 1137, 23) self.file_menu = QMenu("File", self.menubar) self.file_menu.setObjectName("file_men") self.server_menu = QMenu("Server", self.menubar) self.server_menu.setObjectName("server_men") self.options_menu = QMenu("Options", self.menubar) self.options_menu.setObjectName("options_men") self.media_menu = QMenu("Media", self.menubar) self.media_menu.setObjectName("media_men") main_window.setMenuBar(self.menubar) self.exit = QAction("Exit", main_window) self.exit.setObjectName("exit") self.start_server = QAction("Start Server", main_window) self.start_server.setObjectName("start_server") self.connect_server = QAction("Connect to Server", main_window) self.connect_server.setObjectName("connect_server") self.kill_server = QAction("Kill Server", main_window) self.kill_server.setObjectName("kill_server") self.options = QAction("Options", main_window) self.options.setObjectName("options") self.start_webcam = QAction("Start Webcam", main_window) self.start_webcam.setObjectName("start_webcam") self.start_webcam.setCheckable(False) self.centralwidget = QWidget(main_window) self.centralwidget.setObjectName("centralwidget") self.centralwidget.setContentsMargins(QMargins(0, 0, 0, 0)) self.centralwidget.setSizePolicy(*EXP_EXP) self.grid_layout = QGridLayout(self.centralwidget) self.media = QFrame(self.centralwidget) self.media.setObjectName("media") self.media.setSizePolicy(*EXP_EXP) self.media.setMinimumSize(200, 200) self.media.setStyleSheet("background: #000;") self.grid_layout.addWidget(self.media, 0, 0, 5, 1) self.users_label = QLabel(" Online users:", self.centralwidget) self.users_label.setObjectName("users_label") self.users_label.setMinimumSize(300, 15) self.users_label.setMaximumSize(300, 15) self.grid_layout.addWidget(self.users_label, 0, 1, 1, 2) self.online = QPlainTextEdit("", self.centralwidget) self.online.setObjectName("online") self.online.setSizePolicy(*FIX_FIX) self.online.setMinimumSize(300, 50) self.online.setMaximumSize(300, 50) self.online.setStyleSheet("margin-left: 3px;" + SUNKEN) self.online.setLineWidth(2) self.online.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setSizeAdjustPolicy(QAbstractScrollArea.AdjustIgnored) self.online.setReadOnly(True) self.grid_layout.addWidget(self.online, 1, 1, 1, 2) self.chat = QPlainTextEdit("", self.centralwidget) self.chat.setObjectName("chat") self.chat.setSizePolicy(*FIX_EXP) self.chat.setMinimumSize(300, 0) self.chat.setMaximumSize(300, INFINITE) self.chat.setStyleSheet("margin-bottom: 3px; margin-top: 8px;" + SUNKEN) self.chat.setLineWidth(2) self.chat.setReadOnly(True) self.chat.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.grid_layout.addWidget(self.chat, 2, 1, 1, 2) self.input = QLineEdit(self.centralwidget) self.input.setObjectName("input") self.input.setSizePolicy(*FIX_FIX) self.input.setMinimumSize(224, 30) self.input.setMaximumSize(224, 30) self.input.setStyleSheet(SUNKEN) self.input.setEchoMode(QLineEdit.Normal) self.input.setClearButtonEnabled(True) self.grid_layout.addWidget(self.input, 3, 1, 1, 1) self.submit = QPushButton("Submit", self.centralwidget) self.submit.setObjectName("submit") self.submit.setSizePolicy(*FIX_FIX) self.submit.setMinimumSize(70, 30) self.submit.setMaximumSize(70, 30) self.grid_layout.addWidget(self.submit, 3, 2, 1, 1) self.tabs = QTabWidget(self.centralwidget) self.tabs.setObjectName("tabs") self.tabs.setSizePolicy(*FIX_FIX) self.tabs.setMinimumSize(300, 150) self.tabs.setMaximumSize(300, 150) self.tab = QWidget() self.tab.setObjectName("tab") self.tabs.addTab(self.tab, "Actions") self.tab2 = QWidget() self.tab2.setObjectName("tab2") self.tabs.addTab(self.tab2, "My Media") self.tab3 = QWidget() self.tab3.setObjectName("tab3") self.tab3.setSizePolicy(*FIX_FIX) self.grid_layout2 = QGridLayout(self.tab3) self.grid_layout2.setHorizontalSpacing(0) self.grid_layout2.setVerticalSpacing(3) self.grid_layout2.setContentsMargins(3, -1, 3, -1) self.server_folder = QLineEdit(self.tab3) self.server_folder.setObjectName("server_folder") self.grid_layout2.addWidget(self.server_folder, 0, 0, 1, 3) self.srv_browse = QPushButton("BROWSE", self.tab3) self.srv_browse.setObjectName("srv_browse") self.srv_browse.setStyleSheet("background: transparent;\n" " color: #4d4940;\n" " font-size: 8pt;\n" " font-weight: 450;\n" " padding: 6px;\n") self.grid_layout2.addWidget(self.srv_browse, 0, 3, 1, 1) self.back_button = QPushButton("", self.tab3) self.back_button.setObjectName("back_button") self.back_button.setSizePolicy(*FIX_FIX) self.back_button.setMaximumSize(SEVENTY_FIVE) self.back_button.setCursor(QCursor(Qt.PointingHandCursor)) self.back_button.setStyleSheet("border: 0;\n" "background: transparent;") icon = QIcon() icon.addFile(":/newPrefix/back_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.back_button.setIcon(icon) self.back_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.back_button, 1, 0, 1, 1) self.play_button = QPushButton("", self.tab3) self.play_button.setObjectName("play_button") self.play_button.setSizePolicy(*FIX_FIX) self.play_button.setMaximumSize(SEVENTY_FIVE) self.play_button.setCursor(QCursor(Qt.PointingHandCursor)) self.play_button.setStyleSheet("border: 0;\n" "background: transparent;") icon1 = QIcon() icon1.addFile(":/newPrefix/play_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.play_button.setIcon(icon1) self.play_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.play_button, 1, 1, 1, 1) self.stop_button = QPushButton("", self.tab3) self.stop_button.setObjectName("stop_button") self.stop_button.setSizePolicy(*FIX_FIX) self.stop_button.setMaximumSize(SEVENTY_FIVE) self.stop_button.setCursor(QCursor(Qt.PointingHandCursor)) self.stop_button.setStyleSheet("border: 0;\n" "background: transparent;") icon2 = QIcon() icon2.addFile(":/newPrefix/stop_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.stop_button.setIcon(icon2) self.stop_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.stop_button, 1, 2, 1, 1) self.fast_forward = QPushButton("", self.tab3) self.fast_forward.setObjectName("fast_forward") self.fast_forward.setSizePolicy(*FIX_FIX) self.fast_forward.setMaximumSize(SEVENTY_FIVE) self.fast_forward.setCursor(QCursor(Qt.PointingHandCursor)) self.fast_forward.setStyleSheet("border: 0;\n" "background: transparent;") icon3 = QIcon() icon3.addFile(":/newPrefix/fast_forward.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.fast_forward.setIcon(icon3) self.fast_forward.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.fast_forward, 1, 3, 1, 1) self.tabs.addTab(self.tab3, "Server Media") self.grid_layout.addWidget(self.tabs, 4, 1, 1, 2) main_window.setCentralWidget(self.centralwidget) self.statusbar = QStatusBar(main_window) self.statusbar.setObjectName("statusbar") self.statusbar.setEnabled(True) self.statusbar.setStyleSheet("margin-bottom: 5px;") self.statusbar.setSizePolicy(*EXP_FIX) self.statusbar.setMinimumSize(INFINITE, 30) self.statusbar.setMaximumSize(INFINITE, 30) self.statusbar.setSizeGripEnabled(False) main_window.setStatusBar(self.statusbar) self.menubar.addAction(self.file_menu.menuAction()) self.menubar.addAction(self.server_menu.menuAction()) self.menubar.addAction(self.options_menu.menuAction()) self.menubar.addAction(self.media_menu.menuAction()) self.file_menu.addAction(self.exit) self.server_menu.addAction(self.start_server) self.server_menu.addAction(self.connect_server) self.server_menu.addAction(self.kill_server) self.options_menu.addAction(self.options) self.media_menu.addAction(self.start_webcam) self.exit.triggered.connect(main_window.close) self.tabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(main_window) self.exit.setStatusTip("Exit the program.") self.start_server.setStatusTip("Initialize a local server instance.") self.connect_server.setStatusTip("Connect to a remote server.") self.kill_server.setStatusTip("Shut down a running local server.") self.options.setStatusTip("Open the options menu.") self.start_webcam.setStatusTip("Start webcam feed.") self.tooltip = QLabel("", self.statusbar) tooltip_policy = QSizePolicy(*EXP_FIX) tooltip_policy.setHorizontalStretch(100) self.tooltip.setSizePolicy(tooltip_policy) self.tooltip.setMinimumSize(INFINITE, 26) self.tooltip.setMaximumSize(INFINITE, 26) self.server_status = QLabel("Server status:", self.statusbar) self.server_status.setSizePolicy(*FIX_FIX) self.server_status.setMinimumSize(300, 26) self.server_status.setMaximumSize(300, 26) self.client_status = QLabel("Client status:", self.statusbar) self.client_status.setSizePolicy(*FIX_FIX) self.client_status.setMinimumSize(302, 26) self.client_status.setMaximumSize(302, 26) self.statusbar.addPermanentWidget(self.tooltip) self.statusbar.addPermanentWidget(self.server_status) self.statusbar.addPermanentWidget(self.client_status) self.tooltip.setStyleSheet(SUNKEN + "margin-left: 4px;\ margin-right: 0px;") self.client_status.setStyleSheet(SUNKEN + "margin-right: 7px;") self.server_status.setStyleSheet(SUNKEN + "margin-right: 2px;\ margin-left: 2px;") self.statusbar.messageChanged.connect(main_window.status_tip)
def __init__(self, stages: list[Stage], *args, **kwargs): QMainWindow.__init__(self, *args, **kwargs) if not self.objectName(): self.setObjectName("MainWindow") self.resize(800, 600) size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) size_policy.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(size_policy) self.setWindowTitle("Interfan") self.central_widget = QWidget(self) self.central_widget.setObjectName("central_widget") self.main_horizontal_layout = QHBoxLayout(self.central_widget) self.main_horizontal_layout.setObjectName("main_horizontal_layout") self.left_grid_layout = QGridLayout() self.left_grid_layout.setObjectName("left_grid_layout") self.slice_slider = QSlider(self.central_widget) self.slice_slider.setObjectName("slice_slider") self.slice_slider.setEnabled(False) self.slice_slider.setOrientation(Qt.Horizontal) self.left_grid_layout.addWidget(self.slice_slider, 1, 0, 1, 1) self.slice_label = QLabel(self.central_widget) self.slice_label.setObjectName("slice_label") self.slice_label.setGeometry(QRect(0, 10, 58, 18)) self.slice_label.setText("0") self.left_grid_layout.addWidget(self.slice_label, 1, 1, 1, 1) self.main_image_scene = QGraphicsScene() self.main_image_view = QGraphicsView(self.main_image_scene) self.main_image_view.setObjectName("main_image_view") self.left_grid_layout.addWidget(self.main_image_view, 0, 0, 1, 1) self.slice_image_scene = QGraphicsScene() self.slice_image_view = QGraphicsView(self.slice_image_scene) self.slice_image_view.setObjectName("slice_image_view") self.left_grid_layout.addWidget(self.slice_image_view, 0, 1, 1, 1) self.left_grid_layout.setRowStretch(0, 12) self.left_grid_layout.setRowStretch(1, 1) self.left_grid_layout.setColumnStretch(0, 6) self.left_grid_layout.setColumnStretch(1, 1) self.main_horizontal_layout.addLayout(self.left_grid_layout) self.right_vertical_layout = QVBoxLayout() self.right_vertical_layout.setObjectName("right_vertical_layout") self.settings_widget = SettingWidget(self.central_widget) self.right_vertical_layout.addWidget(self.settings_widget.group_box) self.proceed_button = QPushButton(self.central_widget) self.proceed_button.setObjectName("proceed_button") self.proceed_button.setText("Выполнить") self.proceed_button.setEnabled(False) self.right_vertical_layout.addWidget(self.proceed_button) self.right_down_layout = QHBoxLayout() self.right_down_layout.setObjectName("right_down_layout") self.stages_layout = QVBoxLayout() self.stages_layout.setObjectName("stages_layout") self.stages_label = QLabel(self.central_widget) self.stages_label.setObjectName("stages_label") self.stages_label.setText("Этапы") self.stages_layout.addWidget(self.stages_label, 1) self.stages_radio_buttons = [] for s in stages: rb = QRadioButton(self.central_widget) rb.setObjectName("stages_radio_button") rb.setEnabled(False) rb.setText(s.name) self.stages_layout.addWidget(rb, 1) self.stages_radio_buttons.append(rb) self.stages_radio_buttons[0].setEnabled(True) self.stages_radio_buttons[0].setChecked(True) self.set_stage(stages[0]) self.right_down_layout.addLayout(self.stages_layout) self.history_layout = QVBoxLayout() self.history_layout.setObjectName("history_layout") self.history_header_layout = QHBoxLayout() self.history_header_layout.setObjectName("history_header_layout") self.history_label = QLabel(self.central_widget) self.history_label.setObjectName("history_label") self.history_label.setText("История операций") self.history_header_layout.addWidget(self.history_label) self.history_minus_button = QToolButton(self.central_widget) self.history_minus_button.setObjectName("history_minus_button") self.history_minus_button.setEnabled(False) self.history_minus_button.setText("-") self.history_header_layout.addWidget(self.history_minus_button) self.history_header_layout.setStretch(0, 8) self.history_header_layout.setStretch(1, 1) self.history_layout.addLayout(self.history_header_layout) self.history_list_view = QListView(self.central_widget) self.history_list_view.setObjectName("history_list_view") self.history_layout.addWidget(self.history_list_view) self.history_script_button = QPushButton(self.central_widget) self.history_script_button.setObjectName("history_script_button") self.history_script_button.setText("Просмотреть как скрипт") self.history_layout.addWidget(self.history_script_button) self.right_down_layout.addLayout(self.history_layout) self.right_down_layout.setStretch(0, 1) self.right_down_layout.setStretch(1, 1) self.right_vertical_layout.addLayout(self.right_down_layout) self.right_vertical_layout.setStretch(0, 1) self.right_vertical_layout.setStretch(1, 0) self.right_vertical_layout.setStretch(2, 1) self.main_horizontal_layout.addLayout(self.right_vertical_layout) self.main_horizontal_layout.setStretch(0, 1) self.main_horizontal_layout.setStretch(1, 1) self.setCentralWidget(self.central_widget) self.menu_bar = QMenuBar(self) self.menu_bar.setObjectName("menu_bar") self.menu_bar.setGeometry(QRect(0, 0, 800, 30)) self.menu = QMenu(self.menu_bar) self.menu.setObjectName("men") self.menu.setTitle("Меню") self.setMenuBar(self.menu_bar) self.open_file = QAction(self) self.open_file.setObjectName("open_file") self.open_file.setText("Открыть файл") self.menu.addAction(self.open_file) self.status_bar = QStatusBar(self) self.status_bar.setObjectName("status_bar") self.setStatusBar(self.status_bar) self.menu_bar.addAction(self.menu.menuAction()) QMetaObject.connectSlotsByName(self)