コード例 #1
0
    def initUI(self):
        self.setWindowTitle("合并文件")
        self.setWindowIcon(QIcon(SRC_DIR + "upload.ico"))
        self.logo = QLabel()
        self.logo.setPixmap(QPixmap(SRC_DIR + "logo3.gif"))
        self.logo.setStyleSheet("background-color:rgb(0,153,255);")
        self.logo.setAlignment(Qt.AlignmentFlag.AlignCenter)

        # lable
        self.choose_lb = QLabel("选择文件夹")
        # folder
        self.choose_folder = MyLineEdit(self)
        self.choose_folder.setObjectName("choose_folder")
        self.choose_folder.clicked.connect(self.slot_choose_folder)
        self.status = QLabel(self)

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.StandardButton.Ok
            | QDialogButtonBox.StandardButton.Cancel)
        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("提取")
        self.buttonBox.button(
            QDialogButtonBox.StandardButton.Cancel).setText("关闭")
        self.buttonBox.setStyleSheet(btn_style)

        vbox = QVBoxLayout()
        hbox_head = QHBoxLayout()
        hbox_button = QHBoxLayout()
        hbox_head.addWidget(self.choose_lb)
        hbox_head.addWidget(self.choose_folder)
        hbox_button.addWidget(self.buttonBox)
        vbox.addWidget(self.logo)
        vbox.addStretch(1)
        vbox.addWidget(self.status)
        vbox.addLayout(hbox_head)
        vbox.addStretch(1)
        vbox.addLayout(hbox_button)
        self.setLayout(vbox)
        self.setMinimumWidth(350)

        # 设置信号
        self.buttonBox.accepted.connect(self.slot_btn_ok)
        self.buttonBox.rejected.connect(self.slot_btn_no)
        self.buttonBox.rejected.connect(self.reject)
コード例 #2
0
    def initUI(self):
        self.setWindowTitle("设置")
        logo = QLabel()
        logo.setPixmap(QPixmap(SRC_DIR + "logo2.gif"))
        logo.setStyleSheet("background-color:rgb(255,255,255);")
        logo.setAlignment(Qt.AlignCenter)
        self.download_threads_lb = QLabel("同时下载文件数")
        self.download_threads_var = QLineEdit()
        self.download_threads_var.setPlaceholderText("范围:1-9")
        self.download_threads_var.setToolTip("范围:1-9")
        self.download_threads_var.setInputMask("D")
        self.max_size_lb = QLabel("分卷大小(MB)")
        self.max_size_var = QLineEdit()
        self.max_size_var.setPlaceholderText("普通用户最大100,vip用户根据具体情况设置")
        self.max_size_var.setToolTip("普通用户最大100,vip用户根据具体情况设置")
        self.max_size_var.setInputMask("D99")
        self.timeout_lb = QLabel("请求超时(秒)")
        self.timeout_var = QLineEdit()
        self.timeout_var.setPlaceholderText("范围:1-99")
        self.timeout_var.setToolTip("范围:1-99")
        self.timeout_var.setInputMask("D9")
        self.upload_delay_lb = QLabel("上传延时(秒)")
        self.upload_delay_var = QLineEdit()
        self.upload_delay_var.setPlaceholderText("范围:1-99")
        self.upload_delay_var.setToolTip("范围:1-99")
        self.upload_delay_var.setInputMask("D9")
        self.dl_path_lb = QLabel("下载保存路径")
        self.dl_path_var = MyLineEdit(self)
        self.dl_path_var.clicked.connect(self.set_download_path)
        self.time_fmt_box = QCheckBox("使用[年-月-日]时间格式")
        self.time_fmt_box.setToolTip("文件上传日期显示格式")
        self.to_tray_box = QCheckBox("关闭到系统托盘")
        self.to_tray_box.setToolTip("点击关闭软件按钮是最小化软件至系统托盘")
        self.watch_clipboard_box = QCheckBox("监听系统剪切板")
        self.watch_clipboard_box.setToolTip("检测到系统剪切板中有符合规范的蓝奏链接时自动唤起软件,并提取")
        self.debug_box = QCheckBox("开启调试日志")
        self.debug_box.setToolTip("记录软件 debug 信息至 debug-lanzou-gui.log 文件")
        self.set_pwd_box = QCheckBox("上传文件自动设置密码")
        self.set_pwd_var = AutoResizingTextEdit()
        self.set_pwd_var.setPlaceholderText(" 2-8 位数字或字母")
        self.set_pwd_var.setToolTip("2-8 位数字或字母")
        self.set_desc_box = QCheckBox("上传文件自动设置描述")
        self.set_desc_var = AutoResizingTextEdit()
        self.big_file_box = QCheckBox(f"允许上传超过 {self.max_size}MB 的大文件")
        self.big_file_box.setToolTip("开启大文件上传支持 (功能下线)")
        self.upgrade_box = QCheckBox("自动检测新版本")
        self.upgrade_box.setToolTip("在软件打开时自动检测是否有新的版本发布,如有则弹出更新信息")

        self.time_fmt_box.toggle()
        self.time_fmt_box.stateChanged.connect(self.change_time_fmt)
        self.to_tray_box.stateChanged.connect(self.change_to_tray)
        self.watch_clipboard_box.stateChanged.connect(
            self.change_watch_clipboard)
        self.debug_box.stateChanged.connect(self.change_debug)
        self.set_pwd_box.stateChanged.connect(self.change_set_pwd)
        self.set_pwd_var.editingFinished.connect(self.check_pwd)
        self.set_desc_box.stateChanged.connect(self.change_set_desc)
        self.big_file_box.stateChanged.connect(self.change_big_file)
        self.upgrade_box.stateChanged.connect(self.change_upgrade)

        buttonBox = QDialogButtonBox()
        buttonBox.setOrientation(Qt.Horizontal)
        buttonBox.setStandardButtons(QDialogButtonBox.Reset
                                     | QDialogButtonBox.Save
                                     | QDialogButtonBox.Cancel)
        buttonBox.button(QDialogButtonBox.Reset).setText("重置")
        buttonBox.button(QDialogButtonBox.Save).setText("保存")
        buttonBox.button(QDialogButtonBox.Cancel).setText("取消")
        buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            lambda: self.set_values(reset=True))
        buttonBox.button(QDialogButtonBox.Save).clicked.connect(self.slot_save)
        buttonBox.rejected.connect(self.reject)

        form = QFormLayout()
        form.setLabelAlignment(Qt.AlignRight)
        form.setSpacing(10)
        form.addRow(self.download_threads_lb, self.download_threads_var)
        form.addRow(self.timeout_lb, self.timeout_var)
        form.addRow(self.upload_delay_lb, self.upload_delay_var)
        form.addRow(self.max_size_lb, self.max_size_var)
        form.addRow(self.dl_path_lb, self.dl_path_var)

        vbox = QVBoxLayout()
        vbox.addWidget(logo)
        vbox.addStretch(1)
        vbox.addLayout(form)
        vbox.addStretch(1)
        hbox = QHBoxLayout()
        hbox.addWidget(self.time_fmt_box)
        hbox.addWidget(self.to_tray_box)
        hbox.addWidget(self.watch_clipboard_box)
        hbox.addWidget(self.debug_box)
        vbox.addLayout(hbox)
        vbox.addStretch(1)
        hbox_2 = QHBoxLayout()
        hbox_2.addWidget(self.set_pwd_box)
        hbox_2.addWidget(self.set_pwd_var)
        vbox.addLayout(hbox_2)
        vbox.addStretch(1)
        hbox_3 = QHBoxLayout()
        hbox_3.addWidget(self.set_desc_box)
        hbox_3.addWidget(self.set_desc_var)
        vbox.addLayout(hbox_3)
        hbox_4 = QHBoxLayout()
        hbox_4.addWidget(self.big_file_box)
        hbox_4.addWidget(self.upgrade_box)
        vbox.addStretch(1)
        vbox.addLayout(hbox_4)
        vbox.addStretch(2)
        vbox.addWidget(buttonBox)
        self.setLayout(vbox)
        self.setMinimumWidth(500)
コード例 #3
0
class SettingDialog(QDialog):
    saved = pyqtSignal()

    def __init__(self, parent=None):
        super(SettingDialog, self).__init__(parent)
        self._config = object
        self.download_threads = 3
        self.max_size = 100
        self.timeout = 5
        self.dl_path = None
        self.time_fmt = False
        self.to_tray = False
        self.watch_clipboard = False
        self.debug = False
        self.set_pwd = False
        self.set_desc = False
        self.upload_delay = 0
        self.allow_big_file = False
        self.upgrade = True
        self.pwd = ""
        self.desc = ""
        self.initUI()
        self.setStyleSheet(dialog_qss_style)

    def open_dialog(self, config):
        """"打开前先更新一下显示界面"""
        self._config = config
        if self._config.name:
            self.setWindowTitle(f"设置 <{self._config.name}>")
        else:
            self.setWindowTitle("设置")
        self.cwd = self._config.path
        self.set_values()
        self.exec()

    def show_values(self):
        """控件显示值"""
        self.download_threads_var.setText(str(self.download_threads))
        self.max_size_var.setText(str(self.max_size))
        self.timeout_var.setText(str(self.timeout))
        self.dl_path_var.setText(str(self.dl_path))
        self.time_fmt_box.setChecked(self.time_fmt)
        self.to_tray_box.setChecked(self.to_tray)
        self.watch_clipboard_box.setChecked(self.watch_clipboard)
        self.debug_box.setChecked(self.debug)
        self.set_pwd_box.setChecked(self.set_pwd)
        self.set_pwd_var.setEnabled(self.set_pwd)
        self.set_pwd_var.setText(self.pwd)
        self.set_desc_box.setChecked(self.set_desc)
        self.set_desc_var.setEnabled(self.set_desc)
        self.set_desc_var.setText(self.desc)
        self.upload_delay_var.setText(str(self.upload_delay))
        self.big_file_box.setChecked(self.allow_big_file)
        self.big_file_box.setText(f"允许上传超过 {self.max_size}MB 的大文件")
        self.big_file_box.setDisabled(True)  # 关闭允许上传大文件设置入口
        self.upgrade_box.setChecked(self.upgrade)

    def set_values(self, reset=False):
        """设置控件对应变量初始值"""
        settings = self._config.default_settings if reset else self._config.settings
        self.download_threads = settings["download_threads"]
        self.max_size = settings["max_size"]
        self.timeout = settings["timeout"]
        self.dl_path = settings["dl_path"]
        self.time_fmt = settings["time_fmt"]
        self.to_tray = settings["to_tray"]
        self.watch_clipboard = settings["watch_clipboard"]
        self.debug = settings["debug"]
        self.set_pwd = settings["set_pwd"]
        self.pwd = settings["pwd"]
        self.set_desc = settings["set_desc"]
        self.desc = settings["desc"]
        self.upload_delay = settings["upload_delay"]
        if 'upgrade' in settings:
            self.upgrade = settings["upgrade"]
        self.show_values()

    def get_values(self) -> dict:
        """读取输入控件的值"""
        if self.download_threads_var.text():
            self.download_threads = int(self.download_threads_var.text())
        if self.max_size_var.text():
            self.max_size = int(self.max_size_var.text())
        if self.timeout_var.text():
            self.timeout = int(self.timeout_var.text())
        if self.upload_delay_var.text():
            self.upload_delay = int(self.upload_delay_var.text())
        self.dl_path = str(self.dl_path_var.text())
        self.pwd = str(self.set_pwd_var.toPlainText())
        self.desc = str(self.set_desc_var.toPlainText())
        return {
            "download_threads": self.download_threads,
            "max_size": self.max_size,
            "timeout": self.timeout,
            "dl_path": self.dl_path,
            "time_fmt": self.time_fmt,
            "to_tray": self.to_tray,
            "watch_clipboard": self.watch_clipboard,
            "debug": self.debug,
            "set_pwd": self.set_pwd,
            "pwd": self.pwd,
            "set_desc": self.set_desc,
            "desc": self.desc,
            "upload_delay": self.upload_delay,
            "allow_big_file": self.allow_big_file,
            "upgrade": self.upgrade
        }

    def initUI(self):
        self.setWindowTitle("设置")
        logo = QLabel()
        logo.setPixmap(QPixmap(SRC_DIR + "logo2.gif"))
        logo.setStyleSheet("background-color:rgb(255,255,255);")
        logo.setAlignment(Qt.AlignCenter)
        self.download_threads_lb = QLabel("同时下载文件数")
        self.download_threads_var = QLineEdit()
        self.download_threads_var.setPlaceholderText("范围:1-9")
        self.download_threads_var.setToolTip("范围:1-9")
        self.download_threads_var.setInputMask("D")
        self.max_size_lb = QLabel("分卷大小(MB)")
        self.max_size_var = QLineEdit()
        self.max_size_var.setPlaceholderText("普通用户最大100,vip用户根据具体情况设置")
        self.max_size_var.setToolTip("普通用户最大100,vip用户根据具体情况设置")
        self.max_size_var.setInputMask("D99")
        self.timeout_lb = QLabel("请求超时(秒)")
        self.timeout_var = QLineEdit()
        self.timeout_var.setPlaceholderText("范围:1-99")
        self.timeout_var.setToolTip("范围:1-99")
        self.timeout_var.setInputMask("D9")
        self.upload_delay_lb = QLabel("上传延时(秒)")
        self.upload_delay_var = QLineEdit()
        self.upload_delay_var.setPlaceholderText("范围:1-99")
        self.upload_delay_var.setToolTip("范围:1-99")
        self.upload_delay_var.setInputMask("D9")
        self.dl_path_lb = QLabel("下载保存路径")
        self.dl_path_var = MyLineEdit(self)
        self.dl_path_var.clicked.connect(self.set_download_path)
        self.time_fmt_box = QCheckBox("使用[年-月-日]时间格式")
        self.time_fmt_box.setToolTip("文件上传日期显示格式")
        self.to_tray_box = QCheckBox("关闭到系统托盘")
        self.to_tray_box.setToolTip("点击关闭软件按钮是最小化软件至系统托盘")
        self.watch_clipboard_box = QCheckBox("监听系统剪切板")
        self.watch_clipboard_box.setToolTip("检测到系统剪切板中有符合规范的蓝奏链接时自动唤起软件,并提取")
        self.debug_box = QCheckBox("开启调试日志")
        self.debug_box.setToolTip("记录软件 debug 信息至 debug-lanzou-gui.log 文件")
        self.set_pwd_box = QCheckBox("上传文件自动设置密码")
        self.set_pwd_var = AutoResizingTextEdit()
        self.set_pwd_var.setPlaceholderText(" 2-8 位数字或字母")
        self.set_pwd_var.setToolTip("2-8 位数字或字母")
        self.set_desc_box = QCheckBox("上传文件自动设置描述")
        self.set_desc_var = AutoResizingTextEdit()
        self.big_file_box = QCheckBox(f"允许上传超过 {self.max_size}MB 的大文件")
        self.big_file_box.setToolTip("开启大文件上传支持 (功能下线)")
        self.upgrade_box = QCheckBox("自动检测新版本")
        self.upgrade_box.setToolTip("在软件打开时自动检测是否有新的版本发布,如有则弹出更新信息")

        self.time_fmt_box.toggle()
        self.time_fmt_box.stateChanged.connect(self.change_time_fmt)
        self.to_tray_box.stateChanged.connect(self.change_to_tray)
        self.watch_clipboard_box.stateChanged.connect(
            self.change_watch_clipboard)
        self.debug_box.stateChanged.connect(self.change_debug)
        self.set_pwd_box.stateChanged.connect(self.change_set_pwd)
        self.set_pwd_var.editingFinished.connect(self.check_pwd)
        self.set_desc_box.stateChanged.connect(self.change_set_desc)
        self.big_file_box.stateChanged.connect(self.change_big_file)
        self.upgrade_box.stateChanged.connect(self.change_upgrade)

        buttonBox = QDialogButtonBox()
        buttonBox.setOrientation(Qt.Horizontal)
        buttonBox.setStandardButtons(QDialogButtonBox.Reset
                                     | QDialogButtonBox.Save
                                     | QDialogButtonBox.Cancel)
        buttonBox.button(QDialogButtonBox.Reset).setText("重置")
        buttonBox.button(QDialogButtonBox.Save).setText("保存")
        buttonBox.button(QDialogButtonBox.Cancel).setText("取消")
        buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            lambda: self.set_values(reset=True))
        buttonBox.button(QDialogButtonBox.Save).clicked.connect(self.slot_save)
        buttonBox.rejected.connect(self.reject)

        form = QFormLayout()
        form.setLabelAlignment(Qt.AlignRight)
        form.setSpacing(10)
        form.addRow(self.download_threads_lb, self.download_threads_var)
        form.addRow(self.timeout_lb, self.timeout_var)
        form.addRow(self.upload_delay_lb, self.upload_delay_var)
        form.addRow(self.max_size_lb, self.max_size_var)
        form.addRow(self.dl_path_lb, self.dl_path_var)

        vbox = QVBoxLayout()
        vbox.addWidget(logo)
        vbox.addStretch(1)
        vbox.addLayout(form)
        vbox.addStretch(1)
        hbox = QHBoxLayout()
        hbox.addWidget(self.time_fmt_box)
        hbox.addWidget(self.to_tray_box)
        hbox.addWidget(self.watch_clipboard_box)
        hbox.addWidget(self.debug_box)
        vbox.addLayout(hbox)
        vbox.addStretch(1)
        hbox_2 = QHBoxLayout()
        hbox_2.addWidget(self.set_pwd_box)
        hbox_2.addWidget(self.set_pwd_var)
        vbox.addLayout(hbox_2)
        vbox.addStretch(1)
        hbox_3 = QHBoxLayout()
        hbox_3.addWidget(self.set_desc_box)
        hbox_3.addWidget(self.set_desc_var)
        vbox.addLayout(hbox_3)
        hbox_4 = QHBoxLayout()
        hbox_4.addWidget(self.big_file_box)
        hbox_4.addWidget(self.upgrade_box)
        vbox.addStretch(1)
        vbox.addLayout(hbox_4)
        vbox.addStretch(2)
        vbox.addWidget(buttonBox)
        self.setLayout(vbox)
        self.setMinimumWidth(500)

    def change_time_fmt(self, state):
        if state == Qt.Checked:
            self.time_fmt = True
        else:
            self.time_fmt = False

    def change_to_tray(self, state):
        if state == Qt.Checked:
            self.to_tray = True
        else:
            self.to_tray = False

    def change_watch_clipboard(self, state):
        if state == Qt.Checked:
            self.watch_clipboard = True
        else:
            self.watch_clipboard = False

    def change_debug(self, state):
        if state == Qt.Checked:
            self.debug = True
        else:
            self.debug = False

    def change_big_file(self, state):
        if state == Qt.Checked:
            self.allow_big_file = True
        else:
            self.allow_big_file = False

    def change_upgrade(self, state):
        if state == Qt.Checked:
            self.upgrade = True
        else:
            self.upgrade = False

    def change_set_pwd(self, state):
        if state == Qt.Checked:
            self.set_pwd = True
            self.set_pwd_var.setDisabled(False)
        else:
            self.set_pwd = False
            self.set_pwd_var.setDisabled(True)

    def change_set_desc(self, state):
        if state == Qt.Checked:
            self.set_desc = True
            self.set_desc_var.setDisabled(False)
        else:
            self.set_desc = False
            self.set_desc_var.setDisabled(True)

    def check_pwd(self):
        pwd = self.set_pwd_var.toPlainText()
        pwd = ''.join(list(filter(str.isalnum, pwd)))
        if len(pwd) < 2:
            pwd = ""
        self.set_pwd_var.setText(pwd[:8])

    def set_download_path(self):
        """设置下载路径"""
        dl_path = QFileDialog.getExistingDirectory(self, "选择文件下载保存文件夹",
                                                   self.cwd)
        dl_path = os.path.normpath(dl_path)  # windows backslash
        if dl_path == self.dl_path or dl_path == ".":
            return None
        self.dl_path_var.setText(dl_path)
        self.dl_path = dl_path

    def slot_save(self):
        """保存槽函数"""
        self._config.settings = self.get_values()
        self.saved.emit()
        self.close()
コード例 #4
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(1000, 650)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.share_tab = QtWidgets.QWidget()
        self.share_tab.setObjectName("share_tab")
        self.share_vlayout = QtWidgets.QVBoxLayout(self.share_tab)
        self.share_vlayout.setObjectName("share_vlayout")
        self.share_hlayout_top = QtWidgets.QHBoxLayout()
        self.share_hlayout_top.setObjectName("share_hlayout_top")
        self.label_share_url = QtWidgets.QLabel(self.share_tab)
        self.label_share_url.setObjectName("label_share_url")
        self.share_hlayout_top.addWidget(self.label_share_url)
        self.line_share_url = QtWidgets.QLineEdit(self.share_tab)
        self.line_share_url.setObjectName("line_share_url")
        self.share_hlayout_top.addWidget(self.line_share_url)
        self.btn_extract = QtWidgets.QPushButton(self.share_tab)
        self.btn_extract.setObjectName("btn_extract")
        self.share_hlayout_top.addWidget(self.btn_extract)
        self.share_vlayout.addLayout(self.share_hlayout_top)
        self.table_share = QtWidgets.QTableView(self.share_tab)
        self.table_share.setObjectName("table_share")
        self.share_vlayout.addWidget(self.table_share)
        self.share_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.share_hlayout_bottom.setObjectName("share_hlayout_bottom")
        self.btn_share_select_all = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_select_all.setObjectName("btn_share_select_all")
        self.share_hlayout_bottom.addWidget(self.btn_share_select_all)
        self.label_dl_path = QtWidgets.QLabel(self.share_tab)
        self.label_dl_path.setObjectName("label_dl_path")
        self.share_hlayout_bottom.addWidget(self.label_dl_path)
        self.share_set_dl_path = MyLineEdit(self.share_tab)
        self.share_set_dl_path.setObjectName("share_set_dl_path")
        self.share_hlayout_bottom.addWidget(self.share_set_dl_path)
        self.btn_share_dl = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_dl.setObjectName("btn_share_dl")
        self.share_hlayout_bottom.addWidget(self.btn_share_dl)
        self.share_vlayout.addLayout(self.share_hlayout_bottom)
        self.tabWidget.addTab(self.share_tab, "")
        self.disk_tab = QtWidgets.QWidget()
        self.disk_tab.setEnabled(True)
        self.disk_tab.setMinimumSize(QtCore.QSize(620, 0))
        self.disk_tab.setObjectName("disk_tab")
        self.disk_vlayout = QtWidgets.QVBoxLayout(self.disk_tab)
        self.disk_vlayout.setObjectName("disk_vlayout")
        self.disk_hlayout_top = QtWidgets.QHBoxLayout()
        self.disk_hlayout_top.setObjectName("disk_hlayout_top")
        self.disk_loc_hbox = QtWidgets.QHBoxLayout()
        self.disk_loc_hbox.setObjectName("disk_loc_hbox")
        self.label_disk_loc = QtWidgets.QLabel(self.disk_tab)
        self.label_disk_loc.setObjectName("label_disk_loc")
        self.disk_loc_hbox.addWidget(self.label_disk_loc)
        self.disk_hlayout_top.addLayout(self.disk_loc_hbox)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_top.addItem(spacerItem)
        self.btn_disk_mkdir = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_mkdir.setObjectName("btn_disk_mkdir")
        self.disk_hlayout_top.addWidget(self.btn_disk_mkdir)
        self.disk_vlayout.addLayout(self.disk_hlayout_top)
        self.table_disk = MyTableView(self.disk_tab)
        self.table_disk.setObjectName("table_disk")
        self.disk_vlayout.addWidget(self.table_disk)
        self.disk_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.disk_hlayout_bottom.setObjectName("disk_hlayout_bottom")
        self.btn_disk_select_all = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_select_all.setObjectName("btn_disk_select_all")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_select_all)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_bottom.addItem(spacerItem1)
        self.btn_disk_delete = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_delete.setObjectName("btn_disk_delete")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_delete)
        self.btn_disk_dl = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_dl.setObjectName("btn_disk_dl")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_dl)
        self.disk_vlayout.addLayout(self.disk_hlayout_bottom)
        self.tabWidget.addTab(self.disk_tab, "")

        self.rec_tab = QtWidgets.QWidget()
        self.rec_tab.setObjectName("rec_tab")
        self.rec_verticalLayout = QtWidgets.QVBoxLayout(self.rec_tab)
        self.rec_verticalLayout.setObjectName("rec_verticalLayout")
        self.rec_horizontalLayout = QtWidgets.QHBoxLayout()
        self.rec_horizontalLayout.setObjectName("rec_horizontalLayout")
        self.btn_rec_select_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_select_all.setObjectName("btn_rec_select_all")
        self.rec_horizontalLayout.addWidget(self.btn_rec_select_all)
        self.btn_recovery = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery.setObjectName("btn_recovery")
        self.rec_horizontalLayout.addWidget(self.btn_recovery)
        self.btn_rec_delete = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_delete.setObjectName("btn_rec_delete")
        self.rec_horizontalLayout.addWidget(self.btn_rec_delete)
        self.rec_horizontalLayout.addStretch(1)
        self.btn_rec_clean = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_clean.setObjectName("btn_rec_clean")
        self.rec_horizontalLayout.addWidget(self.btn_rec_clean)
        self.btn_recovery_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery_all.setObjectName("btn_recovery_all")
        self.rec_horizontalLayout.addWidget(self.btn_recovery_all)
        self.btn_rec_expire_files = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_expire_files.setObjectName("btn_rec_expire_files")
        self.rec_horizontalLayout.addWidget(self.btn_rec_expire_files)
        self.rec_verticalLayout.addLayout(self.rec_horizontalLayout)
        self.table_rec = QtWidgets.QTableView(self.rec_tab)
        self.table_rec.setObjectName("table_rec")
        self.rec_verticalLayout.addWidget(self.table_rec)
        self.tabWidget.addTab(self.rec_tab, "")

        self.jobs_tab = QtWidgets.QWidget()
        self.jobs_tab.setObjectName("jobs_tab")
        self.jobs_verticalLayout = QtWidgets.QVBoxLayout(self.jobs_tab)
        self.jobs_verticalLayout.setObjectName("jobs_verticalLayout")
        self.jobs_horizontalLayout = QtWidgets.QHBoxLayout()
        self.jobs_horizontalLayout.setObjectName("jobs_horizontalLayout")
        self.btn_jobs_start_all = QtWidgets.QPushButton(self.jobs_tab)
        self.btn_jobs_clean_all = QtWidgets.QPushButton(self.jobs_tab)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_start_all)
        self.jobs_horizontalLayout.addStretch(1)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_clean_all)
        self.table_jobs = MyTableView(self.jobs_tab)
        self.table_jobs.setObjectName("table_jobs")
        self.jobs_verticalLayout.addLayout(self.jobs_horizontalLayout)
        self.jobs_verticalLayout.addWidget(self.table_jobs)
        self.tabWidget.addTab(self.jobs_tab, "")

        self.verticalLayout.addWidget(self.tabWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 30))
        self.menubar.setObjectName("menubar")
        self.acount = QtWidgets.QMenu(self.menubar)
        self.acount.setObjectName("acount")
        self.files = QtWidgets.QMenu(self.menubar)
        self.files.setObjectName("files")
        self.help = QtWidgets.QMenu(self.menubar)
        self.help.setObjectName("help")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolbar = QtWidgets.QToolBar(MainWindow)
        self.toolbar.setObjectName("toolbar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar)
        self.login = QtWidgets.QAction(MainWindow)
        self.login.setObjectName("login")
        self.logout = QtWidgets.QAction(MainWindow)
        self.logout.setObjectName("logout")
        self.upload = QtWidgets.QAction(MainWindow)
        self.upload.setObjectName("upload")
        self.download = QtWidgets.QAction(MainWindow)
        self.download.setObjectName("download")
        self.delete = QtWidgets.QAction(MainWindow)
        self.delete.setObjectName("delete")
        self.show_toolbar = QtWidgets.QAction(MainWindow)
        self.show_toolbar.setObjectName("show_toolbar")
        self.setting_menu = QtWidgets.QAction(MainWindow)
        self.setting_menu.setObjectName("setting_menu")
        self.how = QtWidgets.QAction(MainWindow)
        self.how.setObjectName("how")
        self.about = QtWidgets.QAction(MainWindow)
        self.about.setObjectName("about")
        self.acount.addSeparator()
        self.acount.addAction(self.login)
        self.acount.addAction(self.logout)
        self.files.addAction(self.upload)
        self.files.addAction(self.download)
        self.files.addAction(self.delete)
        self.files.addAction(self.show_toolbar)
        self.files.addAction(self.setting_menu)
        self.help.addAction(self.how)
        self.help.addAction(self.about)
        self.menubar.addAction(self.acount.menuAction())
        self.menubar.addAction(self.files.menuAction())
        self.menubar.addAction(self.help.menuAction())
        # 工具栏
        self.toolbar.addAction(self.login)
        # 状态栏
        self.statusbar_msg_label = QtWidgets.QLabel()
        self.statusbar_load_lb = QtWidgets.QLabel()
        self.statusbar_load_movie = QtGui.QMovie(SRC_DIR + "loading_more.gif")
        self.statusbar_load_lb.setMovie(self.statusbar_load_movie)
        self.statusbar_msg_label.setObjectName("msg_label")
        self.statusbar_load_lb.setObjectName("msg_movie_lb")
        self.statusbar.addWidget(self.statusbar_load_lb)
        self.statusbar.addWidget(self.statusbar_msg_label)

        self.retranslateUi(MainWindow)
        self.other_init()
        self.set_window_at_center()
        self.create_left_menus()
        self.init_main_menu()
        self.text_add_shadow()
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
コード例 #5
0
class Ui_MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui_MainWindow, self).__init__()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(1000, 650)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.share_tab = QtWidgets.QWidget()
        self.share_tab.setObjectName("share_tab")
        self.share_vlayout = QtWidgets.QVBoxLayout(self.share_tab)
        self.share_vlayout.setObjectName("share_vlayout")
        self.share_hlayout_top = QtWidgets.QHBoxLayout()
        self.share_hlayout_top.setObjectName("share_hlayout_top")
        self.label_share_url = QtWidgets.QLabel(self.share_tab)
        self.label_share_url.setObjectName("label_share_url")
        self.share_hlayout_top.addWidget(self.label_share_url)
        self.line_share_url = QtWidgets.QLineEdit(self.share_tab)
        self.line_share_url.setObjectName("line_share_url")
        self.share_hlayout_top.addWidget(self.line_share_url)
        self.btn_extract = QtWidgets.QPushButton(self.share_tab)
        self.btn_extract.setObjectName("btn_extract")
        self.share_hlayout_top.addWidget(self.btn_extract)
        self.share_vlayout.addLayout(self.share_hlayout_top)
        self.table_share = QtWidgets.QTableView(self.share_tab)
        self.table_share.setObjectName("table_share")
        self.share_vlayout.addWidget(self.table_share)
        self.share_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.share_hlayout_bottom.setObjectName("share_hlayout_bottom")
        self.btn_share_select_all = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_select_all.setObjectName("btn_share_select_all")
        self.share_hlayout_bottom.addWidget(self.btn_share_select_all)
        self.label_dl_path = QtWidgets.QLabel(self.share_tab)
        self.label_dl_path.setObjectName("label_dl_path")
        self.share_hlayout_bottom.addWidget(self.label_dl_path)
        self.share_set_dl_path = MyLineEdit(self.share_tab)
        self.share_set_dl_path.setObjectName("share_set_dl_path")
        self.share_hlayout_bottom.addWidget(self.share_set_dl_path)
        self.btn_share_dl = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_dl.setObjectName("btn_share_dl")
        self.share_hlayout_bottom.addWidget(self.btn_share_dl)
        self.share_vlayout.addLayout(self.share_hlayout_bottom)
        self.tabWidget.addTab(self.share_tab, "")
        self.disk_tab = QtWidgets.QWidget()
        self.disk_tab.setEnabled(True)
        self.disk_tab.setMinimumSize(QtCore.QSize(620, 0))
        self.disk_tab.setObjectName("disk_tab")
        self.disk_vlayout = QtWidgets.QVBoxLayout(self.disk_tab)
        self.disk_vlayout.setObjectName("disk_vlayout")
        self.disk_hlayout_top = QtWidgets.QHBoxLayout()
        self.disk_hlayout_top.setObjectName("disk_hlayout_top")
        self.disk_loc_hbox = QtWidgets.QHBoxLayout()
        self.disk_loc_hbox.setObjectName("disk_loc_hbox")
        self.label_disk_loc = QtWidgets.QLabel(self.disk_tab)
        self.label_disk_loc.setObjectName("label_disk_loc")
        self.disk_loc_hbox.addWidget(self.label_disk_loc)
        self.disk_hlayout_top.addLayout(self.disk_loc_hbox)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_top.addItem(spacerItem)
        self.btn_disk_mkdir = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_mkdir.setObjectName("btn_disk_mkdir")
        self.disk_hlayout_top.addWidget(self.btn_disk_mkdir)
        self.disk_vlayout.addLayout(self.disk_hlayout_top)
        self.table_disk = MyTableView(self.disk_tab)
        self.table_disk.setObjectName("table_disk")
        self.disk_vlayout.addWidget(self.table_disk)
        self.disk_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.disk_hlayout_bottom.setObjectName("disk_hlayout_bottom")
        self.btn_disk_select_all = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_select_all.setObjectName("btn_disk_select_all")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_select_all)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_bottom.addItem(spacerItem1)
        self.btn_disk_delete = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_delete.setObjectName("btn_disk_delete")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_delete)
        self.btn_disk_dl = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_dl.setObjectName("btn_disk_dl")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_dl)
        self.disk_vlayout.addLayout(self.disk_hlayout_bottom)
        self.tabWidget.addTab(self.disk_tab, "")

        self.rec_tab = QtWidgets.QWidget()
        self.rec_tab.setObjectName("rec_tab")
        self.rec_verticalLayout = QtWidgets.QVBoxLayout(self.rec_tab)
        self.rec_verticalLayout.setObjectName("rec_verticalLayout")
        self.rec_horizontalLayout = QtWidgets.QHBoxLayout()
        self.rec_horizontalLayout.setObjectName("rec_horizontalLayout")
        self.btn_rec_select_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_select_all.setObjectName("btn_rec_select_all")
        self.rec_horizontalLayout.addWidget(self.btn_rec_select_all)
        self.btn_recovery = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery.setObjectName("btn_recovery")
        self.rec_horizontalLayout.addWidget(self.btn_recovery)
        self.btn_rec_delete = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_delete.setObjectName("btn_rec_delete")
        self.rec_horizontalLayout.addWidget(self.btn_rec_delete)
        self.rec_horizontalLayout.addStretch(1)
        self.btn_rec_clean = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_clean.setObjectName("btn_rec_clean")
        self.rec_horizontalLayout.addWidget(self.btn_rec_clean)
        self.btn_recovery_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery_all.setObjectName("btn_recovery_all")
        self.rec_horizontalLayout.addWidget(self.btn_recovery_all)
        self.btn_rec_expire_files = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_expire_files.setObjectName("btn_rec_expire_files")
        self.rec_horizontalLayout.addWidget(self.btn_rec_expire_files)
        self.rec_verticalLayout.addLayout(self.rec_horizontalLayout)
        self.table_rec = QtWidgets.QTableView(self.rec_tab)
        self.table_rec.setObjectName("table_rec")
        self.rec_verticalLayout.addWidget(self.table_rec)
        self.tabWidget.addTab(self.rec_tab, "")

        self.jobs_tab = QtWidgets.QWidget()
        self.jobs_tab.setObjectName("jobs_tab")
        self.jobs_verticalLayout = QtWidgets.QVBoxLayout(self.jobs_tab)
        self.jobs_verticalLayout.setObjectName("jobs_verticalLayout")
        self.jobs_horizontalLayout = QtWidgets.QHBoxLayout()
        self.jobs_horizontalLayout.setObjectName("jobs_horizontalLayout")
        self.btn_jobs_start_all = QtWidgets.QPushButton(self.jobs_tab)
        self.btn_jobs_clean_all = QtWidgets.QPushButton(self.jobs_tab)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_start_all)
        self.jobs_horizontalLayout.addStretch(1)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_clean_all)
        self.table_jobs = MyTableView(self.jobs_tab)
        self.table_jobs.setObjectName("table_jobs")
        self.jobs_verticalLayout.addLayout(self.jobs_horizontalLayout)
        self.jobs_verticalLayout.addWidget(self.table_jobs)
        self.tabWidget.addTab(self.jobs_tab, "")

        self.verticalLayout.addWidget(self.tabWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 30))
        self.menubar.setObjectName("menubar")
        self.acount = QtWidgets.QMenu(self.menubar)
        self.acount.setObjectName("acount")
        self.files = QtWidgets.QMenu(self.menubar)
        self.files.setObjectName("files")
        self.help = QtWidgets.QMenu(self.menubar)
        self.help.setObjectName("help")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolbar = QtWidgets.QToolBar(MainWindow)
        self.toolbar.setObjectName("toolbar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar)
        self.login = QtWidgets.QAction(MainWindow)
        self.login.setObjectName("login")
        self.logout = QtWidgets.QAction(MainWindow)
        self.logout.setObjectName("logout")
        self.upload = QtWidgets.QAction(MainWindow)
        self.upload.setObjectName("upload")
        self.download = QtWidgets.QAction(MainWindow)
        self.download.setObjectName("download")
        self.delete = QtWidgets.QAction(MainWindow)
        self.delete.setObjectName("delete")
        self.show_toolbar = QtWidgets.QAction(MainWindow)
        self.show_toolbar.setObjectName("show_toolbar")
        self.setting_menu = QtWidgets.QAction(MainWindow)
        self.setting_menu.setObjectName("setting_menu")
        self.how = QtWidgets.QAction(MainWindow)
        self.how.setObjectName("how")
        self.about = QtWidgets.QAction(MainWindow)
        self.about.setObjectName("about")
        self.acount.addSeparator()
        self.acount.addAction(self.login)
        self.acount.addAction(self.logout)
        self.files.addAction(self.upload)
        self.files.addAction(self.download)
        self.files.addAction(self.delete)
        self.files.addAction(self.show_toolbar)
        self.files.addAction(self.setting_menu)
        self.help.addAction(self.how)
        self.help.addAction(self.about)
        self.menubar.addAction(self.acount.menuAction())
        self.menubar.addAction(self.files.menuAction())
        self.menubar.addAction(self.help.menuAction())
        # 工具栏
        self.toolbar.addAction(self.login)
        # 状态栏
        self.statusbar_msg_label = QtWidgets.QLabel()
        self.statusbar_load_lb = QtWidgets.QLabel()
        self.statusbar_load_movie = QtGui.QMovie(SRC_DIR + "loading_more.gif")
        self.statusbar_load_lb.setMovie(self.statusbar_load_movie)
        self.statusbar_msg_label.setObjectName("msg_label")
        self.statusbar_load_lb.setObjectName("msg_movie_lb")
        self.statusbar.addWidget(self.statusbar_load_lb)
        self.statusbar.addWidget(self.statusbar_msg_label)

        self.retranslateUi(MainWindow)
        self.other_init()
        self.set_window_at_center()
        self.create_left_menus()
        self.init_main_menu()
        self.text_add_shadow()
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_share_url.setText(_translate("MainWindow", "蓝奏链接"))
        self.btn_extract.setText(_translate("MainWindow", "提取"))
        self.btn_share_select_all.setText(_translate("MainWindow", "全选"))
        self.label_dl_path.setText(_translate("MainWindow", "文件下载路径"))
        self.btn_share_dl.setText(_translate("MainWindow", "下载选中文件"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.share_tab), _translate("MainWindow", "蓝奏云链接提取"))
        self.label_disk_loc.setText(_translate("MainWindow", "位置"))
        self.btn_disk_mkdir.setText(_translate("MainWindow", "新建文件夹"))
        self.btn_disk_select_all.setText(_translate("MainWindow", "全选"))
        self.btn_disk_delete.setText(_translate("MainWindow", "删除"))
        self.btn_disk_dl.setText(_translate("MainWindow", "下载"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.disk_tab), _translate("MainWindow", "我的蓝奏云"))
        self.btn_rec_select_all.setText(_translate("MainWindow", "全选"))
        self.btn_recovery.setText(_translate("MainWindow", "还原"))
        self.btn_rec_delete.setText(_translate("MainWindow", "彻底删除"))
        self.btn_rec_clean.setText(_translate("MainWindow", "清空回收站"))
        self.btn_recovery_all.setText(_translate("MainWindow", "全部还原"))
        self.btn_rec_expire_files.setText(_translate("MainWindow", "过期文件"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.rec_tab), _translate("MainWindow", "回收站"))
        self.btn_jobs_start_all.setText(_translate("MainWindow", "开始所有暂停任务"))
        self.btn_jobs_clean_all.setText(_translate("MainWindow", "删除已完成任务"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.jobs_tab), _translate("MainWindow", "任务管理"))
        self.acount.setTitle(_translate("MainWindow", "登录"))
        self.files.setTitle(_translate("MainWindow", "文件"))
        self.help.setTitle(_translate("MainWindow", "帮助"))
        self.toolbar.setWindowTitle(_translate("MainWindow", "工具栏"))
        self.login.setText(_translate("MainWindow", "登录"))
        self.logout.setText(_translate("MainWindow", "登出"))
        self.upload.setText(_translate("MainWindow", "上传"))
        self.download.setText(_translate("MainWindow", "下载"))
        self.delete.setText(_translate("MainWindow", "删除"))
        self.show_toolbar.setText(_translate("MainWindow", "显示工具栏"))
        self.setting_menu.setText(_translate("MainWindow", "设置"))
        self.how.setText(_translate("MainWindow", "使用说明"))
        self.about.setText(_translate("MainWindow", "关于"))

    def other_init(self):
        # 设置 tab
        self.tabWidget.setCurrentIndex(0)
        self.tabWidget.removeTab(3)
        self.tabWidget.removeTab(2)
        self.tabWidget.removeTab(1)
        self.disk_tab.setEnabled(False)
        self.rec_tab.setEnabled(False)
        self.jobs_tab.setEnabled(False)

    def set_window_at_center(self):
        screen = QtWidgets.QDesktopWidget().screenGeometry()
        size = self.geometry()
        new_left = int((screen.width() - size.width()) / 2)
        new_top = int((screen.height() - size.height()) / 2)
        self.move(new_left, new_top)

    def create_left_menus(self):
        self.left_menus = QtWidgets.QMenu()
        self.left_menu_share_url = self.left_menus.addAction("外链分享地址等")
        self.left_menu_share_url.setIcon(QtGui.QIcon(SRC_DIR + "share.ico"))
        self.left_menu_rename_set_desc = self.left_menus.addAction("修改文件描述(支持批量)")
        self.left_menu_rename_set_desc.setIcon(QtGui.QIcon(SRC_DIR + "desc.ico"))
        self.left_menu_set_pwd = self.left_menus.addAction("设置提取码(支持批量)")
        self.left_menu_set_pwd.setIcon(QtGui.QIcon(SRC_DIR + "password.ico"))
        self.left_menu_move = self.left_menus.addAction("移动(支持批量)")
        self.left_menu_move.setIcon(QtGui.QIcon(SRC_DIR + "move.ico"))
        self.left_menu_copy = self.left_menus.addAction("复制分享链接")
        self.left_menu_copy.setIcon(QtGui.QIcon(SRC_DIR + "count.ico"))

    def init_main_menu(self):
        self.login.setIcon(QtGui.QIcon(SRC_DIR + "login.ico"))
        self.login.setShortcut("Ctrl+L")
        self.logout.setIcon(QtGui.QIcon(SRC_DIR + "logout.ico"))
        self.logout.setShortcut("Ctrl+Q")    # 登出快捷键
        self.logout.setEnabled(False)  # 初始状态
        self.download.setIcon(QtGui.QIcon(SRC_DIR + "download.ico"))
        self.download.setShortcut("Ctrl+J")
        self.download.setEnabled(False)  # 初始状态
        self.delete.setIcon(QtGui.QIcon(SRC_DIR + "delete.ico"))
        self.delete.setShortcut("Ctrl+D")
        self.delete.setEnabled(False)  # 初始状态
        self.show_toolbar.setIcon(QtGui.QIcon(SRC_DIR + "password.ico"))
        self.show_toolbar.setShortcut("Ctrl+T")
        self.toolbar.close()  # 工具栏初始状态
        self.setting_menu.setIcon(QtGui.QIcon(SRC_DIR + "settings.ico"))
        self.setting_menu.setShortcut("Ctrl+P")
        self.how.setIcon(QtGui.QIcon(SRC_DIR + "help.ico"))
        self.how.setShortcut("F1")
        self.about.setIcon(QtGui.QIcon(SRC_DIR + "about.ico"))
        self.about.setShortcut("Ctrl+B")
        self.upload.setIcon(QtGui.QIcon(SRC_DIR + "upload.ico"))
        self.upload.setShortcut("Ctrl+U")  # 上传快捷键
        self.upload.setEnabled(False)  # 初始状态

    def text_add_shadow(self):
        share_url_shadow = QtWidgets.QGraphicsDropShadowEffect()
        share_url_shadow.setBlurRadius(4)
        share_url_shadow.setColor(QtGui.QColor('red'))
        share_url_shadow.setOffset(0)
        self.label_share_url.setGraphicsEffect(share_url_shadow)

        dl_path_shadow = QtWidgets.QGraphicsDropShadowEffect()
        dl_path_shadow.setBlurRadius(4)
        dl_path_shadow.setColor(QtGui.QColor('green'))
        dl_path_shadow.setOffset(0)
        self.label_dl_path.setGraphicsEffect(dl_path_shadow)

        disk_loc_shadow = QtWidgets.QGraphicsDropShadowEffect()
        disk_loc_shadow.setBlurRadius(5)
        disk_loc_shadow.setColor(QtGui.QColor('white'))
        disk_loc_shadow.setOffset(0)
        self.label_disk_loc.setGraphicsEffect(disk_loc_shadow)
コード例 #6
0
    def initUI(self):
        self.setWindowTitle("登录蓝奏云")
        self.setWindowIcon(QIcon(SRC_DIR + "login.ico"))
        logo = QLabel()
        logo.setPixmap(QPixmap(SRC_DIR + "logo3.gif"))
        logo.setStyleSheet("background-color:rgb(0,153,255);")
        logo.setAlignment(Qt.AlignCenter)

        self.name_lb = QLabel("&U 用户")
        self.name_lb.setAlignment(Qt.AlignCenter)
        self.name_ed = QLineEdit()
        self.name_lb.setBuddy(self.name_ed)

        self.pwd_lb = QLabel("&P 密码")
        self.pwd_lb.setAlignment(Qt.AlignCenter)
        self.pwd_ed = QLineEdit()
        self.pwd_ed.setEchoMode(QLineEdit.Password)
        self.pwd_lb.setBuddy(self.pwd_ed)

        self.cookie_lb = QLabel("&Cookie")
        self.cookie_ed = QTextEdit()
        notice = "由于滑动验证的存在,需要输入cookie,cookie请使用浏览器获取\n" + \
            "cookie会保存在本地,下次使用。其格式如下:\n ylogin=value1; phpdisk_info=value2"
        self.cookie_ed.setPlaceholderText(notice)
        self.cookie_lb.setBuddy(self.cookie_ed)

        self.show_input_cookie_btn = QPushButton("显示Cookie输入框")
        self.show_input_cookie_btn.setToolTip(notice)
        self.show_input_cookie_btn.setStyleSheet(
            "QPushButton {min-width: 110px;max-width: 110px;}")
        self.show_input_cookie_btn.clicked.connect(
            self.change_show_input_cookie)
        self.ok_btn = QPushButton("登录")
        self.ok_btn.clicked.connect(self.change_ok_btn)
        self.cancel_btn = QPushButton("取消")
        self.cancel_btn.clicked.connect(self.change_cancel_btn)
        lb_line_1 = QLabel()
        lb_line_1.setText('<html><hr />切换用户</html>')
        lb_line_2 = QLabel()
        lb_line_2.setText('<html><hr /></html>')

        self.form = QFormLayout()
        self.form.setLabelAlignment(Qt.AlignRight)
        self.form.addRow(self.name_lb, self.name_ed)
        self.form.addRow(self.pwd_lb, self.pwd_ed)
        if is_windows:

            def set_assister_path():
                """设置辅助登录程序路径"""
                assister_path = QFileDialog.getOpenFileName(
                    self, "选择辅助登录程序路径", self._cwd, "EXE Files (*.exe)")
                if not assister_path[0]:
                    return None
                assister_path = os.path.normpath(
                    assister_path[0])  # windows backslash
                if assister_path == self._cookie_assister:
                    return None
                self.assister_ed.setText(assister_path)
                self._cookie_assister = assister_path

            self.assister_lb = QLabel("登录辅助程序")
            self.assister_lb.setAlignment(Qt.AlignCenter)
            self.assister_ed = MyLineEdit(self)
            self.assister_ed.setText(self._cookie_assister)
            self.assister_ed.clicked.connect(set_assister_path)
            self.assister_lb.setBuddy(self.assister_ed)
            self.form.addRow(self.assister_lb, self.assister_ed)

        hbox = QHBoxLayout()
        hbox.addWidget(self.show_input_cookie_btn)
        hbox.addStretch(1)
        hbox.addWidget(self.ok_btn)
        hbox.addWidget(self.cancel_btn)

        user_box = QHBoxLayout()
        self.user_num = 0
        self.user_btns = {}
        for user in self._config.users_name:
            user = str(user)  # TODO: 可能需要删掉
            self.user_btns[user] = QDoublePushButton(user)
            self.user_btns[user].setStyleSheet("QPushButton {border:none;}")
            if user == self._config.name:
                self.user_btns[user].setStyleSheet(
                    "QPushButton {background-color:rgb(0,153,2);}")
            self.user_btns[user].setToolTip(f"点击选中,双击切换至用户:{user}")
            self.user_btns[user].doubleClicked.connect(self.choose_user)
            self.user_btns[user].clicked.connect(self.delete_chose_user)
            user_box.addWidget(self.user_btns[user])
            self.user_num += 1
            user_box.addStretch(1)

        vbox = QVBoxLayout()
        vbox.addWidget(logo)
        if self._config.name:
            vbox.addWidget(lb_line_1)
            vbox.addLayout(user_box)
            vbox.addWidget(lb_line_2)
            if self.user_num > 1:
                self.del_user_btn = QPushButton("删除账户")
                self.del_user_btn.setIcon(QIcon(SRC_DIR + "delete.ico"))
                self.del_user_btn.setStyleSheet(
                    "QPushButton {max-width: 180px;}")
                self.del_user_btn.clicked.connect(self.call_del_chose_user)
                vbox.addWidget(self.del_user_btn)
            else:
                self.del_user_btn = None
            vbox.addStretch(1)
        vbox.addLayout(self.form)
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
        self.update_selection(self._config.name)
コード例 #7
0
class LoginDialog(QDialog):
    """登录对话框"""

    clicked_ok = pyqtSignal()

    def __init__(self, config):
        super().__init__()
        self._cwd = os.getcwd()
        self._config = config
        self._cookie_assister = 'login_assister.exe'
        self._user = ""
        self._pwd = ""
        self._cookie = {}
        self._del_user = ""
        self.initUI()
        self.setStyleSheet(dialog_qss_style)
        self.setMinimumWidth(380)
        self.name_ed.setFocus()
        # 信号
        self.name_ed.textChanged.connect(self.set_user)
        self.pwd_ed.textChanged.connect(self.set_pwd)
        self.cookie_ed.textChanged.connect(self.set_cookie)

    def update_selection(self, user):
        """显示已经保存的登录用户信息"""
        user_info = self._config.get_user_info(user)
        if user_info:
            self._user = user_info[0]
            self._pwd = user_info[1]
            self._cookie = user_info[2]
        # 更新控件显示内容
        self.name_ed.setText(self._user)
        self.pwd_ed.setText(self._pwd)
        try:
            text = ";".join([f'{k}={v}' for k, v in self._cookie.items()])
        except:
            text = ''
        self.cookie_ed.setPlainText(text)

    def initUI(self):
        self.setWindowTitle("登录蓝奏云")
        self.setWindowIcon(QIcon(SRC_DIR + "login.ico"))
        logo = QLabel()
        logo.setPixmap(QPixmap(SRC_DIR + "logo3.gif"))
        logo.setStyleSheet("background-color:rgb(0,153,255);")
        logo.setAlignment(Qt.AlignCenter)

        self.name_lb = QLabel("&U 用户")
        self.name_lb.setAlignment(Qt.AlignCenter)
        self.name_ed = QLineEdit()
        self.name_lb.setBuddy(self.name_ed)

        self.pwd_lb = QLabel("&P 密码")
        self.pwd_lb.setAlignment(Qt.AlignCenter)
        self.pwd_ed = QLineEdit()
        self.pwd_ed.setEchoMode(QLineEdit.Password)
        self.pwd_lb.setBuddy(self.pwd_ed)

        self.cookie_lb = QLabel("&Cookie")
        self.cookie_ed = QTextEdit()
        notice = "由于滑动验证的存在,需要输入cookie,cookie请使用浏览器获取\n" + \
            "cookie会保存在本地,下次使用。其格式如下:\n ylogin=value1; phpdisk_info=value2"
        self.cookie_ed.setPlaceholderText(notice)
        self.cookie_lb.setBuddy(self.cookie_ed)

        self.show_input_cookie_btn = QPushButton("显示Cookie输入框")
        self.show_input_cookie_btn.setToolTip(notice)
        self.show_input_cookie_btn.setStyleSheet(
            "QPushButton {min-width: 110px;max-width: 110px;}")
        self.show_input_cookie_btn.clicked.connect(
            self.change_show_input_cookie)
        self.ok_btn = QPushButton("登录")
        self.ok_btn.clicked.connect(self.change_ok_btn)
        self.cancel_btn = QPushButton("取消")
        self.cancel_btn.clicked.connect(self.change_cancel_btn)
        lb_line_1 = QLabel()
        lb_line_1.setText('<html><hr />切换用户</html>')
        lb_line_2 = QLabel()
        lb_line_2.setText('<html><hr /></html>')

        self.form = QFormLayout()
        self.form.setLabelAlignment(Qt.AlignRight)
        self.form.addRow(self.name_lb, self.name_ed)
        self.form.addRow(self.pwd_lb, self.pwd_ed)
        if is_windows:

            def set_assister_path():
                """设置辅助登录程序路径"""
                assister_path = QFileDialog.getOpenFileName(
                    self, "选择辅助登录程序路径", self._cwd, "EXE Files (*.exe)")
                if not assister_path[0]:
                    return None
                assister_path = os.path.normpath(
                    assister_path[0])  # windows backslash
                if assister_path == self._cookie_assister:
                    return None
                self.assister_ed.setText(assister_path)
                self._cookie_assister = assister_path

            self.assister_lb = QLabel("登录辅助程序")
            self.assister_lb.setAlignment(Qt.AlignCenter)
            self.assister_ed = MyLineEdit(self)
            self.assister_ed.setText(self._cookie_assister)
            self.assister_ed.clicked.connect(set_assister_path)
            self.assister_lb.setBuddy(self.assister_ed)
            self.form.addRow(self.assister_lb, self.assister_ed)

        hbox = QHBoxLayout()
        hbox.addWidget(self.show_input_cookie_btn)
        hbox.addStretch(1)
        hbox.addWidget(self.ok_btn)
        hbox.addWidget(self.cancel_btn)

        user_box = QHBoxLayout()
        self.user_num = 0
        self.user_btns = {}
        for user in self._config.users_name:
            user = str(user)  # TODO: 可能需要删掉
            self.user_btns[user] = QDoublePushButton(user)
            self.user_btns[user].setStyleSheet("QPushButton {border:none;}")
            if user == self._config.name:
                self.user_btns[user].setStyleSheet(
                    "QPushButton {background-color:rgb(0,153,2);}")
            self.user_btns[user].setToolTip(f"点击选中,双击切换至用户:{user}")
            self.user_btns[user].doubleClicked.connect(self.choose_user)
            self.user_btns[user].clicked.connect(self.delete_chose_user)
            user_box.addWidget(self.user_btns[user])
            self.user_num += 1
            user_box.addStretch(1)

        vbox = QVBoxLayout()
        vbox.addWidget(logo)
        if self._config.name:
            vbox.addWidget(lb_line_1)
            vbox.addLayout(user_box)
            vbox.addWidget(lb_line_2)
            if self.user_num > 1:
                self.del_user_btn = QPushButton("删除账户")
                self.del_user_btn.setIcon(QIcon(SRC_DIR + "delete.ico"))
                self.del_user_btn.setStyleSheet(
                    "QPushButton {max-width: 180px;}")
                self.del_user_btn.clicked.connect(self.call_del_chose_user)
                vbox.addWidget(self.del_user_btn)
            else:
                self.del_user_btn = None
            vbox.addStretch(1)
        vbox.addLayout(self.form)
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
        self.update_selection(self._config.name)

    def call_del_chose_user(self):
        if self._del_user:
            if self._del_user != self._config.name:
                self.user_num -= 1
                self._config.del_user(self._del_user)
                self.user_btns[self._del_user].close()
                self._del_user = ""
                if self.user_num <= 1:
                    self.del_user_btn.close()
                    self.del_user_btn = None
                return
            else:
                title = '不能删除'
                msg = '不能删除当前登录账户,请先切换用户!'
        else:
            title = '请选择账户'
            msg = '请单击选择需要删除的账户\n\n注意不能删除当前账户(绿色)'
        message_box = QMessageBox(self)
        message_box.setIcon(QMessageBox.Critical)
        message_box.setStyleSheet(btn_style)
        message_box.setWindowTitle(title)
        message_box.setText(msg)
        message_box.setStandardButtons(QMessageBox.Close)
        buttonC = message_box.button(QMessageBox.Close)
        buttonC.setText('关闭')
        message_box.exec()

    def delete_chose_user(self):
        """更改单击选中需要删除的用户"""
        user = str(self.sender().text())
        self._del_user = user
        if self.del_user_btn:
            self.del_user_btn.setText(f"删除 <{user}>")

    def choose_user(self):
        """切换用户"""
        user = self.sender().text()
        if user != self._config.name:
            self.ok_btn.setText("切换用户")
        else:
            self.ok_btn.setText("登录")
        self.update_selection(user)

    def change_show_input_cookie(self):
        row_c = 4 if is_windows else 3
        if self.form.rowCount() < row_c:
            self.org_height = self.height()
            self.form.addRow(self.cookie_lb, self.cookie_ed)
            self.show_input_cookie_btn.setText("隐藏Cookie输入框")
            self.change_height = None
            self.adjustSize()
        else:
            if not self.change_height:
                self.change_height = self.height()
            if self.cookie_ed.isVisible():
                self.cookie_lb.setVisible(False)
                self.cookie_ed.setVisible(False)
                self.show_input_cookie_btn.setText("显示Cookie输入框")
                start_height, end_height = self.change_height, self.org_height
            else:
                self.cookie_lb.setVisible(True)
                self.cookie_ed.setVisible(True)
                self.show_input_cookie_btn.setText("隐藏Cookie输入框")
                start_height, end_height = self.org_height, self.change_height
            gm = self.geometry()
            x, y = gm.x(), gm.y()
            wd = self.width()
            self.animation = QPropertyAnimation(self, b'geometry')
            self.animation.setDuration(400)
            self.animation.setStartValue(QRect(x, y, wd, start_height))
            self.animation.setEndValue(QRect(x, y, wd, end_height))
            self.animation.start()

    def set_user(self, user):
        self._user = user
        if not user:
            return None
        if user not in self._config.users_name:
            self.ok_btn.setText("添加用户")
            self.cookie_ed.setPlainText("")
        elif user != self._config.name:
            self.update_selection(user)
            self.ok_btn.setText("切换用户")
        else:
            self.update_selection(user)
            self.ok_btn.setText("登录")

    def set_pwd(self, pwd):
        if self._user in self._config.users_name:
            user_info = self._config.get_user_info(self._user)
            if pwd and pwd != user_info[1]:  # 改变密码,cookie作废
                self.cookie_ed.setPlainText("")
                self._cookie = None
            if not pwd:  # 输入空密码,表示删除对pwd的存储,并使用以前的cookie
                self._cookie = user_info[2]
                try:
                    text = ";".join(
                        [f'{k}={v}' for k, v in self._cookie.items()])
                except:
                    text = ''
                self.cookie_ed.setPlainText(text)
        self._pwd = pwd

    def set_cookie(self):
        cookies = self.cookie_ed.toPlainText()
        if cookies:
            try:
                self._cookie = {
                    kv.split("=")[0].strip(" "): kv.split("=")[1].strip(" ")
                    for kv in cookies.split(";")
                }
            except:
                self._cookie = None

    def change_cancel_btn(self):
        self.update_selection(self._config.name)
        self.close()

    def change_ok_btn(self):
        if self._user and self._pwd:
            if self._user not in self._config.users_name:
                self._cookie = None
        if self._cookie:
            up_info = {
                "name": self._user,
                "pwd": self._pwd,
                "cookie": self._cookie,
                "work_id": -1
            }
            if self.ok_btn.text() == "切换用户":
                self._config.change_user(self._user)
            else:
                self._config.set_infos(up_info)
            self.clicked_ok.emit()
            self.close()
        elif USE_WEB_ENG:
            self.web = LoginWindow(self._user, self._pwd)
            self.web.cookie.connect(self.get_cookie_by_web)
            self.web.setWindowModality(Qt.ApplicationModal)
            self.web.exec()
        elif os.path.isfile(self._cookie_assister):
            try:
                result = os.popen(
                    f'{self._cookie_assister} {self._user} {self._pwd}')
                cookie = result.read()
                try:
                    self._cookie = {
                        kv.split("=")[0].strip(" "):
                        kv.split("=")[1].strip(" ")
                        for kv in cookie.split(";")
                    }
                except:
                    self._cookie = None
                if not self._cookie:
                    return None
                up_info = {
                    "name": self._user,
                    "pwd": self._pwd,
                    "cookie": self._cookie,
                    "work_id": -1
                }
                self._config.set_infos(up_info)
                self.clicked_ok.emit()
                self.close()
            except:
                pass
        else:
            title = '请使用 Cookie 登录或是选择 登录辅助程序'
            msg = '没有输入 Cookie,或者没有找到登录辅助程序!\n\n' + \
                  '推荐使用浏览器获取 cookie 填入 cookie 输入框\n\n' + \
                  '如果不嫌文件体积大,请下载登录辅助程序:\n' + \
                  'https://github.com/rachpt/lanzou-gui/releases'
            message_box = QMessageBox(self)
            message_box.setIcon(QMessageBox.Critical)
            message_box.setStyleSheet(btn_style)
            message_box.setWindowTitle(title)
            message_box.setText(msg)
            message_box.setStandardButtons(QMessageBox.Close)
            buttonC = message_box.button(QMessageBox.Close)
            buttonC.setText('关闭')
            message_box.exec()

    def get_cookie_by_web(self, cookie):
        self._cookie = cookie
        up_info = {
            "name": self._user,
            "pwd": self._pwd,
            "cookie": self._cookie
        }
        self._config.set_infos(up_info)
        self.clicked_ok.emit()
        self.close()
コード例 #8
0
class MergeFileDialog(QDialog):
    check_update = pyqtSignal(str, bool)

    def __init__(self, user_home, parent=None):
        super(MergeFileDialog, self).__init__(parent)
        self.cwd = user_home
        self.selected = ""
        self.initUI()
        self.setStyleSheet(others_style)

    def initUI(self):
        self.setWindowTitle("合并文件")
        self.setWindowIcon(QIcon(SRC_DIR + "upload.ico"))
        self.logo = QLabel()
        self.logo.setPixmap(QPixmap(SRC_DIR + "logo3.gif"))
        self.logo.setStyleSheet("background-color:rgb(0,153,255);")
        self.logo.setAlignment(Qt.AlignmentFlag.AlignCenter)

        # lable
        self.choose_lb = QLabel("选择文件夹")
        # folder
        self.choose_folder = MyLineEdit(self)
        self.choose_folder.setObjectName("choose_folder")
        self.choose_folder.clicked.connect(self.slot_choose_folder)
        self.status = QLabel(self)

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.StandardButton.Ok
            | QDialogButtonBox.StandardButton.Cancel)
        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("提取")
        self.buttonBox.button(
            QDialogButtonBox.StandardButton.Cancel).setText("关闭")
        self.buttonBox.setStyleSheet(btn_style)

        vbox = QVBoxLayout()
        hbox_head = QHBoxLayout()
        hbox_button = QHBoxLayout()
        hbox_head.addWidget(self.choose_lb)
        hbox_head.addWidget(self.choose_folder)
        hbox_button.addWidget(self.buttonBox)
        vbox.addWidget(self.logo)
        vbox.addStretch(1)
        vbox.addWidget(self.status)
        vbox.addLayout(hbox_head)
        vbox.addStretch(1)
        vbox.addLayout(hbox_button)
        self.setLayout(vbox)
        self.setMinimumWidth(350)

        # 设置信号
        self.buttonBox.accepted.connect(self.slot_btn_ok)
        self.buttonBox.rejected.connect(self.slot_btn_no)
        self.buttonBox.rejected.connect(self.reject)

    def slot_choose_folder(self):
        dir_choose = QFileDialog.getExistingDirectory(self, "选择文件夹",
                                                      self.cwd)  # 起始路径
        if dir_choose == "":
            return
        self.selected = dir_choose
        self.choose_folder.setText(self.selected)
        self.status.setText("")
        self.cwd = os.path.dirname(dir_choose)

    def slot_btn_no(self):
        self.selected = ""
        self.choose_folder.setText(self.selected)
        self.status.setText("")

    def slot_btn_ok(self):
        if self.selected:
            success, msg = un_serialize(self.selected)
            if success:
                text = "提取成功✅"
            else:
                text = f"提取失败❌, {msg}"
        else:
            text = "未选择文件夹📂"
        self.status.setText(text)
コード例 #9
0
ファイル: login.py プロジェクト: fakegit/lanzou-gui
    def initUI(self):
        self.setWindowTitle("登录蓝奏云")
        self.setWindowIcon(QIcon(SRC_DIR + "login.ico"))
        logo = QLabel()
        logo.setPixmap(QPixmap(SRC_DIR + "logo3.gif"))
        logo.setStyleSheet("background-color:rgb(0,153,255);")
        logo.setAlignment(Qt.AlignmentFlag.AlignCenter)

        self.tabs = QTabWidget()
        self.auto_tab = QWidget()
        self.hand_tab = QWidget()

        # Add tabs
        self.tabs.addTab(self.auto_tab,"自动获取Cookie")
        self.tabs.addTab(self.hand_tab,"手动输入Cookie")
        self.auto_get_cookie_ok = AutoResizingTextEdit("🔶点击👇自动获取浏览器登录信息👇")
        self.auto_get_cookie_ok.setReadOnly(True)
        self.auto_get_cookie_btn = QPushButton("自动读取浏览器登录信息")
        auto_cookie_notice = '支持浏览器:Chrome, Chromium, Opera, Edge, Firefox'
        self.auto_get_cookie_btn.setToolTip(auto_cookie_notice)
        self.auto_get_cookie_btn.clicked.connect(self.call_auto_get_cookie)
        self.auto_get_cookie_btn.setStyleSheet("QPushButton {min-width: 210px;max-width: 210px;}")

        self.name_lb = QLabel("&U 用户")
        self.name_lb.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.name_ed = QLineEdit()
        self.name_lb.setBuddy(self.name_ed)

        self.pwd_lb = QLabel("&P 密码")
        self.pwd_lb.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.pwd_ed = QLineEdit()
        self.pwd_ed.setEchoMode(QLineEdit.EchoMode.Password)
        self.pwd_lb.setBuddy(self.pwd_ed)

        self.cookie_lb = QLabel("&Cookie")
        self.cookie_ed = QTextEdit()
        notice = "由于滑动验证的存在,需要输入cookie,cookie请使用浏览器获取\n" + \
            "cookie会保存在本地,下次使用。其格式如下:\n ylogin=value1; phpdisk_info=value2"
        self.cookie_ed.setPlaceholderText(notice)
        self.cookie_lb.setBuddy(self.cookie_ed)

        self.show_input_cookie_btn = QPushButton("显示Cookie输入框")
        self.show_input_cookie_btn.setToolTip(notice)
        self.show_input_cookie_btn.setStyleSheet("QPushButton {min-width: 110px;max-width: 110px;}")
        self.show_input_cookie_btn.clicked.connect(self.change_show_input_cookie)
        self.ok_btn = QPushButton("登录")
        self.ok_btn.clicked.connect(self.change_ok_btn)
        self.cancel_btn = QPushButton("取消")
        self.cancel_btn.clicked.connect(self.change_cancel_btn)
        lb_line_1 = QLabel()
        lb_line_1.setText('<html><hr />切换用户</html>')
        lb_line_2 = QLabel()
        lb_line_2.setText('<html><hr /></html>')

        self.form = QFormLayout()
        self.form.setLabelAlignment(Qt.AlignmentFlag.AlignRight)
        self.form.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.AllNonFixedFieldsGrow)  # 覆盖MacOS的默认样式
        self.form.addRow(self.name_lb, self.name_ed)
        self.form.addRow(self.pwd_lb, self.pwd_ed)
        if is_windows:
            def set_assister_path():
                """设置辅助登录程序路径"""
                assister_path = QFileDialog.getOpenFileName(self, "选择辅助登录程序路径",
                                                            self._cwd, "EXE Files (*.exe)")
                if not assister_path[0]:
                    return None
                assister_path = os.path.normpath(assister_path[0])  # windows backslash
                if assister_path == self._cookie_assister:
                    return None
                self.assister_ed.setText(assister_path)
                self._cookie_assister = assister_path

            self.assister_lb = QLabel("登录辅助程序")
            self.assister_lb.setAlignment(Qt.AlignmentFlag.AlignCenter)
            self.assister_ed = MyLineEdit(self)
            self.assister_ed.setText(self._cookie_assister)
            self.assister_ed.clicked.connect(set_assister_path)
            self.assister_lb.setBuddy(self.assister_ed)
            self.form.addRow(self.assister_lb, self.assister_ed)

        hbox = QHBoxLayout()
        hbox.addWidget(self.show_input_cookie_btn)
        hbox.addStretch(1)
        hbox.addWidget(self.ok_btn)
        hbox.addWidget(self.cancel_btn)

        user_box = QHBoxLayout()
        self.user_num = 0
        self.user_btns = {}
        for user in self._config.users_name:
            user = str(user)  # TODO: 可能需要删掉
            self.user_btns[user] = QDoublePushButton(user)
            self.user_btns[user].setStyleSheet("QPushButton {border:none;}")
            if user == self._config.name:
                self.user_btns[user].setStyleSheet("QPushButton {background-color:rgb(0,153,2);}")
                self.tabs.setCurrentIndex(1)
            self.user_btns[user].setToolTip(f"点击选中,双击切换至用户:{user}")
            self.user_btns[user].doubleClicked.connect(self.choose_user)
            self.user_btns[user].clicked.connect(self.delete_chose_user)
            user_box.addWidget(self.user_btns[user])
            self.user_num += 1
            user_box.addStretch(1)

        self.layout = QVBoxLayout(self)
        self.layout.addWidget(logo)
        vbox = QVBoxLayout()
        if self._config.name:
            vbox.addWidget(lb_line_1)
            user_box.setAlignment(Qt.AlignmentFlag.AlignCenter)
            vbox.addLayout(user_box)
            vbox.addWidget(lb_line_2)
            if self.user_num > 1:
                self.del_user_btn = QPushButton("删除账户")
                self.del_user_btn.setIcon(QIcon(SRC_DIR + "delete.ico"))
                self.del_user_btn.setStyleSheet("QPushButton {min-width: 180px;max-width: 180px;}")
                self.del_user_btn.clicked.connect(self.call_del_chose_user)
                vbox.addWidget(self.del_user_btn)
            else:
                self.del_user_btn = None
            vbox.addStretch(1)

        vbox.addLayout(self.form)
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        vbox.setAlignment(Qt.AlignmentFlag.AlignCenter)

        self.hand_tab.setLayout(vbox)
        auto_cookie_vbox = QVBoxLayout()
        auto_cookie_vbox.addWidget(self.auto_get_cookie_ok)
        auto_cookie_vbox.addWidget(self.auto_get_cookie_btn)
        auto_cookie_vbox.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.auto_tab.setLayout(auto_cookie_vbox)
        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
        self.update_selection(self._config.name)