mirror of
https://github.com/yihong0618/Kindle_download_helper.git
synced 2025-11-22 07:59:04 +08:00
add reqs
This commit is contained in:
5
icon.qrc
Normal file
5
icon.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="icon">
|
||||
<file>resource/kindle.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -13,6 +13,10 @@
|
||||
<property name="windowTitle">
|
||||
<string>Kindle 下载助手</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="kindle.qrc">
|
||||
<normaloff>:/icon/resource/kindle.png</normaloff>:/icon/resource/kindle.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
@@ -166,7 +170,11 @@ hr { height: 1px; border-width: 0; }
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="cookieTextEdit"/>
|
||||
<widget class="QPlainTextEdit" name="cookieTextEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@@ -275,6 +283,8 @@ hr { height: 1px; border-width: 0; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="kindle.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -4,10 +4,10 @@ import os
|
||||
import sys
|
||||
from typing import NamedTuple
|
||||
import webbrowser
|
||||
from PySide6 import QtWidgets, QtCore
|
||||
from PySide6 import QtWidgets, QtCore, QtGui
|
||||
|
||||
import kindle
|
||||
from kindle_helper_ui import Ui_MainDialog
|
||||
from ui_kindle import Ui_MainDialog
|
||||
|
||||
logger = logging.getLogger("kindle")
|
||||
|
||||
@@ -29,12 +29,14 @@ class Book(NamedTuple):
|
||||
title: str
|
||||
author: str
|
||||
asin: str
|
||||
done: bool
|
||||
|
||||
|
||||
class Worker(QtCore.QObject):
|
||||
finished = QtCore.Signal()
|
||||
progress = QtCore.Signal(int)
|
||||
logging = QtCore.Signal(str)
|
||||
done = QtCore.Signal(int)
|
||||
|
||||
def __init__(self, iterable, kindle):
|
||||
super().__init__()
|
||||
@@ -46,14 +48,22 @@ class Worker(QtCore.QObject):
|
||||
logger.handlers[:] = [SignalLogHandler(self.logging)]
|
||||
try:
|
||||
devices = self.kindle.get_devices()
|
||||
device = devices[0]
|
||||
for i, book in enumerate(self.iterable, 1):
|
||||
self.kindle.download_one_book(book.asin, device, i)
|
||||
self.progress.emit(i)
|
||||
except Exception:
|
||||
logger.exception("download failed")
|
||||
finally:
|
||||
logger.exception("get devices failed")
|
||||
self.finished.emit()
|
||||
return
|
||||
device = devices[0]
|
||||
for i, book in enumerate(self.iterable, 1):
|
||||
try:
|
||||
self.kindle.download_one_book(book.asin, device, i)
|
||||
except Exception:
|
||||
logger.exception("download failed")
|
||||
else:
|
||||
self.done.emit(book.id)
|
||||
finally:
|
||||
self.progress.emit(i)
|
||||
|
||||
self.finished.emit()
|
||||
|
||||
|
||||
class KindleMainDialog(QtWidgets.QDialog):
|
||||
@@ -107,20 +117,16 @@ class KindleMainDialog(QtWidgets.QDialog):
|
||||
else:
|
||||
return "com"
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_login_amazon(self):
|
||||
url = kindle.KINDLE_URLS[self.getDomain()]["bookall"]
|
||||
webbrowser.open(url)
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_from_input(self, checked):
|
||||
self.ui.cookieTextEdit.setEnabled(checked)
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_from_browser(self, checked):
|
||||
self.ui.cookieTextEdit.setEnabled(not checked)
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_browse_dir(self):
|
||||
file_dialog = QtWidgets.QFileDialog()
|
||||
file_dialog.setFileMode(QtWidgets.QFileDialog.Directory)
|
||||
@@ -128,7 +134,6 @@ class KindleMainDialog(QtWidgets.QDialog):
|
||||
if file_dialog.exec_():
|
||||
self.ui.outDirEdit.setText(file_dialog.selectedFiles()[0])
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_fetch_books(self):
|
||||
self.ui.fetchButton.setEnabled(False)
|
||||
self.setup_kindle()
|
||||
@@ -158,13 +163,13 @@ class KindleMainDialog(QtWidgets.QDialog):
|
||||
yield gen()
|
||||
self.ui.verticalLayout_7.removeWidget(progressbar)
|
||||
|
||||
@QtCore.Slot()
|
||||
def on_download_books(self):
|
||||
self.setup_kindle()
|
||||
if not os.path.exists(self.kindle.out_dir):
|
||||
os.makedirs(self.kindle.out_dir)
|
||||
self.thread = QtCore.QThread()
|
||||
iterable, total = self.book_model._data, self.book_model.rowCount(0)
|
||||
iterable = self.book_model.data_to_download()
|
||||
total = len(iterable)
|
||||
self.kindle.total_to_download = total
|
||||
self.worker = Worker(iterable, self.kindle)
|
||||
self.worker.moveToThread(self.thread)
|
||||
@@ -175,6 +180,7 @@ class KindleMainDialog(QtWidgets.QDialog):
|
||||
self.worker.finished.connect(self.thread.quit)
|
||||
self.worker.finished.connect(self.worker.deleteLater)
|
||||
self.thread.finished.connect(self.thread.deleteLater)
|
||||
self.worker.done.connect(self.on_book_done)
|
||||
self.worker.logging.connect(self.ui.logBrowser.append)
|
||||
self.worker.progress.connect(
|
||||
lambda n: self.progressbar.setValue(round(n / total * 100, 2))
|
||||
@@ -184,9 +190,13 @@ class KindleMainDialog(QtWidgets.QDialog):
|
||||
self.thread.start()
|
||||
|
||||
def on_finish_download(self):
|
||||
self.ui.downloadButton.setEnabled(True)
|
||||
self.ui.verticalLayout_7.removeWidget(self.progressbar)
|
||||
self.progressbar.deleteLater()
|
||||
|
||||
def on_book_done(self, idx):
|
||||
self.book_model.mark_done(idx - 1)
|
||||
|
||||
|
||||
class BookItemModel(QtCore.QAbstractTableModel):
|
||||
def __init__(self, parent, data, header):
|
||||
@@ -199,8 +209,18 @@ class BookItemModel(QtCore.QAbstractTableModel):
|
||||
return self._header[section]
|
||||
return None
|
||||
|
||||
def mark_done(self, idx):
|
||||
if idx >= len(self._data):
|
||||
return
|
||||
self._data[idx] = Book(*self._data[idx][:-1], done=True)
|
||||
self.layoutAboutToBeChanged.emit()
|
||||
self.dataChanged.emit(
|
||||
self.createIndex(idx, 0), self.createIndex(idx, self.columnCount(0))
|
||||
)
|
||||
self.layoutChanged.emit()
|
||||
|
||||
def updateData(self, data):
|
||||
self._data = [Book(i, *row) for i, row in enumerate(data, 1)]
|
||||
self._data = [Book(i, *row, False) for i, row in enumerate(data, 1)]
|
||||
self.layoutAboutToBeChanged.emit()
|
||||
self.dataChanged.emit(
|
||||
self.createIndex(0, 0),
|
||||
@@ -208,12 +228,17 @@ class BookItemModel(QtCore.QAbstractTableModel):
|
||||
)
|
||||
self.layoutChanged.emit()
|
||||
|
||||
def data_to_download(self):
|
||||
return [item for item in self._data if not item.done]
|
||||
|
||||
def data(self, index, role):
|
||||
if not index.isValid():
|
||||
return None
|
||||
value = self._data[index.row()][index.column()]
|
||||
if role == QtCore.Qt.DisplayRole:
|
||||
return value
|
||||
if role == QtCore.Qt.BackgroundRole and self._data[index.row()].done:
|
||||
return QtGui.QColor(65, 237, 74)
|
||||
return None
|
||||
|
||||
def rowCount(self, parent):
|
||||
|
||||
@@ -1,356 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'kindle_helper.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.3.0
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (
|
||||
QCoreApplication,
|
||||
QDate,
|
||||
QDateTime,
|
||||
QLocale,
|
||||
QMetaObject,
|
||||
QObject,
|
||||
QPoint,
|
||||
QRect,
|
||||
QSize,
|
||||
QTime,
|
||||
QUrl,
|
||||
Qt,
|
||||
)
|
||||
from PySide6.QtGui import (
|
||||
QBrush,
|
||||
QColor,
|
||||
QConicalGradient,
|
||||
QCursor,
|
||||
QFont,
|
||||
QFontDatabase,
|
||||
QGradient,
|
||||
QIcon,
|
||||
QImage,
|
||||
QKeySequence,
|
||||
QLinearGradient,
|
||||
QPainter,
|
||||
QPalette,
|
||||
QPixmap,
|
||||
QRadialGradient,
|
||||
QTransform,
|
||||
)
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
QDialog,
|
||||
QGroupBox,
|
||||
QHBoxLayout,
|
||||
QHeaderView,
|
||||
QLabel,
|
||||
QLineEdit,
|
||||
QPlainTextEdit,
|
||||
QPushButton,
|
||||
QRadioButton,
|
||||
QSizePolicy,
|
||||
QSpinBox,
|
||||
QTableView,
|
||||
QTextBrowser,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
)
|
||||
|
||||
|
||||
class Ui_MainDialog(object):
|
||||
def setupUi(self, MainDialog):
|
||||
if not MainDialog.objectName():
|
||||
MainDialog.setObjectName("MainDialog")
|
||||
MainDialog.resize(1190, 872)
|
||||
self.horizontalLayout = QHBoxLayout(MainDialog)
|
||||
self.horizontalLayout.setSpacing(10)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.leftLayout = QVBoxLayout()
|
||||
self.leftLayout.setObjectName("leftLayout")
|
||||
self.listBox = QGroupBox(MainDialog)
|
||||
self.listBox.setObjectName("listBox")
|
||||
self.verticalLayout_5 = QVBoxLayout(self.listBox)
|
||||
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||
self.fetchButton = QPushButton(self.listBox)
|
||||
self.fetchButton.setObjectName("fetchButton")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.fetchButton, 0, Qt.AlignRight)
|
||||
|
||||
self.bookView = QTableView(self.listBox)
|
||||
self.bookView.setObjectName("bookView")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.bookView)
|
||||
|
||||
self.horizontalLayout_4 = QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.label_2 = QLabel(self.listBox)
|
||||
self.label_2.setObjectName("label_2")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.label_2)
|
||||
|
||||
self.outDirEdit = QLineEdit(self.listBox)
|
||||
self.outDirEdit.setObjectName("outDirEdit")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.outDirEdit)
|
||||
|
||||
self.browseButton = QPushButton(self.listBox)
|
||||
self.browseButton.setObjectName("browseButton")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.browseButton)
|
||||
|
||||
self.downloadButton = QPushButton(self.listBox)
|
||||
self.downloadButton.setObjectName("downloadButton")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.downloadButton)
|
||||
|
||||
self.verticalLayout_5.addLayout(self.horizontalLayout_4)
|
||||
|
||||
self.leftLayout.addWidget(self.listBox)
|
||||
|
||||
self.groupBox_2 = QGroupBox(MainDialog)
|
||||
self.groupBox_2.setObjectName("groupBox_2")
|
||||
self.groupBox_2.setMaximumSize(QSize(16777215, 200))
|
||||
self.verticalLayout_7 = QVBoxLayout(self.groupBox_2)
|
||||
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
||||
self.logBrowser = QTextBrowser(self.groupBox_2)
|
||||
self.logBrowser.setObjectName("logBrowser")
|
||||
|
||||
self.verticalLayout_7.addWidget(self.logBrowser)
|
||||
|
||||
self.leftLayout.addWidget(self.groupBox_2)
|
||||
|
||||
self.horizontalLayout.addLayout(self.leftLayout)
|
||||
|
||||
self.rightLayout = QVBoxLayout()
|
||||
self.rightLayout.setSpacing(6)
|
||||
self.rightLayout.setObjectName("rightLayout")
|
||||
self.settingsBox = QGroupBox(MainDialog)
|
||||
self.settingsBox.setObjectName("settingsBox")
|
||||
self.settingsBox.setMaximumSize(QSize(400, 16777215))
|
||||
self.verticalLayout = QVBoxLayout(self.settingsBox)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.loginGroupBox = QGroupBox(self.settingsBox)
|
||||
self.loginGroupBox.setObjectName("loginGroupBox")
|
||||
self.horizontalLayout_2 = QHBoxLayout(self.loginGroupBox)
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.verticalLayout_2 = QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.radioCOM = QRadioButton(self.loginGroupBox)
|
||||
self.radioCOM.setObjectName("radioCOM")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.radioCOM)
|
||||
|
||||
self.radioCN = QRadioButton(self.loginGroupBox)
|
||||
self.radioCN.setObjectName("radioCN")
|
||||
self.radioCN.setChecked(True)
|
||||
|
||||
self.verticalLayout_2.addWidget(self.radioCN)
|
||||
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
|
||||
|
||||
self.loginButton = QPushButton(self.loginGroupBox)
|
||||
self.loginButton.setObjectName("loginButton")
|
||||
self.loginButton.setMaximumSize(QSize(80, 16777215))
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.loginButton)
|
||||
|
||||
self.verticalLayout.addWidget(self.loginGroupBox)
|
||||
|
||||
self.cookiesGroupBox = QGroupBox(self.settingsBox)
|
||||
self.cookiesGroupBox.setObjectName("cookiesGroupBox")
|
||||
self.verticalLayout_3 = QVBoxLayout(self.cookiesGroupBox)
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.cookieTextEdit = QPlainTextEdit(self.cookiesGroupBox)
|
||||
self.cookieTextEdit.setObjectName("cookieTextEdit")
|
||||
|
||||
self.verticalLayout_3.addWidget(self.cookieTextEdit)
|
||||
|
||||
self.horizontalLayout_3 = QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.radioFromInput = QRadioButton(self.cookiesGroupBox)
|
||||
self.radioFromInput.setObjectName("radioFromInput")
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.radioFromInput)
|
||||
|
||||
self.radioFromBrowser = QRadioButton(self.cookiesGroupBox)
|
||||
self.radioFromBrowser.setObjectName("radioFromBrowser")
|
||||
self.radioFromBrowser.setChecked(True)
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.radioFromBrowser)
|
||||
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
|
||||
|
||||
self.verticalLayout.addWidget(self.cookiesGroupBox)
|
||||
|
||||
self.groupBox = QGroupBox(self.settingsBox)
|
||||
self.groupBox.setObjectName("groupBox")
|
||||
self.verticalLayout_4 = QVBoxLayout(self.groupBox)
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.csrfEdit = QLineEdit(self.groupBox)
|
||||
self.csrfEdit.setObjectName("csrfEdit")
|
||||
|
||||
self.verticalLayout_4.addWidget(self.csrfEdit)
|
||||
|
||||
self.verticalLayout.addWidget(self.groupBox)
|
||||
|
||||
self.horizontalLayout_5 = QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.label = QLabel(self.settingsBox)
|
||||
self.label.setObjectName("label")
|
||||
|
||||
self.horizontalLayout_5.addWidget(self.label)
|
||||
|
||||
self.cutLengthSpin = QSpinBox(self.settingsBox)
|
||||
self.cutLengthSpin.setObjectName("cutLengthSpin")
|
||||
self.cutLengthSpin.setMaximum(999)
|
||||
self.cutLengthSpin.setValue(100)
|
||||
|
||||
self.horizontalLayout_5.addWidget(self.cutLengthSpin)
|
||||
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_5)
|
||||
|
||||
self.rightLayout.addWidget(self.settingsBox, 0, Qt.AlignTop)
|
||||
|
||||
self.copyrightBox = QGroupBox(MainDialog)
|
||||
self.copyrightBox.setObjectName("copyrightBox")
|
||||
self.verticalLayout_6 = QVBoxLayout(self.copyrightBox)
|
||||
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||
self.label_6 = QLabel(self.copyrightBox)
|
||||
self.label_6.setObjectName("label_6")
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_6)
|
||||
|
||||
self.label_3 = QLabel(self.copyrightBox)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_3.setTextFormat(Qt.MarkdownText)
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_3)
|
||||
|
||||
self.label_4 = QLabel(self.copyrightBox)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.label_4.setTextFormat(Qt.MarkdownText)
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_4)
|
||||
|
||||
self.label_5 = QLabel(self.copyrightBox)
|
||||
self.label_5.setObjectName("label_5")
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_5)
|
||||
|
||||
self.rightLayout.addWidget(self.copyrightBox, 0, Qt.AlignTop)
|
||||
|
||||
self.horizontalLayout.addLayout(self.rightLayout)
|
||||
|
||||
self.horizontalLayout.setStretch(0, 1)
|
||||
|
||||
self.retranslateUi(MainDialog)
|
||||
|
||||
QMetaObject.connectSlotsByName(MainDialog)
|
||||
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, MainDialog):
|
||||
MainDialog.setWindowTitle(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog", "Kindle \u4e0b\u8f7d\u52a9\u624b", None
|
||||
)
|
||||
)
|
||||
self.listBox.setTitle(
|
||||
QCoreApplication.translate("MainDialog", "\u4e0b\u8f7d\u5217\u8868", None)
|
||||
)
|
||||
self.fetchButton.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog", "\u83b7\u53d6\u4e66\u7c4d\u5217\u8868", None
|
||||
)
|
||||
)
|
||||
self.label_2.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog", "\u76ee\u6807\u6587\u4ef6\u5939", None
|
||||
)
|
||||
)
|
||||
self.outDirEdit.setText(
|
||||
QCoreApplication.translate("MainDialog", "DOWNLOADS", None)
|
||||
)
|
||||
self.browseButton.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u6d4f\u89c8...", None)
|
||||
)
|
||||
self.downloadButton.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u4e0b\u8f7d\u5168\u90e8", None)
|
||||
)
|
||||
self.groupBox_2.setTitle(
|
||||
QCoreApplication.translate("MainDialog", "\u8f93\u51fa", None)
|
||||
)
|
||||
self.logBrowser.setHtml(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog",
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n'
|
||||
'<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">\n'
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
'<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html>',
|
||||
None,
|
||||
)
|
||||
)
|
||||
self.settingsBox.setTitle(
|
||||
QCoreApplication.translate("MainDialog", "\u8bbe\u7f6e", None)
|
||||
)
|
||||
self.loginGroupBox.setTitle("")
|
||||
self.radioCOM.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u7f8e\u4e9a(.com)", None)
|
||||
)
|
||||
self.radioCN.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u4e2d\u4e9a(.cn)", None)
|
||||
)
|
||||
self.loginButton.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u767b\u5f55", None)
|
||||
)
|
||||
self.cookiesGroupBox.setTitle(
|
||||
QCoreApplication.translate("MainDialog", "Cookies", None)
|
||||
)
|
||||
self.radioFromInput.setText(
|
||||
QCoreApplication.translate("MainDialog", "\u6765\u81ea\u8f93\u5165", None)
|
||||
)
|
||||
self.radioFromBrowser.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog", "\u6765\u81ea\u6d4f\u89c8\u5668", None
|
||||
)
|
||||
)
|
||||
self.groupBox.setTitle(
|
||||
QCoreApplication.translate("MainDialog", "CSRF Token", None)
|
||||
)
|
||||
self.label.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog", "\u6587\u4ef6\u540d\u622a\u65ad", None
|
||||
)
|
||||
)
|
||||
self.copyrightBox.setTitle("")
|
||||
self.label_6.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog",
|
||||
"\u9690\u79c1\u58f0\u660e\uff1a\u6211\u4eec\u4e0d\u4f1a\u6536\u96c6\u4efb\u4f55\u7528\u6237\u4fe1\u606f\uff0c\u8bf7\u653e\u5fc3\u4f7f\u7528",
|
||||
None,
|
||||
)
|
||||
)
|
||||
self.label_3.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog",
|
||||
"Copyright 2022 \u00a9 [yihong0618](https://github.com/yihong0618)",
|
||||
None,
|
||||
)
|
||||
)
|
||||
self.label_4.setText(
|
||||
QCoreApplication.translate(
|
||||
"MainDialog",
|
||||
"GitHub: <https://github.com/yihong0618/Kindle_download_helper>",
|
||||
None,
|
||||
)
|
||||
)
|
||||
self.label_5.setText(
|
||||
QCoreApplication.translate("MainDialog", "License: MIT", None)
|
||||
)
|
||||
|
||||
# retranslateUi
|
||||
1828
kindle_rc.py
Normal file
1828
kindle_rc.py
Normal file
File diff suppressed because it is too large
Load Diff
2
requirements_gui.txt
Normal file
2
requirements_gui.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
PySide6
|
||||
PyInstaller
|
||||
BIN
resource/kindle.png
Normal file
BIN
resource/kindle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
263
ui_kindle.py
Normal file
263
ui_kindle.py
Normal file
@@ -0,0 +1,263 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'kindle.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.3.0
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QDialog, QGroupBox, QHBoxLayout,
|
||||
QHeaderView, QLabel, QLineEdit, QPlainTextEdit,
|
||||
QPushButton, QRadioButton, QSizePolicy, QSpinBox,
|
||||
QTableView, QTextBrowser, QVBoxLayout, QWidget)
|
||||
import kindle_rc
|
||||
|
||||
class Ui_MainDialog(object):
|
||||
def setupUi(self, MainDialog):
|
||||
if not MainDialog.objectName():
|
||||
MainDialog.setObjectName(u"MainDialog")
|
||||
MainDialog.resize(1190, 872)
|
||||
icon = QIcon()
|
||||
icon.addFile(u":/icon/resource/kindle.png", QSize(), QIcon.Normal, QIcon.Off)
|
||||
MainDialog.setWindowIcon(icon)
|
||||
self.horizontalLayout = QHBoxLayout(MainDialog)
|
||||
self.horizontalLayout.setSpacing(10)
|
||||
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||
self.leftLayout = QVBoxLayout()
|
||||
self.leftLayout.setObjectName(u"leftLayout")
|
||||
self.listBox = QGroupBox(MainDialog)
|
||||
self.listBox.setObjectName(u"listBox")
|
||||
self.verticalLayout_5 = QVBoxLayout(self.listBox)
|
||||
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
|
||||
self.fetchButton = QPushButton(self.listBox)
|
||||
self.fetchButton.setObjectName(u"fetchButton")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.fetchButton, 0, Qt.AlignRight)
|
||||
|
||||
self.bookView = QTableView(self.listBox)
|
||||
self.bookView.setObjectName(u"bookView")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.bookView)
|
||||
|
||||
self.horizontalLayout_4 = QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
|
||||
self.label_2 = QLabel(self.listBox)
|
||||
self.label_2.setObjectName(u"label_2")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.label_2)
|
||||
|
||||
self.outDirEdit = QLineEdit(self.listBox)
|
||||
self.outDirEdit.setObjectName(u"outDirEdit")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.outDirEdit)
|
||||
|
||||
self.browseButton = QPushButton(self.listBox)
|
||||
self.browseButton.setObjectName(u"browseButton")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.browseButton)
|
||||
|
||||
self.downloadButton = QPushButton(self.listBox)
|
||||
self.downloadButton.setObjectName(u"downloadButton")
|
||||
|
||||
self.horizontalLayout_4.addWidget(self.downloadButton)
|
||||
|
||||
|
||||
self.verticalLayout_5.addLayout(self.horizontalLayout_4)
|
||||
|
||||
|
||||
self.leftLayout.addWidget(self.listBox)
|
||||
|
||||
self.groupBox_2 = QGroupBox(MainDialog)
|
||||
self.groupBox_2.setObjectName(u"groupBox_2")
|
||||
self.groupBox_2.setMaximumSize(QSize(16777215, 200))
|
||||
self.verticalLayout_7 = QVBoxLayout(self.groupBox_2)
|
||||
self.verticalLayout_7.setObjectName(u"verticalLayout_7")
|
||||
self.logBrowser = QTextBrowser(self.groupBox_2)
|
||||
self.logBrowser.setObjectName(u"logBrowser")
|
||||
|
||||
self.verticalLayout_7.addWidget(self.logBrowser)
|
||||
|
||||
|
||||
self.leftLayout.addWidget(self.groupBox_2)
|
||||
|
||||
|
||||
self.horizontalLayout.addLayout(self.leftLayout)
|
||||
|
||||
self.rightLayout = QVBoxLayout()
|
||||
self.rightLayout.setSpacing(6)
|
||||
self.rightLayout.setObjectName(u"rightLayout")
|
||||
self.settingsBox = QGroupBox(MainDialog)
|
||||
self.settingsBox.setObjectName(u"settingsBox")
|
||||
self.settingsBox.setMaximumSize(QSize(400, 16777215))
|
||||
self.verticalLayout = QVBoxLayout(self.settingsBox)
|
||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||
self.loginGroupBox = QGroupBox(self.settingsBox)
|
||||
self.loginGroupBox.setObjectName(u"loginGroupBox")
|
||||
self.horizontalLayout_2 = QHBoxLayout(self.loginGroupBox)
|
||||
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
||||
self.verticalLayout_2 = QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||
self.radioCOM = QRadioButton(self.loginGroupBox)
|
||||
self.radioCOM.setObjectName(u"radioCOM")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.radioCOM)
|
||||
|
||||
self.radioCN = QRadioButton(self.loginGroupBox)
|
||||
self.radioCN.setObjectName(u"radioCN")
|
||||
self.radioCN.setChecked(True)
|
||||
|
||||
self.verticalLayout_2.addWidget(self.radioCN)
|
||||
|
||||
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
|
||||
|
||||
self.loginButton = QPushButton(self.loginGroupBox)
|
||||
self.loginButton.setObjectName(u"loginButton")
|
||||
self.loginButton.setMaximumSize(QSize(80, 16777215))
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.loginButton)
|
||||
|
||||
|
||||
self.verticalLayout.addWidget(self.loginGroupBox)
|
||||
|
||||
self.cookiesGroupBox = QGroupBox(self.settingsBox)
|
||||
self.cookiesGroupBox.setObjectName(u"cookiesGroupBox")
|
||||
self.verticalLayout_3 = QVBoxLayout(self.cookiesGroupBox)
|
||||
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
||||
self.cookieTextEdit = QPlainTextEdit(self.cookiesGroupBox)
|
||||
self.cookieTextEdit.setObjectName(u"cookieTextEdit")
|
||||
self.cookieTextEdit.setEnabled(False)
|
||||
|
||||
self.verticalLayout_3.addWidget(self.cookieTextEdit)
|
||||
|
||||
self.horizontalLayout_3 = QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
|
||||
self.radioFromInput = QRadioButton(self.cookiesGroupBox)
|
||||
self.radioFromInput.setObjectName(u"radioFromInput")
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.radioFromInput)
|
||||
|
||||
self.radioFromBrowser = QRadioButton(self.cookiesGroupBox)
|
||||
self.radioFromBrowser.setObjectName(u"radioFromBrowser")
|
||||
self.radioFromBrowser.setChecked(True)
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.radioFromBrowser)
|
||||
|
||||
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
|
||||
|
||||
|
||||
self.verticalLayout.addWidget(self.cookiesGroupBox)
|
||||
|
||||
self.groupBox = QGroupBox(self.settingsBox)
|
||||
self.groupBox.setObjectName(u"groupBox")
|
||||
self.verticalLayout_4 = QVBoxLayout(self.groupBox)
|
||||
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
||||
self.csrfEdit = QLineEdit(self.groupBox)
|
||||
self.csrfEdit.setObjectName(u"csrfEdit")
|
||||
|
||||
self.verticalLayout_4.addWidget(self.csrfEdit)
|
||||
|
||||
|
||||
self.verticalLayout.addWidget(self.groupBox)
|
||||
|
||||
self.horizontalLayout_5 = QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
|
||||
self.label = QLabel(self.settingsBox)
|
||||
self.label.setObjectName(u"label")
|
||||
|
||||
self.horizontalLayout_5.addWidget(self.label)
|
||||
|
||||
self.cutLengthSpin = QSpinBox(self.settingsBox)
|
||||
self.cutLengthSpin.setObjectName(u"cutLengthSpin")
|
||||
self.cutLengthSpin.setMaximum(999)
|
||||
self.cutLengthSpin.setValue(100)
|
||||
|
||||
self.horizontalLayout_5.addWidget(self.cutLengthSpin)
|
||||
|
||||
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_5)
|
||||
|
||||
|
||||
self.rightLayout.addWidget(self.settingsBox, 0, Qt.AlignTop)
|
||||
|
||||
self.copyrightBox = QGroupBox(MainDialog)
|
||||
self.copyrightBox.setObjectName(u"copyrightBox")
|
||||
self.verticalLayout_6 = QVBoxLayout(self.copyrightBox)
|
||||
self.verticalLayout_6.setObjectName(u"verticalLayout_6")
|
||||
self.label_6 = QLabel(self.copyrightBox)
|
||||
self.label_6.setObjectName(u"label_6")
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_6)
|
||||
|
||||
self.label_3 = QLabel(self.copyrightBox)
|
||||
self.label_3.setObjectName(u"label_3")
|
||||
self.label_3.setTextFormat(Qt.MarkdownText)
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_3)
|
||||
|
||||
self.label_4 = QLabel(self.copyrightBox)
|
||||
self.label_4.setObjectName(u"label_4")
|
||||
self.label_4.setTextFormat(Qt.MarkdownText)
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_4)
|
||||
|
||||
self.label_5 = QLabel(self.copyrightBox)
|
||||
self.label_5.setObjectName(u"label_5")
|
||||
|
||||
self.verticalLayout_6.addWidget(self.label_5)
|
||||
|
||||
|
||||
self.rightLayout.addWidget(self.copyrightBox, 0, Qt.AlignTop)
|
||||
|
||||
|
||||
self.horizontalLayout.addLayout(self.rightLayout)
|
||||
|
||||
self.horizontalLayout.setStretch(0, 1)
|
||||
|
||||
self.retranslateUi(MainDialog)
|
||||
|
||||
QMetaObject.connectSlotsByName(MainDialog)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, MainDialog):
|
||||
MainDialog.setWindowTitle(QCoreApplication.translate("MainDialog", u"Kindle \u4e0b\u8f7d\u52a9\u624b", None))
|
||||
self.listBox.setTitle(QCoreApplication.translate("MainDialog", u"\u4e0b\u8f7d\u5217\u8868", None))
|
||||
self.fetchButton.setText(QCoreApplication.translate("MainDialog", u"\u83b7\u53d6\u4e66\u7c4d\u5217\u8868", None))
|
||||
self.label_2.setText(QCoreApplication.translate("MainDialog", u"\u76ee\u6807\u6587\u4ef6\u5939", None))
|
||||
self.outDirEdit.setText(QCoreApplication.translate("MainDialog", u"DOWNLOADS", None))
|
||||
self.browseButton.setText(QCoreApplication.translate("MainDialog", u"\u6d4f\u89c8...", None))
|
||||
self.downloadButton.setText(QCoreApplication.translate("MainDialog", u"\u4e0b\u8f7d\u5168\u90e8", None))
|
||||
self.groupBox_2.setTitle(QCoreApplication.translate("MainDialog", u"\u8f93\u51fa", None))
|
||||
self.logBrowser.setHtml(QCoreApplication.translate("MainDialog", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", None))
|
||||
self.settingsBox.setTitle(QCoreApplication.translate("MainDialog", u"\u8bbe\u7f6e", None))
|
||||
self.loginGroupBox.setTitle("")
|
||||
self.radioCOM.setText(QCoreApplication.translate("MainDialog", u"\u7f8e\u4e9a(.com)", None))
|
||||
self.radioCN.setText(QCoreApplication.translate("MainDialog", u"\u4e2d\u4e9a(.cn)", None))
|
||||
self.loginButton.setText(QCoreApplication.translate("MainDialog", u"\u767b\u5f55", None))
|
||||
self.cookiesGroupBox.setTitle(QCoreApplication.translate("MainDialog", u"Cookies", None))
|
||||
self.radioFromInput.setText(QCoreApplication.translate("MainDialog", u"\u6765\u81ea\u8f93\u5165", None))
|
||||
self.radioFromBrowser.setText(QCoreApplication.translate("MainDialog", u"\u6765\u81ea\u6d4f\u89c8\u5668", None))
|
||||
self.groupBox.setTitle(QCoreApplication.translate("MainDialog", u"CSRF Token", None))
|
||||
self.label.setText(QCoreApplication.translate("MainDialog", u"\u6587\u4ef6\u540d\u622a\u65ad", None))
|
||||
self.copyrightBox.setTitle("")
|
||||
self.label_6.setText(QCoreApplication.translate("MainDialog", u"\u9690\u79c1\u58f0\u660e\uff1a\u6211\u4eec\u4e0d\u4f1a\u6536\u96c6\u4efb\u4f55\u7528\u6237\u4fe1\u606f\uff0c\u8bf7\u653e\u5fc3\u4f7f\u7528", None))
|
||||
self.label_3.setText(QCoreApplication.translate("MainDialog", u"Copyright 2022 \u00a9 [yihong0618](https://github.com/yihong0618)", None))
|
||||
self.label_4.setText(QCoreApplication.translate("MainDialog", u"GitHub: <https://github.com/yihong0618/Kindle_download_helper>", None))
|
||||
self.label_5.setText(QCoreApplication.translate("MainDialog", u"License: MIT", None))
|
||||
# retranslateUi
|
||||
|
||||
Reference in New Issue
Block a user