本地漫画支持多章节

This commit is contained in:
tonquer 2023-08-13 18:14:45 +08:00
parent 69bd22ab68
commit 97a2e18231
36 changed files with 10363 additions and 4103 deletions

View File

@ -2,6 +2,18 @@
# tonquer<tonquer@qq.com>
# https://github.com/tonquer/picacg-qt
######################################################################################
# Version: v1.4.6
# 2023/8/13
# 1) 本地漫画支持多章节
# Version: v1.4.5
# 2023/5/7
# 1) 修改上一页和上一章跳到最后 #252
# 2) 自动打卡功能
# 3) 新增新版本聊天室
# 4) 修复上下滚动可能出现回滚 #242
# 5) 收藏新增搜索功能
# Version: v1.4.4
# 2023/3/19
# 1) 优化非滚动模式下,放大后的清晰度问题

BIN
res/icon/clear_off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
res/icon/clear_on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,14 +1,12 @@
import os
import sys
from tools.langconv import Converter
cmd = "pyside6-lupdate.exe"
sts = os.system(cmd + " -no-obsolete -source-language zh_CN -target-language zh_HK ../src/tools/str.py -ts ../translate/str_hk.ts")
sts = os.system(cmd + " -no-obsolete -source-language zh_CN -target-language en_US ../src/tools/str.py -ts ../translate/str_en.ts")
sts = os.system(cmd + " -no-obsolete -source-language zh_CN -target-language zh_HK ../ui -ts ../translate/ui_hk.ts")
sts = os.system(cmd + " -no-obsolete -source-language zh_CN -target-language en_US ../ui -ts ../translate/ui_en.ts")
os.system("chcp 65001")
sts = os.system("pyside6-lupdate.exe -no-obsolete -source-language zh_CN -target-language zh_HK ../src/tools/str.py -ts ../translate/str_hk.ts")
sts = os.system("pyside6-lupdate.exe -no-obsolete -source-language zh_CN -target-language en_US ../src/tools/str.py -ts ../translate/str_en.ts")
sts = os.system("pyside6-lupdate.exe -no-obsolete -source-language zh_CN -target-language zh_HK ../ui -ts ../translate/ui_hk.ts")
sts = os.system("pyside6-lupdate.exe -no-obsolete -source-language zh_CN -target-language en_US ../ui -ts ../translate/ui_en.ts")
#
for tsFile in ["../translate/str_hk.ts", "../translate/ui_hk.ts"]:
f = open(tsFile, "r", encoding="utf-8")
data = ""
@ -33,6 +31,5 @@ for tsFile in ["../translate/str_hk.ts", "../translate/ui_hk.ts"]:
f.write(data)
f.close()
cmd = "pyside6-lrelease.exe"
sts = os.system(cmd + " ../translate/str_en.ts ../translate/ui_en.ts -qm ../res/tr/tr_en.qm")
sts = os.system(cmd + " ../translate/str_hk.ts ../translate/ui_hk.ts -qm ../res/tr/tr_hk.qm")
sts = os.system("pyside6-lrelease.exe ../translate/str_en.ts ../translate/ui_en.ts -qm ../res/tr/tr_en.qm")
sts = os.system("pyside6-lrelease.exe ../translate/str_hk.ts ../translate/ui_hk.ts -qm ../res/tr/tr_hk.qm")

View File

@ -31,6 +31,7 @@ class ComicListWidget(BaseListWidget):
self.isDelMenu = False
self.isGame = False
self.isLocal = False
self.isLocalEps = False
self.isMoveMenu = False
self.openMenu = False
@ -113,7 +114,10 @@ class ComicListWidget(BaseListWidget):
widget.title = v.title
widget.picNum = v.picCnt
widget.url = v.file
title += "<font color=#d5577c>{}</font>".format("(" + str(v.picCnt) + "P)")
if len(v.eps) > 0:
title += "<font color=#d5577c>{}</font>".format("(" + str(len(v.eps)) + "E)")
else:
title += "<font color=#d5577c>{}</font>".format("(" + str(v.picCnt) + "P)")
if v.lastReadTime:
categories = "{} {}".format(ToolUtil.GetUpdateStrByTick(v.lastReadTime), Str.GetStr(Str.Looked))
@ -247,6 +251,8 @@ class ComicListWidget(BaseListWidget):
assert isinstance(widget, ComicItemWidget)
if self.isGame:
QtOwner().OpenGameInfo(widget.id)
elif self.isLocalEps:
QtOwner().OpenLocalEpsBook(widget.id)
elif self.isLocal:
QtOwner().OpenLocalBook(widget.id)
else:

View File

@ -54,7 +54,7 @@ Issues3 = "https://hub.fastgit.xyz/tonquer/picacg-qt/issues"
UpdateVersion = "v1.4.5"
RealVersion = "v1.4.5"
TimeVersion = "2023-5-7"
TimeVersion = "2023-8-13"
Waifu2xVersion = "1.1.6"

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ class Ui_Help(object):
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 753, 718))
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 736, 744))
self.verticalLayout_3 = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.horizontalLayout = QHBoxLayout()
@ -89,33 +89,10 @@ class Ui_Help(object):
self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
self.verCheck = QPushButton(self.widget_2)
self.verCheck.setObjectName(u"verCheck")
self.gridLayout.addWidget(self.verCheck, 1, 2, 1, 1)
self.logButton = QPushButton(self.widget_2)
self.logButton.setObjectName(u"logButton")
self.gridLayout.addWidget(self.logButton, 5, 2, 1, 1)
self.label_7 = QLabel(self.widget_2)
self.label_7.setObjectName(u"label_7")
self.label_7.setMinimumSize(QSize(80, 50))
self.label_7.setFont(font)
self.gridLayout.addWidget(self.label_7, 5, 0, 1, 1)
self.localTime = QLabel(self.widget_2)
self.localTime.setObjectName(u"localTime")
self.localTime.setFont(font)
self.gridLayout.addWidget(self.localTime, 4, 1, 1, 1)
self.dbCheck = QPushButton(self.widget_2)
self.dbCheck.setObjectName(u"dbCheck")
self.gridLayout.addWidget(self.dbCheck, 4, 2, 1, 1)
self.gridLayout.addWidget(self.dbCheck, 5, 2, 1, 1)
self.label_4 = QLabel(self.widget_2)
self.label_4.setObjectName(u"label_4")
@ -124,23 +101,11 @@ class Ui_Help(object):
self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1)
self.localNum = QLabel(self.widget_2)
self.localNum.setObjectName(u"localNum")
self.localNum.setFont(font)
self.localTime = QLabel(self.widget_2)
self.localTime.setObjectName(u"localTime")
self.localTime.setFont(font)
self.gridLayout.addWidget(self.localNum, 3, 1, 1, 1)
self.label_9 = QLabel(self.widget_2)
self.label_9.setObjectName(u"label_9")
self.label_9.setFont(font)
self.gridLayout.addWidget(self.label_9, 1, 0, 1, 1)
self.version = QLabel(self.widget_2)
self.version.setObjectName(u"version")
self.version.setFont(font)
self.gridLayout.addWidget(self.version, 0, 1, 1, 1)
self.gridLayout.addWidget(self.localTime, 5, 1, 1, 1)
self.label_6 = QLabel(self.widget_2)
self.label_6.setObjectName(u"label_6")
@ -149,33 +114,81 @@ class Ui_Help(object):
self.gridLayout.addWidget(self.label_6, 2, 0, 1, 1)
self.label_11 = QLabel(self.widget_2)
self.label_11.setObjectName(u"label_11")
self.label_11.setFont(font)
self.gridLayout.addWidget(self.label_11, 4, 0, 1, 1)
self.upTimeLabel = QLabel(self.widget_2)
self.upTimeLabel.setObjectName(u"upTimeLabel")
self.upTimeLabel.setFont(font)
self.gridLayout.addWidget(self.upTimeLabel, 1, 1, 1, 1)
self.verCheck = QPushButton(self.widget_2)
self.verCheck.setObjectName(u"verCheck")
self.gridLayout.addWidget(self.verCheck, 1, 2, 1, 1)
self.localNum = QLabel(self.widget_2)
self.localNum.setObjectName(u"localNum")
self.localNum.setFont(font)
self.gridLayout.addWidget(self.localNum, 3, 1, 1, 1)
self.openCmd = QPushButton(self.widget_2)
self.openCmd.setObjectName(u"openCmd")
self.gridLayout.addWidget(self.openCmd, 6, 1, 1, 1)
self.preCheckBox = QCheckBox(self.widget_2)
self.preCheckBox.setObjectName(u"preCheckBox")
self.gridLayout.addWidget(self.preCheckBox, 0, 2, 1, 1)
self.version = QLabel(self.widget_2)
self.version.setObjectName(u"version")
self.version.setFont(font)
self.gridLayout.addWidget(self.version, 0, 1, 1, 1)
self.label_9 = QLabel(self.widget_2)
self.label_9.setObjectName(u"label_9")
self.label_9.setFont(font)
self.gridLayout.addWidget(self.label_9, 1, 0, 1, 1)
self.logButton = QPushButton(self.widget_2)
self.logButton.setObjectName(u"logButton")
self.gridLayout.addWidget(self.logButton, 6, 2, 1, 1)
self.label_7 = QLabel(self.widget_2)
self.label_7.setObjectName(u"label_7")
self.label_7.setMinimumSize(QSize(80, 50))
self.label_7.setFont(font)
self.gridLayout.addWidget(self.label_7, 6, 0, 1, 1)
self.label_11 = QLabel(self.widget_2)
self.label_11.setObjectName(u"label_11")
self.label_11.setFont(font)
self.gridLayout.addWidget(self.label_11, 5, 0, 1, 1)
self.waifu2x = QLabel(self.widget_2)
self.waifu2x.setObjectName(u"waifu2x")
self.waifu2x.setFont(font)
self.gridLayout.addWidget(self.waifu2x, 2, 1, 1, 1)
self.openCmd = QPushButton(self.widget_2)
self.openCmd.setObjectName(u"openCmd")
self.label_10 = QLabel(self.widget_2)
self.label_10.setObjectName(u"label_10")
self.label_10.setMinimumSize(QSize(80, 50))
self.label_10.setFont(font)
self.gridLayout.addWidget(self.openCmd, 5, 1, 1, 1)
self.gridLayout.addWidget(self.label_10, 4, 0, 1, 1)
self.preCheckBox = QCheckBox(self.widget_2)
self.preCheckBox.setObjectName(u"preCheckBox")
self.localVer = QLabel(self.widget_2)
self.localVer.setObjectName(u"localVer")
self.localVer.setFont(font)
self.gridLayout.addWidget(self.preCheckBox, 0, 2, 1, 1)
self.gridLayout.addWidget(self.localVer, 4, 1, 1, 1)
self.verticalLayout_2.addWidget(self.widget_2)
@ -239,21 +252,23 @@ class Ui_Help(object):
self.label_3.setText(QCoreApplication.translate("Help", u"\u60f3\u63d0\u4f9b\u4e00\u4e9b\u5efa\u8bae\uff1f", None))
self.pushButton.setText(QCoreApplication.translate("Help", u"Github Issue", None))
self.label_5.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u5e93\u6570\u91cf:", None))
self.verCheck.setText(QCoreApplication.translate("Help", u"\u68c0\u6d4b\u66f4\u65b0", None))
self.logButton.setText(QCoreApplication.translate("Help", u"\u6253\u5f00\u65e5\u5fd7\u76ee\u5f55", None))
self.label_7.setText(QCoreApplication.translate("Help", u"\u65e5\u5fd7:", None))
self.localTime.setText("")
self.dbCheck.setText(QCoreApplication.translate("Help", u"\u68c0\u6d4b\u66f4\u65b0", None))
self.label_4.setText(QCoreApplication.translate("Help", u"\u7248\u672c\u53f7:", None))
self.localNum.setText("")
self.label_9.setText(QCoreApplication.translate("Help", u"\u4e0a\u6b21\u66f4\u65b0\u65f6\u95f4\uff1a", None))
self.version.setText(QCoreApplication.translate("Help", u"v1.2.8", None))
self.localTime.setText("")
self.label_6.setText(QCoreApplication.translate("Help", u"waifu2x\u7248\u672c:", None))
self.label_11.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u6570\u636e\u4e0a\u6b21\u66f4\u65b0:", None))
self.upTimeLabel.setText(QCoreApplication.translate("Help", u"2021-11-27", None))
self.waifu2x.setText(QCoreApplication.translate("Help", u"v1.0.8", None))
self.verCheck.setText(QCoreApplication.translate("Help", u"\u68c0\u6d4b\u66f4\u65b0", None))
self.localNum.setText("")
self.openCmd.setText(QCoreApplication.translate("Help", u"\u6253\u5f00\u63a7\u5236\u53f0", None))
self.preCheckBox.setText(QCoreApplication.translate("Help", u"\u63a5\u53d7Beta\u7248\u672c\u66f4\u65b0", None))
self.version.setText(QCoreApplication.translate("Help", u"v1.2.8", None))
self.label_9.setText(QCoreApplication.translate("Help", u"\u4e0a\u6b21\u66f4\u65b0\u65f6\u95f4\uff1a", None))
self.logButton.setText(QCoreApplication.translate("Help", u"\u6253\u5f00\u65e5\u5fd7\u76ee\u5f55", None))
self.label_7.setText(QCoreApplication.translate("Help", u"\u65e5\u5fd7:", None))
self.label_11.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u6570\u636e\u4e0a\u6b21\u66f4\u65b0:", None))
self.waifu2x.setText(QCoreApplication.translate("Help", u"v1.0.8", None))
self.label_10.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u5e93\u7248\u672c\uff1a", None))
self.localVer.setText("")
self.label_8.setText(QCoreApplication.translate("Help", u"\u65b0\u7248\u672c\uff1a", None))
self.updateLabel.setText("")
self.updateButton.setText(QCoreApplication.translate("Help", u"\u524d\u5f80\u66f4\u65b0", None))

View File

@ -16,8 +16,9 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QComboBox, QFrame, QGridLayout,
QHBoxLayout, QLabel, QListWidgetItem, QPushButton,
QSizePolicy, QSpacerItem, QSpinBox, QWidget)
QHBoxLayout, QLabel, QLineEdit, QListWidgetItem,
QPushButton, QSizePolicy, QSpacerItem, QSpinBox,
QWidget)
from component.list.comic_list_widget import ComicListWidget
from component.list.tag_list_widget import TagListWidget
@ -29,6 +30,17 @@ class Ui_Local(object):
Local.resize(628, 334)
self.gridLayout_2 = QGridLayout(Local)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.bookList = ComicListWidget(Local)
self.bookList.setObjectName(u"bookList")
self.bookList.setStyleSheet(u"")
self.gridLayout_3.addWidget(self.bookList, 0, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_3, 3, 0, 1, 1)
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.tagsList = TagListWidget(Local)
@ -67,18 +79,7 @@ class Ui_Local(object):
self.horizontalLayout_2.addWidget(self.toolButton, 0, Qt.AlignRight)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.bookList = ComicListWidget(Local)
self.bookList.setObjectName(u"bookList")
self.bookList.setStyleSheet(u"")
self.gridLayout_3.addWidget(self.bookList, 0, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_3, 2, 0, 1, 1)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
self.gridLayout_4 = QGridLayout()
self.gridLayout_4.setObjectName(u"gridLayout_4")
@ -168,7 +169,24 @@ class Ui_Local(object):
self.gridLayout_4.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_4, 3, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_4, 4, 0, 1, 1)
self.widget = QWidget(Local)
self.widget.setObjectName(u"widget")
self.horizontalLayout_3 = QHBoxLayout(self.widget)
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.label = QLabel(self.widget)
self.label.setObjectName(u"label")
self.horizontalLayout_3.addWidget(self.label)
self.lineEdit = QLineEdit(self.widget)
self.lineEdit.setObjectName(u"lineEdit")
self.horizontalLayout_3.addWidget(self.lineEdit)
self.gridLayout_2.addWidget(self.widget, 0, 0, 1, 1)
self.retranslateUi(Local)
@ -194,5 +212,6 @@ class Ui_Local(object):
#if QT_CONFIG(shortcut)
self.jumpButton.setShortcut(QCoreApplication.translate("Local", u"Return", None))
#endif // QT_CONFIG(shortcut)
self.label.setText(QCoreApplication.translate("Local", u"\u641c\u7d22\uff1a", None))
# retranslateUi

View File

@ -15,7 +15,8 @@ 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, QGridLayout, QListWidgetItem, QSizePolicy,
from PySide6.QtWidgets import (QApplication, QGridLayout, QHBoxLayout, QLabel,
QListWidgetItem, QRadioButton, QSizePolicy, QSpacerItem,
QWidget)
from component.list.comic_list_widget import ComicListWidget
@ -36,7 +37,26 @@ class Ui_LocalEps(object):
self.gridLayout_3.addWidget(self.bookList, 0, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_3, 1, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout_3, 4, 0, 1, 1)
self.name = QLabel(LocalEps)
self.name.setObjectName(u"name")
self.gridLayout_2.addWidget(self.name, 0, 0, 1, 1)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.showWaifu2x = QRadioButton(LocalEps)
self.showWaifu2x.setObjectName(u"showWaifu2x")
self.horizontalLayout.addWidget(self.showWaifu2x)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout.addItem(self.horizontalSpacer)
self.gridLayout_2.addLayout(self.horizontalLayout, 2, 0, 1, 1)
self.retranslateUi(LocalEps)
@ -46,5 +66,7 @@ class Ui_LocalEps(object):
def retranslateUi(self, LocalEps):
LocalEps.setWindowTitle(QCoreApplication.translate("LocalEps", u"\u672c\u5730\u6f2b\u753b\u7ae0\u8282", None))
self.name.setText("")
self.showWaifu2x.setText(QCoreApplication.translate("LocalEps", u"\u53ea\u663e\u793aWaifu2x", None))
# retranslateUi

View File

@ -101,9 +101,9 @@ class Ui_Main(object):
self.indexView = IndexView()
self.indexView.setObjectName(u"indexView")
self.subStackWidget.addWidget(self.indexView)
self.localEpsReadView = LocalEpsReadView()
self.localEpsReadView.setObjectName(u"localEpsReadView")
self.subStackWidget.addWidget(self.localEpsReadView)
self.localReadEpsView = LocalEpsReadView()
self.localReadEpsView.setObjectName(u"localReadEpsView")
self.subStackWidget.addWidget(self.localReadEpsView)
self.chatNewView = ChatNewView()
self.chatNewView.setObjectName(u"chatNewView")
self.subStackWidget.addWidget(self.chatNewView)

View File

@ -42,7 +42,7 @@ from view.info.game_info_view import GameInfoView
from view.read.read_view import ReadView
from view.search.search_view import SearchView
from view.setting.setting_view import SettingView
from view.tool.local_eps_read_view import LocalEpsReadView
from view.tool.local_read_eps_view import LocalReadEpsView
from view.tool.local_read_view import LocalReadView
from view.tool.waifu2x_tool_view import Waifu2xToolView
from view.user.favorite_view import FavoriteView
@ -171,9 +171,9 @@ class Ui_MainWindows(object):
self.chatNewView = ChatNewView()
self.chatNewView.setObjectName(u"chatNewView")
self.subStackWidget.addWidget(self.chatNewView)
self.localEpsReadView = LocalEpsReadView()
self.localEpsReadView.setObjectName(u"localEpsReadView")
self.subStackWidget.addWidget(self.localEpsReadView)
self.localReadEpsView = LocalReadEpsView()
self.localReadEpsView.setObjectName(u"localReadEpsView")
self.subStackWidget.addWidget(self.localReadEpsView)
self.bookEpsView = BookEpsView()
self.bookEpsView.setObjectName(u"bookEpsView")
self.subStackWidget.addWidget(self.bookEpsView)

View File

@ -195,6 +195,10 @@ class QtOwner(Singleton):
self.owner.searchView2.searchTab.setText(Title)
self.owner.SwitchWidget(self.owner.searchView2, **arg)
def OpenLocalEpsView(self, bookId):
arg = {"bookId": bookId}
self.owner.SwitchWidget(self.owner.localReadEpsView, **arg)
def OpenSearchByText(self, text):
self.owner.searchView.lineEdit.setText(text)
self.owner.searchView.lineEdit.Search()
@ -203,9 +207,9 @@ class QtOwner(Singleton):
self.owner.totalStackWidget.setCurrentIndex(1)
self.owner.readView.OpenPage(bookId, index, pageIndex=pageIndex, isOffline=isOffline)
def OpenLocalReadView(self, v):
def OpenLocalReadView(self, v, epsId=0):
self.owner.totalStackWidget.setCurrentIndex(1)
self.owner.readView.OpenLocalPage(v)
self.owner.readView.OpenLocalPage(v, epsId)
def CloseReadView(self):
self.owner.totalStackWidget.setCurrentIndex(0)
@ -238,6 +242,9 @@ class QtOwner(Singleton):
def OpenLocalBook(self, bookId):
self.owner.localReadView.OpenLocalBook(bookId)
def OpenLocalEpsBook(self, bookId):
self.owner.localReadEpsView.OpenLocalBook(bookId)
def OpenEpsInfo(self, bookId):
# self.owner.subCommentView.SetOpenEvent(commentId, widget)
arg = {"bookId": bookId}

View File

@ -224,21 +224,22 @@ class SqlServer(Singleton):
def _SelectUpdateInfo(self, conn, sql, backId):
cur = conn.cursor()
cur.execute("select * from system")
cur.execute("select id, size, time, sub_version from system where 1 order by id desc limit 1")
nums = 0
time = ""
version = 0
dbVer = ""
for data in cur.fetchall():
if config.UpdateVersion == data[0]:
nums = data[1]
time = data[2]
version = data[3]
dbVer = data[0]
nums = data[1]
time = data[2]
version = data[3]
cur.execute("select count(*) from book")
for data in cur.fetchall():
nums = data[0]
data = pickle.dumps((nums, time, version))
data = pickle.dumps((dbVer, nums, time, version))
if backId:
TaskSql().taskObj.sqlBack.emit(backId, data)

View File

@ -36,7 +36,7 @@ class QLocalTask(object):
class LocalData(object):
Type1 = 1 # 加载目录
Type2 = 2 # 加载文件
Type3 = 3 #
Type3 = 3 # 加载目录所有
Type4 = 4 #
Type5 = 5 # 批量加载
@ -61,6 +61,10 @@ class LocalData(object):
self.pic = [] # 图片数
self.eps = [] # 多章节
@property
def isWaifu2x(self):
return "waifu2x" in self.file or "waifu2x" in self.path
def CopyData(self, o):
assert isinstance(o, LocalData)
self.cover = o.cover
@ -68,6 +72,20 @@ class LocalData(object):
self.pic = []
self.pic.extend(o.pic)
oldDict = {}
for v in self.eps:
oldDict[v.id] = v
self.eps.clear()
for v in o.eps:
if v.id in oldDict:
newV = oldDict[v.id]
newV.CopyData(v)
self.eps.append(newV)
else:
self.eps.append(v)
@property
def sumPicCnt(self):
a = 0
@ -82,6 +100,15 @@ class LocalData(object):
self.cover = self.pic[0]
return
def SortEps(self):
self.eps = natsorted(self.eps, key=lambda a:a.title)
if self.eps:
first = self.eps[0]
path = first.file.replace(self.file, "").strip("\\").strip("/")
self.cover = os.path.join(path, os.path.join(first.path, first.cover))
for v in self.eps:
v.main_id = self.id
return
class TaskLocal(TaskBase, QtTaskBase):
def __init__(self) -> None:
@ -191,7 +218,8 @@ class TaskLocal(TaskBase, QtTaskBase):
st, data = self.ParseBookInfoByFile(dir)
datas = [data]
elif type == LocalData.Type3:
st, datas = self.ParseBookInfoByFile(dir)
st, data = self.ParseBookInfoByDirRecursion(dir)
datas = [data]
elif type == LocalData.Type4:
st, datas = self.ParseBookInfoByFile(dir)
elif type == LocalData.Type5:
@ -222,9 +250,13 @@ class TaskLocal(TaskBase, QtTaskBase):
self._inQueue.put(self.taskId)
return self.taskId
def AddLoadReadPicture(self, v, index, backParam, callBack, cleanFlag):
def AddLoadReadPicture(self, v2, index, backParam, callBack, cleanFlag):
self.taskId += 1
assert isinstance(v, LocalData)
assert isinstance(v2, LocalData)
if index == -1 and v2.eps:
v = v2.eps[0]
else:
v = v2
info = QLocalTask(self.taskId)
info.callBack = callBack
@ -306,6 +338,77 @@ class TaskLocal(TaskBase, QtTaskBase):
return Str.ErrorPath, ""
return Status.Ok, l
def ParseBookInfoByDirRecursion(self, dirName):
# 解析递归目录
# 获取目录名称
path = dirName
try:
if not os.path.isdir(dirName):
return Str.ErrorPath, ""
nextPath = ""
allData = self.ParseBookInfoByDirRecursion2(dirName)
if not allData:
return Str.ErrorPath, ""
if len(allData) <= 1 :
return self.ParseBookInfoByDir(dirName)
l = LocalData()
l.eps = allData
l.title = os.path.basename(dirName)
l.file = dirName
l.id = hashlib.md5(l.file.encode("utf-8")).hexdigest()
l.SortEps()
l.path = ""
l.main_id = l.id
l.isZipFile = False
l.addTime = int(time.time())
except Exception as es:
Log.Error(es)
return Str.ErrorPath, ""
return Status.Ok, l
def ParseBookInfoByDirRecursion2(self, dirName):
allData = []
try:
if not os.path.isdir(dirName):
return []
allDir = []
zipFile = []
picNum = 0
for v in os.scandir(dirName):
isinstance(v, os.DirEntry)
if v.is_dir():
allDir.append(v.name)
elif v.is_file():
data = v.name.split(".")
if len(data) < 2:
continue
mat = data[-1]
if mat == "zip":
zipFile.append(v.name)
if mat in LocalData.AllPictureFormat:
picNum += 1
for zipName in zipFile:
st, l = self.ParseBookInfoByFile(os.path.join(dirName, zipName))
if st == Status.Ok:
allData.append(l)
if picNum > 1:
st, l = self.ParseBookInfoByDir(dirName)
if st == Status.Ok:
allData.append(l)
else:
for file in allDir:
newAllData = self.ParseBookInfoByDirRecursion2(os.path.join(dirName, file))
allData.extend(newAllData)
except Exception as es:
Log.Error(es)
return allData
def ParseBookInfoByFile(self, fileName):
# 解析
# 判断ZIP是否存在
@ -376,7 +479,7 @@ class TaskLocal(TaskBase, QtTaskBase):
if os.path.isfile(url):
st, v = self.ParseBookInfoByFile(url)
elif os.path.isdir(url):
st, v = self.ParseBookInfoByDir(url)
st, v = self.ParseBookInfoByDirRecursion(url)
else:
st = Status.Error
if st == Status.Ok:

View File

@ -227,6 +227,9 @@ class Str:
SupportDrop = 148 # 支持拖拽文件导入
AlreadyHave = 149 # 已存在
SameWight = 150 # 等宽模式
CopyFileLast = 151 # 保存上次路径
ImportDouble = 152 # 导入多章节目录
@classmethod
def Reload(cls):
@ -442,10 +445,12 @@ class Str:
cls.strDict[cls.SupportDrop] = QCoreApplication.translate("cls.obj", "支持拖拽文件导入", None)
cls.strDict[cls.AlreadyHave] = QCoreApplication.translate("cls.obj", "已存在", None)
cls.strDict[cls.SameWight] = QCoreApplication.translate("cls.obj", "等宽模式", None)
cls.strDict[cls.CopyFileLast] = QCoreApplication.translate("cls.obj", "保存上次路径", None)
cls.strDict[cls.ImportDouble] = QCoreApplication.translate("cls.obj", "导入多章节目录", None)
@classmethod
def GetStr(cls, enumType):
return cls.strDict.get(enumType, "")
def GetStr(cls, enumType, defualt=""):
return cls.strDict.get(enumType, defualt)
@classmethod
def CheckStr(cls):

View File

@ -125,10 +125,10 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
self.AddSqlTask("book", "", SqlServer.TaskTypeSelectUpdate, self.UpdateDbInfoBack)
def UpdateDbInfoBack(self, data):
num, timeStr, version = data
dbVer, num, timeStr, version = data
self.curSubVersion = version
self.curUpdateTick = ToolUtil.GetTimeTickEx(timeStr)
self.localVer.setText(dbVer)
# curEndTime = datetime.now() - timedelta(7)
# newTick = int(curEndTime.timestamp())
# self.curUpdateTick = newTick
@ -136,6 +136,10 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
self.localNum.setText(str(num))
self.localTime.setText(timeStr)
QtOwner().searchView.UpdateTime(timeStr)
if config.RealVersion != dbVer:
self.UpdateText(self.dbCheck, "错误的data.db版本", "#7fb80e", False)
return
if not self.isCheckUp:
self.isCheckUp = True
self.ReUpdateDatabase()
@ -149,11 +153,13 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
if QtOwner().isOfflineModel:
return
if self.curUpdateTick <= 0:
return
if self.curIndex >= len(self.dbUpdateUrl):
return
if self.curUpdateTick <= 0:
return
self.UpdateText(self.dbCheck, Str.CheckUp, "#7fb80e", False)
self.dbCheck.setEnabled(False)
url = self.dbUpdateUrl[self.curIndex]
@ -174,7 +180,7 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
def UpdateText(self, label, text, color, enable):
label.setStyleSheet("background-color:transparent;color:{}".format(color))
label.setText("{}".format(Str.GetStr(text)))
label.setText("{}".format(Str.GetStr(text, text)))
label.setEnabled(enable)
if enable:
label.setCursor(Qt.PointingHandCursor)

View File

@ -143,6 +143,7 @@ class MainView(Main, QtTaskBase):
self.gameView.retranslateUi(self.gameView)
self.helpView.retranslateUi(self.helpView)
self.waifu2xToolView.retranslateUi(self.waifu2xToolView)
self.navigationWidget.retranslateUi(self.navigationWidget)
def Init(self):
IsCanUse = False

View File

@ -297,6 +297,14 @@ class ReadGraphicsView(QGraphicsView, SmoothScroll):
self.qtTool.FullScreen()
elif ev.key() == Qt.Key_F2:
self.qtTool.curWaifu2x.click()
elif ev.key() == Qt.Key_F4:
self.readImg.CopyLastFile()
elif ev.key() == Qt.Key_F3:
self.readImg.CopyFile()
elif ev.key() == Qt.Key_F1:
self.readImg.CopyPicture()
elif ev.key() == Qt.Key_F12:
self.readImg.ShowAndCloseTool()
elif ev.key() == Qt.Key_Space:

View File

@ -348,7 +348,10 @@ class ReadTool(QtWidgets.QWidget, Ui_ReadImg):
epsId -= 1
if self.readImg.isLocal:
QtOwner().ShowMsg(Str.GetStr(Str.AlreadyLastChapter))
if epsId < 0:
QtOwner().ShowMsg(Str.GetStr(Str.AlreadyLastChapter))
return
self.readImg.OpenLocalPage(self.readImg._cacheBook, epsId, 9999)
return
elif self.readImg.isOffline:
if not QtOwner().downloadView.IsDownloadEpsId(self.readImg.bookId, self.readImg.epsId - 1):
@ -373,7 +376,10 @@ class ReadTool(QtWidgets.QWidget, Ui_ReadImg):
bookInfo = BookMgr().books.get(bookId)
epsId += 1
if self.readImg.isLocal:
QtOwner().ShowMsg(Str.GetStr(Str.AlreadyNextChapter))
if epsId >= len(self.readImg._cacheBook):
QtOwner().ShowMsg(Str.GetStr(Str.AlreadyNextChapter))
return
self.readImg.OpenLocalPage(self.readImg._cacheBook, epsId, 0)
return
elif self.readImg.isOffline:
if not QtOwner().downloadView.IsDownloadEpsId(self.readImg.bookId, self.readImg.epsId + 1):

View File

@ -63,9 +63,18 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
self.pageIndex = -1
self.isOffline = False
self.isLocal = False
self.cacheBook = None
self._cacheBook = None
self.lastPath = ""
# QtOwner().owner.WindowsSizeChange.connect(self.qtTool.ClearQImage)
@property
def cacheBook(self):
if self._cacheBook:
if self._cacheBook.eps:
if self.epsId >= 0 and self.epsId < len(self._cacheBook.eps):
return self._cacheBook.eps[self.epsId]
return self._cacheBook
@property
def scrollArea(self):
return self.frame.scrollArea
@ -143,11 +152,15 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
action.triggered.connect(self.qtTool.OpenNextEps)
menu4 = popMenu.addMenu(Str.GetStr(Str.Copy))
action = menu4.addAction(Str.GetStr(Str.CopyPicture))
action = menu4.addAction(Str.GetStr(Str.CopyPicture) + "(F1)")
action.triggered.connect(self.CopyPicture)
action = menu4.addAction(Str.GetStr(Str.CopyFile))
action = menu4.addAction(Str.GetStr(Str.CopyFile) + "(F3)")
action.triggered.connect(self.CopyFile)
action = menu4.addAction(Str.GetStr(Str.CopyFileLast) + "(F4)")
action.triggered.connect(self.CopyLastFile)
action = popMenu.addAction(Str.GetStr(Str.AutoScroll)+"(F5)")
action.triggered.connect(self.qtTool.SwitchScrollAndTurn)
@ -196,7 +209,7 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
return
self.isOffline = isOffline
self.isLocal = False
self.cacheBook = None
self._cacheBook = None
self.Clear()
info = BookMgr().books.get(bookId)
if info:
@ -227,14 +240,19 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
config.IsTips = 0
self.frame.InitHelp()
def OpenLocalPage(self, v):
def OpenLocalPage(self, v, epsId=0, pageIndex=-1):
if not v:
return
self.Clear()
assert isinstance(v, LocalData)
self.cacheBook = v
self.epsId = epsId
self._cacheBook = v
self.pageIndex = self.cacheBook.lastIndex
if pageIndex >= 0:
self.pageIndex = pageIndex
self.isOffline = False
self.isLocal = True
self.Clear()
self.qtTool.checkBox.setChecked(Setting.IsOpenWaifu.value)
self.qtTool.preDownWaifu2x.setChecked(Setting.PreDownWaifu2x.value)
@ -243,10 +261,7 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
self.qtTool.SetData()
# self.qtTool.show()
self.bookId = v.id
self.epsId = 0
self.pageIndex = v.lastIndex
self.bookId = self.cacheBook.id
self.qtTool.isMaxFull = self.window().isMaximized()
if Setting.LookReadFull.value:
@ -714,7 +729,12 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
assert isinstance(self.cacheBook, LocalData)
self.cacheBook.lastIndex = self.curIndex
self.cacheBook.lastReadTime = int(time.time())
QtOwner().localReadView.AddDataToDB(self.cacheBook.id)
if self._cacheBook.eps:
self._cacheBook.lastReadTime = int(time.time())
QtOwner().localReadView.UpdateLastTick(self._cacheBook.id)
QtOwner().localReadView.AddEpsDataToDB(self._cacheBook.id, self.cacheBook.id)
else:
QtOwner().localReadView.AddDataToDB(self.cacheBook.id)
else:
bookName = QtOwner().bookInfoView.bookName
url = QtOwner().bookInfoView.url
@ -848,25 +868,67 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
if not info.data and not info.waifuData:
return
today = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
# today = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
if info.waifuData:
path = "{}_waifu2x.jpg".format(today)
path = "{}_{}_waifu2x.jpg".format(self.bookId, self.curIndex+1)
data = info.waifuData
else:
path = "{}.jpg".format(today)
path = "{}_{}.jpg".format(self.bookId, self.curIndex+1)
data = info.data
if not data:
return
try:
if self.lastPath:
path = os.path.join(self.lastPath, path)
filepath = QFileDialog.getSaveFileName(self, Str.GetStr(Str.Save), path, "Image Files(*.jpg *.png)")
if filepath and len(filepath) >= 1:
name = filepath[0]
if not name:
return
self.lastPath = os.path.dirname(name)
f = open(name, "wb")
f.write(data)
f.close()
QtOwner().ShowMsg(Str.GetStr(Str.CopySuc))
QtOwner().ShowMsg(Str.GetStr(Str.SaveSuc))
except Exception as es:
Log.Error(es)
def CopyLastFile(self):
info = self.pictureData.get(self.curIndex)
if not info:
return
assert isinstance(info, QtFileData)
if not info.data and not info.waifuData:
return
if info.waifuData:
path = "{}_{}_waifu2x.jpg".format(self.bookId, self.curIndex+1)
data = info.waifuData
else:
path = "{}_{}.jpg".format(self.bookId, self.curIndex+1)
data = info.data
if not data:
return
try:
if self.lastPath:
name = os.path.join(self.lastPath, path)
else:
if self.lastPath:
path = os.path.join(self.lastPath, path)
filepath = QFileDialog.getSaveFileName(self, Str.GetStr(Str.Save), path, "Image Files(*.jpg *.png)")
if filepath and len(filepath) >= 1:
name = filepath[0]
if not name:
return
self.lastPath = os.path.dirname(name)
else:
return
# self.lastPath = os.path.dirname(name)
f = open(name, "wb")
f.write(data)
f.close()
QtOwner().ShowMsg(Str.GetStr(Str.SaveSuc))
except Exception as es:
Log.Error(es)

View File

@ -100,7 +100,7 @@ class SettingView(QtWidgets.QWidget, Ui_SettingNew):
self.openProxy.clicked.connect(self.OpenProxy)
# TODO
self.languageButton3.setVisible(False)
# self.languageButton3.setVisible(False)
self.msgLabel.setVisible(False)
@ -312,8 +312,8 @@ class SettingView(QtWidgets.QWidget, Ui_SettingNew):
language = 2
else:
# TODO
# language = 3
language = 2
language = 3
# language = 2
if language == Setting.Language.autoValue:
return

View File

@ -93,21 +93,38 @@ class LocalReadDb(object):
def GetSaveStr(self, name):
return name.replace("'", "''")
def AddLoadLocalBook(self, info):
def AddLoadLocalBook(self, info2):
info = info2
assert isinstance(info, LocalData)
self.AddLoadLocalBook2(info)
for info in info2.eps:
self.AddLoadLocalBook2(info)
self.cur.execute("COMMIT")
return
def AddLoadLocalEpsBook(self, info2):
info = info2
assert isinstance(info, LocalData)
self.AddLoadLocalBook2(info)
self.cur.execute("COMMIT")
return
def AddLoadLocalBook2(self, info2):
info = info2
assert isinstance(info, LocalData)
sql = "INSERT INTO local_book(id, title, file, path, cover, epsId, isZipFile, lastIndex, lastEpsId, addTime, lastReadTime, picCnt, main_id) " \
"VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', {5}, {6}, {7}, {8}, {9}, {10}, {11}, '{12}') " \
"ON CONFLICT(id) DO UPDATE SET lastIndex='{7}', file='{2}', path='{3}', lastEpsId={8}, addTime={9}, lastReadTime={10}, picCnt={11}, cover='{4}' ".\
format(info.id, self.GetSaveStr(info.title), self.GetSaveStr(info.file), self.GetSaveStr(info.path), self.GetSaveStr(info.cover), info.epsId, int(info.isZipFile), info.lastIndex
, info.lastEpsId, info.addTime, info.lastReadTime, info.picCnt, info.main_id)
suc = self.cur.execute(sql)
self.cur.execute("COMMIT")
return
def DelDownloadDB(self, bookId):
sql = "delete from local_book where id='{}'".format(bookId)
suc = self.cur.execute(sql)
sql = "delete from local_book where main_id='{}'".format(bookId)
suc = self.cur.execute(sql)
sql = "delete from local_category where book_id='{}'".format(bookId)
suc = self.cur.execute(sql)
self.cur.execute("COMMIT")

View File

@ -0,0 +1,107 @@
import json
import os
from this import d
from PySide6.QtCore import Signal, QUrl
from PySide6.QtGui import QAction, Qt, QDesktopServices
from PySide6.QtWidgets import QWidget, QMenu, QFileDialog
from natsort import natsorted
from interface.ui_index import Ui_Index
from interface.ui_local import Ui_Local
from interface.ui_local_eps import Ui_LocalEps
from qt_owner import QtOwner
from server import req, Log, User, Status
from task.qt_task import QtTaskBase
from task.task_local import LocalData
from tools.str import Str
from view.tool.local_read_db import LocalReadDb
class LocalReadEpsView(QWidget, Ui_LocalEps, QtTaskBase):
ReloadHistory = Signal(int)
def __init__(self, parent=None):
QWidget.__init__(self, parent)
Ui_Index.__init__(self)
QtTaskBase.__init__(self)
self.setupUi(self)
self.isInit = False
self.bookId = ""
self.cacheBook = None
self.bookIdToIndex = {}
self.bookList.isLocal = True
self.bookList.isLocalEps = True
self.bookList.LoadingPicture = self.LoadingPicture
self.bookList.ReDownloadPicture = self.LoadingPicture
self.showWaifu2x.clicked.connect(self.Init)
@property
def localReadView(self):
return QtOwner().localReadView
def Init(self):
book = self.localReadView.allBookInfos.get(self.bookId)
if not book:
return
self.name.setText(book.title)
self.bookIdToIndex.clear()
self.cacheBook = book
assert isinstance(book, LocalData)
self.bookList.clear()
for i, v in enumerate(book.eps):
assert isinstance(v, LocalData)
self.bookIdToIndex[v.id] = i
categroup = []
if v.isWaifu2x:
categroup.append("waifu2x")
else:
if self.showWaifu2x.isChecked():
continue
if v.isZipFile:
categroup.append("zip")
self.bookList.AddBookByLocal(v, "".join(categroup))
pass
def SwitchCurrent(self, **kwargs):
bookId = kwargs.get("bookId")
if bookId == self.bookId:
return
self.bookId = bookId
self.Init()
return
def LoadingPicture(self, index):
if isinstance(index, int):
item = self.bookList.item(index)
widget = self.bookList.itemWidget(item)
else:
widget = self.bookList.indexWidget(index)
bookId = widget.id
if bookId not in self.bookIdToIndex:
return
i = self.bookIdToIndex.get(bookId)
v = self.cacheBook.eps[i]
self.AddLocalTaskLoadPicture(v, -1, index, self.bookList.LoadingPictureComplete)
def OpenLocalBook(self, bookId):
if bookId not in self.bookIdToIndex:
return
newV = LocalData()
newV.id = self.cacheBook.id
newV.CopyData(self.cacheBook)
newV.eps = []
eps = 0
i = 0
for v in self.cacheBook.eps:
assert isinstance(v, LocalData)
if v.id == bookId:
eps = i
if not v.isWaifu2x:
if self.showWaifu2x.isChecked():
continue
i += 1
newV.eps.append(v)
QtOwner().OpenLocalReadView(newV, eps)

View File

@ -10,7 +10,7 @@ from natsort import natsorted
from interface.ui_index import Ui_Index
from interface.ui_local import Ui_Local
from qt_owner import QtOwner
from server import req, Log, User, Status
from server import req, Log, User, Status, time
from task.qt_task import QtTaskBase
from task.task_local import LocalData
from tools.str import Str
@ -32,6 +32,7 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.action1 = QAction(Str.GetStr(Str.ImportSimple), self.toolMenu, triggered=self.CheckAction1)
self.action2 = QAction(Str.GetStr(Str.ImportSimpleZip), self.toolMenu, triggered=self.CheckAction2)
self.action4 = QAction(Str.GetStr(Str.ImportDouble), self.toolMenu, triggered=self.CheckAction3)
self.action3 = QAction(Str.GetStr(Str.SupportDrop), self.toolMenu)
self.action3.setEnabled(False)
# self.action3 = QAction(Str.GetStr(Str.ImportSimpleDir), self.toolMenu, triggered=self.CheckAction3)
@ -39,6 +40,7 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.toolMenu.addAction(self.action1)
self.toolMenu.addAction(self.action2)
self.toolMenu.addAction(self.action4)
self.toolMenu.addAction(self.action3)
# self.toolMenu.addAction(self.action3)
# self.toolMenu.addAction(self.action4)
@ -71,6 +73,12 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.bookList.MoveHandler = self.MoveCallBack
self.bookList.openMenu = True
self.bookList.OpenDirHandler = self.OpenDirCallBack
self.lineEdit.textChanged.connect(self.SearchTextChange)
self.searchText = ""
def SearchTextChange(self, text):
self.searchText = text
self.InitBook()
def Init(self):
self.categoryBook, self.bookCategory = self.db.LoadCategory()
@ -105,7 +113,8 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
if v.id in allBookId:
categoryList = self.bookCategory.get(v.id, [])
categoryStr = ",".join(categoryList)
self.bookList.AddBookByLocal(v, categoryStr)
if not self.searchText or self.searchText in v.title:
self.bookList.AddBookByLocal(v, categoryStr)
return
def ClickTagsItem(self, modelIndex):
@ -129,7 +138,7 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
datas = list(value)
sortId = self.sortIdCombox.currentIndex()
sortKeyID = self.sortKeyCombox.currentIndex()
isRevert = (sortId != 0)
isRevert = (sortId == 0)
if sortKeyID == 0:
datas.sort(key=lambda a: a.lastReadTime, reverse=isRevert)
elif sortKeyID == 2:
@ -184,11 +193,19 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
return
v = self.allBookInfos[bookId]
assert isinstance(v, LocalData)
type = LocalData.Type1 if not v.isZipFile else LocalData.Type2
if v.eps != []:
type = LocalData.Type3
elif v.isZipFile:
type = LocalData.Type2
else:
type = LocalData.Type1
QtOwner().ShowLoading()
self.AddLocalTaskLoad(type, v.file, bookId, callBack=self.OpenLocalBookBack)
return
def OpenLocalBookBack(self, st, books, bookId):
QtOwner().CloseLoading()
if st != Status.Ok:
QtOwner().ShowError(Str.GetStr(st))
return
@ -201,6 +218,10 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
assert isinstance(v, LocalData)
newV = books[0]
v.CopyData(newV)
if v.eps != []:
QtOwner().OpenLocalEpsView(v.id)
return
if v.picCnt <= 0:
QtOwner().ShowError(Str.GetStr(Str.NotPictureFile))
return
@ -215,6 +236,22 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.db.AddLoadLocalBook(v)
return
def UpdateLastTick(self, taskId):
if taskId not in self.allBookInfos:
return
v = self.allBookInfos[taskId]
v.lastReadTime = int(time.time())
self.db.AddLoadLocalBook(v)
return
def AddEpsDataToDB(self, taskId, subId):
if taskId not in self.allBookInfos:
return
for v in self.allBookInfos[taskId].eps:
if v.id == subId:
self.db.AddLoadLocalEpsBook(v)
return
def AddBookByDir(self):
return
@ -252,6 +289,9 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.bookList.AddBookByLocal(v, category)
self.AddDataToDB(v.id)
QtOwner().ShowMsg("已添加{}本到书架, {}本存在已忽略".format(addNum, alreadyNum))
self.lineEdit.setText("")
self.sortIdCombox.setCurrentIndex(0)
self.sortKeyCombox.setCurrentIndex(1)
return
# 导入单本Zip
@ -268,8 +308,15 @@ class LocalReadView(QWidget, Ui_Local, QtTaskBase):
self.AddLocalTaskLoad(LocalData.Type2, name, path, self.CheckAction1LoadBack)
return
# 批量导入目录
# 导入单本目录
def CheckAction3(self):
if self.lastPath:
url = QFileDialog.getExistingDirectory(self, Str.GetStr(Str.SelectFold), dir=self.lastPath)
else:
url = QFileDialog.getExistingDirectory(self, Str.GetStr(Str.SelectFold))
if url:
QtOwner().ShowLoading()
self.AddLocalTaskLoad(LocalData.Type3, url, os.path.dirname(url), self.CheckAction1LoadBack)
return
# 批量导入带章节的目录

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,8 +28,8 @@ QScrollArea {background-color:transparent;}</string>
<rect>
<x>0</x>
<y>0</y>
<width>753</width>
<height>718</height>
<width>736</width>
<height>744</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -126,51 +126,7 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="verCheck">
<property name="text">
<string>检测更新</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="logButton">
<property name="text">
<string>打开日志目录</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>80</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>日志:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="localTime">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="dbCheck">
<property name="text">
<string>检测更新</string>
@ -195,8 +151,8 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="localNum">
<item row="5" column="1">
<widget class="QLabel" name="localTime">
<property name="font">
<font>
<pointsize>12</pointsize>
@ -207,30 +163,6 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>上次更新时间:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="version">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>v1.2.8</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
@ -249,18 +181,6 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>本地数据上次更新:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="upTimeLabel">
<property name="font">
@ -273,6 +193,100 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="verCheck">
<property name="text">
<string>检测更新</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="localNum">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="openCmd">
<property name="text">
<string>打开控制台</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="preCheckBox">
<property name="text">
<string>接受Beta版本更新</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="version">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>v1.2.8</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>上次更新时间:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="logButton">
<property name="text">
<string>打开日志目录</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>80</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>日志:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>本地数据上次更新:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="waifu2x">
<property name="font">
@ -285,17 +299,33 @@ QScrollArea {background-color:transparent;}</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="openCmd">
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>80</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>打开控制台</string>
<string>本地库版本:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="preCheckBox">
<item row="4" column="1">
<widget class="QLabel" name="localVer">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>接受Beta版本更新</string>
<string/>
</property>
</widget>
</item>

View File

@ -14,7 +14,18 @@
<string>本地漫画</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="ComicListWidget" name="bookList">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="TagListWidget" name="tagsList">
@ -70,18 +81,7 @@ QListWidget::item {
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="ComicListWidget" name="bookList">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
@ -234,6 +234,22 @@ QListWidget::item {
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>搜索:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -14,7 +14,7 @@
<string>本地漫画章节</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="ComicListWidget" name="bookList">
@ -25,6 +25,37 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="name">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="showWaifu2x">
<property name="text">
<string>只显示Waifu2x</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -87,7 +87,7 @@
<item>
<widget class="AnimationStackWidget" name="subStackWidget">
<widget class="IndexView" name="indexView"/>
<widget class="LocalEpsReadView" name="localEpsReadView"/>
<widget class="LocalEpsReadView" name="localReadEpsView"/>
<widget class="ChatNewView" name="chatNewView"/>
<widget class="HelpView" name="helpView"/>
<widget class="MyCommentView" name="myCommentView"/>

View File

@ -129,7 +129,7 @@
<widget class="DownloadAllView" name="downloadAllView"/>
<widget class="LocalReadView" name="localReadView"/>
<widget class="ChatNewView" name="chatNewView"/>
<widget class="LocalEpsReadView" name="localEpsReadView"/>
<widget class="LocalReadEpsView" name="localReadEpsView"/>
<widget class="BookEpsView" name="bookEpsView"/>
<widget class="FriedView" name="friedView"/>
</widget>
@ -301,15 +301,15 @@
<container>1</container>
</customwidget>
<customwidget>
<class>TitleBarWidget</class>
<class>LocalReadEpsView</class>
<extends>QWidget</extends>
<header location="global">component.widget.title_bar_widget.h</header>
<header location="global">view.tool.local_read_eps_view.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LocalEpsReadView</class>
<class>TitleBarWidget</class>
<extends>QWidget</extends>
<header location="global">view.tool.local_eps_read_view.h</header>
<header location="global">component.widget.title_bar_widget.h</header>
<container>1</container>
</customwidget>
</customwidgets>