def grid_layout_creation_1(self) -> None: self.group_box_1 = QGroupBox("Image info") layout = QGridLayout() layout.addWidget(QLabel(bold("Local file?")), 0, 0) layout.addWidget(QLabel("Yes" if self.img.local_file else "No"), 0, 1) layout.addWidget(QLabel(bold("Path:")), 1, 0) text = self.img.get_absolute_path_or_url() layout.addWidget(QLabel(text), 1, 1) icon = QtGui.QIcon(str(Path(cfg.ASSETS_DIR, "clipboard.png"))) btn = QPushButton() btn.setIcon(icon) btn.setIconSize(QtCore.QSize(ICON_SIZE, ICON_SIZE)) btn.setToolTip("copy to clipboard") btn.clicked.connect(partial(self.copy_to_clipboard, text)) layout.addWidget(btn, 1, 2) layout.addWidget(QLabel(bold("Resolution:")), 2, 0) text = "{w} x {h} pixels".format(w=self.img.original_img.width(), h=self.img.original_img.height()) layout.addWidget(QLabel(text), 2, 1) layout.addWidget(QLabel(bold("Size:")), 3, 0) file_size_hr = self.img.get_file_size(human_readable=True) text = "{0} ({1} bytes)".format( file_size_hr, helper.pretty_num(self.img.get_file_size())) layout.addWidget(QLabel(text), 3, 1) layout.addWidget(QLabel(bold("Flags:")), 4, 0) text = self.img.get_flags() layout.addWidget(QLabel(text), 4, 1) self.group_box_1.setLayout(layout)
def simple_button(self): sleep_btn = QPushButton('Sleep Button', self) # sleep_btn = QPushButton('&Sleep Button', self) # Alt + S sleep_btn.setToolTip('This is a <b>QPushButton</b> widget') sleep_btn.resize(sleep_btn.sizeHint()) sleep_btn.move(50, 50) sleep_btn.clicked.connect(self.show_question_message_box)
def __init__(self, previewImage, fileName): super(ImageView, self).__init__() self.fileName = fileName mainLayout = QVBoxLayout(self) self.imageLabel = QLabel() self.imageLabel.setPixmap(QPixmap.fromImage(previewImage)) mainLayout.addWidget(self.imageLabel) topLayout = QHBoxLayout() self.fileNameLabel = QLabel(QDir.toNativeSeparators(fileName)) self.fileNameLabel.setTextInteractionFlags(Qt.TextBrowserInteraction) topLayout.addWidget(self.fileNameLabel) topLayout.addStretch() copyButton = QPushButton("Copy") copyButton.setToolTip("Copy file name to clipboard") topLayout.addWidget(copyButton) copyButton.clicked.connect(self.copy) launchButton = QPushButton("Launch") launchButton.setToolTip("Launch image viewer") topLayout.addWidget(launchButton) launchButton.clicked.connect(self.launch) mainLayout.addLayout(topLayout)
def menu_button(self): sleep_btn = QPushButton('Sleep Button', self) # sleep_btn = QPushButton('&Sleep Button', self) # Alt + S sleep_btn.setToolTip('This is a menu') sleep_btn.resize(sleep_btn.sizeHint()) sleep_btn.move(200, 50) menu = QMenu("kek", self) menu.addAction(self.new_action('1', shortcut="Ctrl+A")) menu.addAction(self.new_action('2')) sleep_btn.setMenu(menu)
def gui_components(self): update_data = QPushButton("Update Data", self) update_data.clicked.connect(self.update_data) update_data.resize(update_data.sizeHint()) update_data.move(20, 25) render_data_button = QPushButton("Render data analysis", self) render_data_button.clicked.connect(self.render_data) render_data_button.move(140, 25) render_data_button.resize(render_data_button.sizeHint()) quit_button = QPushButton("Exit", self) quit_button.clicked.connect(QApplication.instance().quit) quit_button.clicked.connect(QCloseEvent) quit_button.resize(quit_button.sizeHint()) quit_button.move(300, 25) quit_button.setToolTip("Quit program")
def setupWidgets(self): """ Set up the widgets and layouts for interface. """ dir_label = QLabel("Choose Directory:") self.dir_line_edit = QLineEdit() dir_button = QPushButton('...') dir_button.setToolTip("Select file directory.") dir_button.clicked.connect(self.setDirectory) self.change_name_edit = QLineEdit() self.change_name_edit.setToolTip( "Files will be appended with numerical values.For example: filename <b> 01 </b >.jpg") self.change_name_edit.setPlaceholderText("Change file names to...") rename_button = QPushButton("Rename Files") rename_button.setToolTip("Begin renaming files in directory.") rename_button.clicked.connect(self.renameFiles) file_exts = [".jpg", ".jpeg", ".png", ".gif", ".txt"] # Create combo box for selecting file extensions. ext_cb = QComboBox() self.cb_value = file_exts[0] ext_cb.setToolTip("Only files with this extension will be changed.") ext_cb.addItems(file_exts) ext_cb.currentTextChanged.connect(self.updateCbValue) # Text edit is for displaying the file names as they are updated. self.display_files_edit = QTextEdit() self.display_files_edit.setReadOnly(True) self.progress_bar = QProgressBar() self.progress_bar.setValue(0) # Set layout and widgets. grid = QGridLayout() grid.addWidget(dir_label, 0, 0) grid.addWidget(self.dir_line_edit, 1, 0, 1, 2) grid.addWidget(dir_button, 1, 2) grid.addWidget(self.change_name_edit, 2, 0) grid.addWidget(ext_cb, 2, 1) grid.addWidget(rename_button, 2, 2) grid.addWidget(self.display_files_edit, 3, 0, 1, 3) grid.addWidget(self.progress_bar, 4, 0, 1, 3) self.setLayout(grid)
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.setWindowModality(Qt.ApplicationModal) MainWindow.resize(1492, 1852) sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QSize(700, 700)) MainWindow.setMaximumSize(QSize(16777215, 16777215)) MainWindow.setBaseSize(QSize(600, 600)) font = QFont() font.setPointSize(12) font.setKerning(True) MainWindow.setFont(font) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet(u"") MainWindow.setDocumentMode(False) MainWindow.setTabShape(QTabWidget.Rounded) MainWindow.setDockOptions(QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.action_Quit = QAction(MainWindow) self.action_Quit.setObjectName(u"action_Quit") self.main_widget = QWidget(MainWindow) self.main_widget.setObjectName(u"main_widget") self.main_widget.setEnabled(True) self.main_widget.setMinimumSize(QSize(650, 650)) self.main_widget.setContextMenuPolicy(Qt.DefaultContextMenu) self.main_widget.setAutoFillBackground(False) self.main_widget.setStyleSheet(u"") self.main_layout = QGridLayout(self.main_widget) self.main_layout.setObjectName(u"main_layout") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.log_button = QPushButton(self.main_widget) self.log_button.setObjectName(u"log_button") sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.log_button.sizePolicy().hasHeightForWidth()) self.log_button.setSizePolicy(sizePolicy1) self.log_button.setMinimumSize(QSize(24, 24)) font1 = QFont() font1.setPointSize(9) font1.setBold(True) font1.setKerning(True) self.log_button.setFont(font1) self.log_button.setCursor(QCursor(Qt.PointingHandCursor)) self.log_button.setCheckable(False) self.log_button.setFlat(True) self.horizontalLayout_2.addWidget(self.log_button) self.main_layout.addLayout(self.horizontalLayout_2, 5, 2, 1, 1) self.shuttle_widget = QWidget(self.main_widget) self.shuttle_widget.setObjectName(u"shuttle_widget") self.shuttle_widget.setMinimumSize(QSize(600, 600)) self.shuttle_widget.setMaximumSize(QSize(600, 600)) self.shuttle_widget.setAutoFillBackground(False) self.shuttle_widget.setStyleSheet(u"QWidget#shuttle_widget {background: url(images/ShuttleXpress_Black.png);\n" " background-repeat:no-repeat;}\n" " ") self.button_1 = QCheckBox(self.shuttle_widget) self.button_1.setObjectName(u"button_1") self.button_1.setGeometry(QRect(80, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_1.sizePolicy().hasHeightForWidth()) self.button_1.setSizePolicy(sizePolicy1) self.button_1.setMinimumSize(QSize(24, 24)) self.button_1.setFont(font) self.button_1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.usb_status = QPushButton(self.shuttle_widget) self.usb_status.setObjectName(u"usb_status") self.usb_status.setEnabled(False) self.usb_status.setGeometry(QRect(288, 10, 24, 24)) sizePolicy1.setHeightForWidth(self.usb_status.sizePolicy().hasHeightForWidth()) self.usb_status.setSizePolicy(sizePolicy1) self.usb_status.setMinimumSize(QSize(24, 24)) self.usb_status.setFont(font1) self.usb_status.setCursor(QCursor(Qt.ArrowCursor)) self.usb_status.setAutoFillBackground(False) self.usb_status.setText(u"") icon = QIcon() icon.addFile(u"images/usb_black_24.png", QSize(), QIcon.Disabled, QIcon.Off) icon.addFile(u"images/usb_white_24.png", QSize(), QIcon.Disabled, QIcon.On) self.usb_status.setIcon(icon) self.usb_status.setIconSize(QSize(24, 24)) self.usb_status.setCheckable(True) self.usb_status.setChecked(False) self.usb_status.setFlat(True) self.button_5 = QCheckBox(self.shuttle_widget) self.button_5.setObjectName(u"button_5") self.button_5.setGeometry(QRect(498, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_5.sizePolicy().hasHeightForWidth()) self.button_5.setSizePolicy(sizePolicy1) self.button_5.setMinimumSize(QSize(24, 24)) self.button_5.setFont(font) self.button_5.setLayoutDirection(Qt.RightToLeft) self.button_5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos4 = QRadioButton(self.shuttle_widget) self.wheel_pos4.setObjectName(u"wheel_pos4") self.wheel_pos4.setGeometry(QRect(382, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos4.sizePolicy().hasHeightForWidth()) self.wheel_pos4.setSizePolicy(sizePolicy1) self.wheel_pos4.setMinimumSize(QSize(24, 24)) self.wheel_pos4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0 = QRadioButton(self.shuttle_widget) self.wheel_cent0.setObjectName(u"wheel_cent0") self.wheel_cent0.setGeometry(QRect(289, 130, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_cent0.sizePolicy().hasHeightForWidth()) self.wheel_cent0.setSizePolicy(sizePolicy1) self.wheel_cent0.setMinimumSize(QSize(24, 24)) self.wheel_cent0.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0.setChecked(True) self.wheel_pos1 = QRadioButton(self.shuttle_widget) self.wheel_pos1.setObjectName(u"wheel_pos1") self.wheel_pos1.setGeometry(QRect(314, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos1.sizePolicy().hasHeightForWidth()) self.wheel_pos1.setSizePolicy(sizePolicy1) self.wheel_pos1.setMinimumSize(QSize(24, 24)) self.wheel_pos1.setStyleSheet(u"color: white;") self.wheel_pos2 = QRadioButton(self.shuttle_widget) self.wheel_pos2.setObjectName(u"wheel_pos2") self.wheel_pos2.setGeometry(QRect(338, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos2.sizePolicy().hasHeightForWidth()) self.wheel_pos2.setSizePolicy(sizePolicy1) self.wheel_pos2.setMinimumSize(QSize(24, 24)) self.wheel_pos2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.dial = QDial(self.shuttle_widget) self.dial.setObjectName(u"dial") self.dial.setGeometry(QRect(197, 178, 216, 216)) sizePolicy2 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.dial.sizePolicy().hasHeightForWidth()) self.dial.setSizePolicy(sizePolicy2) self.dial.setMinimumSize(QSize(24, 24)) self.dial.setAutoFillBackground(False) self.dial.setStyleSheet(u"background-color: black;") self.dial.setMinimum(0) self.dial.setMaximum(10) self.dial.setPageStep(1) self.dial.setValue(5) self.dial.setSliderPosition(5) self.dial.setInvertedAppearance(False) self.dial.setInvertedControls(False) self.dial.setWrapping(True) self.dial.setNotchTarget(3.700000000000000) self.dial.setNotchesVisible(False) self.wheel_neg6 = QRadioButton(self.shuttle_widget) self.wheel_neg6.setObjectName(u"wheel_neg6") self.wheel_neg6.setGeometry(QRect(162, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg6.sizePolicy().hasHeightForWidth()) self.wheel_neg6.setSizePolicy(sizePolicy1) self.wheel_neg6.setMinimumSize(QSize(24, 24)) self.wheel_neg6.setStyleSheet(u"color: white;") self.wheel_pos5 = QRadioButton(self.shuttle_widget) self.wheel_pos5.setObjectName(u"wheel_pos5") self.wheel_pos5.setGeometry(QRect(400, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos5.sizePolicy().hasHeightForWidth()) self.wheel_pos5.setSizePolicy(sizePolicy1) self.wheel_pos5.setMinimumSize(QSize(24, 24)) self.wheel_pos5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_2 = QCheckBox(self.shuttle_widget) self.button_2.setObjectName(u"button_2") self.button_2.setGeometry(QRect(156, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_2.sizePolicy().hasHeightForWidth()) self.button_2.setSizePolicy(sizePolicy1) self.button_2.setMinimumSize(QSize(24, 24)) self.button_2.setFont(font) self.button_2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg5 = QRadioButton(self.shuttle_widget) self.wheel_neg5.setObjectName(u"wheel_neg5") self.wheel_neg5.setGeometry(QRect(178, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg5.sizePolicy().hasHeightForWidth()) self.wheel_neg5.setSizePolicy(sizePolicy1) self.wheel_neg5.setMinimumSize(QSize(24, 24)) self.wheel_neg5.setStyleSheet(u"color: white;") self.wheel_pos6 = QRadioButton(self.shuttle_widget) self.wheel_pos6.setObjectName(u"wheel_pos6") self.wheel_pos6.setGeometry(QRect(416, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos6.sizePolicy().hasHeightForWidth()) self.wheel_pos6.setSizePolicy(sizePolicy1) self.wheel_pos6.setMinimumSize(QSize(24, 24)) self.wheel_pos6.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg1 = QRadioButton(self.shuttle_widget) self.wheel_neg1.setObjectName(u"wheel_neg1") self.wheel_neg1.setGeometry(QRect(264, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg1.sizePolicy().hasHeightForWidth()) self.wheel_neg1.setSizePolicy(sizePolicy1) self.wheel_neg1.setMinimumSize(QSize(24, 24)) self.wheel_neg1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_4 = QCheckBox(self.shuttle_widget) self.button_4.setObjectName(u"button_4") self.button_4.setGeometry(QRect(430, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_4.sizePolicy().hasHeightForWidth()) self.button_4.setSizePolicy(sizePolicy1) self.button_4.setMinimumSize(QSize(24, 24)) self.button_4.setFont(font) self.button_4.setLayoutDirection(Qt.RightToLeft) self.button_4.setAutoFillBackground(False) self.button_4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos7 = QRadioButton(self.shuttle_widget) self.wheel_pos7.setObjectName(u"wheel_pos7") self.wheel_pos7.setGeometry(QRect(427, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos7.sizePolicy().hasHeightForWidth()) self.wheel_pos7.setSizePolicy(sizePolicy1) self.wheel_pos7.setMinimumSize(QSize(24, 24)) self.wheel_pos7.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3 = QCheckBox(self.shuttle_widget) self.button_3.setObjectName(u"button_3") self.button_3.setGeometry(QRect(290, 72, 24, 24)) sizePolicy1.setHeightForWidth(self.button_3.sizePolicy().hasHeightForWidth()) self.button_3.setSizePolicy(sizePolicy1) self.button_3.setMinimumSize(QSize(24, 24)) self.button_3.setFont(font) self.button_3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3.setTristate(False) self.wheel_neg2 = QRadioButton(self.shuttle_widget) self.wheel_neg2.setObjectName(u"wheel_neg2") self.wheel_neg2.setGeometry(QRect(240, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg2.sizePolicy().hasHeightForWidth()) self.wheel_neg2.setSizePolicy(sizePolicy1) self.wheel_neg2.setMinimumSize(QSize(24, 24)) self.wheel_neg2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos3 = QRadioButton(self.shuttle_widget) self.wheel_pos3.setObjectName(u"wheel_pos3") self.wheel_pos3.setGeometry(QRect(361, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos3.sizePolicy().hasHeightForWidth()) self.wheel_pos3.setSizePolicy(sizePolicy1) self.wheel_pos3.setMinimumSize(QSize(24, 24)) self.wheel_pos3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg3 = QRadioButton(self.shuttle_widget) self.wheel_neg3.setObjectName(u"wheel_neg3") self.wheel_neg3.setGeometry(QRect(217, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg3.sizePolicy().hasHeightForWidth()) self.wheel_neg3.setSizePolicy(sizePolicy1) self.wheel_neg3.setMinimumSize(QSize(24, 24)) self.wheel_neg3.setStyleSheet(u"color: white;") self.wheel_neg4 = QRadioButton(self.shuttle_widget) self.wheel_neg4.setObjectName(u"wheel_neg4") self.wheel_neg4.setGeometry(QRect(196, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg4.sizePolicy().hasHeightForWidth()) self.wheel_neg4.setSizePolicy(sizePolicy1) self.wheel_neg4.setMinimumSize(QSize(24, 24)) self.wheel_neg4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg7 = QRadioButton(self.shuttle_widget) self.wheel_neg7.setObjectName(u"wheel_neg7") self.wheel_neg7.setGeometry(QRect(151, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg7.sizePolicy().hasHeightForWidth()) self.wheel_neg7.setSizePolicy(sizePolicy1) self.wheel_neg7.setMinimumSize(QSize(24, 24)) self.wheel_neg7.setStyleSheet(u"color: white;") self.dial.raise_() self.button_1.raise_() self.usb_status.raise_() self.button_5.raise_() self.wheel_pos4.raise_() self.wheel_cent0.raise_() self.wheel_pos1.raise_() self.wheel_pos2.raise_() self.wheel_neg6.raise_() self.wheel_pos5.raise_() self.button_2.raise_() self.wheel_neg5.raise_() self.wheel_pos6.raise_() self.wheel_neg1.raise_() self.button_4.raise_() self.wheel_pos7.raise_() self.button_3.raise_() self.wheel_neg2.raise_() self.wheel_pos3.raise_() self.wheel_neg3.raise_() self.wheel_neg4.raise_() self.wheel_neg7.raise_() self.main_layout.addWidget(self.shuttle_widget, 3, 2, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.about_button = QPushButton(self.main_widget) self.about_button.setObjectName(u"about_button") sizePolicy1.setHeightForWidth(self.about_button.sizePolicy().hasHeightForWidth()) self.about_button.setSizePolicy(sizePolicy1) self.about_button.setMinimumSize(QSize(24, 24)) self.about_button.setFont(font1) self.about_button.setCursor(QCursor(Qt.WhatsThisCursor)) self.about_button.setCheckable(False) self.about_button.setFlat(True) self.horizontalLayout.addWidget(self.about_button) self.main_layout.addLayout(self.horizontalLayout, 1, 2, 1, 1) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.plug_button = QPushButton(self.main_widget) self.plug_button.setObjectName(u"plug_button") sizePolicy1.setHeightForWidth(self.plug_button.sizePolicy().hasHeightForWidth()) self.plug_button.setSizePolicy(sizePolicy1) self.plug_button.setMinimumSize(QSize(24, 24)) self.plug_button.setFont(font1) self.plug_button.setCursor(QCursor(Qt.PointingHandCursor)) self.plug_button.setCheckable(False) self.plug_button.setFlat(True) self.horizontalLayout_3.addWidget(self.plug_button) self.main_layout.addLayout(self.horizontalLayout_3, 3, 1, 1, 1) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.conf_button = QPushButton(self.main_widget) self.conf_button.setObjectName(u"conf_button") sizePolicy1.setHeightForWidth(self.conf_button.sizePolicy().hasHeightForWidth()) self.conf_button.setSizePolicy(sizePolicy1) self.conf_button.setMinimumSize(QSize(24, 24)) self.conf_button.setFont(font1) self.conf_button.setCursor(QCursor(Qt.PointingHandCursor)) self.conf_button.setCheckable(False) self.conf_button.setFlat(True) self.verticalLayout.addWidget(self.conf_button) self.main_layout.addLayout(self.verticalLayout, 3, 4, 1, 1) MainWindow.setCentralWidget(self.main_widget) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") self.statusbar.setMinimumSize(QSize(600, 0)) MainWindow.setStatusBar(self.statusbar) self.about_widget = QDockWidget(MainWindow) self.about_widget.setObjectName(u"about_widget") self.about_widget.setEnabled(True) sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.about_widget.sizePolicy().hasHeightForWidth()) self.about_widget.setSizePolicy(sizePolicy3) self.about_widget.setMinimumSize(QSize(600, 600)) self.about_widget.setVisible(True) self.about_widget.setFloating(False) self.about_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetMovable) self.about_widget.setAllowedAreas(Qt.TopDockWidgetArea) self.about_layout = QWidget() self.about_layout.setObjectName(u"about_layout") sizePolicy3.setHeightForWidth(self.about_layout.sizePolicy().hasHeightForWidth()) self.about_layout.setSizePolicy(sizePolicy3) self.about_layout.setAutoFillBackground(False) self.gridLayout_3 = QGridLayout(self.about_layout) self.gridLayout_3.setObjectName(u"gridLayout_3") self.about_text = QTextEdit(self.about_layout) self.about_text.setObjectName(u"about_text") self.about_text.setFocusPolicy(Qt.WheelFocus) self.about_text.setAcceptDrops(False) self.about_text.setStyleSheet(u"color: white;") self.about_text.setFrameShape(QFrame.StyledPanel) self.about_text.setFrameShadow(QFrame.Sunken) self.about_text.setUndoRedoEnabled(False) self.about_text.setReadOnly(True) self.about_text.setAcceptRichText(True) self.gridLayout_3.addWidget(self.about_text, 0, 0, 1, 1) self.about_widget.setWidget(self.about_layout) MainWindow.addDockWidget(Qt.TopDockWidgetArea, self.about_widget) self.log_widget = QDockWidget(MainWindow) self.log_widget.setObjectName(u"log_widget") self.log_widget.setEnabled(True) self.log_widget.setMinimumSize(QSize(550, 158)) self.log_widget.setFont(font) self.log_widget.setVisible(True) self.log_widget.setFloating(False) self.log_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.log_widget.setAllowedAreas(Qt.BottomDockWidgetArea) self.log_layout = QWidget() self.log_layout.setObjectName(u"log_layout") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth(self.log_layout.sizePolicy().hasHeightForWidth()) self.log_layout.setSizePolicy(sizePolicy4) self.gridLayout_2 = QGridLayout(self.log_layout) self.gridLayout_2.setObjectName(u"gridLayout_2") self.log_content_layout = QVBoxLayout() self.log_content_layout.setObjectName(u"log_content_layout") self.log_content_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_text = QPlainTextEdit(self.log_layout) self.log_text.setObjectName(u"log_text") sizePolicy4.setHeightForWidth(self.log_text.sizePolicy().hasHeightForWidth()) self.log_text.setSizePolicy(sizePolicy4) self.log_text.setMinimumSize(QSize(0, 0)) self.log_text.setAcceptDrops(False) self.log_text.setFrameShape(QFrame.StyledPanel) self.log_text.setFrameShadow(QFrame.Sunken) self.log_text.setUndoRedoEnabled(False) self.log_text.setReadOnly(True) self.log_content_layout.addWidget(self.log_text) self.buttons_layout = QHBoxLayout() self.buttons_layout.setObjectName(u"buttons_layout") self.buttons_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_clear_button = QToolButton(self.log_layout) self.log_clear_button.setObjectName(u"log_clear_button") icon1 = QIcon() icon1.addFile(u"images/delete-sweep_24.png", QSize(), QIcon.Normal, QIcon.Off) self.log_clear_button.setIcon(icon1) self.log_clear_button.setIconSize(QSize(24, 24)) self.buttons_layout.addWidget(self.log_clear_button) self.log_content_layout.addLayout(self.buttons_layout) self.gridLayout_2.addLayout(self.log_content_layout, 0, 0, 1, 1) self.log_widget.setWidget(self.log_layout) MainWindow.addDockWidget(Qt.BottomDockWidgetArea, self.log_widget) self.config_widget = QDockWidget(MainWindow) self.config_widget.setObjectName(u"config_widget") self.config_widget.setEnabled(True) self.config_widget.setMinimumSize(QSize(250, 600)) self.config_widget.setFloating(False) self.config_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.config_widget.setAllowedAreas(Qt.RightDockWidgetArea) self.config_layout = QWidget() self.config_layout.setObjectName(u"config_layout") self.gridLayout = QGridLayout(self.config_layout) self.gridLayout.setObjectName(u"gridLayout") self.config_content_layout = QFormLayout() self.config_content_layout.setObjectName(u"config_content_layout") self.gridLayout.addLayout(self.config_content_layout, 0, 0, 1, 1) self.config_widget.setWidget(self.config_layout) MainWindow.addDockWidget(Qt.RightDockWidgetArea, self.config_widget) self.plugins_widget = QDockWidget(MainWindow) self.plugins_widget.setObjectName(u"plugins_widget") self.plugins_widget.setMinimumSize(QSize(250, 600)) self.plugins_widget.setAllowedAreas(Qt.LeftDockWidgetArea) self.dockWidgetContents = QWidget() self.dockWidgetContents.setObjectName(u"dockWidgetContents") self.plugins_widget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(Qt.LeftDockWidgetArea, self.plugins_widget) self.about_widget.raise_() self.log_widget.raise_() self.retranslateUi(MainWindow) self.usb_status.setDefault(False) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Contour ShuttleXpress", None)) self.action_Quit.setText(QCoreApplication.translate("MainWindow", u"&Quit", None)) #if QT_CONFIG(tooltip) self.log_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.log_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Log", None)) #endif // QT_CONFIG(statustip) self.log_button.setText(QCoreApplication.translate("MainWindow", u"//", None)) #if QT_CONFIG(statustip) self.button_1.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 1", None)) #endif // QT_CONFIG(statustip) self.button_1.setText("") #if QT_CONFIG(tooltip) self.usb_status.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.usb_status.setStatusTip(QCoreApplication.translate("MainWindow", u"USB connection status", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(whatsthis) self.usb_status.setWhatsThis(QCoreApplication.translate("MainWindow", u"USB Status", None)) #endif // QT_CONFIG(whatsthis) #if QT_CONFIG(statustip) self.button_5.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 5", None)) #endif // QT_CONFIG(statustip) self.button_5.setText("") #if QT_CONFIG(statustip) self.wheel_pos4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 4", None)) #endif // QT_CONFIG(statustip) self.wheel_pos4.setText("") #if QT_CONFIG(statustip) self.wheel_cent0.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: center", None)) #endif // QT_CONFIG(statustip) self.wheel_cent0.setText("") #if QT_CONFIG(statustip) self.wheel_pos1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 1", None)) #endif // QT_CONFIG(statustip) self.wheel_pos1.setText("") #if QT_CONFIG(statustip) self.wheel_pos2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 2", None)) #endif // QT_CONFIG(statustip) self.wheel_pos2.setText("") #if QT_CONFIG(statustip) self.dial.setStatusTip(QCoreApplication.translate("MainWindow", u"Dial", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(statustip) self.wheel_neg6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 6", None)) #endif // QT_CONFIG(statustip) self.wheel_neg6.setText("") #if QT_CONFIG(statustip) self.wheel_pos5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 5", None)) #endif // QT_CONFIG(statustip) self.wheel_pos5.setText("") #if QT_CONFIG(statustip) self.button_2.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 2", None)) #endif // QT_CONFIG(statustip) self.button_2.setText("") #if QT_CONFIG(statustip) self.wheel_neg5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 5", None)) #endif // QT_CONFIG(statustip) self.wheel_neg5.setText("") #if QT_CONFIG(statustip) self.wheel_pos6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 6", None)) #endif // QT_CONFIG(statustip) self.wheel_pos6.setText("") #if QT_CONFIG(statustip) self.wheel_neg1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 1", None)) #endif // QT_CONFIG(statustip) self.wheel_neg1.setText("") #if QT_CONFIG(statustip) self.button_4.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 4", None)) #endif // QT_CONFIG(statustip) self.button_4.setText("") #if QT_CONFIG(statustip) self.wheel_pos7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 7", None)) #endif // QT_CONFIG(statustip) self.wheel_pos7.setText("") #if QT_CONFIG(statustip) self.button_3.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 3", None)) #endif // QT_CONFIG(statustip) self.button_3.setText("") #if QT_CONFIG(statustip) self.wheel_neg2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 2", None)) #endif // QT_CONFIG(statustip) self.wheel_neg2.setText("") #if QT_CONFIG(statustip) self.wheel_pos3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 3", None)) #endif // QT_CONFIG(statustip) self.wheel_pos3.setText("") #if QT_CONFIG(statustip) self.wheel_neg3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 3", None)) #endif // QT_CONFIG(statustip) self.wheel_neg3.setText("") #if QT_CONFIG(statustip) self.wheel_neg4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 4", None)) #endif // QT_CONFIG(statustip) self.wheel_neg4.setText(QCoreApplication.translate("MainWindow", u"-", None)) #if QT_CONFIG(statustip) self.wheel_neg7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 7", None)) #endif // QT_CONFIG(statustip) self.wheel_neg7.setText("") #if QT_CONFIG(tooltip) self.about_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.about_button.setStatusTip(QCoreApplication.translate("MainWindow", u"About", None)) #endif // QT_CONFIG(statustip) self.about_button.setText(QCoreApplication.translate("MainWindow", u"?", None)) #if QT_CONFIG(tooltip) self.plug_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.plug_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.plug_button.setText(QCoreApplication.translate("MainWindow", u"#", None)) #if QT_CONFIG(tooltip) self.conf_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.conf_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.conf_button.setText(QCoreApplication.translate("MainWindow", u"=", None)) self.about_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"About", None)) self.about_text.setDocumentTitle("") self.log_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Log", None)) self.log_clear_button.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) self.config_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Configuration", None)) self.plugins_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Plugins", None))
class App(QWidget): def __init__(self): #init super(App, self).__init__() #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #parameters for the resume generation. self.params = { "White": 1.0, "Black": 1.0, "Hispanic": 1.0, "Asian": 1.0, "GenderRatio": 0.5, "TestSection": '', "TestMode": 2, "WorkPath": "", "BeginYear": "", "EndYear": "", "BeginMonth": "", "EndMonth": "", "BeginYearEdu": "", "EndYearEdu": "", "BeginMonthEdu": "", "EndMonthEdu": "" } #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #Dictionaries for UI buttons self.testModes = {"Before": 1, "After": 2, "Replace": 3} self.testSections = { "Address": 1, "Education": 2, "Work History": 3, "Skills": 4 } #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #Window sizing for application self.title = "COEHP Resume Generator" self.left = 10 self.top = 10 self.width = 100 self.height = 300 #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #Window is created here self.makeUI() #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #Function creates window and adds widgets def makeUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.createLayout() windowLayout = QGridLayout() windowLayout.addWidget(self.box0, 1, 1, 1, 1) windowLayout.addWidget(self.box4, 0, 0, 1, 1) windowLayout.addWidget(self.box6, 1, 0, 1, 1) windowLayout.addWidget(self.box7, 0, 1, 1, 1) windowLayout.addWidget(self.box5, 3, 0, 1, 2) windowLayout.addWidget(self.box8, 2, 0, 1, 2) windowLayout.setAlignment(QtCore.Qt.AlignTop) self.setLayout(windowLayout) self.show() #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ #All QGroupBoxes for features are added here. def createLayout(self): self.box0 = QGroupBox("Timeframe") self.box4 = QGroupBox("Test Data") self.box6 = QGroupBox("Output Directory") self.box5 = QGroupBox("") self.box7 = QGroupBox("Demographic Settings") self.box8 = QGroupBox("Resume Layout") #Demographic Settings self.wPercent = QTextEdit("0.25") self.bPercent = QTextEdit("0.25") self.aPercent = QTextEdit("0.25") self.hPercent = QTextEdit("0.25") self.gPercent = QTextEdit("0.5") self.wLabel = QLabel("White %") self.bLabel = QLabel("Black %") self.aLabel = QLabel("Asian %") self.hLabel = QLabel("Hispanic %") self.gLabel = QLabel(" Gender Ratio") self.wPercent.setFixedSize(100, 30) self.bPercent.setFixedSize(100, 30) self.aPercent.setFixedSize(100, 30) self.hPercent.setFixedSize(100, 30) self.gPercent.setFixedSize(100, 30) #Resume Layout Settings self.testSectionLabel1 = QLabel("Test Location") self.testSectionLabel2 = QLabel("Section") self.testSectionLabel3 = QLabel("Location of Content") self.sectionSelect = QComboBox() self.sectionSelect.addItems( ["Address", "Education", "Work History", "Skills"]) self.sectionSelect.setFixedSize(300, 30) self.modeSelect = QComboBox() self.modeSelect.addItems(["Before", "After", "Replace"]) self.modeSelect.setFixedSize(300, 30) #Academic Year #First Semester self.monthBegin = QComboBox() self.monthBegin.addItems([ "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December" ]) self.monthBegin.setFixedSize(100, 30) self.yearBeginLabel = QLabel("First Semester") self.yearBegin = QComboBox() self.yearBegin.setFixedSize(100, 30) for year in range(1970, 2050): self.yearBegin.addItem(str(year)) #Last Semester self.monthEnd = QComboBox() self.monthEnd.addItems([ "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December" ]) self.monthEnd.setFixedSize(100, 30) self.yearEnd = QComboBox() self.yearEndLabel = QLabel("Semester of Graduation") for year in range(1970, 2050): self.yearEnd.addItem(str(year)) self.yearEnd.setFixedSize(100, 30) #Earliest relevant employment self.monthWorkBegin = QComboBox() self.monthWorkBegin.addItems([ "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December" ]) self.monthBegin.setFixedSize(100, 30) self.yearWorkBeginLabel = QLabel( "Earliest Possible Date of Employment") self.yearWorkBegin = QComboBox() self.yearWorkBegin.setFixedSize(100, 30) for year in range(1970, 2050): self.yearWorkBegin.addItem(str(year)) #Latest relevant employment self.monthWorkEnd = QComboBox() self.monthWorkEnd.addItems([ "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December" ]) self.monthWorkEnd.setFixedSize(100, 30) self.yearWorkEnd = QComboBox() self.yearWorkEndLabel = QLabel("Latest Possible Date of Employment") for year in range(1970, 2050): self.yearWorkEnd.addItem(str(year)) self.yearWorkEnd.setFixedSize(100, 30) currentYear = date.today().year index = currentYear - 1970 self.yearEnd.setCurrentIndex(index) self.yearBegin.setCurrentIndex(index) self.yearWorkBegin.setCurrentIndex(index) self.yearWorkEnd.setCurrentIndex(index) #Output Directory self.dirLabel = QLabel("Output Directory") self.currentDir = QTextEdit() self.currentDir.setText("Not Selected") self.currentDir.layout() self.currentDir.setFixedSize(300, 30) self.currentDir.setReadOnly(True) self.outputName = QTextEdit() self.outputLabel = QLabel("Output Folder Name") self.outputName.setText("None written") self.outputName.setToolTip( "Type in the name of the new Folder you would like to make for your Resume batch. \n Otherwise, this will use the current timestamp." ) self.outputName.setFixedSize(300, 30) #Select ouput folder button self.outputButton = QPushButton('Select Output Directory') self.outputButton.setToolTip( "Click here to tell the generator where to put this batch of Resumes when it is finished." ) self.outputButton.clicked.connect( lambda: self.openDir(self.currentDir)) self.currentTest = QTextEdit() self.currentTest.setText("SportsCollegeList.csv") #Output Directory self.workLabel = QLabel("Output Directory") self.currentWork = QTextEdit() self.currentWork.setText("SportsCollegeList.csv") self.currentWork.layout() self.currentWork.setFixedSize(300, 30) self.currentWork.setReadOnly(True) #Select work datafolder button self.workButton = QPushButton('Select Work Data (.CSV)') self.workButton.setToolTip( "Click here to select a source file for the employment information in this Resume Batch." ) self.workButton.clicked.connect(lambda: self.openDir(self.currentWork)) #Select School Data self.workLabel = QLabel("Output Directory") self.currentSchool = QTextEdit() self.currentSchool.setText("Not Selected") self.currentSchool.layout() self.currentSchool.setFixedSize(300, 30) self.currentSchool.setReadOnly(True) #Select work datafolder button self.schoolButton = QPushButton('Select Work Data (.CSV)') self.schoolButton.clicked.connect( lambda: self.openDir(self.currentWork)) #Select test data self.testLabel = QLabel("Output Directory") self.currentTest = QTextEdit() self.currentTest.setText("SportsCollegeList.csv") self.currentTest.layout() self.currentTest.setFixedSize(300, 30) self.currentTest.setReadOnly(True) self.testButton = QPushButton('Select Test Data (.CSV)') self.testButton.clicked.connect(lambda: self.openDir(self.currentTest)) #Generate Resumes button self.begin = QPushButton('Generate Resumes') self.begin.clicked.connect( lambda: self.beginTask(self.currentTest.toPlainText())) layout = QGridLayout() self.box0.setLayout(layout) layout.addWidget(self.yearBeginLabel, 0, 0, 1, 2) layout.addWidget(self.monthBegin, 1, 0, 1, 1) layout.addWidget(self.yearBegin, 1, 1, 1, 1) layout.addWidget(self.yearEndLabel, 2, 0, 1, 2) layout.addWidget(self.monthEnd, 3, 0, 1, 1) layout.addWidget(self.yearEnd, 3, 1, 1, 1) layout.addWidget(self.yearWorkBeginLabel, 4, 0, 1, 2) layout.addWidget(self.monthWorkBegin, 5, 0, 1, 1) layout.addWidget(self.yearWorkBegin, 5, 1, 1, 1) layout.addWidget(self.yearWorkEndLabel, 6, 0, 1, 2) layout.addWidget(self.monthWorkEnd, 7, 0, 1, 1) layout.addWidget(self.yearWorkEnd, 7, 1, 1, 1) layout1 = QGridLayout() self.box8.setLayout(layout1) layout1.addWidget(self.testSectionLabel1, 0, 0, 1, 1) layout1.addWidget(self.testSectionLabel3, 1, 0, 1, 1) layout1.addWidget(self.sectionSelect, 0, 1, 1, 1) layout1.addWidget(self.modeSelect, 1, 1, 1, 1) layout2 = QGridLayout() self.box7.setLayout(layout2) layout2.addWidget(self.wLabel, 0, 0, 1, 1) layout2.addWidget(self.bLabel, 1, 0, 1, 1) layout2.addWidget(self.hLabel, 0, 2, 1, 1) layout2.addWidget(self.aLabel, 2, 0, 1, 1) layout2.addWidget(self.wPercent, 0, 1, 1, 1) layout2.addWidget(self.bPercent, 1, 1, 1, 1) layout2.addWidget(self.hPercent, 0, 3, 1, 1) layout2.addWidget(self.aPercent, 2, 1, 1, 1) layout2.addWidget(self.gLabel, 3, 1, 1, 1) layout2.addWidget(self.gPercent, 3, 2, 1, 2) layout = QGridLayout() self.box5.setLayout(layout) layout.addWidget(self.begin, 0, 0, 1, 2) layout3 = QGridLayout() layout3.addWidget(self.testButton, 0, 0, 1, 2) layout3.addWidget(self.currentTest, 1, 0, 1, 2) self.box4.setLayout(layout3) layout4 = QGridLayout() layout4.addWidget(self.outputButton, 0, 0, 1, 2) layout4.addWidget(self.currentDir, 1, 0, 1, 2) layout4.addWidget(self.outputLabel, 2, 0, 1, 2) layout4.addWidget(self.outputName, 3, 0, 1, 2) self.box6.setLayout(layout4) #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ # def openDir(self, target): fileName = QFileDialog() filenames = list() if fileName.exec_(): fileNames = fileName.selectedFiles() target.setText(fileNames[0]) #▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ # def beginTask(self, path): self.beginGen(path) def beginGen(self, path): self.params["White"] = self.wPercent.toPlainText() self.params["Black"] = self.bPercent.toPlainText() self.params["Hispanic"] = self.hPercent.toPlainText() self.params["Asian"] = self.aPercent.toPlainText() self.params["GenderRatio"] = self.gPercent.toPlainText() self.params["TestMode"] = str(self.modeSelect.currentText()) self.params["TestSection"] = str(self.sectionSelect.currentText()) self.params["BeginYear"] = str(self.yearWorkBegin.currentText()) self.params["EndYear"] = str(self.yearWorkEnd.currentText()) self.params["BeginMonth"] = str(self.monthWorkBegin.currentText()) self.params["EndMonth"] = str(self.monthWorkEnd.currentText()) self.params["workPath"] = "work.csv" self.params["BeginYearEdu"] = str(self.yearBegin.currentText()) self.params["EndYearEdu"] = str(self.yearEnd.currentText()) self.params["BeginMonthEdu"] = str(self.monthBegin.currentText()) self.params["EndMonthEdu"] = str(self.monthEnd.currentText()) print(self.params) Printer.begin(self.currentDir.toPlainText(), path, self.outputName.toPlainText(), self.params)
class Ui_TaxExportDlg(object): def setupUi(self, TaxExportDlg): if not TaxExportDlg.objectName(): TaxExportDlg.setObjectName(u"TaxExportDlg") TaxExportDlg.resize(602, 315) self.gridLayout = QGridLayout(TaxExportDlg) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setHorizontalSpacing(6) self.gridLayout.setContentsMargins(9, 9, 9, 9) self.line = QFrame(TaxExportDlg) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.gridLayout.addWidget(self.line, 4, 0, 1, 4) self.XlsSelectBtn = QPushButton(TaxExportDlg) self.XlsSelectBtn.setObjectName(u"XlsSelectBtn") sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.XlsSelectBtn.sizePolicy().hasHeightForWidth()) self.XlsSelectBtn.setSizePolicy(sizePolicy) self.gridLayout.addWidget(self.XlsSelectBtn, 3, 2, 1, 1) self.WarningLbl = QLabel(TaxExportDlg) self.WarningLbl.setObjectName(u"WarningLbl") font = QFont() font.setItalic(True) self.WarningLbl.setFont(font) self.gridLayout.addWidget(self.WarningLbl, 5, 0, 1, 4) self.DlsgGroup = QGroupBox(TaxExportDlg) self.DlsgGroup.setObjectName(u"DlsgGroup") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.DlsgGroup.sizePolicy().hasHeightForWidth()) self.DlsgGroup.setSizePolicy(sizePolicy1) self.DlsgGroup.setFlat(False) self.DlsgGroup.setCheckable(True) self.DlsgGroup.setChecked(False) self.gridLayout_2 = QGridLayout(self.DlsgGroup) self.gridLayout_2.setSpacing(2) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(6, 6, 6, 6) self.InitialFileLbl = QLabel(self.DlsgGroup) self.InitialFileLbl.setObjectName(u"InitialFileLbl") self.gridLayout_2.addWidget(self.InitialFileLbl, 0, 0, 1, 1) self.DlsgOutFileName = QLineEdit(self.DlsgGroup) self.DlsgOutFileName.setObjectName(u"DlsgOutFileName") self.gridLayout_2.addWidget(self.DlsgOutFileName, 1, 1, 1, 1) self.DlsgInFileName = QLineEdit(self.DlsgGroup) self.DlsgInFileName.setObjectName(u"DlsgInFileName") self.gridLayout_2.addWidget(self.DlsgInFileName, 0, 1, 1, 1) self.OutputFileLbl = QLabel(self.DlsgGroup) self.OutputFileLbl.setObjectName(u"OutputFileLbl") self.gridLayout_2.addWidget(self.OutputFileLbl, 1, 0, 1, 1) self.DividendsOnly = QCheckBox(self.DlsgGroup) self.DividendsOnly.setObjectName(u"DividendsOnly") self.gridLayout_2.addWidget(self.DividendsOnly, 3, 0, 1, 3) self.OutputSelectBtn = QPushButton(self.DlsgGroup) self.OutputSelectBtn.setObjectName(u"OutputSelectBtn") self.gridLayout_2.addWidget(self.OutputSelectBtn, 1, 2, 1, 1) self.InitialSelectBtn = QPushButton(self.DlsgGroup) self.InitialSelectBtn.setObjectName(u"InitialSelectBtn") self.gridLayout_2.addWidget(self.InitialSelectBtn, 0, 2, 1, 1) self.IncomeSourceBroker = QCheckBox(self.DlsgGroup) self.IncomeSourceBroker.setObjectName(u"IncomeSourceBroker") self.IncomeSourceBroker.setChecked(True) self.gridLayout_2.addWidget(self.IncomeSourceBroker, 2, 0, 1, 3) self.gridLayout.addWidget(self.DlsgGroup, 7, 0, 1, 4) self.Year = QSpinBox(TaxExportDlg) self.Year.setObjectName(u"Year") self.Year.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.Year.setMinimum(2010) self.Year.setMaximum(2030) self.Year.setValue(2020) self.gridLayout.addWidget(self.Year, 1, 1, 1, 2) self.XlsFileName = QLineEdit(TaxExportDlg) self.XlsFileName.setObjectName(u"XlsFileName") sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.XlsFileName.sizePolicy().hasHeightForWidth()) self.XlsFileName.setSizePolicy(sizePolicy2) self.gridLayout.addWidget(self.XlsFileName, 3, 1, 1, 1) self.AccountWidget = AccountSelector(TaxExportDlg) self.AccountWidget.setObjectName(u"AccountWidget") self.gridLayout.addWidget(self.AccountWidget, 2, 1, 1, 2) self.YearLbl = QLabel(TaxExportDlg) self.YearLbl.setObjectName(u"YearLbl") self.gridLayout.addWidget(self.YearLbl, 1, 0, 1, 1) self.buttonBox = QDialogButtonBox(TaxExportDlg) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Vertical) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.gridLayout.addWidget(self.buttonBox, 1, 3, 3, 1) self.AccountLbl = QLabel(TaxExportDlg) self.AccountLbl.setObjectName(u"AccountLbl") self.gridLayout.addWidget(self.AccountLbl, 2, 0, 1, 1) self.XlsFileLbl = QLabel(TaxExportDlg) self.XlsFileLbl.setObjectName(u"XlsFileLbl") self.gridLayout.addWidget(self.XlsFileLbl, 3, 0, 1, 1) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 9, 0, 1, 1) self.NoSettlement = QCheckBox(TaxExportDlg) self.NoSettlement.setObjectName(u"NoSettlement") self.gridLayout.addWidget(self.NoSettlement, 8, 0, 1, 4) QWidget.setTabOrder(self.Year, self.XlsFileName) QWidget.setTabOrder(self.XlsFileName, self.XlsSelectBtn) QWidget.setTabOrder(self.XlsSelectBtn, self.DlsgGroup) QWidget.setTabOrder(self.DlsgGroup, self.DlsgInFileName) QWidget.setTabOrder(self.DlsgInFileName, self.InitialSelectBtn) QWidget.setTabOrder(self.InitialSelectBtn, self.DlsgOutFileName) QWidget.setTabOrder(self.DlsgOutFileName, self.OutputSelectBtn) self.retranslateUi(TaxExportDlg) self.buttonBox.accepted.connect(TaxExportDlg.accept) self.buttonBox.rejected.connect(TaxExportDlg.reject) QMetaObject.connectSlotsByName(TaxExportDlg) # setupUi def retranslateUi(self, TaxExportDlg): TaxExportDlg.setWindowTitle( QCoreApplication.translate( "TaxExportDlg", u"Select parameters and files for tax report", None)) #if QT_CONFIG(tooltip) self.XlsSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.XlsSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u"...", None)) self.WarningLbl.setText( QCoreApplication.translate( "TaxExportDlg", u"Below functions are experimental - use it with care", None)) self.DlsgGroup.setTitle( QCoreApplication.translate( "TaxExportDlg", u"Update file \"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\" (*.dc0)", None)) self.InitialFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Initial file:", None)) #if QT_CONFIG(tooltip) self.DlsgOutFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File where to store russian tax form", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.DlsgInFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File to use as a template for russian tax form", None)) #endif // QT_CONFIG(tooltip) self.OutputFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Output file:", None)) self.DividendsOnly.setText( QCoreApplication.translate( "TaxExportDlg", u"Update only information about dividends", None)) #if QT_CONFIG(tooltip) self.OutputSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.OutputSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u" ... ", None)) #if QT_CONFIG(tooltip) self.InitialSelectBtn.setToolTip( QCoreApplication.translate("TaxExportDlg", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.InitialSelectBtn.setText( QCoreApplication.translate("TaxExportDlg", u" ... ", None)) self.IncomeSourceBroker.setText( QCoreApplication.translate("TaxExportDlg", u"Use broker name as income source", None)) self.Year.setSuffix("") #if QT_CONFIG(tooltip) self.XlsFileName.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"File where to store tax report in Excel format", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.AccountWidget.setToolTip( QCoreApplication.translate( "TaxExportDlg", u"Foreign account to prepare tax report for", None)) #endif // QT_CONFIG(tooltip) self.YearLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Year:", None)) self.AccountLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Account:", None)) self.XlsFileLbl.setText( QCoreApplication.translate("TaxExportDlg", u"Excel file:", None)) self.NoSettlement.setText( QCoreApplication.translate( "TaxExportDlg", u"Do not use settlement date for currency rates", None))
class Ui_Form(object): def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(600, 500) Form.setStyleSheet(u"QWidget#Form{\n" " background-color: rgb(225, 243, 254);\n" "}") self.verticalLayout_2 = QVBoxLayout(Form) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setSpacing(6) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.lineEdit_headers_path = HeaderFileQLineEdit(Form) self.lineEdit_headers_path.setObjectName(u"lineEdit_headers_path") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_headers_path.sizePolicy().hasHeightForWidth()) self.lineEdit_headers_path.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_headers_path) self.pushButton_select = QPushButton(Form) self.pushButton_select.setObjectName(u"pushButton_select") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.pushButton_select.sizePolicy().hasHeightForWidth()) self.pushButton_select.setSizePolicy(sizePolicy1) self.pushButton_select.setMaximumSize(QSize(16777215, 40)) self.horizontalLayout_2.addWidget(self.pushButton_select) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName(u"horizontalLayout") self.textEdit_headers_content = HeadersQTextEdit(Form) self.textEdit_headers_content.setObjectName( u"textEdit_headers_content") self.horizontalLayout.addWidget(self.textEdit_headers_content) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(u"verticalLayout") self.pushButton_save = QPushButton(Form) self.pushButton_save.setObjectName(u"pushButton_save") sizePolicy1.setHeightForWidth( self.pushButton_save.sizePolicy().hasHeightForWidth()) self.pushButton_save.setSizePolicy(sizePolicy1) self.pushButton_save.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_save) self.pushButton_add = QPushButton(Form) self.pushButton_add.setObjectName(u"pushButton_add") sizePolicy1.setHeightForWidth( self.pushButton_add.sizePolicy().hasHeightForWidth()) self.pushButton_add.setSizePolicy(sizePolicy1) self.pushButton_add.setMaximumSize(QSize(16777215, 40)) self.verticalLayout.addWidget(self.pushButton_add) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2.addLayout(self.horizontalLayout) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.listWidget_headers_key = QListWidget(Form) self.listWidget_headers_key.setObjectName(u"listWidget_headers_key") self.horizontalLayout_3.addWidget(self.listWidget_headers_key) self.listWidget_headers_value = QListWidget(Form) self.listWidget_headers_value.setObjectName( u"listWidget_headers_value") self.horizontalLayout_3.addWidget(self.listWidget_headers_value) self.horizontalLayout_3.setStretch(0, 1) self.horizontalLayout_3.setStretch(1, 4) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.verticalLayout_2.setStretch(0, 1) self.verticalLayout_2.setStretch(1, 3) self.verticalLayout_2.setStretch(2, 6) self.retranslateUi(Form) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, Form): Form.setWindowTitle( QCoreApplication.translate("Form", u"headers editor", None)) self.lineEdit_headers_path.setPlaceholderText( QCoreApplication.translate("Form", u"headers.json", None)) #if QT_CONFIG(tooltip) self.pushButton_select.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>load headers.json file</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_select.setText( QCoreApplication.translate("Form", u"select", None)) #if QT_CONFIG(tooltip) self.pushButton_save.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>save to headers.json</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_save.setText( QCoreApplication.translate("Form", u"save", None)) #if QT_CONFIG(tooltip) self.pushButton_add.setToolTip( QCoreApplication.translate( "Form", u"<html><head/><body><p>add a group of header key-value</p></body></html>", None)) #endif // QT_CONFIG(tooltip) self.pushButton_add.setText( QCoreApplication.translate("Form", u"add", None))
class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(580, 501) icon = QIcon() icon.addFile(u":/openshot.svg", QSize(), QIcon.Normal, QIcon.Off) Dialog.setWindowIcon(icon) Dialog.setLocale(QLocale(QLocale.English, QLocale.UnitedStates)) self.horizontalLayout = QHBoxLayout(Dialog) self.horizontalLayout.setObjectName(u"horizontalLayout") self.vbox_parent = QVBoxLayout() self.vbox_parent.setObjectName(u"vbox_parent") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.vboxTreeParent = QVBoxLayout() self.vboxTreeParent.setObjectName(u"vboxTreeParent") self.horizontalLayout_6 = QHBoxLayout() self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.btnMoveUp = QPushButton(Dialog) self.btnMoveUp.setObjectName(u"btnMoveUp") icon1 = QIcon() iconThemeName = u"go-up" if QIcon.hasThemeIcon(iconThemeName): icon1 = QIcon.fromTheme(iconThemeName) else: icon1.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnMoveUp.setIcon(icon1) self.horizontalLayout_6.addWidget(self.btnMoveUp) self.btnMoveDown = QPushButton(Dialog) self.btnMoveDown.setObjectName(u"btnMoveDown") icon2 = QIcon() iconThemeName = u"go-down" if QIcon.hasThemeIcon(iconThemeName): icon2 = QIcon.fromTheme(iconThemeName) else: icon2.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnMoveDown.setIcon(icon2) self.horizontalLayout_6.addWidget(self.btnMoveDown) self.btnShuffle = QPushButton(Dialog) self.btnShuffle.setObjectName(u"btnShuffle") icon3 = QIcon() iconThemeName = u"view-refresh" if QIcon.hasThemeIcon(iconThemeName): icon3 = QIcon.fromTheme(iconThemeName) else: icon3.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnShuffle.setIcon(icon3) self.horizontalLayout_6.addWidget(self.btnShuffle) self.btnRemove = QPushButton(Dialog) self.btnRemove.setObjectName(u"btnRemove") icon4 = QIcon() iconThemeName = u"list-remove" if QIcon.hasThemeIcon(iconThemeName): icon4 = QIcon.fromTheme(iconThemeName) else: icon4.addFile(u"", QSize(), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon4) self.horizontalLayout_6.addWidget(self.btnRemove) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_6.addItem(self.horizontalSpacer) self.vboxTreeParent.addLayout(self.horizontalLayout_6) self.horizontalLayout_2.addLayout(self.vboxTreeParent) self.vbox_properties = QVBoxLayout() self.vbox_properties.setObjectName(u"vbox_properties") self.lblTimelineLocation = QLabel(Dialog) self.lblTimelineLocation.setObjectName(u"lblTimelineLocation") self.lblTimelineLocation.setStyleSheet(u"font-weight: bold") self.lblTimelineLocation.setMargin(0) self.vbox_properties.addWidget(self.lblTimelineLocation) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.lblStartTime = QLabel(Dialog) self.lblStartTime.setObjectName(u"lblStartTime") self.lblStartTime.setMinimumSize(QSize(100, 0)) self.lblStartTime.setStyleSheet(u"") self.horizontalLayout_4.addWidget(self.lblStartTime) self.txtStartTime = QDoubleSpinBox(Dialog) self.txtStartTime.setObjectName(u"txtStartTime") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.txtStartTime.sizePolicy().hasHeightForWidth()) self.txtStartTime.setSizePolicy(sizePolicy) self.txtStartTime.setMinimumSize(QSize(150, 0)) self.txtStartTime.setMaximum(999999999.000000000000000) self.horizontalLayout_4.addWidget(self.txtStartTime) self.vbox_properties.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.lblTrack = QLabel(Dialog) self.lblTrack.setObjectName(u"lblTrack") self.lblTrack.setMinimumSize(QSize(100, 0)) self.lblTrack.setStyleSheet(u"") self.horizontalLayout_3.addWidget(self.lblTrack) self.cmbTrack = QComboBox(Dialog) self.cmbTrack.setObjectName(u"cmbTrack") self.cmbTrack.setMinimumSize(QSize(150, 0)) self.horizontalLayout_3.addWidget(self.cmbTrack) self.vbox_properties.addLayout(self.horizontalLayout_3) self.horizontalLayout_11 = QHBoxLayout() self.horizontalLayout_11.setObjectName(u"horizontalLayout_11") self.horizontalLayout_11.setContentsMargins(-1, 0, -1, -1) self.label_3 = QLabel(Dialog) self.label_3.setObjectName(u"label_3") self.label_3.setMinimumSize(QSize(100, 0)) self.horizontalLayout_11.addWidget(self.label_3) self.txtImageLength = QDoubleSpinBox(Dialog) self.txtImageLength.setObjectName(u"txtImageLength") sizePolicy.setHeightForWidth( self.txtImageLength.sizePolicy().hasHeightForWidth()) self.txtImageLength.setSizePolicy(sizePolicy) self.txtImageLength.setMinimumSize(QSize(150, 0)) self.txtImageLength.setMaximum(999999999.000000000000000) self.horizontalLayout_11.addWidget(self.txtImageLength) self.vbox_properties.addLayout(self.horizontalLayout_11) self.lblFade = QLabel(Dialog) self.lblFade.setObjectName(u"lblFade") self.lblFade.setStyleSheet(u"font-weight: bold; margin-top: 15px;") self.lblFade.setMargin(0) self.vbox_properties.addWidget(self.lblFade) self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.lblFade1 = QLabel(Dialog) self.lblFade1.setObjectName(u"lblFade1") self.lblFade1.setStyleSheet(u"") self.horizontalLayout_5.addWidget(self.lblFade1) self.cmbFade = QComboBox(Dialog) self.cmbFade.setObjectName(u"cmbFade") self.cmbFade.setMinimumSize(QSize(150, 0)) self.horizontalLayout_5.addWidget(self.cmbFade) self.vbox_properties.addLayout(self.horizontalLayout_5) self.horizontalLayout_8 = QHBoxLayout() self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.lblFadeLength = QLabel(Dialog) self.lblFadeLength.setObjectName(u"lblFadeLength") self.lblFadeLength.setStyleSheet(u"") self.horizontalLayout_8.addWidget(self.lblFadeLength) self.txtFadeLength = QDoubleSpinBox(Dialog) self.txtFadeLength.setObjectName(u"txtFadeLength") self.txtFadeLength.setMinimumSize(QSize(150, 0)) self.txtFadeLength.setMaximum(999999999.000000000000000) self.txtFadeLength.setValue(2.000000000000000) self.horizontalLayout_8.addWidget(self.txtFadeLength) self.vbox_properties.addLayout(self.horizontalLayout_8) self.label = QLabel(Dialog) self.label.setObjectName(u"label") self.label.setStyleSheet(u"font-weight: bold; margin-top: 15px;") self.vbox_properties.addWidget(self.label) self.horizontalLayout_7 = QHBoxLayout() self.horizontalLayout_7.setObjectName(u"horizontalLayout_7") self.horizontalLayout_7.setContentsMargins(-1, 0, -1, -1) self.label_2 = QLabel(Dialog) self.label_2.setObjectName(u"label_2") self.horizontalLayout_7.addWidget(self.label_2) self.cmbZoom = QComboBox(Dialog) self.cmbZoom.setObjectName(u"cmbZoom") self.cmbZoom.setMinimumSize(QSize(150, 0)) self.horizontalLayout_7.addWidget(self.cmbZoom) self.vbox_properties.addLayout(self.horizontalLayout_7) self.lblTransition = QLabel(Dialog) self.lblTransition.setObjectName(u"lblTransition") self.lblTransition.setStyleSheet( u"font-weight: bold; margin-top: 15px;") self.lblTransition.setMargin(0) self.vbox_properties.addWidget(self.lblTransition) self.horizontalLayout_9 = QHBoxLayout() self.horizontalLayout_9.setObjectName(u"horizontalLayout_9") self.lblTransition1 = QLabel(Dialog) self.lblTransition1.setObjectName(u"lblTransition1") self.lblTransition1.setStyleSheet(u"") self.horizontalLayout_9.addWidget(self.lblTransition1) self.cmbTransition = QComboBox(Dialog) self.cmbTransition.setObjectName(u"cmbTransition") self.cmbTransition.setMinimumSize(QSize(150, 0)) self.cmbTransition.setMaximumSize(QSize(150, 16777215)) self.horizontalLayout_9.addWidget(self.cmbTransition) self.vbox_properties.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QHBoxLayout() self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.lblTransitionLength = QLabel(Dialog) self.lblTransitionLength.setObjectName(u"lblTransitionLength") self.lblTransitionLength.setStyleSheet(u"") self.horizontalLayout_10.addWidget(self.lblTransitionLength) self.txtTransitionLength = QDoubleSpinBox(Dialog) self.txtTransitionLength.setObjectName(u"txtTransitionLength") self.txtTransitionLength.setMinimumSize(QSize(150, 0)) self.txtTransitionLength.setMaximum(999999999.000000000000000) self.txtTransitionLength.setValue(2.000000000000000) self.horizontalLayout_10.addWidget(self.txtTransitionLength) self.vbox_properties.addLayout(self.horizontalLayout_10) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.vbox_properties.addItem(self.verticalSpacer) self.horizontalLayout_2.addLayout(self.vbox_properties) self.verticalLayout.addLayout(self.horizontalLayout_2) self.vbox_parent.addLayout(self.verticalLayout) self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(-1, 0, -1, -1) self.lblTotalLength = QLabel(Dialog) self.lblTotalLength.setObjectName(u"lblTotalLength") sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.lblTotalLength.sizePolicy().hasHeightForWidth()) self.lblTotalLength.setSizePolicy(sizePolicy1) self.lblTotalLength.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.horizontalLayout_12.addWidget(self.lblTotalLength) self.lblTotalLengthValue = QLabel(Dialog) self.lblTotalLengthValue.setObjectName(u"lblTotalLengthValue") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.lblTotalLengthValue.sizePolicy().hasHeightForWidth()) self.lblTotalLengthValue.setSizePolicy(sizePolicy2) self.lblTotalLengthValue.setMinimumSize(QSize(75, 0)) self.lblTotalLengthValue.setStyleSheet(u"font-weight:bold;") self.lblTotalLengthValue.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.horizontalLayout_12.addWidget(self.lblTotalLengthValue) self.vbox_parent.addLayout(self.horizontalLayout_12) self.btnBox = QDialogButtonBox(Dialog) self.btnBox.setObjectName(u"btnBox") self.btnBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.btnBox.setCenterButtons(False) self.vbox_parent.addWidget(self.btnBox) self.horizontalLayout.addLayout(self.vbox_parent) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Add To Timeline", None)) #if QT_CONFIG(tooltip) self.btnMoveUp.setToolTip( QCoreApplication.translate("Dialog", u"Move Up", None)) #endif // QT_CONFIG(tooltip) self.btnMoveUp.setText("") #if QT_CONFIG(tooltip) self.btnMoveDown.setToolTip( QCoreApplication.translate("Dialog", u"Move Down", None)) #endif // QT_CONFIG(tooltip) self.btnMoveDown.setText("") #if QT_CONFIG(tooltip) self.btnShuffle.setToolTip( QCoreApplication.translate("Dialog", u"Shuffle", None)) #endif // QT_CONFIG(tooltip) self.btnShuffle.setText("") #if QT_CONFIG(tooltip) self.btnRemove.setToolTip( QCoreApplication.translate("Dialog", u"Remove", None)) #endif // QT_CONFIG(tooltip) self.btnRemove.setText("") self.lblTimelineLocation.setText( QCoreApplication.translate("Dialog", u"Timeline Location", None)) self.lblStartTime.setText( QCoreApplication.translate("Dialog", u"Start Time (seconds):", None)) self.lblTrack.setText( QCoreApplication.translate("Dialog", u"Track:", None)) self.label_3.setText( QCoreApplication.translate("Dialog", u"Image Length (seconds):", None)) self.lblFade.setText( QCoreApplication.translate("Dialog", u"Fade", None)) self.lblFade1.setText( QCoreApplication.translate("Dialog", u"Fade:", None)) self.lblFadeLength.setText( QCoreApplication.translate("Dialog", u"Length (seconds):", None)) self.label.setText(QCoreApplication.translate("Dialog", u"Zoom", None)) self.label_2.setText( QCoreApplication.translate("Dialog", u"Zoom:", None)) self.lblTransition.setText( QCoreApplication.translate("Dialog", u"Transition", None)) self.lblTransition1.setText( QCoreApplication.translate("Dialog", u"Transition:", None)) self.lblTransitionLength.setText( QCoreApplication.translate("Dialog", u"Length:", None)) self.lblTotalLength.setText( QCoreApplication.translate("Dialog", u"Total Length (seconds):", None)) self.lblTotalLengthValue.setText( QCoreApplication.translate("Dialog", u"0.0", None))
class AbstractOperationDetails(QWidget): dbUpdated = Signal() def __init__(self, parent=None): QWidget.__init__(self, parent) self.model = None self.table_name = '' self.mapper = None self.modified = False self.name = "N/A" self.operation_type = None self.layout = QGridLayout(self) self.layout.setContentsMargins(2, 2, 2, 2) self.bold_font = QFont() self.bold_font.setBold(True) self.main_label = QLabel(self) self.main_label.setFont(self.bold_font) self.layout.addWidget(self.main_label, 0, 0, 1, 1, Qt.AlignLeft) self.commit_button = QPushButton(load_icon("accept.png"), '', self) self.commit_button.setToolTip(self.tr("Commit changes")) self.commit_button.setEnabled(False) self.revert_button = QPushButton(load_icon("cancel.png"), '', self) self.revert_button.setToolTip(self.tr("Cancel changes")) self.revert_button.setEnabled(False) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) def _init_db(self, table_name): self.table_name = table_name self.model = QSqlTableModel(parent=self, db=db_connection()) self.model.setTable(table_name) self.model.setEditStrategy(QSqlTableModel.OnManualSubmit) self.mapper = QDataWidgetMapper(self.model) self.mapper.setModel(self.model) self.mapper.setSubmitPolicy(QDataWidgetMapper.AutoSubmit) self.model.dataChanged.connect(self.onDataChange) self.commit_button.clicked.connect(self.saveChanges) self.revert_button.clicked.connect(self.revertChanges) def isCustom(self): return True def setId(self, id): self.model.setFilter(f"id={id}") self.mapper.setCurrentModelIndex(self.model.index(0, 0)) @Slot() def onDataChange(self, _index_start, _index_stop, _role): self.modified = True self.commit_button.setEnabled(True) self.revert_button.setEnabled(True) @Slot() def saveChanges(self): if not self.model.submitAll(): logging.fatal( self.tr("Operation submit failed: ") + self.model.lastError().text()) return False self.modified = False self.commit_button.setEnabled(False) self.revert_button.setEnabled(False) self.dbUpdated.emit() @Slot() def revertChanges(self): self.model.revertAll() self.modified = False self.commit_button.setEnabled(False) self.revert_button.setEnabled(False) def createNew(self, account_id=0): if self.modified: self.revertChanges() logging.warning( self.tr( "Unsaved changes were reverted to create new operation")) self.model.setFilter(f"{self.table_name}.id = 0") new_record = self.prepareNew(account_id) assert self.model.insertRows(0, 1) self.model.setRecord(0, new_record) self.mapper.toLast() def prepareNew(self, account_id): new_record = self.model.record() new_record.setNull("id") new_record.setValue("op_type", self.operation_type) return new_record def copyNew(self): row = self.mapper.currentIndex() new_record = self.copyToNew(row) self.model.setFilter(f"{self.table_name}.id = 0") assert self.model.insertRows(0, 1) self.model.setRecord(0, new_record) self.mapper.toLast() def copyToNew(self, row): new_record = self.model.record(row) return new_record
class VideoFinderAddLink(AddLinkWindow): running_thread = None threadPool = {} def __init__(self, parent, receiver_slot, settings, video_dict={}): super().__init__(parent, receiver_slot, settings, video_dict) self.setWindowTitle( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video Finder')) self.size_label.hide() # empty lists for no_audio and no_video and video_audio files self.no_audio_list = [] self.no_video_list = [] self.video_audio_list = [] self.media_title = '' # 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) # extension_label self.extension_label = QLabel(self.link_frame) self.change_name_horizontalLayout.addWidget(self.extension_label) # Fetch Button self.url_submit_pushButtontton = QPushButton(self.link_frame) self.link_horizontalLayout.addWidget(self.url_submit_pushButtontton) # Status Box self.status_box_textEdit = QTextEdit(self.link_frame) self.status_box_textEdit.setMaximumHeight(150) self.link_verticalLayout.addWidget(self.status_box_textEdit) # Select format horizontal layout select_format_horizontalLayout = QHBoxLayout() # Selection Label self.select_format_label = QLabel(self.link_frame) select_format_horizontalLayout.addWidget(self.select_format_label) # Selection combobox self.media_comboBox = QComboBox(self.link_frame) self.media_comboBox.setMinimumWidth(200) select_format_horizontalLayout.addWidget(self.media_comboBox) # Duration label self.duration_label = QLabel(self.link_frame) select_format_horizontalLayout.addWidget(self.duration_label) self.format_selection_frame = QFrame(self) self.format_selection_frame.setLayout(select_format_horizontalLayout) self.link_verticalLayout.addWidget(self.format_selection_frame) # advanced_format_selection_checkBox self.advanced_format_selection_checkBox = QCheckBox(self) self.link_verticalLayout.addWidget( self.advanced_format_selection_checkBox) # advanced_format_selection_frame self.advanced_format_selection_frame = QFrame(self) self.link_verticalLayout.addWidget( self.advanced_format_selection_frame) advanced_format_selection_horizontalLayout = QHBoxLayout( self.advanced_format_selection_frame) # video_format_selection self.video_format_selection_label = QLabel( self.advanced_format_selection_frame) self.video_format_selection_comboBox = QComboBox( self.advanced_format_selection_frame) # audio_format_selection self.audio_format_selection_label = QLabel( self.advanced_format_selection_frame) self.audio_format_selection_comboBox = QComboBox( self.advanced_format_selection_frame) for widget in [ self.video_format_selection_label, self.video_format_selection_comboBox, self.audio_format_selection_label, self.audio_format_selection_comboBox ]: advanced_format_selection_horizontalLayout.addWidget(widget) # Set Texts self.url_submit_pushButtontton.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Fetch Media List')) self.select_format_label.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Select a format')) self.video_format_selection_label.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video format:')) self.audio_format_selection_label.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Audio format:')) self.advanced_format_selection_checkBox.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Advanced options')) # Add Slot Connections self.url_submit_pushButtontton.setEnabled(False) self.change_name_lineEdit.setEnabled(False) self.ok_pushButton.setEnabled(False) self.download_later_pushButton.setEnabled(False) self.format_selection_frame.setEnabled(True) self.advanced_format_selection_frame.setEnabled(False) self.advanced_format_selection_checkBox.toggled.connect( self.advancedFormatFrame) self.url_submit_pushButtontton.clicked.connect(self.submitClicked) self.media_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'video_audio')) self.video_format_selection_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'video')) self.audio_format_selection_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'audio')) self.link_lineEdit.textChanged.disconnect( super().linkLineChanged) # Should be disconnected. self.link_lineEdit.textChanged.connect(self.linkLineChangedHere) self.setMinimumSize(650, 480) self.status_box_textEdit.hide() self.format_selection_frame.hide() self.advanced_format_selection_frame.hide() self.advanced_format_selection_checkBox.hide() if 'link' in video_dict.keys() and video_dict['link']: self.link_lineEdit.setText(video_dict['link']) self.url_submit_pushButtontton.setEnabled(True) else: # check clipboard clipboard = QApplication.clipboard() text = clipboard.text() if (("tp:/" in text[2:6]) or ("tps:/" in text[2:7])): self.link_lineEdit.setText(str(text)) self.url_submit_pushButtontton.setEnabled(True) def advancedFormatFrame(self, button): if self.advanced_format_selection_checkBox.isChecked(): self.advanced_format_selection_frame.setEnabled(True) self.format_selection_frame.setEnabled(False) self.mediaSelectionChanged( 'video', int(self.video_format_selection_comboBox.currentIndex())) else: self.advanced_format_selection_frame.setEnabled(False) self.format_selection_frame.setEnabled(True) self.mediaSelectionChanged('video_audio', int(self.media_comboBox.currentIndex())) def getReadableSize(self, size): try: return '{:1.2f} MB'.format(int(size) / 1048576) except: return str(size) def getReadableDuration(self, seconds): try: seconds = int(seconds) hours = seconds // 3600 seconds = seconds % 3600 minutes = seconds // 60 seconds = seconds % 60 return '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds) except: return str(seconds) # Define native slots def urlChanged(self, value): if ' ' in value or value == '': self.url_submit_pushButtontton.setEnabled(False) self.url_submit_pushButtontton.setToolTip( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Please enter a valid video link')) else: self.url_submit_pushButtontton.setEnabled(True) self.url_submit_pushButtontton.setToolTip('') def submitClicked(self, button=None): # Clear media list self.media_comboBox.clear() self.format_selection_frame.hide() self.advanced_format_selection_checkBox.hide() self.advanced_format_selection_frame.hide() self.video_format_selection_comboBox.clear() self.audio_format_selection_comboBox.clear() self.change_name_lineEdit.clear() self.threadPool.clear() self.change_name_checkBox.setChecked(False) self.video_audio_list.clear() self.no_video_list.clear() self.no_audio_list.clear() self.url_submit_pushButtontton.setEnabled(False) self.status_box_textEdit.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Fetching Media Info...')) self.status_box_textEdit.show() self.ok_pushButton.setEnabled(False) self.download_later_pushButton.setEnabled(False) dictionary_to_send = deepcopy(self.plugin_add_link_dictionary) # More options more_options = self.collectMoreOptions() for k in more_options.keys(): dictionary_to_send[k] = more_options[k] dictionary_to_send['link'] = self.link_lineEdit.text() fetcher_thread = MediaListFetcherThread(self.fetchedResult, dictionary_to_send, self) self.parent.threadPool.append(fetcher_thread) self.parent.threadPool[len(self.parent.threadPool) - 1].start() def fileNameChanged(self, value): if value.strip() == '': self.ok_pushButton.setEnabled(False) def mediaSelectionChanged(self, combobox, index): try: if combobox == 'video_audio': if self.media_comboBox.currentText() == 'Best quality': self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_audio_list[-1]['ext']) else: self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText( '.' + self.video_audio_list[index]['ext']) self.change_name_checkBox.setChecked(True) elif combobox == 'video': if self.video_format_selection_comboBox.currentText( ) != 'No video': self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_audio_list[index - 1]['ext']) self.change_name_checkBox.setChecked(True) else: if self.audio_format_selection_comboBox.currentText( ) != 'No audio': self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_video_list[ int(self.audio_format_selection_comboBox. currentIndex()) - 1]['ext']) self.change_name_checkBox.setChecked(True) else: self.change_name_lineEdit.setChecked(False) elif combobox == 'audio': if self.audio_format_selection_comboBox.currentText( ) != 'No audio' and self.video_format_selection_comboBox.currentText( ) == 'No video': self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_video_list[index - 1]['ext']) self.change_name_checkBox.setChecked(True) elif (self.audio_format_selection_comboBox.currentText() == 'No audio' and self.video_format_selection_comboBox.currentText() != 'No video') or ( self.audio_format_selection_comboBox.currentText() != 'No audio' and self.video_format_selection_comboBox.currentText() != 'No video'): self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_audio_list[ int(self.video_format_selection_comboBox.currentIndex( )) - 1]['ext']) self.change_name_checkBox.setChecked(True) elif self.audio_format_selection_comboBox.currentText( ) == 'No audio' and self.video_format_selection_comboBox.currentText( ) == 'No video': self.change_name_checkBox.setChecked(False) except Exception as ex: logger.sendToLog(ex, "ERROR") def fetchedResult(self, media_dict): self.url_submit_pushButtontton.setEnabled(True) if 'error' in media_dict.keys(): self.status_box_textEdit.setText('<font color="#f11">' + str(media_dict['error']) + '</font>') self.status_box_textEdit.show() else: # Show the media list # add no audio and no video options to the comboboxes self.video_format_selection_comboBox.addItem('No video') self.audio_format_selection_comboBox.addItem('No audio') self.media_title = media_dict['title'] if 'formats' not in media_dict.keys( ) and 'entries' in media_dict.keys(): formats = media_dict['entries'] formats = formats[0] media_dict['formats'] = formats['formats'] elif 'formats' not in media_dict.keys( ) and 'format' in media_dict.keys(): media_dict['formats'] = [media_dict.copy()] try: i = 0 for f in media_dict['formats']: no_audio = False no_video = False text = '' if 'acodec' in f.keys(): # only video, no audio if f['acodec'] == 'none': no_audio = True # resolution if 'height' in f.keys(): text = text + ' ' + '{}p'.format(f['height']) if 'vcodec' in f.keys(): # if f['vcodec'] == 'none' and f['acodec'] != 'none': # continue # No video, show audio bit rate if f['vcodec'] == 'none': text = text + '{}kbps'.format(f['abr']) no_video = True if 'ext' in f.keys(): text = text + ' ' + '.{}'.format(f['ext']) if 'filesize' in f.keys() and f['filesize']: # Youtube api does not supply file size for some formats, so check it. text = text + ' ' + '{}'.format( self.getReadableSize(f['filesize'])) else: # Start spider to find file size input_dict = deepcopy(self.plugin_add_link_dictionary) input_dict['link'] = f['url'] more_options = self.collectMoreOptions() for key in more_options.keys(): input_dict[key] = more_options[key] size_fetcher = FileSizeFetcherThread(input_dict, i) self.threadPool[str(i)] = { 'thread': size_fetcher, 'item_id': i } self.parent.threadPool.append(size_fetcher) self.parent.threadPool[len(self.parent.threadPool) - 1].start() self.parent.threadPool[len(self.parent.threadPool) - 1].FOUND.connect( self.findFileSize) # Add current format to the related comboboxes if no_audio: self.no_audio_list.append(f) self.video_format_selection_comboBox.addItem(text) elif no_video: self.no_video_list.append(f) self.audio_format_selection_comboBox.addItem(text) else: self.video_audio_list.append(f) self.media_comboBox.addItem(text) i = i + 1 self.status_box_textEdit.hide() if 'duration' in media_dict.keys(): self.duration_label.setText( 'Duration ' + self.getReadableDuration(media_dict['duration'])) self.format_selection_frame.show() self.advanced_format_selection_checkBox.show() self.advanced_format_selection_frame.show() self.ok_pushButton.setEnabled(True) self.download_later_pushButton.setEnabled(True) # if we have no options for separate audio and video, then hide advanced_format_selection... if len(self.no_audio_list) == 0 and len( self.no_video_list) == 0: self.advanced_format_selection_checkBox.hide() self.advanced_format_selection_frame.hide() # set index of comboboxes on best available quality. # we have both audio and video if len(self.no_audio_list) != 0 and len( self.no_video_list) != 0: self.media_comboBox.addItem('Best quality') self.media_comboBox.setCurrentIndex( len(self.video_audio_list)) self.change_name_lineEdit.setText(self.media_title) self.extension_label.setText('.' + self.no_audio_list[-1]['ext']) self.change_name_checkBox.setChecked(True) # video and audio are not separate elif len(self.video_audio_list) != 0: self.media_comboBox.setCurrentIndex( len(self.video_audio_list) - 1) if len(self.no_audio_list) != 0: self.video_format_selection_comboBox.setCurrentIndex( len(self.no_audio_list)) if len(self.no_video_list) != 0: self.audio_format_selection_comboBox.setCurrentIndex( len(self.no_video_list)) # if we have only audio or we have only video then hide media_comboBox if len(self.video_audio_list) == 0: self.media_comboBox.hide() self.select_format_label.hide() # only video if len(self.no_video_list) != 0 and len( self.no_audio_list) == 0: self.mediaSelectionChanged( 'video', int(self.video_format_selection_comboBox. currentIndex())) self.advanced_format_selection_checkBox.setChecked( True) self.advanced_format_selection_checkBox.hide() # only audio elif len(self.no_video_list) == 0 and len( self.no_audio_list) != 0: self.mediaSelectionChanged( 'audio', int(self.audio_format_selection_comboBox. currentIndex())) self.advanced_format_selection_checkBox.setChecked( True) self.advanced_format_selection_checkBox.hide() # audio and video else: self.mediaSelectionChanged( 'video_audio', int(self.media_comboBox.currentIndex())) except Exception as ex: logger.sendToLog(ex, "ERROR") def findFileSize(self, result): try: item_id = self.threadPool[str(result['thread_key'])]['item_id'] if result['file_size'] and result['file_size'] != '0': text = self.media_comboBox.itemText(item_id) self.media_comboBox.setItemText( item_id, '{} - {}'.format(text, result['file_size'])) except Exception as ex: logger.sendToLog(ex, "ERROR") def linkLineChangedHere(self, lineEdit): if str(lineEdit) == '': self.url_submit_pushButtontton.setEnabled(False) else: self.url_submit_pushButtontton.setEnabled(True) # This method collects additional information like proxy ip, user, password etc. def collectMoreOptions(self): options = { 'ip': None, 'port': None, 'proxy_user': None, 'proxy_passwd': None, 'download_user': None, 'download_passwd': None } if self.proxy_checkBox.isChecked(): options['ip'] = self.ip_lineEdit.text() options['port'] = self.port_spinBox.value() options['proxy_user'] = self.proxy_user_lineEdit.text() options['proxy_passwd'] = self.proxy_pass_lineEdit.text() if self.download_checkBox.isChecked(): options['download_user'] = self.download_user_lineEdit.text() options['download_passwd'] = self.download_pass_lineEdit.text() # These info (keys) are required for spider to find file size, because spider() does not check if key exists. additional_info = [ 'header', 'load_cookies', 'user_agent', 'referer', 'out' ] for i in additional_info: if i not in self.plugin_add_link_dictionary.keys(): options[i] = None return options # user submitted information by pressing ok_pushButton, so get information # from VideoFinderAddLink window and return them to the mainwindow with callback! def okButtonPressed(self, download_later, button=None): link_list = [] # separate audio format and video format is selected. if self.advanced_format_selection_checkBox.isChecked(): if self.video_format_selection_comboBox.currentText( ) == 'No video' and self.audio_format_selection_comboBox.currentText( ) != 'No audio': # only audio link must be added to the link_list audio_link = self.no_video_list[ self.audio_format_selection_comboBox.currentIndex() - 1]['url'] link_list.append(audio_link) elif self.video_format_selection_comboBox.currentText( ) != 'No video' and self.audio_format_selection_comboBox.currentText( ) == 'No audio': # only video link must be added to the link_list video_link = self.no_audio_list[ self.video_format_selection_comboBox.currentIndex() - 1]['url'] link_list.append(video_link) elif self.video_format_selection_comboBox.currentText( ) != 'No video' and self.audio_format_selection_comboBox.currentText( ) != 'No audio': # video and audio links must be added to the link_list audio_link = self.no_video_list[ self.audio_format_selection_comboBox.currentIndex() - 1]['url'] video_link = self.no_audio_list[ self.video_format_selection_comboBox.currentIndex() - 1]['url'] link_list = [video_link, audio_link] elif self.video_format_selection_comboBox.currentText( ) == 'No video' and self.audio_format_selection_comboBox.currentText( ) == 'No audio': # no video and audio is selected! REALLY?!. user is DRUNK! close the window! :)) self.close() else: if self.media_comboBox.currentText() == 'Best quality': # the last item in no_video_list and no_audio_list are the best. video_link = self.no_audio_list[-1]['url'] audio_link = self.no_video_list[-1]['url'] link_list = [video_link, audio_link] else: audio_and_video_link = self.video_audio_list[ self.media_comboBox.currentIndex()]['url'] link_list.append(audio_and_video_link) # write user's new inputs in persepolis_setting for next time :) self.persepolis_setting.setValue('add_link_initialization/ip', self.ip_lineEdit.text()) self.persepolis_setting.setValue('add_link_initialization/port', self.port_spinBox.value()) self.persepolis_setting.setValue('add_link_initialization/proxy_user', self.proxy_user_lineEdit.text()) self.persepolis_setting.setValue( 'add_link_initialization/download_user', self.download_user_lineEdit.text()) # get proxy information if not (self.proxy_checkBox.isChecked()): ip = None port = None proxy_user = None proxy_passwd = None else: ip = self.ip_lineEdit.text() if not (ip): ip = None port = self.port_spinBox.value() if not (port): port = None proxy_user = self.proxy_user_lineEdit.text() if not (proxy_user): proxy_user = None proxy_passwd = self.proxy_pass_lineEdit.text() if not (proxy_passwd): proxy_passwd = None # get download username and password information if not (self.download_checkBox.isChecked()): download_user = None download_passwd = None else: download_user = self.download_user_lineEdit.text() if not (download_user): download_user = None download_passwd = self.download_pass_lineEdit.text() if not (download_passwd): download_passwd = None # check that if user limits download speed. if not (self.limit_checkBox.isChecked()): limit = 0 else: if self.limit_comboBox.currentText() == "KiB/s": limit = str(self.limit_spinBox.value()) + str("K") else: limit = str(self.limit_spinBox.value()) + str("M") # get start time for download if user set that. if not (self.start_checkBox.isChecked()): start_time = None else: start_time = self.start_time_qDataTimeEdit.text() # get end time for download if user set that. if not (self.end_checkBox.isChecked()): end_time = None else: end_time = self.end_time_qDateTimeEdit.text() # set name for file(s) if self.change_name_checkBox.isChecked(): name = str(self.change_name_lineEdit.text()) if name == '': name = 'video_finder_file' else: name = 'video_finder_file' # video finder always finds extension # but if it can't find file extension # use mp4 for extension. if str(self.extension_label.text()) == '': extension = '.mp4' else: extension = str(self.extension_label.text()) # did user select separate audio and video? if len(link_list) == 2: video_name = name + extension audio_name = name + '.' + \ str(self.no_video_list[self.audio_format_selection_comboBox.currentIndex() - 1]['ext']) name_list = [video_name, audio_name] else: name_list = [name + extension] # get number of connections connections = self.connections_spinBox.value() # get download_path download_path = self.download_folder_lineEdit.text() # referer if self.referer_lineEdit.text() != '': referer = self.referer_lineEdit.text() else: referer = None # header if self.header_lineEdit.text() != '': header = self.header_lineEdit.text() else: header = None # user_agent if self.user_agent_lineEdit.text() != '': user_agent = self.user_agent_lineEdit.text() else: user_agent = None # load_cookies if self.load_cookies_lineEdit.text() != '': load_cookies = self.load_cookies_lineEdit.text() else: load_cookies = None add_link_dictionary_list = [] if len(link_list) == 1: # save information in a dictionary(add_link_dictionary). add_link_dictionary = { 'referer': referer, 'header': header, 'user_agent': user_agent, 'load_cookies': load_cookies, 'out': name_list[0], 'start_time': start_time, 'end_time': end_time, 'link': link_list[0], 'ip': ip, 'port': port, 'proxy_user': proxy_user, 'proxy_passwd': proxy_passwd, 'download_user': download_user, 'download_passwd': download_passwd, 'connections': connections, 'limit_value': limit, 'download_path': download_path } add_link_dictionary_list.append(add_link_dictionary) else: video_add_link_dictionary = { 'referer': referer, 'header': header, 'user_agent': user_agent, 'load_cookies': load_cookies, 'out': name_list[0], 'start_time': start_time, 'end_time': end_time, 'link': link_list[0], 'ip': ip, 'port': port, 'proxy_user': proxy_user, 'proxy_passwd': proxy_passwd, 'download_user': download_user, 'download_passwd': download_passwd, 'connections': connections, 'limit_value': limit, 'download_path': download_path } audio_add_link_dictionary = { 'referer': referer, 'header': header, 'user_agent': user_agent, 'load_cookies': load_cookies, 'out': name_list[1], 'start_time': None, 'end_time': end_time, 'link': link_list[1], 'ip': ip, 'port': port, 'proxy_user': proxy_user, 'proxy_passwd': proxy_passwd, 'download_user': download_user, 'download_passwd': download_passwd, 'connections': connections, 'limit_value': limit, 'download_path': download_path } add_link_dictionary_list = [ video_add_link_dictionary, audio_add_link_dictionary ] # get category of download category = str(self.add_queue_comboBox.currentText()) del self.plugin_add_link_dictionary # return information to mainwindow self.callback(add_link_dictionary_list, download_later, category) # close window self.close()
class Maker(QWidget): def __init__(self, parent=None): super(Maker, self).__init__(parent) self.setWindowTitle("Project Maker") self.userFilepath = QLineEdit() self.userFilepath.setPlaceholderText("Your filepath here...") self.projName = QLineEdit() self.projName.setPlaceholderText("Your project name here...") self.makeButton = QPushButton("Create Project") self.fileSearchButton = QPushButton("...") self.fileSearchButton.setToolTip( "Search for a directory for your project") self.goProj = QRadioButton("Go Project") self.goProj.setToolTip("You will still need a go.mod file") self.pyProj = QRadioButton("Python Project") self.versionControlFiles = QCheckBox( "Create README.md and .gitignore?") self.versionControlFiles.setToolTip( "Creates the files used in online version control, such as Github") self.pyProj.setChecked(True) self.versionControlFiles.setChecked(True) projSelect = QGroupBox("Project Selection") projectOptions = QVBoxLayout() projectOptions.addWidget(self.pyProj) projectOptions.addWidget(self.goProj) projectOptions.addWidget(self.versionControlFiles) projectOptions.stretch(1) projSelect.setLayout(projectOptions) searchLayout = QHBoxLayout() searchLayout.addWidget(self.userFilepath) searchLayout.addWidget(self.fileSearchButton) searchLayout.stretch(1) layout = QVBoxLayout() layout.addLayout(searchLayout) layout.addWidget(self.projName) layout.addWidget(self.makeButton) layout.addWidget(self.fileSearchButton) layout.addWidget(projSelect) self.setLayout(layout) self.makeButton.clicked.connect(self.createFiles) self.fileSearchButton.clicked.connect(self.onClickFileSearch) @Slot() def onClickFileSearch(self): fileSearch = QFileDialog.getExistingDirectory(self, "Select a Directory...", "C:/Users") self.userFilepath.setText(fileSearch) @Slot() def createFiles(self): p = Path(f"{self.userFilepath.text()}/{self.projName.text()}") try: p.mkdir() except FileExistsError as exc: msgbox = QMessageBox() msgbox.setText(f"{exc}") msgbox.exec() else: os.chdir(f"{self.userFilepath.text()}\\{self.projName.text()}") if self.pyProj.isChecked(): fileType = "py" elif self.goProj.isChecked(): fileType = "go" with open(f"{self.projName.text()}.{fileType}", "w") as f: f.write(f"# Created on {date.today()}") if self.versionControlFiles.isChecked(): open("README.md", "a").close() open(".gitignore", "a").close()
class Setting_Ui(QWidget): def __init__(self, persepolis_setting): super().__init__() icon = QIcon() 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) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle( QCoreApplication.translate("setting_ui_tr", 'Preferences')) # 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) global icons icons = ':/' + str( self.persepolis_setting.value('settings/icons')) + '/' # main layout window_verticalLayout = QVBoxLayout(self) # setting_tabWidget self.setting_tabWidget = QTabWidget(self) # download_options_tab self.download_options_tab = QWidget() download_options_tab_verticalLayout = QVBoxLayout( self.download_options_tab) download_options_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # tries tries_horizontalLayout = QHBoxLayout() self.tries_label = QLabel(self.download_options_tab) tries_horizontalLayout.addWidget(self.tries_label) self.tries_spinBox = QSpinBox(self.download_options_tab) self.tries_spinBox.setMinimum(1) tries_horizontalLayout.addWidget(self.tries_spinBox) download_options_tab_verticalLayout.addLayout(tries_horizontalLayout) # wait wait_horizontalLayout = QHBoxLayout() self.wait_label = QLabel(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_label) self.wait_spinBox = QSpinBox(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_spinBox) download_options_tab_verticalLayout.addLayout(wait_horizontalLayout) # time_out time_out_horizontalLayout = QHBoxLayout() self.time_out_label = QLabel(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_label) self.time_out_spinBox = QSpinBox(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_spinBox) download_options_tab_verticalLayout.addLayout( time_out_horizontalLayout) # connections connections_horizontalLayout = QHBoxLayout() self.connections_label = QLabel(self.download_options_tab) connections_horizontalLayout.addWidget(self.connections_label) self.connections_spinBox = QSpinBox(self.download_options_tab) self.connections_spinBox.setMinimum(1) self.connections_spinBox.setMaximum(16) connections_horizontalLayout.addWidget(self.connections_spinBox) download_options_tab_verticalLayout.addLayout( connections_horizontalLayout) # rpc_port self.rpc_port_label = QLabel(self.download_options_tab) self.rpc_horizontalLayout = QHBoxLayout() self.rpc_horizontalLayout.addWidget(self.rpc_port_label) self.rpc_port_spinbox = QSpinBox(self.download_options_tab) self.rpc_port_spinbox.setMinimum(1024) self.rpc_port_spinbox.setMaximum(65535) self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox) download_options_tab_verticalLayout.addLayout( self.rpc_horizontalLayout) # wait_queue wait_queue_horizontalLayout = QHBoxLayout() self.wait_queue_label = QLabel(self.download_options_tab) wait_queue_horizontalLayout.addWidget(self.wait_queue_label) self.wait_queue_time = MyQDateTimeEdit(self.download_options_tab) self.wait_queue_time.setDisplayFormat('H:mm') wait_queue_horizontalLayout.addWidget(self.wait_queue_time) download_options_tab_verticalLayout.addLayout( wait_queue_horizontalLayout) # don't check certificate checkBox self.dont_check_certificate_checkBox = QCheckBox( self.download_options_tab) download_options_tab_verticalLayout.addWidget( self.dont_check_certificate_checkBox) # change aria2 path aria2_path_verticalLayout = QVBoxLayout() self.aria2_path_checkBox = QCheckBox(self.download_options_tab) aria2_path_verticalLayout.addWidget(self.aria2_path_checkBox) aria2_path_horizontalLayout = QHBoxLayout() self.aria2_path_lineEdit = QLineEdit(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_lineEdit) self.aria2_path_pushButton = QPushButton(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_pushButton) aria2_path_verticalLayout.addLayout(aria2_path_horizontalLayout) download_options_tab_verticalLayout.addLayout( aria2_path_verticalLayout) download_options_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.download_options_tab, "") # save_as_tab self.save_as_tab = QWidget() save_as_tab_verticalLayout = QVBoxLayout(self.save_as_tab) save_as_tab_verticalLayout.setContentsMargins(20, 30, 0, 0) # download_folder self.download_folder_horizontalLayout = QHBoxLayout() self.download_folder_label = QLabel(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_label) self.download_folder_lineEdit = QLineEdit(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_lineEdit) self.download_folder_pushButton = QPushButton(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_pushButton) save_as_tab_verticalLayout.addLayout( self.download_folder_horizontalLayout) # temp_download_folder self.temp_horizontalLayout = QHBoxLayout() self.temp_download_label = QLabel(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_label) self.temp_download_lineEdit = QLineEdit(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit) self.temp_download_pushButton = QPushButton(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_pushButton) save_as_tab_verticalLayout.addLayout(self.temp_horizontalLayout) # create subfolder self.subfolder_checkBox = QCheckBox(self.save_as_tab) save_as_tab_verticalLayout.addWidget(self.subfolder_checkBox) save_as_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.save_as_tab, "") # notifications_tab self.notifications_tab = QWidget() notification_tab_verticalLayout = QVBoxLayout(self.notifications_tab) notification_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) self.enable_notifications_checkBox = QCheckBox(self.notifications_tab) notification_tab_verticalLayout.addWidget( self.enable_notifications_checkBox) self.sound_frame = QFrame(self.notifications_tab) self.sound_frame.setFrameShape(QFrame.StyledPanel) self.sound_frame.setFrameShadow(QFrame.Raised) verticalLayout = QVBoxLayout(self.sound_frame) self.volume_label = QLabel(self.sound_frame) verticalLayout.addWidget(self.volume_label) self.volume_dial = QDial(self.sound_frame) self.volume_dial.setProperty("value", 100) verticalLayout.addWidget(self.volume_dial) notification_tab_verticalLayout.addWidget(self.sound_frame) # message_notification message_notification_horizontalLayout = QHBoxLayout() self.notification_label = QLabel(self.notifications_tab) message_notification_horizontalLayout.addWidget( self.notification_label) self.notification_comboBox = QComboBox(self.notifications_tab) message_notification_horizontalLayout.addWidget( self.notification_comboBox) notification_tab_verticalLayout.addLayout( message_notification_horizontalLayout) notification_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.notifications_tab, "") # style_tab self.style_tab = QWidget() style_tab_verticalLayout = QVBoxLayout(self.style_tab) style_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # style style_horizontalLayout = QHBoxLayout() self.style_label = QLabel(self.style_tab) style_horizontalLayout.addWidget(self.style_label) self.style_comboBox = QComboBox(self.style_tab) style_horizontalLayout.addWidget(self.style_comboBox) style_tab_verticalLayout.addLayout(style_horizontalLayout) # language language_horizontalLayout = QHBoxLayout() self.lang_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.lang_label) self.lang_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.lang_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) language_horizontalLayout = QHBoxLayout() self.lang_label.setText( QCoreApplication.translate("setting_ui_tr", "Language: ")) # color scheme self.color_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.color_label) self.color_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.color_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) # icons icons_horizontalLayout = QHBoxLayout() self.icon_label = QLabel(self.style_tab) icons_horizontalLayout.addWidget(self.icon_label) self.icon_comboBox = QComboBox(self.style_tab) icons_horizontalLayout.addWidget(self.icon_comboBox) style_tab_verticalLayout.addLayout(icons_horizontalLayout) self.icons_size_horizontalLayout = QHBoxLayout() self.icons_size_label = QLabel(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_label) self.icons_size_comboBox = QComboBox(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_comboBox) style_tab_verticalLayout.addLayout(self.icons_size_horizontalLayout) # font font_horizontalLayout = QHBoxLayout() self.font_checkBox = QCheckBox(self.style_tab) font_horizontalLayout.addWidget(self.font_checkBox) self.fontComboBox = QFontComboBox(self.style_tab) font_horizontalLayout.addWidget(self.fontComboBox) self.font_size_label = QLabel(self.style_tab) font_horizontalLayout.addWidget(self.font_size_label) self.font_size_spinBox = QSpinBox(self.style_tab) self.font_size_spinBox.setMinimum(1) font_horizontalLayout.addWidget(self.font_size_spinBox) style_tab_verticalLayout.addLayout(font_horizontalLayout) self.setting_tabWidget.addTab(self.style_tab, "") window_verticalLayout.addWidget(self.setting_tabWidget) # start persepolis in system tray if browser executed self.start_persepolis_if_browser_executed_checkBox = QCheckBox( self.style_tab) style_tab_verticalLayout.addWidget( self.start_persepolis_if_browser_executed_checkBox) # hide window if close button clicked self.hide_window_checkBox = QCheckBox(self.style_tab) style_tab_verticalLayout.addWidget(self.hide_window_checkBox) # Enable system tray icon self.enable_system_tray_checkBox = QCheckBox(self.style_tab) style_tab_verticalLayout.addWidget(self.enable_system_tray_checkBox) # after_download dialog self.after_download_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.after_download_checkBox) # show_menubar_checkbox self.show_menubar_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_menubar_checkbox) # show_sidepanel_checkbox self.show_sidepanel_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_sidepanel_checkbox) # hide progress window self.show_progress_window_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_progress_window_checkbox) # add persepolis to startup self.startup_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.startup_checkbox) # keep system awake self.keep_awake_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.keep_awake_checkBox) style_tab_verticalLayout.addStretch(1) # columns_tab self.columns_tab = QWidget() columns_tab_verticalLayout = QVBoxLayout(self.columns_tab) columns_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # creating checkBox for columns self.show_column_label = QLabel() self.column0_checkBox = QCheckBox() self.column1_checkBox = QCheckBox() self.column2_checkBox = QCheckBox() self.column3_checkBox = QCheckBox() self.column4_checkBox = QCheckBox() self.column5_checkBox = QCheckBox() self.column6_checkBox = QCheckBox() self.column7_checkBox = QCheckBox() self.column10_checkBox = QCheckBox() self.column11_checkBox = QCheckBox() self.column12_checkBox = QCheckBox() columns_tab_verticalLayout.addWidget(self.show_column_label) columns_tab_verticalLayout.addWidget(self.column0_checkBox) columns_tab_verticalLayout.addWidget(self.column1_checkBox) columns_tab_verticalLayout.addWidget(self.column2_checkBox) columns_tab_verticalLayout.addWidget(self.column3_checkBox) columns_tab_verticalLayout.addWidget(self.column4_checkBox) columns_tab_verticalLayout.addWidget(self.column5_checkBox) columns_tab_verticalLayout.addWidget(self.column6_checkBox) columns_tab_verticalLayout.addWidget(self.column7_checkBox) columns_tab_verticalLayout.addWidget(self.column10_checkBox) columns_tab_verticalLayout.addWidget(self.column11_checkBox) columns_tab_verticalLayout.addWidget(self.column12_checkBox) columns_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.columns_tab, '') # video_finder_tab self.video_finder_tab = QWidget() video_finder_layout = QVBoxLayout(self.video_finder_tab) video_finder_layout.setContentsMargins(21, 21, 0, 0) video_finder_tab_verticalLayout = QVBoxLayout() max_links_horizontalLayout = QHBoxLayout() # max_links_label self.max_links_label = QLabel(self.video_finder_tab) max_links_horizontalLayout.addWidget(self.max_links_label) # max_links_spinBox self.max_links_spinBox = QSpinBox(self.video_finder_tab) self.max_links_spinBox.setMinimum(1) self.max_links_spinBox.setMaximum(16) max_links_horizontalLayout.addWidget(self.max_links_spinBox) video_finder_tab_verticalLayout.addLayout(max_links_horizontalLayout) self.video_finder_dl_path_horizontalLayout = QHBoxLayout() self.video_finder_frame = QFrame(self.video_finder_tab) self.video_finder_frame.setLayout(video_finder_tab_verticalLayout) video_finder_tab_verticalLayout.addStretch(1) video_finder_layout.addWidget(self.video_finder_frame) self.setting_tabWidget.addTab(self.video_finder_tab, "") # shortcut tab self.shortcut_tab = QWidget() shortcut_tab_verticalLayout = QVBoxLayout(self.shortcut_tab) shortcut_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # shortcut_table self.shortcut_table = QTableWidget(self) self.shortcut_table.setColumnCount(2) self.shortcut_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.shortcut_table.setSelectionMode(QAbstractItemView.SingleSelection) self.shortcut_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.shortcut_table.verticalHeader().hide() shortcut_table_header = [ QCoreApplication.translate("setting_ui_tr", 'Action'), QCoreApplication.translate("setting_ui_tr", 'Shortcut') ] self.shortcut_table.setHorizontalHeaderLabels(shortcut_table_header) shortcut_tab_verticalLayout.addWidget(self.shortcut_table) self.setting_tabWidget.addTab( self.shortcut_tab, QCoreApplication.translate("setting_ui_tr", "Shortcuts")) # Actions actions_list = [ QCoreApplication.translate('setting_ui_tr', 'Quit'), QCoreApplication.translate('setting_ui_tr', 'Minimize to System Tray'), QCoreApplication.translate('setting_ui_tr', 'Remove Download Items'), QCoreApplication.translate('setting_ui_tr', 'Delete Download Items'), QCoreApplication.translate('setting_ui_tr', 'Move Selected Items Up'), QCoreApplication.translate('setting_ui_tr', 'Move Selected Items Down'), QCoreApplication.translate('setting_ui_tr', 'Add New Download Link'), QCoreApplication.translate('setting_ui_tr', 'Add New Video Link'), QCoreApplication.translate('setting_ui_tr', 'Import Links from Text File') ] # add actions to the shortcut_table j = 0 for action in actions_list: item = QTableWidgetItem(str(action)) # align center item.setTextAlignment(0x0004 | 0x0080) # insert item in shortcut_table self.shortcut_table.insertRow(j) self.shortcut_table.setItem(j, 0, item) j = j + 1 self.shortcut_table.resizeColumnsToContents() # window buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) self.defaults_pushButton = QPushButton(self) buttons_horizontalLayout.addWidget(self.defaults_pushButton) self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # set style_tab for default self.setting_tabWidget.setCurrentIndex(3) # labels and translations self.setWindowTitle( QCoreApplication.translate("setting_ui_tr", "Preferences")) self.tries_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>" )) self.tries_label.setText( QCoreApplication.translate("setting_ui_tr", "Number of tries: ")) self.tries_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>" )) self.wait_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>" )) self.wait_label.setText( QCoreApplication.translate( "setting_ui_tr", "Wait period between retries (seconds): ")) self.wait_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>" )) self.time_out_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>" )) self.time_out_label.setText( QCoreApplication.translate("setting_ui_tr", "Timeout (seconds): ")) self.time_out_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>" )) self.connections_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>" )) self.connections_label.setText( QCoreApplication.translate("setting_ui_tr", "Number of connections: ")) self.connections_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>" )) self.rpc_port_label.setText( QCoreApplication.translate("setting_ui_tr", "RPC port number: ")) self.rpc_port_spinbox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>" )) self.wait_queue_label.setText( QCoreApplication.translate( "setting_ui_tr", 'Wait period between each download in queue:')) self.dont_check_certificate_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Don't use certificate to verify the peers")) self.dont_check_certificate_checkBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>This option avoids SSL/TLS handshake failure. But use it at your own risk!</p></body></html>" )) self.aria2_path_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Change Aria2 default path')) self.aria2_path_pushButton.setText( QCoreApplication.translate("setting_ui_tr", 'Change')) aria2_path_tooltip = QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Attention: Wrong path may cause problems! Do it carefully or don't change default setting!</p></body></html>" ) self.aria2_path_checkBox.setToolTip(aria2_path_tooltip) self.aria2_path_lineEdit.setToolTip(aria2_path_tooltip) self.aria2_path_pushButton.setToolTip(aria2_path_tooltip) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.download_options_tab), QCoreApplication.translate("setting_ui_tr", "Download Options")) self.download_folder_label.setText( QCoreApplication.translate("setting_ui_tr", "Download folder: ")) self.download_folder_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Change")) self.temp_download_label.setText( QCoreApplication.translate("setting_ui_tr", "Temporary download folder: ")) self.temp_download_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Change")) self.subfolder_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Create subfolders for Music,Videos, ... in default download folder" )) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.save_as_tab), QCoreApplication.translate("setting_ui_tr", "Save As")) self.enable_notifications_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Enable Notification Sounds")) self.volume_label.setText( QCoreApplication.translate("setting_ui_tr", "Volume: ")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.notifications_tab), QCoreApplication.translate("setting_ui_tr", "Notifications")) self.style_label.setText( QCoreApplication.translate("setting_ui_tr", "Style: ")) self.color_label.setText( QCoreApplication.translate("setting_ui_tr", "Color scheme: ")) self.icon_label.setText( QCoreApplication.translate("setting_ui_tr", "Icons: ")) self.icons_size_label.setText( QCoreApplication.translate("setting_ui_tr", "Toolbar icons size: ")) self.notification_label.setText( QCoreApplication.translate("setting_ui_tr", "Notification type: ")) self.font_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Font: ")) self.font_size_label.setText( QCoreApplication.translate("setting_ui_tr", "Size: ")) self.hide_window_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Hide main window if close button clicked.")) self.hide_window_checkBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>This feature may not work in your operating system.</p></body></html>" )) self.start_persepolis_if_browser_executed_checkBox.setText( QCoreApplication.translate( 'setting_ui_tr', 'If browser is opened, start Persepolis in system tray')) self.enable_system_tray_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Enable system tray icon")) self.after_download_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Show download complete dialog when download is finished")) self.show_menubar_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show menubar")) self.show_sidepanel_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show side panel")) self.show_progress_window_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show download progress window")) self.startup_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Run Persepolis at startup")) self.keep_awake_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Keep system awake!")) self.keep_awake_checkBox.setToolTip( QCoreApplication.translate( "setting_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.wait_queue_time.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Format HH:MM</p></body></html>")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.style_tab), QCoreApplication.translate("setting_ui_tr", "Preferences")) # columns_tab self.show_column_label.setText( QCoreApplication.translate("setting_ui_tr", 'Show these columns:')) self.column0_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'File Name')) self.column1_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Status')) self.column2_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Size')) self.column3_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Downloaded')) self.column4_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Percentage')) self.column5_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Connections')) self.column6_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Transfer Rate')) self.column7_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Estimated Time Left')) self.column10_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'First Try Date')) self.column11_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Last Try Date')) self.column12_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Category')) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.columns_tab), QCoreApplication.translate("setting_ui_tr", "Columns Customization")) # Video Finder options tab self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.video_finder_tab), QCoreApplication.translate("setting_ui_tr", "Video Finder Options")) self.max_links_label.setText( QCoreApplication.translate( "setting_ui_tr", 'Maximum number of links to capture:<br/>' '<small>(If browser sends multiple video links at a time)</small>' )) # window buttons self.defaults_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Defaults")) self.cancel_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Cancel")) self.ok_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "OK"))
class Ui_ReferenceDataDialog(object): def setupUi(self, ReferenceDataDialog): if not ReferenceDataDialog.objectName(): ReferenceDataDialog.setObjectName(u"ReferenceDataDialog") ReferenceDataDialog.resize(869, 300) self.verticalLayout = QVBoxLayout(ReferenceDataDialog) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.EditFrame = QFrame(ReferenceDataDialog) self.EditFrame.setObjectName(u"EditFrame") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.EditFrame.sizePolicy().hasHeightForWidth()) self.EditFrame.setSizePolicy(sizePolicy) self.EditFrame.setFrameShape(QFrame.Panel) self.EditFrame.setFrameShadow(QFrame.Plain) self.EditFrame.setLineWidth(0) self.edit_layout = QHBoxLayout(self.EditFrame) self.edit_layout.setObjectName(u"edit_layout") self.edit_layout.setContentsMargins(0, 0, 0, 0) self.GroupLbl = QLabel(self.EditFrame) self.GroupLbl.setObjectName(u"GroupLbl") self.edit_layout.addWidget(self.GroupLbl) self.GroupCombo = QComboBox(self.EditFrame) self.GroupCombo.setObjectName(u"GroupCombo") self.edit_layout.addWidget(self.GroupCombo) self.Toggle = QCheckBox(self.EditFrame) self.Toggle.setObjectName(u"Toggle") self.Toggle.setChecked(False) self.edit_layout.addWidget(self.Toggle) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.edit_layout.addItem(self.horizontalSpacer) self.AddBtn = QPushButton(self.EditFrame) self.AddBtn.setObjectName(u"AddBtn") self.edit_layout.addWidget(self.AddBtn) self.AddChildBtn = QPushButton(self.EditFrame) self.AddChildBtn.setObjectName(u"AddChildBtn") self.edit_layout.addWidget(self.AddChildBtn) self.RemoveBtn = QPushButton(self.EditFrame) self.RemoveBtn.setObjectName(u"RemoveBtn") self.edit_layout.addWidget(self.RemoveBtn) self.CommitBtn = QPushButton(self.EditFrame) self.CommitBtn.setObjectName(u"CommitBtn") self.CommitBtn.setEnabled(False) self.edit_layout.addWidget(self.CommitBtn) self.RevertBtn = QPushButton(self.EditFrame) self.RevertBtn.setObjectName(u"RevertBtn") self.RevertBtn.setEnabled(False) self.edit_layout.addWidget(self.RevertBtn) self.verticalLayout.addWidget(self.EditFrame) self.SearchFrame = QFrame(ReferenceDataDialog) self.SearchFrame.setObjectName(u"SearchFrame") self.SearchFrame.setFrameShape(QFrame.Panel) self.SearchFrame.setFrameShadow(QFrame.Plain) self.SearchFrame.setLineWidth(0) self.search_layout = QHBoxLayout(self.SearchFrame) self.search_layout.setObjectName(u"search_layout") self.search_layout.setContentsMargins(0, 0, 0, 0) self.SearchLbl = QLabel(self.SearchFrame) self.SearchLbl.setObjectName(u"SearchLbl") self.search_layout.addWidget(self.SearchLbl) self.SearchString = QLineEdit(self.SearchFrame) self.SearchString.setObjectName(u"SearchString") self.search_layout.addWidget(self.SearchString) self.verticalLayout.addWidget(self.SearchFrame) self.DataView = QTableView(ReferenceDataDialog) self.DataView.setObjectName(u"DataView") self.DataView.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.DataView.setAlternatingRowColors(True) self.DataView.setSelectionBehavior(QAbstractItemView.SelectRows) self.DataView.verticalHeader().setVisible(True) self.DataView.verticalHeader().setMinimumSectionSize(20) self.DataView.verticalHeader().setDefaultSectionSize(20) self.verticalLayout.addWidget(self.DataView) self.TreeView = QTreeView(ReferenceDataDialog) self.TreeView.setObjectName(u"TreeView") self.TreeView.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.TreeView.setTabKeyNavigation(True) self.TreeView.setAlternatingRowColors(True) self.TreeView.setSelectionMode(QAbstractItemView.ExtendedSelection) self.TreeView.setExpandsOnDoubleClick(False) self.TreeView.header().setStretchLastSection(False) self.verticalLayout.addWidget(self.TreeView) self.retranslateUi(ReferenceDataDialog) QMetaObject.connectSlotsByName(ReferenceDataDialog) # setupUi def retranslateUi(self, ReferenceDataDialog): ReferenceDataDialog.setWindowTitle( QCoreApplication.translate("ReferenceDataDialog", u"Reference Data", None)) self.GroupLbl.setText( QCoreApplication.translate("ReferenceDataDialog", u"Account Type:", None)) self.Toggle.setText( QCoreApplication.translate("ReferenceDataDialog", u"Show inactive", None)) #if QT_CONFIG(tooltip) self.AddBtn.setToolTip( QCoreApplication.translate("ReferenceDataDialog", u"Add new", None)) #endif // QT_CONFIG(tooltip) self.AddBtn.setText("") #if QT_CONFIG(tooltip) self.AddChildBtn.setToolTip( QCoreApplication.translate("ReferenceDataDialog", u"Add child", None)) #endif // QT_CONFIG(tooltip) self.AddChildBtn.setText("") #if QT_CONFIG(tooltip) self.RemoveBtn.setToolTip( QCoreApplication.translate("ReferenceDataDialog", u"Delete", None)) #endif // QT_CONFIG(tooltip) self.RemoveBtn.setText("") #if QT_CONFIG(tooltip) self.CommitBtn.setToolTip( QCoreApplication.translate("ReferenceDataDialog", u"Save changes", None)) #endif // QT_CONFIG(tooltip) self.CommitBtn.setText("") #if QT_CONFIG(tooltip) self.RevertBtn.setToolTip( QCoreApplication.translate("ReferenceDataDialog", u"Revert changes", None)) #endif // QT_CONFIG(tooltip) self.RevertBtn.setText("") self.SearchLbl.setText( QCoreApplication.translate("ReferenceDataDialog", u"Search:", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(770, 640) MainWindow.setMinimumSize(QSize(770, 640)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout_10 = QGridLayout(self.centralwidget) self.gridLayout_10.setObjectName(u"gridLayout_10") self.groupBoxConnection = QGroupBox(self.centralwidget) self.groupBoxConnection.setObjectName(u"groupBoxConnection") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.groupBoxConnection.sizePolicy().hasHeightForWidth()) self.groupBoxConnection.setSizePolicy(sizePolicy) self.gridLayout_2 = QGridLayout(self.groupBoxConnection) self.gridLayout_2.setObjectName(u"gridLayout_2") self.pushButtonConnect = QPushButton(self.groupBoxConnection) self.pushButtonConnect.setObjectName(u"pushButtonConnect") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(1) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.pushButtonConnect.sizePolicy().hasHeightForWidth()) self.pushButtonConnect.setSizePolicy(sizePolicy1) self.gridLayout_2.addWidget(self.pushButtonConnect, 0, 1, 1, 1) self.labelUpdateDelay = QLabel(self.groupBoxConnection) self.labelUpdateDelay.setObjectName(u"labelUpdateDelay") self.gridLayout_2.addWidget(self.labelUpdateDelay, 1, 0, 1, 1) self.labelStatus = QLabel(self.groupBoxConnection) self.labelStatus.setObjectName(u"labelStatus") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(1) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.labelStatus.sizePolicy().hasHeightForWidth()) self.labelStatus.setSizePolicy(sizePolicy2) self.gridLayout_2.addWidget(self.labelStatus, 1, 2, 1, 1) self.comboBoxGameSelection = QComboBox(self.groupBoxConnection) self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.addItem("") self.comboBoxGameSelection.setObjectName(u"comboBoxGameSelection") sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy3.setHorizontalStretch(1) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.comboBoxGameSelection.sizePolicy().hasHeightForWidth()) self.comboBoxGameSelection.setSizePolicy(sizePolicy3) self.gridLayout_2.addWidget(self.comboBoxGameSelection, 0, 0, 1, 1) self.doubleSpinBoxDelay = QDoubleSpinBox(self.groupBoxConnection) self.doubleSpinBoxDelay.setObjectName(u"doubleSpinBoxDelay") self.doubleSpinBoxDelay.setEnabled(False) self.doubleSpinBoxDelay.setMinimum(0.500000000000000) self.doubleSpinBoxDelay.setMaximum(2.000000000000000) self.gridLayout_2.addWidget(self.doubleSpinBoxDelay, 1, 1, 1, 1) self.gridLayout_10.addWidget(self.groupBoxConnection, 0, 0, 1, 1) self.tabWidget = QTabWidget(self.centralwidget) self.tabWidget.setObjectName(u"tabWidget") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(5) sizePolicy4.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy4) self.tabGen6 = QWidget() self.tabGen6.setObjectName(u"tabGen6") self.gridLayout = QGridLayout(self.tabGen6) self.gridLayout.setObjectName(u"gridLayout") self.tabWidgetGen6 = QTabWidget(self.tabGen6) self.tabWidgetGen6.setObjectName(u"tabWidgetGen6") self.tabMain6 = QWidget() self.tabMain6.setObjectName(u"tabMain6") self.gridLayout_13 = QGridLayout(self.tabMain6) self.gridLayout_13.setObjectName(u"gridLayout_13") self.comboBoxMainIndex6 = QComboBox(self.tabMain6) self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.addItem("") self.comboBoxMainIndex6.setObjectName(u"comboBoxMainIndex6") self.comboBoxMainIndex6.setEnabled(False) sizePolicy3.setHeightForWidth(self.comboBoxMainIndex6.sizePolicy().hasHeightForWidth()) self.comboBoxMainIndex6.setSizePolicy(sizePolicy3) self.gridLayout_13.addWidget(self.comboBoxMainIndex6, 0, 0, 1, 1) self.groupBoxMainRNG6 = QGroupBox(self.tabMain6) self.groupBoxMainRNG6.setObjectName(u"groupBoxMainRNG6") sizePolicy2.setHeightForWidth(self.groupBoxMainRNG6.sizePolicy().hasHeightForWidth()) self.groupBoxMainRNG6.setSizePolicy(sizePolicy2) self.gridLayout_11 = QGridLayout(self.groupBoxMainRNG6) self.gridLayout_11.setObjectName(u"gridLayout_11") self.lineEditFrame6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditFrame6.setObjectName(u"lineEditFrame6") sizePolicy5 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy5.setHorizontalStretch(0) sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth(self.lineEditFrame6.sizePolicy().hasHeightForWidth()) self.lineEditFrame6.setSizePolicy(sizePolicy5) self.lineEditFrame6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditFrame6, 3, 2, 1, 2) self.labelTiny2 = QLabel(self.groupBoxMainRNG6) self.labelTiny2.setObjectName(u"labelTiny2") self.gridLayout_11.addWidget(self.labelTiny2, 5, 2, 1, 1) self.labelTiny0 = QLabel(self.groupBoxMainRNG6) self.labelTiny0.setObjectName(u"labelTiny0") self.gridLayout_11.addWidget(self.labelTiny0, 6, 2, 1, 1) self.lineEditInitialSeed6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditInitialSeed6.setObjectName(u"lineEditInitialSeed6") sizePolicy5.setHeightForWidth(self.lineEditInitialSeed6.sizePolicy().hasHeightForWidth()) self.lineEditInitialSeed6.setSizePolicy(sizePolicy5) self.lineEditInitialSeed6.setMaxLength(8) self.lineEditInitialSeed6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditInitialSeed6, 1, 2, 1, 2) self.labelTiny3 = QLabel(self.groupBoxMainRNG6) self.labelTiny3.setObjectName(u"labelTiny3") self.gridLayout_11.addWidget(self.labelTiny3, 5, 0, 1, 1) self.labelTiny1 = QLabel(self.groupBoxMainRNG6) self.labelTiny1.setObjectName(u"labelTiny1") self.gridLayout_11.addWidget(self.labelTiny1, 6, 0, 1, 1) self.labelMainCurrentSeed6 = QLabel(self.groupBoxMainRNG6) self.labelMainCurrentSeed6.setObjectName(u"labelMainCurrentSeed6") self.gridLayout_11.addWidget(self.labelMainCurrentSeed6, 2, 0, 1, 2) self.lineEditCurrentSeed6 = QLineEdit(self.groupBoxMainRNG6) self.lineEditCurrentSeed6.setObjectName(u"lineEditCurrentSeed6") sizePolicy5.setHeightForWidth(self.lineEditCurrentSeed6.sizePolicy().hasHeightForWidth()) self.lineEditCurrentSeed6.setSizePolicy(sizePolicy5) self.lineEditCurrentSeed6.setMaxLength(16) self.lineEditCurrentSeed6.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditCurrentSeed6, 2, 2, 1, 2) self.lineEditTiny2 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny2.setObjectName(u"lineEditTiny2") self.gridLayout_11.addWidget(self.lineEditTiny2, 5, 3, 1, 1) self.lineEditTiny1 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny1.setObjectName(u"lineEditTiny1") self.gridLayout_11.addWidget(self.lineEditTiny1, 6, 1, 1, 1) self.lineEditTiny3 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny3.setObjectName(u"lineEditTiny3") self.gridLayout_11.addWidget(self.lineEditTiny3, 5, 1, 1, 1) self.labelMainInitialSeed6 = QLabel(self.groupBoxMainRNG6) self.labelMainInitialSeed6.setObjectName(u"labelMainInitialSeed6") self.gridLayout_11.addWidget(self.labelMainInitialSeed6, 1, 0, 1, 2) self.labelMainFrame6 = QLabel(self.groupBoxMainRNG6) self.labelMainFrame6.setObjectName(u"labelMainFrame6") self.gridLayout_11.addWidget(self.labelMainFrame6, 3, 0, 1, 1) self.lineEditTiny0 = QLineEdit(self.groupBoxMainRNG6) self.lineEditTiny0.setObjectName(u"lineEditTiny0") self.gridLayout_11.addWidget(self.lineEditTiny0, 6, 3, 1, 1) self.pushButtonMainUpdate6 = QPushButton(self.groupBoxMainRNG6) self.pushButtonMainUpdate6.setObjectName(u"pushButtonMainUpdate6") self.pushButtonMainUpdate6.setEnabled(False) self.gridLayout_11.addWidget(self.pushButtonMainUpdate6, 0, 0, 1, 4) self.labelSaveVariable = QLabel(self.groupBoxMainRNG6) self.labelSaveVariable.setObjectName(u"labelSaveVariable") self.gridLayout_11.addWidget(self.labelSaveVariable, 4, 0, 1, 1) self.lineEditSaveVariable = QLineEdit(self.groupBoxMainRNG6) self.lineEditSaveVariable.setObjectName(u"lineEditSaveVariable") self.lineEditSaveVariable.setReadOnly(True) self.gridLayout_11.addWidget(self.lineEditSaveVariable, 4, 2, 1, 2) self.gridLayout_13.addWidget(self.groupBoxMainRNG6, 0, 1, 2, 1) self.mainPokemon6 = PokemonDisplay(self.tabMain6) self.mainPokemon6.setObjectName(u"mainPokemon6") sizePolicy2.setHeightForWidth(self.mainPokemon6.sizePolicy().hasHeightForWidth()) self.mainPokemon6.setSizePolicy(sizePolicy2) self.gridLayout_13.addWidget(self.mainPokemon6, 1, 0, 1, 1) self.tabWidgetGen6.addTab(self.tabMain6, "") self.tabEgg6 = QWidget() self.tabEgg6.setObjectName(u"tabEgg6") self.gridLayout_15 = QGridLayout(self.tabEgg6) self.gridLayout_15.setObjectName(u"gridLayout_15") self.eggParent1_6 = PokemonDisplay(self.tabEgg6) self.eggParent1_6.setObjectName(u"eggParent1_6") sizePolicy2.setHeightForWidth(self.eggParent1_6.sizePolicy().hasHeightForWidth()) self.eggParent1_6.setSizePolicy(sizePolicy2) self.gridLayout_15.addWidget(self.eggParent1_6, 0, 0, 1, 1) self.eggParent2_6 = PokemonDisplay(self.tabEgg6) self.eggParent2_6.setObjectName(u"eggParent2_6") sizePolicy2.setHeightForWidth(self.eggParent2_6.sizePolicy().hasHeightForWidth()) self.eggParent2_6.setSizePolicy(sizePolicy2) self.gridLayout_15.addWidget(self.eggParent2_6, 0, 1, 1, 1) self.groupBoxEggRNG6 = QGroupBox(self.tabEgg6) self.groupBoxEggRNG6.setObjectName(u"groupBoxEggRNG6") sizePolicy2.setHeightForWidth(self.groupBoxEggRNG6.sizePolicy().hasHeightForWidth()) self.groupBoxEggRNG6.setSizePolicy(sizePolicy2) self.gridLayout_14 = QGridLayout(self.groupBoxEggRNG6) self.gridLayout_14.setObjectName(u"gridLayout_14") self.labelEggReady6 = QLabel(self.groupBoxEggRNG6) self.labelEggReady6.setObjectName(u"labelEggReady6") sizePolicy5.setHeightForWidth(self.labelEggReady6.sizePolicy().hasHeightForWidth()) self.labelEggReady6.setSizePolicy(sizePolicy5) self.gridLayout_14.addWidget(self.labelEggReady6, 1, 0, 1, 1) self.labelEggReadyStatus6 = QLabel(self.groupBoxEggRNG6) self.labelEggReadyStatus6.setObjectName(u"labelEggReadyStatus6") self.gridLayout_14.addWidget(self.labelEggReadyStatus6, 1, 1, 1, 1) self.lineEditEggSeed0_6 = QLineEdit(self.groupBoxEggRNG6) self.lineEditEggSeed0_6.setObjectName(u"lineEditEggSeed0_6") sizePolicy5.setHeightForWidth(self.lineEditEggSeed0_6.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed0_6.setSizePolicy(sizePolicy5) self.lineEditEggSeed0_6.setMaxLength(8) self.lineEditEggSeed0_6.setReadOnly(True) self.gridLayout_14.addWidget(self.lineEditEggSeed0_6, 3, 1, 1, 1) self.pushButtonEggUpdate6 = QPushButton(self.groupBoxEggRNG6) self.pushButtonEggUpdate6.setObjectName(u"pushButtonEggUpdate6") self.pushButtonEggUpdate6.setEnabled(False) self.gridLayout_14.addWidget(self.pushButtonEggUpdate6, 0, 0, 1, 2) self.labelEggSeed0_6 = QLabel(self.groupBoxEggRNG6) self.labelEggSeed0_6.setObjectName(u"labelEggSeed0_6") self.gridLayout_14.addWidget(self.labelEggSeed0_6, 3, 0, 1, 1) self.labelEggSeed1_6 = QLabel(self.groupBoxEggRNG6) self.labelEggSeed1_6.setObjectName(u"labelEggSeed1_6") self.gridLayout_14.addWidget(self.labelEggSeed1_6, 2, 0, 1, 1) self.lineEditEggSeed1_6 = QLineEdit(self.groupBoxEggRNG6) self.lineEditEggSeed1_6.setObjectName(u"lineEditEggSeed1_6") sizePolicy5.setHeightForWidth(self.lineEditEggSeed1_6.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed1_6.setSizePolicy(sizePolicy5) self.lineEditEggSeed1_6.setMaxLength(8) self.lineEditEggSeed1_6.setReadOnly(True) self.gridLayout_14.addWidget(self.lineEditEggSeed1_6, 2, 1, 1, 1) self.gridLayout_15.addWidget(self.groupBoxEggRNG6, 0, 2, 1, 1) self.tabWidgetGen6.addTab(self.tabEgg6, "") self.gridLayout.addWidget(self.tabWidgetGen6, 0, 0, 1, 1) self.tabWidget.addTab(self.tabGen6, "") self.tabGen7 = QWidget() self.tabGen7.setObjectName(u"tabGen7") self.tabGen7.setEnabled(False) self.gridLayout_12 = QGridLayout(self.tabGen7) self.gridLayout_12.setObjectName(u"gridLayout_12") self.tabWidgetGen7 = QTabWidget(self.tabGen7) self.tabWidgetGen7.setObjectName(u"tabWidgetGen7") self.tabMain7 = QWidget() self.tabMain7.setObjectName(u"tabMain7") self.gridLayout_7 = QGridLayout(self.tabMain7) self.gridLayout_7.setObjectName(u"gridLayout_7") self.comboBoxMainIndex7 = QComboBox(self.tabMain7) self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.addItem("") self.comboBoxMainIndex7.setObjectName(u"comboBoxMainIndex7") self.comboBoxMainIndex7.setEnabled(False) sizePolicy3.setHeightForWidth(self.comboBoxMainIndex7.sizePolicy().hasHeightForWidth()) self.comboBoxMainIndex7.setSizePolicy(sizePolicy3) self.gridLayout_7.addWidget(self.comboBoxMainIndex7, 0, 0, 1, 1) self.groupBoxMainRNG7 = QGroupBox(self.tabMain7) self.groupBoxMainRNG7.setObjectName(u"groupBoxMainRNG7") sizePolicy2.setHeightForWidth(self.groupBoxMainRNG7.sizePolicy().hasHeightForWidth()) self.groupBoxMainRNG7.setSizePolicy(sizePolicy2) self.gridLayout_3 = QGridLayout(self.groupBoxMainRNG7) self.gridLayout_3.setObjectName(u"gridLayout_3") self.labelMainInitialSeed7 = QLabel(self.groupBoxMainRNG7) self.labelMainInitialSeed7.setObjectName(u"labelMainInitialSeed7") self.gridLayout_3.addWidget(self.labelMainInitialSeed7, 1, 0, 1, 1) self.lineEditInitialSeed7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditInitialSeed7.setObjectName(u"lineEditInitialSeed7") sizePolicy5.setHeightForWidth(self.lineEditInitialSeed7.sizePolicy().hasHeightForWidth()) self.lineEditInitialSeed7.setSizePolicy(sizePolicy5) self.lineEditInitialSeed7.setMaxLength(8) self.lineEditInitialSeed7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditInitialSeed7, 1, 1, 1, 1) self.labelMainCurrentSeed7 = QLabel(self.groupBoxMainRNG7) self.labelMainCurrentSeed7.setObjectName(u"labelMainCurrentSeed7") self.gridLayout_3.addWidget(self.labelMainCurrentSeed7, 2, 0, 1, 1) self.lineEditCurrentSeed7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditCurrentSeed7.setObjectName(u"lineEditCurrentSeed7") sizePolicy5.setHeightForWidth(self.lineEditCurrentSeed7.sizePolicy().hasHeightForWidth()) self.lineEditCurrentSeed7.setSizePolicy(sizePolicy5) self.lineEditCurrentSeed7.setMaxLength(16) self.lineEditCurrentSeed7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditCurrentSeed7, 2, 1, 1, 1) self.labelMainFrame7 = QLabel(self.groupBoxMainRNG7) self.labelMainFrame7.setObjectName(u"labelMainFrame7") self.gridLayout_3.addWidget(self.labelMainFrame7, 3, 0, 1, 1) self.lineEditFrame7 = QLineEdit(self.groupBoxMainRNG7) self.lineEditFrame7.setObjectName(u"lineEditFrame7") sizePolicy5.setHeightForWidth(self.lineEditFrame7.sizePolicy().hasHeightForWidth()) self.lineEditFrame7.setSizePolicy(sizePolicy5) self.lineEditFrame7.setReadOnly(True) self.gridLayout_3.addWidget(self.lineEditFrame7, 3, 1, 1, 1) self.pushButtonMainUpdate7 = QPushButton(self.groupBoxMainRNG7) self.pushButtonMainUpdate7.setObjectName(u"pushButtonMainUpdate7") self.pushButtonMainUpdate7.setEnabled(False) self.gridLayout_3.addWidget(self.pushButtonMainUpdate7, 0, 0, 1, 2) self.gridLayout_7.addWidget(self.groupBoxMainRNG7, 0, 1, 2, 1) self.mainPokemon7 = PokemonDisplay(self.tabMain7) self.mainPokemon7.setObjectName(u"mainPokemon7") sizePolicy2.setHeightForWidth(self.mainPokemon7.sizePolicy().hasHeightForWidth()) self.mainPokemon7.setSizePolicy(sizePolicy2) self.gridLayout_7.addWidget(self.mainPokemon7, 1, 0, 1, 1) self.tabWidgetGen7.addTab(self.tabMain7, "") self.tabEgg7 = QWidget() self.tabEgg7.setObjectName(u"tabEgg7") self.gridLayout_6 = QGridLayout(self.tabEgg7) self.gridLayout_6.setObjectName(u"gridLayout_6") self.groupBoxEggRNG7 = QGroupBox(self.tabEgg7) self.groupBoxEggRNG7.setObjectName(u"groupBoxEggRNG7") sizePolicy2.setHeightForWidth(self.groupBoxEggRNG7.sizePolicy().hasHeightForWidth()) self.groupBoxEggRNG7.setSizePolicy(sizePolicy2) self.gridLayout_4 = QGridLayout(self.groupBoxEggRNG7) self.gridLayout_4.setObjectName(u"gridLayout_4") self.pushButtonEggUpdate7 = QPushButton(self.groupBoxEggRNG7) self.pushButtonEggUpdate7.setObjectName(u"pushButtonEggUpdate7") self.pushButtonEggUpdate7.setEnabled(False) self.gridLayout_4.addWidget(self.pushButtonEggUpdate7, 0, 0, 1, 2) self.labelEggReady7 = QLabel(self.groupBoxEggRNG7) self.labelEggReady7.setObjectName(u"labelEggReady7") sizePolicy5.setHeightForWidth(self.labelEggReady7.sizePolicy().hasHeightForWidth()) self.labelEggReady7.setSizePolicy(sizePolicy5) self.gridLayout_4.addWidget(self.labelEggReady7, 1, 0, 1, 1) self.labelEggReadyStatus7 = QLabel(self.groupBoxEggRNG7) self.labelEggReadyStatus7.setObjectName(u"labelEggReadyStatus7") self.gridLayout_4.addWidget(self.labelEggReadyStatus7, 1, 1, 1, 1) self.labelEggSeed3_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed3_7.setObjectName(u"labelEggSeed3_7") self.gridLayout_4.addWidget(self.labelEggSeed3_7, 2, 0, 1, 1) self.lineEditEggSeed3_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed3_7.setObjectName(u"lineEditEggSeed3_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed3_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed3_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed3_7.setMaxLength(8) self.lineEditEggSeed3_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed3_7, 2, 1, 1, 1) self.labelEggSeed2_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed2_7.setObjectName(u"labelEggSeed2_7") self.gridLayout_4.addWidget(self.labelEggSeed2_7, 3, 0, 1, 1) self.lineEditEggSeed2_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed2_7.setObjectName(u"lineEditEggSeed2_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed2_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed2_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed2_7.setMaxLength(8) self.lineEditEggSeed2_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed2_7, 3, 1, 1, 1) self.labelEggSeed1_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed1_7.setObjectName(u"labelEggSeed1_7") self.gridLayout_4.addWidget(self.labelEggSeed1_7, 4, 0, 1, 1) self.lineEditEggSeed1_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed1_7.setObjectName(u"lineEditEggSeed1_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed1_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed1_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed1_7.setMaxLength(8) self.lineEditEggSeed1_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed1_7, 4, 1, 1, 1) self.labelEggSeed0_7 = QLabel(self.groupBoxEggRNG7) self.labelEggSeed0_7.setObjectName(u"labelEggSeed0_7") self.gridLayout_4.addWidget(self.labelEggSeed0_7, 5, 0, 1, 1) self.lineEditEggSeed0_7 = QLineEdit(self.groupBoxEggRNG7) self.lineEditEggSeed0_7.setObjectName(u"lineEditEggSeed0_7") sizePolicy5.setHeightForWidth(self.lineEditEggSeed0_7.sizePolicy().hasHeightForWidth()) self.lineEditEggSeed0_7.setSizePolicy(sizePolicy5) self.lineEditEggSeed0_7.setMaxLength(8) self.lineEditEggSeed0_7.setReadOnly(True) self.gridLayout_4.addWidget(self.lineEditEggSeed0_7, 5, 1, 1, 1) self.gridLayout_6.addWidget(self.groupBoxEggRNG7, 0, 2, 2, 1) self.eggParent1_7 = PokemonDisplay(self.tabEgg7) self.eggParent1_7.setObjectName(u"eggParent1_7") sizePolicy2.setHeightForWidth(self.eggParent1_7.sizePolicy().hasHeightForWidth()) self.eggParent1_7.setSizePolicy(sizePolicy2) self.gridLayout_6.addWidget(self.eggParent1_7, 0, 0, 2, 1) self.eggParent2_7 = PokemonDisplay(self.tabEgg7) self.eggParent2_7.setObjectName(u"eggParent2_7") sizePolicy2.setHeightForWidth(self.eggParent2_7.sizePolicy().hasHeightForWidth()) self.eggParent2_7.setSizePolicy(sizePolicy2) self.gridLayout_6.addWidget(self.eggParent2_7, 0, 1, 2, 1) self.tabWidgetGen7.addTab(self.tabEgg7, "") self.tabSOS = QWidget() self.tabSOS.setObjectName(u"tabSOS") self.gridLayout_8 = QGridLayout(self.tabSOS) self.gridLayout_8.setObjectName(u"gridLayout_8") self.comboBoxSOSIndex = QComboBox(self.tabSOS) self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.addItem("") self.comboBoxSOSIndex.setObjectName(u"comboBoxSOSIndex") self.comboBoxSOSIndex.setEnabled(False) self.gridLayout_8.addWidget(self.comboBoxSOSIndex, 0, 0, 1, 1) self.groupBoxSOS = QGroupBox(self.tabSOS) self.groupBoxSOS.setObjectName(u"groupBoxSOS") sizePolicy2.setHeightForWidth(self.groupBoxSOS.sizePolicy().hasHeightForWidth()) self.groupBoxSOS.setSizePolicy(sizePolicy2) self.gridLayout_5 = QGridLayout(self.groupBoxSOS) self.gridLayout_5.setObjectName(u"gridLayout_5") self.pushButtonSOSUpdate = QPushButton(self.groupBoxSOS) self.pushButtonSOSUpdate.setObjectName(u"pushButtonSOSUpdate") self.pushButtonSOSUpdate.setEnabled(False) self.gridLayout_5.addWidget(self.pushButtonSOSUpdate, 0, 0, 1, 1) self.pushButtonSOSReset = QPushButton(self.groupBoxSOS) self.pushButtonSOSReset.setObjectName(u"pushButtonSOSReset") self.pushButtonSOSReset.setEnabled(False) self.gridLayout_5.addWidget(self.pushButtonSOSReset, 0, 1, 1, 1) self.labelSOSInitialSeed = QLabel(self.groupBoxSOS) self.labelSOSInitialSeed.setObjectName(u"labelSOSInitialSeed") self.gridLayout_5.addWidget(self.labelSOSInitialSeed, 1, 0, 1, 1) self.lineEditSOSInitialSeed = QLineEdit(self.groupBoxSOS) self.lineEditSOSInitialSeed.setObjectName(u"lineEditSOSInitialSeed") self.lineEditSOSInitialSeed.setMaxLength(8) self.lineEditSOSInitialSeed.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSInitialSeed, 1, 1, 1, 1) self.labelSOSCurrentSeed = QLabel(self.groupBoxSOS) self.labelSOSCurrentSeed.setObjectName(u"labelSOSCurrentSeed") self.gridLayout_5.addWidget(self.labelSOSCurrentSeed, 2, 0, 1, 1) self.lineEditSOSCurrentSeed = QLineEdit(self.groupBoxSOS) self.lineEditSOSCurrentSeed.setObjectName(u"lineEditSOSCurrentSeed") self.lineEditSOSCurrentSeed.setMaxLength(8) self.lineEditSOSCurrentSeed.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSCurrentSeed, 2, 1, 1, 1) self.labelSOSFrame = QLabel(self.groupBoxSOS) self.labelSOSFrame.setObjectName(u"labelSOSFrame") self.gridLayout_5.addWidget(self.labelSOSFrame, 3, 0, 1, 1) self.lineEditSOSFrame = QLineEdit(self.groupBoxSOS) self.lineEditSOSFrame.setObjectName(u"lineEditSOSFrame") self.lineEditSOSFrame.setMaxLength(8) self.lineEditSOSFrame.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSFrame, 3, 1, 1, 1) self.labelSOSChainCount = QLabel(self.groupBoxSOS) self.labelSOSChainCount.setObjectName(u"labelSOSChainCount") self.gridLayout_5.addWidget(self.labelSOSChainCount, 4, 0, 1, 1) self.lineEditSOSChainCount = QLineEdit(self.groupBoxSOS) self.lineEditSOSChainCount.setObjectName(u"lineEditSOSChainCount") self.lineEditSOSChainCount.setMaxLength(8) self.lineEditSOSChainCount.setReadOnly(True) self.gridLayout_5.addWidget(self.lineEditSOSChainCount, 4, 1, 1, 1) self.gridLayout_8.addWidget(self.groupBoxSOS, 0, 1, 2, 1) self.sosPokemon = PokemonDisplay(self.tabSOS) self.sosPokemon.setObjectName(u"sosPokemon") sizePolicy2.setHeightForWidth(self.sosPokemon.sizePolicy().hasHeightForWidth()) self.sosPokemon.setSizePolicy(sizePolicy2) self.gridLayout_8.addWidget(self.sosPokemon, 1, 0, 1, 1) self.tabWidgetGen7.addTab(self.tabSOS, "") self.gridLayout_12.addWidget(self.tabWidgetGen7, 0, 0, 1, 1) self.tabWidget.addTab(self.tabGen7, "") self.gridLayout_10.addWidget(self.tabWidget, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"CitraRNG 3.2.0", None)) self.groupBoxConnection.setTitle(QCoreApplication.translate("MainWindow", u"Connection", None)) self.pushButtonConnect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) self.labelUpdateDelay.setText(QCoreApplication.translate("MainWindow", u"Auto update delay(seconds):", None)) self.labelStatus.setText(QCoreApplication.translate("MainWindow", u"Status: Not Connected", None)) self.comboBoxGameSelection.setItemText(0, QCoreApplication.translate("MainWindow", u"XY", None)) self.comboBoxGameSelection.setItemText(1, QCoreApplication.translate("MainWindow", u"ORAS", None)) self.comboBoxGameSelection.setItemText(2, QCoreApplication.translate("MainWindow", u"SM", None)) self.comboBoxGameSelection.setItemText(3, QCoreApplication.translate("MainWindow", u"USUM", None)) self.comboBoxMainIndex6.setItemText(0, QCoreApplication.translate("MainWindow", u"Party 1", None)) self.comboBoxMainIndex6.setItemText(1, QCoreApplication.translate("MainWindow", u"Party 2", None)) self.comboBoxMainIndex6.setItemText(2, QCoreApplication.translate("MainWindow", u"Party 3", None)) self.comboBoxMainIndex6.setItemText(3, QCoreApplication.translate("MainWindow", u"Party 4", None)) self.comboBoxMainIndex6.setItemText(4, QCoreApplication.translate("MainWindow", u"Party 5", None)) self.comboBoxMainIndex6.setItemText(5, QCoreApplication.translate("MainWindow", u"Party 6", None)) self.comboBoxMainIndex6.setItemText(6, QCoreApplication.translate("MainWindow", u"Wild", None)) self.groupBoxMainRNG6.setTitle(QCoreApplication.translate("MainWindow", u"Main RNG", None)) self.labelTiny2.setText(QCoreApplication.translate("MainWindow", u"[2]", None)) self.labelTiny0.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.labelTiny3.setText(QCoreApplication.translate("MainWindow", u"[3]", None)) self.labelTiny1.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.labelMainCurrentSeed6.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelMainInitialSeed6.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelMainFrame6.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.pushButtonMainUpdate6.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelSaveVariable.setText(QCoreApplication.translate("MainWindow", u"Save Variable:", None)) self.tabWidgetGen6.setTabText(self.tabWidgetGen6.indexOf(self.tabMain6), QCoreApplication.translate("MainWindow", u"Main", None)) self.groupBoxEggRNG6.setTitle(QCoreApplication.translate("MainWindow", u"Egg RNG", None)) self.labelEggReady6.setText(QCoreApplication.translate("MainWindow", u"Egg Ready:", None)) self.labelEggReadyStatus6.setText(QCoreApplication.translate("MainWindow", u"No egg yet", None)) self.pushButtonEggUpdate6.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelEggSeed0_6.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.labelEggSeed1_6.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.tabWidgetGen6.setTabText(self.tabWidgetGen6.indexOf(self.tabEgg6), QCoreApplication.translate("MainWindow", u"Egg", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabGen6), QCoreApplication.translate("MainWindow", u"Gen 6", None)) self.comboBoxMainIndex7.setItemText(0, QCoreApplication.translate("MainWindow", u"Party 1", None)) self.comboBoxMainIndex7.setItemText(1, QCoreApplication.translate("MainWindow", u"Party 2", None)) self.comboBoxMainIndex7.setItemText(2, QCoreApplication.translate("MainWindow", u"Party 3", None)) self.comboBoxMainIndex7.setItemText(3, QCoreApplication.translate("MainWindow", u"Party 4", None)) self.comboBoxMainIndex7.setItemText(4, QCoreApplication.translate("MainWindow", u"Party 5", None)) self.comboBoxMainIndex7.setItemText(5, QCoreApplication.translate("MainWindow", u"Party 6", None)) self.comboBoxMainIndex7.setItemText(6, QCoreApplication.translate("MainWindow", u"Wild", None)) self.groupBoxMainRNG7.setTitle(QCoreApplication.translate("MainWindow", u"Main RNG", None)) self.labelMainInitialSeed7.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelMainCurrentSeed7.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelMainFrame7.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.pushButtonMainUpdate7.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabMain7), QCoreApplication.translate("MainWindow", u"Main", None)) self.groupBoxEggRNG7.setTitle(QCoreApplication.translate("MainWindow", u"Egg RNG", None)) self.pushButtonEggUpdate7.setText(QCoreApplication.translate("MainWindow", u"Update", None)) self.labelEggReady7.setText(QCoreApplication.translate("MainWindow", u"Egg Ready:", None)) self.labelEggReadyStatus7.setText(QCoreApplication.translate("MainWindow", u"No egg yet", None)) self.labelEggSeed3_7.setText(QCoreApplication.translate("MainWindow", u"[3]", None)) self.labelEggSeed2_7.setText(QCoreApplication.translate("MainWindow", u"[2]", None)) self.labelEggSeed1_7.setText(QCoreApplication.translate("MainWindow", u"[1]", None)) self.labelEggSeed0_7.setText(QCoreApplication.translate("MainWindow", u"[0]", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabEgg7), QCoreApplication.translate("MainWindow", u"Egg", None)) self.comboBoxSOSIndex.setItemText(0, QCoreApplication.translate("MainWindow", u"SOS 1", None)) self.comboBoxSOSIndex.setItemText(1, QCoreApplication.translate("MainWindow", u"SOS 2", None)) self.comboBoxSOSIndex.setItemText(2, QCoreApplication.translate("MainWindow", u"SOS 3", None)) self.comboBoxSOSIndex.setItemText(3, QCoreApplication.translate("MainWindow", u"SOS 4", None)) self.groupBoxSOS.setTitle(QCoreApplication.translate("MainWindow", u"SOS RNG", None)) self.pushButtonSOSUpdate.setText(QCoreApplication.translate("MainWindow", u"Update", None)) #if QT_CONFIG(tooltip) self.pushButtonSOSReset.setToolTip(QCoreApplication.translate("MainWindow", u"This should be used after a battle", None)) #endif // QT_CONFIG(tooltip) self.pushButtonSOSReset.setText(QCoreApplication.translate("MainWindow", u"Reset", None)) self.labelSOSInitialSeed.setText(QCoreApplication.translate("MainWindow", u"Initial Seed:", None)) self.labelSOSCurrentSeed.setText(QCoreApplication.translate("MainWindow", u"Current Seed:", None)) self.labelSOSFrame.setText(QCoreApplication.translate("MainWindow", u"Frame:", None)) self.labelSOSChainCount.setText(QCoreApplication.translate("MainWindow", u"Chain Count:", None)) self.tabWidgetGen7.setTabText(self.tabWidgetGen7.indexOf(self.tabSOS), QCoreApplication.translate("MainWindow", u"SOS", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabGen7), QCoreApplication.translate("MainWindow", u"Gen 7", None))
class SettingsWindow(QDialog): def __init__(self, parent: Optional[QWidget] = None, firstStart: bool = False) -> None: super().__init__(parent, ) if parent: self.setWindowTitle('Settings') else: self.setWindowTitle(getTitleString('Settings')) self.setAttribute(Qt.WA_DeleteOnClose) settings = QSettings() mainLayout = QVBoxLayout(self) mainLayout.setContentsMargins(5, 5, 5, 5) # First Start info if firstStart: firstStartInfo = QLabel( ''' <p><strong>Hello! It looks like this is your first time using w3modmanager, or the game installation path recently changed.</strong></p> <p> Please review the settings below. </p> ''', self) firstStartInfo.setWordWrap(True) firstStartInfo.setContentsMargins(10, 10, 10, 10) firstStartInfo.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) mainLayout.addWidget(firstStartInfo) # Game gbGame = QGroupBox('Game Path', self) mainLayout.addWidget(gbGame) gbGameLayout = QVBoxLayout(gbGame) gamePathLayout = QHBoxLayout() self.gamePath = QLineEdit(self) self.gamePath.setPlaceholderText('Path to witcher3.exe...') if settings.value('gamePath'): self.gamePath.setText(str(settings.value('gamePath'))) self.gamePath.textChanged.connect( lambda: self.validateGamePath(self.gamePath.text())) gamePathLayout.addWidget(self.gamePath) self.locateGame = QPushButton('Detect', self) self.locateGame.clicked.connect(self.locateGameEvent) self.locateGame.setToolTip( 'Automatically detect the game path if possible') gamePathLayout.addWidget(self.locateGame) selectGame = QPushButton('Browse', self) selectGame.clicked.connect(self.selectGameEvent) gamePathLayout.addWidget(selectGame) gbGameLayout.addLayout(gamePathLayout) gamePathInfoLayout = QHBoxLayout() self.gamePathInfo = QLabel('', self) self.gamePathInfo.setContentsMargins(4, 4, 4, 4) self.gamePathInfo.setMinimumHeight(40) self.gamePathInfo.setWordWrap(True) gamePathInfoLayout.addWidget(self.gamePathInfo) gbGameLayout.addLayout(gamePathInfoLayout) # Config gbConfig = QGroupBox('Game Config', self) mainLayout.addWidget(gbConfig) gbConfigLayout = QVBoxLayout(gbConfig) configPathLayout = QHBoxLayout() self.configPath = QLineEdit(self) self.configPath.setPlaceholderText('Path to config folder...') if settings.value('configPath'): self.configPath.setText(str(settings.value('configPath'))) self.configPath.textChanged.connect( lambda: self.validateConfigPath(self.configPath.text())) configPathLayout.addWidget(self.configPath) self.locateConfig = QPushButton('Detect', self) self.locateConfig.clicked.connect(self.locateConfigEvent) self.locateConfig.setToolTip( 'Automatically detect the config folder if possible') configPathLayout.addWidget(self.locateConfig) selectConfig = QPushButton('Browse', self) selectConfig.clicked.connect(self.selectConfigEvent) configPathLayout.addWidget(selectConfig) gbConfigLayout.addLayout(configPathLayout) configPathInfoLayout = QHBoxLayout() self.configPathInfo = QLabel('', self) self.configPathInfo.setContentsMargins(4, 4, 4, 4) self.configPathInfo.setMinimumHeight(40) self.configPathInfo.setWordWrap(True) configPathInfoLayout.addWidget(self.configPathInfo) gbConfigLayout.addLayout(configPathInfoLayout) # Script Merger gbScriptMerger = QGroupBox('Script Merger', self) mainLayout.addWidget(gbScriptMerger) gbScriptMergerLayout = QVBoxLayout(gbScriptMerger) scriptMergerPathLayout = QHBoxLayout() self.scriptMergerPath = QLineEdit(self) self.scriptMergerPath.setPlaceholderText( 'Path to WitcherScriptMerger.exe...') if settings.value('scriptMergerPath'): self.scriptMergerPath.setText( str(settings.value('scriptMergerPath'))) self.scriptMergerPath.textChanged.connect( lambda: self.validateScriptMergerPath(self.scriptMergerPath.text() )) scriptMergerPathLayout.addWidget(self.scriptMergerPath) self.locateScriptMerger = QPushButton('Detect', self) self.locateScriptMerger.clicked.connect(self.locateScriptMergerEvent) self.locateScriptMerger.setToolTip( 'Automatically detect the script merger path if possible') scriptMergerPathLayout.addWidget(self.locateScriptMerger) selectScriptMerger = QPushButton('Browse', self) selectScriptMerger.clicked.connect(self.selectScriptMergerEvent) scriptMergerPathLayout.addWidget(selectScriptMerger) gbScriptMergerLayout.addLayout(scriptMergerPathLayout) scriptMergerPathInfoLayout = QHBoxLayout() self.scriptMergerPathInfo = QLabel('', self) self.scriptMergerPathInfo.setOpenExternalLinks(True) self.scriptMergerPathInfo.setContentsMargins(4, 4, 4, 4) self.scriptMergerPathInfo.setMinimumHeight(40) self.scriptMergerPathInfo.setWordWrap(True) scriptMergerPathInfoLayout.addWidget(self.scriptMergerPathInfo) gbScriptMergerLayout.addLayout(scriptMergerPathInfoLayout) # Nexus Mods API gbNexusModsAPI = QGroupBox('Nexus Mods API', self) mainLayout.addWidget(gbNexusModsAPI) gbNexusModsAPILayout = QVBoxLayout(gbNexusModsAPI) self.nexusAPIKey = QLineEdit(self) self.nexusAPIKey.setPlaceholderText('Personal API Key...') if settings.value('nexusAPIKey'): self.nexusAPIKey.setText(str(settings.value('nexusAPIKey'))) self.nexusAPIKey.textChanged.connect( lambda: self.validateApiKey(self.nexusAPIKey.text())) gbNexusModsAPILayout.addWidget(self.nexusAPIKey) self.nexusAPIKeyInfo = QLabel('🌐', self) self.nexusAPIKeyInfo.setOpenExternalLinks(True) self.nexusAPIKeyInfo.setWordWrap(True) self.nexusAPIKeyInfo.setContentsMargins(4, 4, 4, 4) self.nexusAPIKeyInfo.setMinimumHeight(48) gbNexusModsAPILayout.addWidget(self.nexusAPIKeyInfo) self.nexusGetInfo = QCheckBox('Get Mod details after adding a new mod', self) self.nexusGetInfo.setChecked( settings.value('nexusGetInfo', 'True') == 'True') self.nexusGetInfo.setDisabled(True) gbNexusModsAPILayout.addWidget(self.nexusGetInfo) self.nexusCheckUpdates = QCheckBox('Check for Mod updates on startup', self) self.nexusCheckUpdates.setChecked( settings.value('nexusCheckUpdates', 'False') == 'True') self.nexusCheckUpdates.setDisabled(True) gbNexusModsAPILayout.addWidget(self.nexusCheckUpdates) self.nexusCheckClipboard = QCheckBox( 'Monitor the Clipboard for Nexus Mods URLs', self) self.nexusCheckClipboard.setChecked( settings.value('nexusCheckClipboard', 'False') == 'True') self.nexusCheckClipboard.setDisabled(True) gbNexusModsAPILayout.addWidget(self.nexusCheckClipboard) # Output gbOutput = QGroupBox('Output Preferences', self) mainLayout.addWidget(gbOutput) gbOutputLayout = QVBoxLayout(gbOutput) self.unhideOutput = QCheckBox('Auto-show output panel', self) self.unhideOutput.setChecked( settings.value('unhideOutput', 'True') == 'True') gbOutputLayout.addWidget(self.unhideOutput) self.debugOutput = QCheckBox('Show debug output', self) self.debugOutput.setChecked( settings.value('debugOutput', 'False') == 'True') gbOutputLayout.addWidget(self.debugOutput) # Actions actionsLayout = QHBoxLayout() actionsLayout.setAlignment(Qt.AlignRight) self.save = QPushButton('Save', self) self.save.clicked.connect(self.saveEvent) self.save.setAutoDefault(True) self.save.setDefault(True) actionsLayout.addWidget(self.save) cancel = QPushButton('Cancel', self) cancel.clicked.connect(self.cancelEvent) actionsLayout.addWidget(cancel) mainLayout.addLayout(actionsLayout) # Setup if not settings.value('gamePath'): self.locateGameEvent() self.setMinimumSize(QSize(440, 440)) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.validGamePath = False self.validConfigPath = False self.validNexusAPIKey = False self.validScriptMergerPath = False self.validateGamePath(self.gamePath.text()) self.validateConfigPath(self.configPath.text()) self.validateApiKey(self.nexusAPIKey.text()) self.validateScriptMergerPath(self.scriptMergerPath.text()) self.updateSaveButton() self.finished.connect( lambda: self.validateApiKey.cancel()) # type: ignore def saveEvent(self) -> None: settings = QSettings() settings.setValue('settingsWindowGeometry', self.saveGeometry()) settings.setValue('gamePath', self.gamePath.text()) settings.setValue('configPath', self.configPath.text()) settings.setValue('scriptMergerPath', self.scriptMergerPath.text()) settings.setValue('nexusAPIKey', self.nexusAPIKey.text()) settings.setValue('nexusGetInfo', str(self.nexusGetInfo.isChecked())) settings.setValue('nexusCheckUpdates', str(self.nexusCheckUpdates.isChecked())) settings.setValue('nexusCheckClipboard', str(self.nexusCheckClipboard.isChecked())) settings.setValue('debugOutput', str(self.debugOutput.isChecked())) settings.setValue('unhideOutput', str(self.unhideOutput.isChecked())) self.close() def cancelEvent(self) -> None: self.close() def selectGameEvent(self) -> None: dialog: QFileDialog = QFileDialog(self, 'Select witcher3.exe', '', 'The Witcher 3 (witcher3.exe)') dialog.setOptions(QFileDialog.ReadOnly) dialog.setFileMode(QFileDialog.ExistingFile) if (dialog.exec_()): if dialog.selectedFiles(): self.gamePath.setText(dialog.selectedFiles()[0]) def selectConfigEvent(self) -> None: dialog: QFileDialog = QFileDialog(self, 'Select config folder', '', 'The Witcher 3') dialog.setOptions(QFileDialog.ReadOnly) dialog.setFileMode(QFileDialog.Directory) if (dialog.exec_()): if dialog.selectedFiles(): self.configPath.setText(dialog.selectedFiles()[0]) def selectScriptMergerEvent(self) -> None: dialog: QFileDialog = QFileDialog( self, 'Select WitcherScriptMerger.exe', '', 'Script Merger (WitcherScriptMerger.exe)') dialog.setOptions(QFileDialog.ReadOnly) dialog.setFileMode(QFileDialog.ExistingFile) if (dialog.exec_()): if dialog.selectedFiles(): self.scriptMergerPath.setText(dialog.selectedFiles()[0]) def locateGameEvent(self) -> None: game = fetcher.findGamePath() if game: self.gamePath.setText(str(game)) else: self.gamePathInfo.setText(''' <font color="#888"> Could not detect The Witcher 3!<br> Please make sure the game is installed, or set the path manually. </font>''') def locateConfigEvent(self) -> None: config = fetcher.findConfigPath() if config: self.configPath.setText(str(config)) else: self.configPathInfo.setText(''' <font color="#888"> Could not detect a valid config path! Please make sure the The Witcher 3 was started at least once, or set the path manually. </font>''') def locateScriptMergerEvent(self) -> None: scriptmerger = findScriptMergerPath() if scriptmerger: self.scriptMergerPath.setText(str(scriptmerger)) else: self.scriptMergerPathInfo.setText(''' <font color="#888"> Could not detect Script Merger! Please make sure Script Merger is running,<br> or set the path manually. Download Script Merger <a href="https://www.nexusmods.com/witcher3/mods/484">here</a>. </font>''') def validateGamePath(self, text: str) -> bool: # validate game installation path if not verifyGamePath(Path(text)): self.gamePath.setStyleSheet(''' *{ border: 1px solid #B22222; padding: 1px 0px; } ''') self.gamePathInfo.setText( '<font color="#888">Please enter a valid game path.</font>') self.validGamePath = False self.locateGame.setDisabled(False) self.updateSaveButton() return False else: self.gamePath.setStyleSheet('') self.gamePathInfo.setText( '<font color="#888">Everything looks good!</font>') self.validGamePath = True self.locateGame.setDisabled(True) self.updateSaveButton() return True def validateConfigPath(self, text: str) -> bool: # validate game config path if not verifyConfigPath(Path(text)): self.configPath.setStyleSheet(''' *{ border: 1px solid #B22222; padding: 1px 0px; } ''') self.configPathInfo.setText('''<font color="#888"> Please enter a valid config path. You need to start the The Witcher 3 at least once to generate the necessary user.settings and input.settings files.</font> ''') self.validConfigPath = False self.locateConfig.setDisabled(False) self.updateSaveButton() return False else: self.configPath.setStyleSheet('') self.configPathInfo.setText( '<font color="#888">Everything looks good!</font>') self.validConfigPath = True self.locateConfig.setDisabled(True) self.updateSaveButton() return True def validateScriptMergerPath(self, text: str) -> bool: # validate script merger path if not text: self.scriptMergerPath.setStyleSheet('') self.scriptMergerPathInfo.setText(''' <font color="#888">Script Merger is used to resolve conflicts between mods \ by merging scripts and other text files. \ Download Script Merger <a href="https://www.nexusmods.com/witcher3/mods/484">here</a>.</font> ''') self.validScriptMergerPath = True self.updateSaveButton() return True if not verifyScriptMergerPath(Path(text)): self.scriptMergerPath.setStyleSheet(''' *{ border: 1px solid #B22222; padding: 1px 0px; } ''') self.scriptMergerPathInfo.setText( '''<font color="#888">Please enter a valid script merger path.</font> ''') self.validScriptMergerPath = False self.locateScriptMerger.setDisabled(False) self.updateSaveButton() return False else: self.scriptMergerPath.setStyleSheet('') self.scriptMergerPathInfo.setText( '<font color="#888">Everything looks good!</font>') self.validScriptMergerPath = True self.locateScriptMerger.setDisabled(True) self.updateSaveButton() return True @debounce(200, cancel_running=True) async def validateApiKey(self, text: str) -> bool: # validate neus mods api key self.nexusGetInfo.setDisabled(True) self.nexusCheckUpdates.setDisabled(True) self.nexusCheckClipboard.setDisabled(True) self.nexusAPIKey.setStyleSheet('') if not text: self.nexusAPIKeyInfo.setText(''' <font color="#888">The API Key is used to check for mod updates, \ to get mod details and to download mods. \ Get your Personal API Key <a href="https://www.nexusmods.com/users/myaccount?tab=api">here</a>.</font> ''') self.validNexusAPIKey = True self.updateSaveButton() return True self.nexusAPIKeyInfo.setText('🌐') try: apiUser = await getUserInformation(text) except UnauthorizedError: self.nexusAPIKey.setStyleSheet(''' *{ border: 1px solid #B22222; padding: 1px 0px; } ''') self.nexusAPIKeyInfo.setText(''' <font color="#888">Not a valid API Key. \ Get your Personal API Key <a href="https://www.nexusmods.com/users/myaccount?tab=api">here</a>.</font> ''') self.validNexusAPIKey = False self.updateSaveButton() return False except (RequestError, ResponseError, Exception) as e: self.nexusAPIKey.setStyleSheet(''' *{ border: 1px solid #B22222; padding: 1px 0px; } ''') self.nexusAPIKeyInfo.setText(f''' <font color="#888">Could not validate API Key: {str(e) if str(e) else 'Request error'}.</font> ''') self.validNexusAPIKey = False self.updateSaveButton() return False self.nexusAPIKeyInfo.setText( f'<font color="#888">Valid API Key for {apiUser["name"]}!</font>') self.validNexusAPIKey = True self.nexusGetInfo.setDisabled(False) self.nexusCheckUpdates.setDisabled(False) self.nexusCheckClipboard.setDisabled(False) self.updateSaveButton() return True def updateSaveButton(self) -> None: # TODO: release: disable saving invalid settings # self.save.setDisabled(not all(( # self.validConfigPath, # self.validGamePath, # self.validNexusAPIKey, # self.validScriptMergerPath, # ))) # noqa self.save.setDisabled(False)
class IncomeSpendingWidget(AbstractOperationDetails): def __init__(self, parent=None): AbstractOperationDetails.__init__(self, parent) self.name = "Income/Spending" self.details_model = None self.category_delegate = CategorySelectorDelegate() self.tag_delegate = TagSelectorDelegate() self.float_delegate = FloatDelegate(2) self.date_label = QLabel(self) self.details_label = QLabel(self) self.account_label = QLabel(self) self.peer_label = QLabel(self) self.main_label.setText(self.tr("Income / Spending")) self.date_label.setText(self.tr("Date/Time")) self.details_label.setText(self.tr("Details")) self.account_label.setText(self.tr("Account")) self.peer_label.setText(self.tr("Peer")) self.timestamp_editor = QDateTimeEdit(self) self.timestamp_editor.setCalendarPopup(True) self.timestamp_editor.setTimeSpec(Qt.UTC) self.timestamp_editor.setFixedWidth( self.timestamp_editor.fontMetrics().horizontalAdvance( "00/00/0000 00:00:00") * 1.25) self.timestamp_editor.setDisplayFormat("dd/MM/yyyy hh:mm:ss") self.account_widget = AccountSelector(self) self.peer_widget = PeerSelector(self) self.a_currency = OptionalCurrencyComboBox(self) self.a_currency.setText(self.tr("Paid in foreign currency:")) self.add_button = QPushButton(load_icon("add.png"), '', self) self.add_button.setToolTip(self.tr("Add detail")) self.del_button = QPushButton(load_icon("remove.png"), '', self) self.del_button.setToolTip(self.tr("Remove detail")) self.copy_button = QPushButton(load_icon("copy.png"), '', self) self.copy_button.setToolTip(self.tr("Copy detail")) self.details_table = QTableView(self) self.details_table.horizontalHeader().setFont(self.bold_font) self.details_table.setAlternatingRowColors(True) self.details_table.verticalHeader().setVisible(False) self.details_table.verticalHeader().setMinimumSectionSize(20) self.details_table.verticalHeader().setDefaultSectionSize(20) self.layout.addWidget(self.date_label, 1, 0, 1, 1, Qt.AlignLeft) self.layout.addWidget(self.details_label, 2, 0, 1, 1, Qt.AlignLeft) self.layout.addWidget(self.timestamp_editor, 1, 1, 1, 4) self.layout.addWidget(self.add_button, 2, 1, 1, 1) self.layout.addWidget(self.copy_button, 2, 2, 1, 1) self.layout.addWidget(self.del_button, 2, 3, 1, 1) self.layout.addWidget(self.account_label, 1, 5, 1, 1, Qt.AlignRight) self.layout.addWidget(self.peer_label, 2, 5, 1, 1, Qt.AlignRight) self.layout.addWidget(self.account_widget, 1, 6, 1, 1) self.layout.addWidget(self.peer_widget, 2, 6, 1, 1) self.layout.addWidget(self.a_currency, 1, 7, 1, 1) self.layout.addWidget(self.commit_button, 0, 9, 1, 1) self.layout.addWidget(self.revert_button, 0, 10, 1, 1) self.layout.addWidget(self.details_table, 4, 0, 1, 11) self.layout.addItem(self.horizontalSpacer, 1, 8, 1, 1) self.add_button.clicked.connect(self.addChild) self.copy_button.clicked.connect(self.copyChild) self.del_button.clicked.connect(self.delChild) super()._init_db("actions") self.model.beforeInsert.connect(self.before_record_insert) self.model.beforeUpdate.connect(self.before_record_update) self.mapper.setItemDelegate(IncomeSpendingWidgetDelegate(self.mapper)) self.details_model = DetailsModel(self.details_table, db_connection()) self.details_model.setTable("action_details") self.details_model.setEditStrategy(QSqlTableModel.OnManualSubmit) self.details_table.setModel(self.details_model) self.details_model.dataChanged.connect(self.onDataChange) self.account_widget.changed.connect(self.mapper.submit) self.peer_widget.changed.connect(self.mapper.submit) self.a_currency.changed.connect(self.mapper.submit) self.a_currency.name_updated.connect(self.details_model.setAltCurrency) self.mapper.addMapping(self.timestamp_editor, self.model.fieldIndex("timestamp")) self.mapper.addMapping(self.account_widget, self.model.fieldIndex("account_id")) self.mapper.addMapping(self.peer_widget, self.model.fieldIndex("peer_id")) self.mapper.addMapping(self.a_currency, self.model.fieldIndex("alt_currency_id")) self.details_table.setItemDelegateForColumn(2, self.category_delegate) self.details_table.setItemDelegateForColumn(3, self.tag_delegate) self.details_table.setItemDelegateForColumn(4, self.float_delegate) self.details_table.setItemDelegateForColumn(5, self.float_delegate) self.model.select() self.details_model.select() self.details_model.configureView() def setId(self, id): super().setId(id) self.details_model.setFilter(f"action_details.pid = {id}") @Slot() def addChild(self): new_record = self.details_model.record() new_record.setNull("tag_id") new_record.setValue("amount", 0) new_record.setValue("amount_alt", 0) if not self.details_model.insertRecord(-1, new_record): logging.fatal( self.tr("Failed to add new record: ") + self.details_model.lastError().text()) return @Slot() def copyChild(self): idx = self.details_table.selectionModel().selection().indexes() src_record = self.details_model.record(idx[0].row()) new_record = self.details_model.record() new_record.setValue("category_id", src_record.value("category_id")) if src_record.value("tag_id"): new_record.setValue("tag_id", src_record.value("tag_id")) else: new_record.setNull("tag_id") new_record.setValue("amount", src_record.value("amount")) new_record.setValue("amount_alt", src_record.value("amount_alt")) new_record.setValue("note", src_record.value("note")) if not self.details_model.insertRecord(-1, new_record): logging.fatal( self.tr("Failed to add new record: ") + self.details_model.lastError().text()) return @Slot() def delChild(self): selection = self.details_table.selectionModel().selection().indexes() for idx in selection: self.details_model.removeRow(idx.row()) self.onDataChange(idx, idx, None) @Slot() def saveChanges(self): if not self.model.submitAll(): logging.fatal( self.tr("Operation submit failed: ") + self.model.lastError().text()) return pid = self.model.data(self.model.index(0, self.model.fieldIndex("id"))) if pid is None: # we just have saved new action record and need last inserted id pid = self.model.query().lastInsertId() for row in range(self.details_model.rowCount()): self.details_model.setData( self.details_model.index(row, self.details_model.fieldIndex("pid")), pid) if not self.details_model.submitAll(): logging.fatal( self.tr("Operation details submit failed: ") + self.details_model.lastError().text()) return self.modified = False self.commit_button.setEnabled(False) self.revert_button.setEnabled(False) self.dbUpdated.emit() @Slot() def revertChanges(self): self.model.revertAll() self.details_model.revertAll() self.modified = False self.commit_button.setEnabled(False) self.revert_button.setEnabled(False) def createNew(self, account_id=0): super().createNew(account_id) self.details_model.setFilter(f"action_details.pid = 0") def prepareNew(self, account_id): new_record = self.model.record() new_record.setNull("id") new_record.setValue( "timestamp", int(datetime.now().replace(tzinfo=tz.tzutc()).timestamp())) new_record.setValue("account_id", account_id) new_record.setValue("peer_id", 0) new_record.setValue("alt_currency_id", None) return new_record def copyNew(self): old_id = self.model.record(self.mapper.currentIndex()).value(0) super().copyNew() self.details_model.setFilter(f"action_details.pid = 0") query = executeSQL( "SELECT * FROM action_details WHERE pid = :pid ORDER BY id DESC", [(":pid", old_id)]) while query.next(): new_record = query.record() new_record.setNull("id") new_record.setNull("pid") assert self.details_model.insertRows(0, 1) self.details_model.setRecord(0, new_record) def copyToNew(self, row): new_record = self.model.record(row) new_record.setNull("id") new_record.setValue( "timestamp", int(datetime.now().replace(tzinfo=tz.tzutc()).timestamp())) return new_record def before_record_insert(self, record): if record.value("alt_currency_id") == 0: record.setNull("alt_currency_id") def before_record_update(self, _row, record): self.before_record_insert( record) # processing is the same as before insert
class Ui_TaxWidget(object): def setupUi(self, TaxWidget): if not TaxWidget.objectName(): TaxWidget.setObjectName(u"TaxWidget") TaxWidget.resize(696, 408) self.gridLayout = QGridLayout(TaxWidget) self.gridLayout.setObjectName(u"gridLayout") self.AccountLbl = QLabel(TaxWidget) self.AccountLbl.setObjectName(u"AccountLbl") self.gridLayout.addWidget(self.AccountLbl, 1, 0, 1, 1) self.AccountWidget = AccountSelector(TaxWidget) self.AccountWidget.setObjectName(u"AccountWidget") self.gridLayout.addWidget(self.AccountWidget, 1, 1, 1, 2) self.YearLbl = QLabel(TaxWidget) self.YearLbl.setObjectName(u"YearLbl") self.gridLayout.addWidget(self.YearLbl, 0, 0, 1, 1) self.Year = QSpinBox(TaxWidget) self.Year.setObjectName(u"Year") self.Year.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.Year.setMinimum(2010) self.Year.setMaximum(2030) self.Year.setValue(2020) self.gridLayout.addWidget(self.Year, 0, 1, 1, 2) self.verticalSpacer = QSpacerItem(20, 52, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 8, 0, 1, 1) self.line = QFrame(TaxWidget) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.gridLayout.addWidget(self.line, 3, 0, 1, 3) self.DlsgGroup = QGroupBox(TaxWidget) self.DlsgGroup.setObjectName(u"DlsgGroup") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.DlsgGroup.sizePolicy().hasHeightForWidth()) self.DlsgGroup.setSizePolicy(sizePolicy) self.DlsgGroup.setFlat(False) self.DlsgGroup.setCheckable(True) self.DlsgGroup.setChecked(False) self.gridLayout_2 = QGridLayout(self.DlsgGroup) self.gridLayout_2.setSpacing(2) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(6, 6, 6, 6) self.DlsgFileLbl = QLabel(self.DlsgGroup) self.DlsgFileLbl.setObjectName(u"DlsgFileLbl") self.gridLayout_2.addWidget(self.DlsgFileLbl, 0, 0, 1, 1) self.IncomeSourceBroker = QCheckBox(self.DlsgGroup) self.IncomeSourceBroker.setObjectName(u"IncomeSourceBroker") self.IncomeSourceBroker.setChecked(True) self.gridLayout_2.addWidget(self.IncomeSourceBroker, 1, 0, 1, 3) self.DividendsOnly = QCheckBox(self.DlsgGroup) self.DividendsOnly.setObjectName(u"DividendsOnly") self.gridLayout_2.addWidget(self.DividendsOnly, 2, 0, 1, 3) self.DlsgSelectBtn = QPushButton(self.DlsgGroup) self.DlsgSelectBtn.setObjectName(u"DlsgSelectBtn") self.gridLayout_2.addWidget(self.DlsgSelectBtn, 0, 2, 1, 1) self.DlsgFileName = QLineEdit(self.DlsgGroup) self.DlsgFileName.setObjectName(u"DlsgFileName") self.gridLayout_2.addWidget(self.DlsgFileName, 0, 1, 1, 1) self.gridLayout.addWidget(self.DlsgGroup, 5, 0, 1, 3) self.XlsFileLbl = QLabel(TaxWidget) self.XlsFileLbl.setObjectName(u"XlsFileLbl") self.gridLayout.addWidget(self.XlsFileLbl, 2, 0, 1, 1) self.XlsFileName = QLineEdit(TaxWidget) self.XlsFileName.setObjectName(u"XlsFileName") sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.XlsFileName.sizePolicy().hasHeightForWidth()) self.XlsFileName.setSizePolicy(sizePolicy1) self.gridLayout.addWidget(self.XlsFileName, 2, 1, 1, 1) self.XlsSelectBtn = QPushButton(TaxWidget) self.XlsSelectBtn.setObjectName(u"XlsSelectBtn") sizePolicy2 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.XlsSelectBtn.sizePolicy().hasHeightForWidth()) self.XlsSelectBtn.setSizePolicy(sizePolicy2) self.gridLayout.addWidget(self.XlsSelectBtn, 2, 2, 1, 1) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout.addItem(self.horizontalSpacer, 5, 3, 1, 1) self.NoSettlement = QCheckBox(TaxWidget) self.NoSettlement.setObjectName(u"NoSettlement") self.gridLayout.addWidget(self.NoSettlement, 6, 0, 1, 4) self.SaveButton = QPushButton(TaxWidget) self.SaveButton.setObjectName(u"SaveButton") self.gridLayout.addWidget(self.SaveButton, 7, 2, 1, 1) self.WarningLbl = QLabel(TaxWidget) self.WarningLbl.setObjectName(u"WarningLbl") font = QFont() font.setItalic(True) self.WarningLbl.setFont(font) self.gridLayout.addWidget(self.WarningLbl, 4, 0, 1, 3) self.retranslateUi(TaxWidget) QMetaObject.connectSlotsByName(TaxWidget) # setupUi def retranslateUi(self, TaxWidget): TaxWidget.setWindowTitle(QCoreApplication.translate("TaxWidget", u"Taxes", None)) self.AccountLbl.setText(QCoreApplication.translate("TaxWidget", u"Account:", None)) #if QT_CONFIG(tooltip) self.AccountWidget.setToolTip(QCoreApplication.translate("TaxWidget", u"Foreign account to prepare tax report for", None)) #endif // QT_CONFIG(tooltip) self.YearLbl.setText(QCoreApplication.translate("TaxWidget", u"Year:", None)) self.Year.setSuffix("") self.DlsgGroup.setTitle(QCoreApplication.translate("TaxWidget", u"Create tax form in \"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\" program format (*.dcX)", None)) self.DlsgFileLbl.setText(QCoreApplication.translate("TaxWidget", u"Output file:", None)) self.IncomeSourceBroker.setText(QCoreApplication.translate("TaxWidget", u"Use broker name as income source", None)) self.DividendsOnly.setText(QCoreApplication.translate("TaxWidget", u"Update only information about dividends", None)) #if QT_CONFIG(tooltip) self.DlsgSelectBtn.setToolTip(QCoreApplication.translate("TaxWidget", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.DlsgSelectBtn.setText(QCoreApplication.translate("TaxWidget", u" ... ", None)) #if QT_CONFIG(tooltip) self.DlsgFileName.setToolTip(QCoreApplication.translate("TaxWidget", u"File where to store russian tax form", None)) #endif // QT_CONFIG(tooltip) self.XlsFileLbl.setText(QCoreApplication.translate("TaxWidget", u"Excel file:", None)) #if QT_CONFIG(tooltip) self.XlsFileName.setToolTip(QCoreApplication.translate("TaxWidget", u"File where to store tax report in Excel format", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(tooltip) self.XlsSelectBtn.setToolTip(QCoreApplication.translate("TaxWidget", u"Select file", None)) #endif // QT_CONFIG(tooltip) self.XlsSelectBtn.setText(QCoreApplication.translate("TaxWidget", u"...", None)) self.NoSettlement.setText(QCoreApplication.translate("TaxWidget", u"Do not use settlement date for currency rates", None)) self.SaveButton.setText(QCoreApplication.translate("TaxWidget", u"Save Report", None)) self.WarningLbl.setText(QCoreApplication.translate("TaxWidget", u"Below functions are experimental - use it with care", None))
class Ui_OperationsWidget(object): def setupUi(self, OperationsWidget): if not OperationsWidget.objectName(): OperationsWidget.setObjectName(u"OperationsWidget") OperationsWidget.resize(1232, 552) self.verticalLayout_4 = QVBoxLayout(OperationsWidget) self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.BalanceOperationsSplitter = QSplitter(OperationsWidget) self.BalanceOperationsSplitter.setObjectName( u"BalanceOperationsSplitter") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BalanceOperationsSplitter.sizePolicy().hasHeightForWidth()) self.BalanceOperationsSplitter.setSizePolicy(sizePolicy) self.BalanceOperationsSplitter.setOrientation(Qt.Horizontal) self.BalanceBox = QGroupBox(self.BalanceOperationsSplitter) self.BalanceBox.setObjectName(u"BalanceBox") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(1) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.BalanceBox.sizePolicy().hasHeightForWidth()) self.BalanceBox.setSizePolicy(sizePolicy1) self.BalanceBox.setMaximumSize(QSize(16777215, 16777215)) self.verticalLayout = QVBoxLayout(self.BalanceBox) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.BalanceConfigFrame = QFrame(self.BalanceBox) self.BalanceConfigFrame.setObjectName(u"BalanceConfigFrame") self.BalanceConfigFrame.setMinimumSize(QSize(408, 0)) self.BalanceConfigFrame.setMaximumSize(QSize(16777215, 44)) self.BalanceConfigFrame.setFrameShape(QFrame.Panel) self.BalanceConfigFrame.setFrameShadow(QFrame.Plain) self.BalanceConfigFrame.setLineWidth(0) self.horizontalLayout_2 = QHBoxLayout(self.BalanceConfigFrame) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2) self.BalanceDate = QDateEdit(self.BalanceConfigFrame) self.BalanceDate.setObjectName(u"BalanceDate") self.BalanceDate.setDateTime( QDateTime(QDate(2020, 11, 25), QTime(21, 0, 0))) self.BalanceDate.setCalendarPopup(True) self.BalanceDate.setTimeSpec(Qt.UTC) self.horizontalLayout_2.addWidget(self.BalanceDate) self.CurrencyLbl = QLabel(self.BalanceConfigFrame) self.CurrencyLbl.setObjectName(u"CurrencyLbl") self.CurrencyLbl.setLayoutDirection(Qt.LeftToRight) self.CurrencyLbl.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.horizontalLayout_2.addWidget(self.CurrencyLbl) self.BalancesCurrencyCombo = CurrencyComboBox(self.BalanceConfigFrame) self.BalancesCurrencyCombo.setObjectName(u"BalancesCurrencyCombo") self.horizontalLayout_2.addWidget(self.BalancesCurrencyCombo) self.ShowInactiveCheckBox = QCheckBox(self.BalanceConfigFrame) self.ShowInactiveCheckBox.setObjectName(u"ShowInactiveCheckBox") self.horizontalLayout_2.addWidget(self.ShowInactiveCheckBox) self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_2.addItem(self.horizontalSpacer_2) self.verticalLayout.addWidget(self.BalanceConfigFrame) self.BalancesTableView = QTableView(self.BalanceBox) self.BalancesTableView.setObjectName(u"BalancesTableView") self.BalancesTableView.setFrameShape(QFrame.Panel) self.BalancesTableView.setEditTriggers( QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.BalancesTableView.setAlternatingRowColors(True) self.BalancesTableView.setSelectionMode(QAbstractItemView.NoSelection) self.BalancesTableView.setGridStyle(Qt.DotLine) self.BalancesTableView.setWordWrap(False) self.BalancesTableView.verticalHeader().setVisible(False) self.BalancesTableView.verticalHeader().setMinimumSectionSize(20) self.BalancesTableView.verticalHeader().setDefaultSectionSize(20) self.verticalLayout.addWidget(self.BalancesTableView) self.BalanceOperationsSplitter.addWidget(self.BalanceBox) self.OperationsBox = QGroupBox(self.BalanceOperationsSplitter) self.OperationsBox.setObjectName(u"OperationsBox") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(4) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.OperationsBox.sizePolicy().hasHeightForWidth()) self.OperationsBox.setSizePolicy(sizePolicy2) self.OperationsBox.setContextMenuPolicy(Qt.DefaultContextMenu) self.verticalLayout_2 = QVBoxLayout(self.OperationsBox) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.OperationConfigFrame = QFrame(self.OperationsBox) self.OperationConfigFrame.setObjectName(u"OperationConfigFrame") self.OperationConfigFrame.setEnabled(True) self.OperationConfigFrame.setMinimumSize(QSize(0, 0)) self.OperationConfigFrame.setFrameShape(QFrame.Panel) self.OperationConfigFrame.setFrameShadow(QFrame.Plain) self.OperationConfigFrame.setLineWidth(0) self.horizontalLayout_3 = QHBoxLayout(self.OperationConfigFrame) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(2, 2, 2, 2) self.DateRange = DateRangeSelector(self.OperationConfigFrame) self.DateRange.setObjectName(u"DateRange") self.DateRange.setProperty("ItemsList", u"week;month;quarter;year;all") self.horizontalLayout_3.addWidget(self.DateRange) self.AccountLbl = QLabel(self.OperationConfigFrame) self.AccountLbl.setObjectName(u"AccountLbl") self.horizontalLayout_3.addWidget(self.AccountLbl) self.ChooseAccountBtn = AccountButton(self.OperationConfigFrame) self.ChooseAccountBtn.setObjectName(u"ChooseAccountBtn") self.horizontalLayout_3.addWidget(self.ChooseAccountBtn) self.SearchLbl = QLabel(self.OperationConfigFrame) self.SearchLbl.setObjectName(u"SearchLbl") self.horizontalLayout_3.addWidget(self.SearchLbl) self.SearchString = QLineEdit(self.OperationConfigFrame) self.SearchString.setObjectName(u"SearchString") self.horizontalLayout_3.addWidget(self.SearchString) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_3.addItem(self.horizontalSpacer) self.verticalLayout_2.addWidget(self.OperationConfigFrame) self.OperationsDetailsSplitter = QSplitter(self.OperationsBox) self.OperationsDetailsSplitter.setObjectName( u"OperationsDetailsSplitter") self.OperationsDetailsSplitter.setOrientation(Qt.Vertical) self.OperationsTableView = QTableView(self.OperationsDetailsSplitter) self.OperationsTableView.setObjectName(u"OperationsTableView") sizePolicy3 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(4) sizePolicy3.setHeightForWidth( self.OperationsTableView.sizePolicy().hasHeightForWidth()) self.OperationsTableView.setSizePolicy(sizePolicy3) self.OperationsTableView.setAlternatingRowColors(True) self.OperationsTableView.setSelectionMode( QAbstractItemView.ExtendedSelection) self.OperationsTableView.setSelectionBehavior( QAbstractItemView.SelectRows) self.OperationsTableView.setWordWrap(False) self.OperationsDetailsSplitter.addWidget(self.OperationsTableView) self.OperationsTableView.verticalHeader().setVisible(False) self.OperationsTableView.verticalHeader().setMinimumSectionSize(20) self.OperationsTableView.verticalHeader().setDefaultSectionSize(20) self.OperationDetails = QFrame(self.OperationsDetailsSplitter) self.OperationDetails.setObjectName(u"OperationDetails") sizePolicy4 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(1) sizePolicy4.setHeightForWidth( self.OperationDetails.sizePolicy().hasHeightForWidth()) self.OperationDetails.setSizePolicy(sizePolicy4) self.OperationDetails.setMinimumSize(QSize(0, 100)) self.OperationDetails.setMaximumSize(QSize(16777215, 300)) self.OperationDetails.setFrameShape(QFrame.Panel) self.OperationDetails.setFrameShadow(QFrame.Sunken) self.OperationDetails.setLineWidth(1) self.horizontalLayout_4 = QHBoxLayout(self.OperationDetails) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.OperationsTabs = QStackedWidget(self.OperationDetails) self.OperationsTabs.setObjectName(u"OperationsTabs") self.NoOperation = QWidget() self.NoOperation.setObjectName(u"NoOperation") self.OperationsTabs.addWidget(self.NoOperation) self.IncomeSpending = IncomeSpendingWidget() self.IncomeSpending.setObjectName(u"IncomeSpending") self.OperationsTabs.addWidget(self.IncomeSpending) self.Dividend = DividendWidget() self.Dividend.setObjectName(u"Dividend") self.OperationsTabs.addWidget(self.Dividend) self.Trade = TradeWidget() self.Trade.setObjectName(u"Trade") self.OperationsTabs.addWidget(self.Trade) self.Transfer = TransferWidget() self.Transfer.setObjectName(u"Transfer") self.OperationsTabs.addWidget(self.Transfer) self.CorporateAction = CorporateActionWidget() self.CorporateAction.setObjectName(u"CorporateAction") self.OperationsTabs.addWidget(self.CorporateAction) self.horizontalLayout_4.addWidget(self.OperationsTabs) self.OperationsButtons = QFrame(self.OperationDetails) self.OperationsButtons.setObjectName(u"OperationsButtons") self.verticalLayout_3 = QVBoxLayout(self.OperationsButtons) self.verticalLayout_3.setSpacing(2) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(2, 2, 2, 2) self.NewOperationBtn = QPushButton(self.OperationsButtons) self.NewOperationBtn.setObjectName(u"NewOperationBtn") self.verticalLayout_3.addWidget(self.NewOperationBtn) self.CopyOperationBtn = QPushButton(self.OperationsButtons) self.CopyOperationBtn.setObjectName(u"CopyOperationBtn") self.verticalLayout_3.addWidget(self.CopyOperationBtn) self.DeleteOperationBtn = QPushButton(self.OperationsButtons) self.DeleteOperationBtn.setObjectName(u"DeleteOperationBtn") self.verticalLayout_3.addWidget(self.DeleteOperationBtn) self.verticalSpacer_4 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_3.addItem(self.verticalSpacer_4) self.horizontalLayout_4.addWidget(self.OperationsButtons) self.OperationsDetailsSplitter.addWidget(self.OperationDetails) self.verticalLayout_2.addWidget(self.OperationsDetailsSplitter) self.BalanceOperationsSplitter.addWidget(self.OperationsBox) self.verticalLayout_4.addWidget(self.BalanceOperationsSplitter) self.retranslateUi(OperationsWidget) self.OperationsTabs.setCurrentIndex(5) QMetaObject.connectSlotsByName(OperationsWidget) # setupUi def retranslateUi(self, OperationsWidget): OperationsWidget.setWindowTitle( QCoreApplication.translate("OperationsWidget", u"Operations & Balances", None)) self.BalanceBox.setTitle( QCoreApplication.translate("OperationsWidget", u"Balances", None)) self.BalanceDate.setDisplayFormat( QCoreApplication.translate("OperationsWidget", u"dd/MM/yyyy", None)) self.CurrencyLbl.setText( QCoreApplication.translate("OperationsWidget", u"Sum Currency:", None)) self.ShowInactiveCheckBox.setText( QCoreApplication.translate("OperationsWidget", u"Show &Inactive", None)) self.OperationsBox.setTitle( QCoreApplication.translate("OperationsWidget", u"Operations", None)) self.AccountLbl.setText( QCoreApplication.translate("OperationsWidget", u"Account:", None)) self.SearchLbl.setText( QCoreApplication.translate("OperationsWidget", u"Search:", None)) #if QT_CONFIG(tooltip) self.NewOperationBtn.setToolTip( QCoreApplication.translate("OperationsWidget", u"New operation", None)) #endif // QT_CONFIG(tooltip) self.NewOperationBtn.setText("") #if QT_CONFIG(tooltip) self.CopyOperationBtn.setToolTip( QCoreApplication.translate("OperationsWidget", u"Copy operation", None)) #endif // QT_CONFIG(tooltip) self.CopyOperationBtn.setText("") #if QT_CONFIG(tooltip) self.DeleteOperationBtn.setToolTip( QCoreApplication.translate("OperationsWidget", u"Delete operation", None)) #endif // QT_CONFIG(tooltip) self.DeleteOperationBtn.setText("")