Skip to content

Commit

Permalink
本地漫画支持多章节
Browse files Browse the repository at this point in the history
  • Loading branch information
tonquer committed Aug 13, 2023
1 parent 5652126 commit 9008089
Show file tree
Hide file tree
Showing 18 changed files with 643 additions and 131 deletions.
17 changes: 13 additions & 4 deletions src/component/list/comic_list_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, parent):
self.isDelMenu = False
self.isGame = False
self.isLocal = False
self.isLocalEps = False
self.openMenu = False

def SelectMenuBook(self, pos):
Expand Down Expand Up @@ -86,7 +87,7 @@ def AddBookItemByBook(self, v, isShowHistory=False):
categories = ",".join(v.baseInfo.category)
self.AddBookItem(_id, title, categories, url)

def AddBookByLocal(self, v, isFirstAdd=False):
def AddBookByLocal(self, v, category=""):
from task.task_local import LocalData
assert isinstance(v, LocalData)
index = self.count()
Expand All @@ -98,17 +99,23 @@ def AddBookByLocal(self, v, isFirstAdd=False):
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))

widget.timeLabel.setText(categories)
else:
widget.timeLabel.setVisible(False)
widget.starButton.setVisible(False)

# widget.toolButton.setVisible(False)
widget.categoryLabel.setVisible(False)
widget.starButton.setVisible(False)
if category:
widget.categoryLabel.setText(category)
widget.categoryLabel.setVisible(True)

widget.nameLable.setText(title)
item = QListWidgetItem(self)
item.setFlags(item.flags() & ~Qt.ItemIsSelectable)
Expand Down Expand Up @@ -200,6 +207,8 @@ def SelectItem(self, item):
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:
Expand Down
6 changes: 3 additions & 3 deletions src/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
UpdateUrl3Api = "https://api.fastgit.xyz/repos/tonquer/JMComic-qt/releases"
UpdateUrl3Back = "https://hub.fastgit.xyz/tonquer/JMComic-qt"

UpdateVersion = "v1.1.3"
RealVersion = "v1.1.3"
VersionTime = "2023-7-27"
UpdateVersion = "v1.1.4"
RealVersion = "v1.1.4"
VersionTime = "2023-8-13"

Waifu2xVersion = "1.1.6"
LoginUserName = ""
Expand Down
53 changes: 36 additions & 17 deletions src/interface/ui_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
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
Expand All @@ -29,6 +30,17 @@ def setupUi(self, Local):
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)
Expand All @@ -43,13 +55,13 @@ def setupUi(self, Local):
" border-color:rgb(196, 95, 125);\n"
"}\n"
"/* \u9f20\u6807\u5728\u6309\u94ae\u4e0a\u65f6\uff0c\u6309\u94ae\u989c\u8272 */\n"
" QListWidget::item:hover\n"
" QListWidget::item:hover \n"
"{\n"
" background-color:rgb(21, 85, 154);\n"
" border-radius: 10px;\n"
" color: rgb(0, 0, 0);\n"
"}\n"
" QListWidget::item:selected\n"
" QListWidget::item:selected \n"
"{\n"
" background-color:rgb(21, 85, 154);\n"
" border-radius: 10px;\n"
Expand All @@ -67,18 +79,7 @@ def setupUi(self, Local):
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")
Expand Down Expand Up @@ -168,7 +169,24 @@ def setupUi(self, Local):
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)
Expand All @@ -194,5 +212,6 @@ def retranslateUi(self, Local):
#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

72 changes: 72 additions & 0 deletions src/interface/ui_local_eps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'ui_local_eps.ui'
##
## Created by: Qt User Interface Compiler version 6.2.4
##
## 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, QGridLayout, QHBoxLayout, QLabel,
QListWidgetItem, QRadioButton, QSizePolicy, QSpacerItem,
QWidget)

from component.list.comic_list_widget import ComicListWidget

class Ui_LocalEps(object):
def setupUi(self, LocalEps):
if not LocalEps.objectName():
LocalEps.setObjectName(u"LocalEps")
LocalEps.resize(646, 391)
self.gridLayout_2 = QGridLayout(LocalEps)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.bookList = ComicListWidget(LocalEps)
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, 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)

QMetaObject.connectSlotsByName(LocalEps)
# setupUi

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

4 changes: 4 additions & 0 deletions src/interface/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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_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
Expand Down Expand Up @@ -96,6 +97,9 @@ def setupUi(self, Main):
self.indexView = IndexView()
self.indexView.setObjectName(u"indexView")
self.subStackWidget.addWidget(self.indexView)
self.localReadEpsView = LocalReadEpsView()
self.localReadEpsView.setObjectName(u"localReadEpsView")
self.subStackWidget.addWidget(self.localReadEpsView)
self.localReadView = LocalReadView()
self.localReadView.setObjectName(u"localReadView")
self.subStackWidget.addWidget(self.localReadView)
Expand Down
4 changes: 4 additions & 0 deletions src/interface/ui_main_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
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_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
Expand Down Expand Up @@ -103,6 +104,9 @@ def setupUi(self, MainWindows):
self.indexView = IndexView()
self.indexView.setObjectName(u"indexView")
self.subStackWidget.addWidget(self.indexView)
self.localReadEpsView = LocalReadEpsView()
self.localReadEpsView.setObjectName(u"localReadEpsView")
self.subStackWidget.addWidget(self.localReadEpsView)
self.localFavoriteView = LocalFavoriteView()
self.localFavoriteView.setObjectName(u"localFavoriteView")
self.subStackWidget.addWidget(self.localFavoriteView)
Expand Down
11 changes: 9 additions & 2 deletions src/qt_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def OpenSubComment(self, commentId, widget, commentList):
self.owner.subCommentView.SetWidget(widget)
self.owner.SwitchWidget(self.owner.subCommentView, **arg)

def OpenLocalEpsView(self, bookId):
arg = {"bookId": bookId}
self.owner.SwitchWidget(self.owner.localReadEpsView, **arg)

def OpenSearch(self, text):
arg = {"text": text}
if text.isdigit() and len(text) == 6:
Expand Down Expand Up @@ -206,9 +210,9 @@ def OpenReadView(self, bookId, index, pageIndex, isOffline=False):
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)
Expand All @@ -226,6 +230,9 @@ def OpenBookInfo(self, bookId, bookName=""):
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}
Expand Down
Loading

0 comments on commit 9008089

Please sign in to comment.