Skip to content

Commit

Permalink
修复部分错误
Browse files Browse the repository at this point in the history
  • Loading branch information
tonquer committed Jul 22, 2023
1 parent 2d9279c commit 1878bab
Show file tree
Hide file tree
Showing 16 changed files with 911 additions and 231 deletions.
Binary file added res/icon/clear_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/icon/clear_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions res/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<file>icon/ic_get_app_black_36dp.png</file>
<file>icon/icon_like.png</file>
<file>icon/icon_like_off.png</file>
<file>icon/clear_on.png</file>
<file>icon/clear_off.png</file>
<file>icon/loading_gif.gif</file>
<file>icon/loading_gif.webp</file>
<file>icon/logo_round.png</file>
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
Issues2 = "https://hub.ggo.icu/tonquer/ehentai-qt/issues"
Issues3 = "https://hub.fastgit.xyz/tonquer/ehentai-qt/issues"

UpdateVersion = "v1.1.4"
RealVersion = "v1.1.4"
UpdateVersion = "v1.1.5"
RealVersion = "v1.1.5"
Waifu2xVersion = "1.1.6"
TimeVersion = "2023-6-25"

Expand Down
873 changes: 686 additions & 187 deletions src/images_rc.py

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions src/interface/ui_book_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QFrame, QGridLayout, QHBoxLayout,
QLabel, QListWidgetItem, QPushButton, QScrollArea,
QSizePolicy, QSpacerItem, QTabWidget, QVBoxLayout,
QWidget)
QSizePolicy, QSpacerItem, QTabWidget, QToolButton,
QVBoxLayout, QWidget)

from component.button.icon_tool_button import IconToolButton
from component.list.comic_list_widget import ComicListWidget
from component.list.tag_list_widget import TagListWidget
from component.scroll_area.smooth_scroll_area import SmoothScrollArea
import images_rc
import images_rc

class Ui_BookInfo(object):
def setupUi(self, BookInfo):
Expand Down Expand Up @@ -247,6 +248,7 @@ def setupUi(self, BookInfo):
self.favoriteButton.setIcon(icon)
self.favoriteButton.setIconSize(QSize(50, 50))
self.favoriteButton.setCheckable(False)
self.favoriteButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

self.horizontalLayout_2.addWidget(self.favoriteButton)

Expand All @@ -272,9 +274,21 @@ def setupUi(self, BookInfo):
icon2.addFile(u":/png/icon/ic_get_app_black_36dp.png", QSize(), QIcon.Normal, QIcon.Off)
self.downloadButton.setIcon(icon2)
self.downloadButton.setIconSize(QSize(50, 50))
self.downloadButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

self.horizontalLayout_2.addWidget(self.downloadButton)

self.clearButton = QToolButton(self.scrollAreaWidgetContents)
self.clearButton.setObjectName(u"clearButton")
self.clearButton.setMinimumSize(QSize(40, 40))
icon3 = QIcon()
icon3.addFile(u":/png/icon/clear_off.png", QSize(), QIcon.Normal, QIcon.Off)
self.clearButton.setIcon(icon3)
self.clearButton.setIconSize(QSize(50, 50))
self.clearButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

self.horizontalLayout_2.addWidget(self.clearButton)

self.startRead = QPushButton(self.scrollAreaWidgetContents)
self.startRead.setObjectName(u"startRead")
self.startRead.setMinimumSize(QSize(0, 40))
Expand Down Expand Up @@ -351,6 +365,7 @@ def setupUi(self, BookInfo):
self.downloadButton.clicked.connect(BookInfo.AddDownload)
self.startRead.clicked.connect(BookInfo.StartRead)
self.commentButton.clicked.connect(BookInfo.OpenComment)
self.clearButton.clicked.connect(BookInfo.ClearCache)

self.tabWidget.setCurrentIndex(1)

Expand All @@ -373,9 +388,10 @@ def retranslateUi(self, BookInfo):
self.label_13.setText(QCoreApplication.translate("BookInfo", u"\u6536\u85cf\u6570\uff1a", None))
self.favoriteLabel.setText("")
self.updateTick.setText(QCoreApplication.translate("BookInfo", u"TextLabel", None))
self.favoriteButton.setText("")
self.commentButton.setText("")
self.downloadButton.setText("")
self.favoriteButton.setText(QCoreApplication.translate("BookInfo", u"\u6536\u85cf", None))
self.commentButton.setText(QCoreApplication.translate("BookInfo", u"\u8bc4\u8bba", None))
self.downloadButton.setText(QCoreApplication.translate("BookInfo", u"\u4e0b\u8f7d", None))
self.clearButton.setText(QCoreApplication.translate("BookInfo", u"\u6e05\u7406", None))
self.startRead.setText(QCoreApplication.translate("BookInfo", u"\u5f00\u59cb\u9605\u8bfb", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("BookInfo", u"Tags", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("BookInfo", u"\u9884\u89c8", None))
Expand Down
7 changes: 2 additions & 5 deletions src/interface/ui_login_proxy_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Ui_LoginProxyWidget(object):
def setupUi(self, LoginProxyWidget):
if not LoginProxyWidget.objectName():
LoginProxyWidget.setObjectName(u"LoginProxyWidget")
LoginProxyWidget.resize(495, 483)
LoginProxyWidget.resize(450, 486)
LoginProxyWidget.setMinimumSize(QSize(450, 0))
self.gridLayout = QGridLayout(LoginProxyWidget)
self.gridLayout.setSpacing(12)
Expand All @@ -36,7 +36,7 @@ def setupUi(self, LoginProxyWidget):
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, -353, 458, 816))
self.scrollAreaWidgetContents.setGeometry(QRect(0, -56, 413, 816))
self.verticalLayout = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout.setObjectName(u"verticalLayout")
self.horizontalLayout_11 = QHBoxLayout()
Expand Down Expand Up @@ -206,7 +206,6 @@ def setupUi(self, LoginProxyWidget):

self.label_eh = QLabel(self.scrollAreaWidgetContents)
self.label_eh.setObjectName(u"label_eh")
self.label_eh.setTextInteractionFlags(Qt.TextSelectableByMouse)

self.gridLayout_2.addWidget(self.label_eh, 17, 0, 1, 1)

Expand All @@ -227,7 +226,6 @@ def setupUi(self, LoginProxyWidget):

self.label_ex = QLabel(self.scrollAreaWidgetContents)
self.label_ex.setObjectName(u"label_ex")
self.label_ex.setTextInteractionFlags(Qt.TextSelectableByMouse)

self.gridLayout_2.addWidget(self.label_ex, 12, 0, 1, 1)

Expand Down Expand Up @@ -319,7 +317,6 @@ def setupUi(self, LoginProxyWidget):

self.label_exa = QLabel(self.scrollAreaWidgetContents)
self.label_exa.setObjectName(u"label_exa")
self.label_exa.setTextInteractionFlags(Qt.TextSelectableByMouse)

self.gridLayout_2.addWidget(self.label_exa, 22, 0, 1, 1)

Expand Down
2 changes: 1 addition & 1 deletion src/qt_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def OpenFavoriteInfo(self, bookId, bookName):
from view.user.favorite_info_view import FavoriteInfoView
info = FavoriteInfoView(QtOwner().owner)
info.OpenFavorite(bookId, bookName)
info.exec_()
info.show()
return

def OpenBookInfo(self, bookId, token="", site=""):
Expand Down
56 changes: 45 additions & 11 deletions src/server/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def __str__(self):
else:
host = ""
# haveProxy = bool(self.proxy) and self.proxy.get("http") != None
return "{}, url:{}, host:{}, proxy:{}, method:{}, params:{}".format(self.__class__.__name__, self.url, host, self.printProxy, self.method, params)
if Setting.LogIndex.value == 2:
return "{}, url:{}, host:{}, proxy:{}, method:{}, params:{}, header:{}".format(self.__class__.__name__, self.url, host, self.printProxy, self.method, params, self.headers)
else:
return "{}, url:{}, host:{}, proxy:{}, method:{}, params:{}".format(self.__class__.__name__, self.url, host,
self.printProxy, self.method, params)


# 下载图片
Expand All @@ -70,7 +74,14 @@ def __init__(self, url, loadPath="", cachePath="", savePath="", isReload=False):
self.cachePath = cachePath
self.savePath = savePath
self.isReload = isReload
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
header = ToolUtil.GetHeader(url, method)
host = ToolUtil.GetUrlHost(config.Url)
host2 = ToolUtil.GetUrlHost(config.ExUrl)
if host in url:
header['Referer'] = get_url(host) + "/"
elif host2 in url:
header['Referer'] = get_url(host2) + "/"
super(self.__class__, self).__init__(url, header,
{}, method)


Expand Down Expand Up @@ -108,6 +119,7 @@ def __init__(self):

header = ToolUtil.GetHeader(url, method)
data = dict()
header['Referer'] = config.Url + "/"
super(self.__class__, self).__init__(url, header, data, method)


Expand Down Expand Up @@ -163,10 +175,12 @@ def __init__(self, bookId, page=1, token="", site=""):
params["nw"] = "always"
params["inline_set"] = "ts_l"
data = ToolUtil.DictToUrl(params)
method = "GET"
if data:
url += "/?" + data
method = "GET"
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method), {}, method)
header = ToolUtil.GetHeader(url, method)
header['Referer'] = get_url(site) + "/"
super(self.__class__, self).__init__(url, header, {}, method)


# 图片信息
Expand All @@ -181,8 +195,12 @@ def __init__(self, bookId, index, site=""):

info = BookMgr().GetBookBySite(bookId, self.site)
url = info.pageInfo.picUrl.get(index)
ref = get_url(site) + "/g/{}/{}/".format(bookId, info.baseInfo.token)

method = "Get"
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method), {}, method)
header = ToolUtil.GetHeader(url, method)
header['Referer'] = ref
super(self.__class__, self).__init__(url, header, {}, method)


# 图片信息Api
Expand All @@ -208,6 +226,8 @@ def __init__(self, bookId, index, site=""):
}
header = ToolUtil.GetHeader(url, method)
header["Content-Type"] = "application/json; charset=UTF-8"
header['Origin'] = get_url(site)
header['Referer'] = get_url(site) + "/"
super(self.__class__, self).__init__(url, header, json.dumps(data), method)


Expand Down Expand Up @@ -249,8 +269,9 @@ def __init__(self, nextId='', f_search="", f_cats="", f_sh="", f_spf="", f_spt="
if param:
url += "/?" + param
method = "GET"
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
{}, method)
header = ToolUtil.GetHeader(url, method)
header['Referer'] = get_url(site) + "/"
super(self.__class__, self).__init__(url, header, {}, method)


# 获得排行
Expand All @@ -270,7 +291,9 @@ def __init__(self, tl="", p=1, site=""):
if param:
url += "/?" + param
method = "GET"
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
header = ToolUtil.GetHeader(url, method)
header['Referer'] = config.Url + "/"
super(self.__class__, self).__init__(url, header,
{}, method)


Expand All @@ -288,7 +311,9 @@ def __init__(self, nextId="", category=""):
url += "/?" + param
method = "GET"
self.site = config.CurSite
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
header = ToolUtil.GetHeader(url, method)
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
{}, method)


Expand All @@ -308,7 +333,9 @@ def __init__(self, favcat="", nextId=""):
url += "/?" + param
method = "GET"
self.site = config.CurSite
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
header = ToolUtil.GetHeader(url, method)
header['Referer'] = get_url(self.site) + "/"
super(self.__class__, self).__init__(url, header,
{}, method)


Expand All @@ -319,7 +346,9 @@ def __init__(self, bookId=""):
info = BookMgr().GetBook(bookId)
url = get_url() + "/gallerypopups.php?gid={}&t={}&act=addfav".format(bookId, info.baseInfo.token)
method = "GET"
super(self.__class__, self).__init__(url, ToolUtil.GetHeader(url, method),
header = ToolUtil.GetHeader(url, method)
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
{}, method)


Expand All @@ -341,6 +370,7 @@ def __init__(self, bookId="", favcat=0, msg="", isUpdate=False):
data["apply"] = "Apply Changes"
else:
data["apply"] = "Add to Favorites"
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
ToolUtil.DictToUrl(data), method)

Expand All @@ -357,6 +387,7 @@ def __init__(self, bookId=""):
data["modifygids[]"] = bookId
data["apply"] = "Confirm"
data["ddact"] = "delete"
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
ToolUtil.DictToUrl(data), method)

Expand All @@ -377,6 +408,7 @@ def __init__(self, bookId, comment):
header["content-type"] = "application/x-www-form-urlencoded"
data = dict()
data["commenttext_new"] = comment
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
ToolUtil.DictToUrl(data), method)

Expand All @@ -400,6 +432,7 @@ def __init__(self, bookId, rating):
}
header = ToolUtil.GetHeader(url, method)
header["Content-Type"] = "application/json"
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header, json.dumps(data), method)


Expand Down Expand Up @@ -430,6 +463,7 @@ def __init__(self, ip, domain):
header['cache-control'] = 'no-cache'
header['expires'] = '0'
header['pragma'] = 'no-cache'
header['Referer'] = get_url() + "/"
super(self.__class__, self).__init__(url, header,
{}, method)
self.timeout = 3
2 changes: 1 addition & 1 deletion src/task/task_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def DownloadTask(self, url, path, downloadCallBack=None, completeCallBack=None,
return self.taskId

def HandlerTask(self, downloadId, laveFileSize, data, isCallBack=True):
Log.Debug("download back, taskId:{}, laveSize:{}".format(downloadId, laveFileSize))
# Log.Debug("download back, taskId:{}, laveSize:{}".format(downloadId, laveFileSize))
info = self.tasks.get(downloadId)
if not info:
return
Expand Down
2 changes: 2 additions & 0 deletions src/tools/str.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class Str:
SupportDrop = 148 # 支持拖拽文件导入
AlreadyHave = 149 # 已存在
SameWight = 150 # 等宽模式
CopyFileLast = 151 # 保存上次路径

@classmethod
def Reload(cls):
Expand Down Expand Up @@ -436,6 +437,7 @@ def Reload(cls):
cls.strDict[cls.Copy] = QCoreApplication.translate("cls.obj", "复制", None)
cls.strDict[cls.CopyPicture] = QCoreApplication.translate("cls.obj", "复制图片到剪贴板", None)
cls.strDict[cls.CopyFile] = QCoreApplication.translate("cls.obj", "保存文件", None)
cls.strDict[cls.CopyFileLast] = QCoreApplication.translate("cls.obj", "保存上次路径", None)
cls.strDict[cls.MainUi] = QCoreApplication.translate("cls.obj", "主界面", None)
cls.strDict[cls.ShowMin] = QCoreApplication.translate("cls.obj", "最小化", None)
cls.strDict[cls.DownloadAll] = QCoreApplication.translate("cls.obj", "批量下载", None)
Expand Down
28 changes: 27 additions & 1 deletion src/view/info/book_info_view.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import json
import os
import shutil
from functools import partial

from PySide6 import QtWidgets, QtCore, QtGui
from PySide6.QtCore import Qt, QSize, QEvent, Signal
from PySide6.QtGui import QColor, QFont, QPixmap, QIcon
from PySide6.QtWidgets import QListWidgetItem, QLabel, QPushButton, QVBoxLayout, QSpacerItem, \
QSizePolicy, QScroller, QScrollerProperties
QSizePolicy, QScroller, QScrollerProperties, QMessageBox

import config.config
from component.layout.flow_layout import FlowLayout
Expand Down Expand Up @@ -69,13 +71,36 @@ def __init__(self):
propertiesOne.setScrollMetric(QScrollerProperties.HorizontalOvershootPolicy, QScrollerProperties.OvershootAlwaysOff)
QScroller.scroller(self.tagScrollArea).setScrollerProperties(propertiesOne)

def UpdateFavoriteIcon(self):
path = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir), "{}/{}_{}".format(config.CurSite, self.bookId, self.token))
waifuPath = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir), "waifu2x/{}/{}_{}".format(config.CurSite, self.bookId, self.token))
if os.path.isdir(path) or os.path.isdir(waifuPath):
self.clearButton.setIcon(QIcon(":/png/icon/clear_on.png"))
else:
self.clearButton.setIcon(QIcon(":/png/icon/clear_off.png"))

def Clear(self):
self.ClearTask()
self.preListWidget.clear()
# self.epsListWidget.clear()
self.nameToTag.clear()
self.tabWidget.setCurrentIndex(0)

def ClearCache(self):
isClear = QMessageBox.information(self, '清除缓存', "是否清除本书所有缓存", QtWidgets.QMessageBox.Yes|QtWidgets.QMessageBox.No)
if isClear == QtWidgets.QMessageBox.Yes:
if not Setting.SavePath.value:
return
path = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir),
"{}/{}_{}".format(config.CurSite, self.bookId, self.token))
waifuPath = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir),
"waifu2x/{}/{}_{}".format(config.CurSite, self.bookId, self.token))
if os.path.isdir(path):
shutil.rmtree(path, True)
if os.path.isdir(waifuPath):
shutil.rmtree(waifuPath, True)
self.UpdateFavoriteIcon()

def SwitchCurrent(self, **kwargs):
bookId = kwargs.get("bookId")
token = kwargs.get("token", "")
Expand Down Expand Up @@ -189,6 +214,7 @@ def OpenBookBack(self, data):

self.lastEpsId = -1
self.LoadHistory()
self.UpdateFavoriteIcon()
else:
msg = data.get("msg")
if msg:
Expand Down
Loading

0 comments on commit 1878bab

Please sign in to comment.