修复图片锯齿模糊问题,界面优化

This commit is contained in:
tonquer 2021-11-27 19:50:45 +08:00
parent 1961a61416
commit c16367a8ba
143 changed files with 100996 additions and 4264 deletions

View File

@ -81,6 +81,7 @@ jobs:
create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "Icon.icns" 200 190 \
--hide-extension "Icon.icns" ${{ env.PACKAGENAME }}.dmg dist/
zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg
mv ${{ env.PACKAGENAME }}.dmg ..
mv bika.zip ..
cd ..
- name: Upload

View File

@ -81,8 +81,8 @@ jobs:
create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "Icon.icns" 200 190 \
--hide-extension "Icon.icns" ${{ env.PACKAGENAME }}.dmg dist/
zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg
mv bika.zip ..
mv ${{ env.PACKAGENAME }}.dmg ..
mv bika.zip ..
cd ..
- name: Upload
uses: actions/upload-artifact@v2
@ -127,11 +127,10 @@ jobs:
Copy-Item -Verbose -Recurse -Path data -Destination bika/
cp ..\LICENSE bika\
cp ..\README.md bika\
# mkdir ${{ env.PACKAGENAME }}
# mv bika ${{ env.PACKAGENAME }}
7z a -r "$($Env:PACKAGENAME + '.zip')" "bika"
mv "$($Env:PACKAGENAME + '.zip')" ..
cd ..
mkdir ${{ env.PACKAGENAME }}
mv src\bika ${{ env.PACKAGENAME }}
7z a -r "$($Env:PACKAGENAME + '.zip')" "bika"
- name: Upload
uses: actions/upload-artifact@v2
with:

1
.gitignore vendored
View File

@ -136,3 +136,4 @@ history.db
# Downloaded Commies for PicACG
commies/
test/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 594 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@ -31,6 +31,16 @@
<file>icon/skin_aio_friend_bubble_pressed.9.png</file>
<file>icon/splash_title_new.png</file>
<file>icon/verified.png</file>
<file>icon/loading/loading_1.png</file>
<file>icon/loading/loading_2.png</file>
<file>icon/loading/loading_3.png</file>
<file>icon/loading/loading_4.png</file>
<file>icon/loading/loading_5.png</file>
<file>icon/loading/loading_6.png</file>
<file>icon/loading/loading_7.png</file>
<file>icon/loading/loading_8.png</file>
<file>icon/loading/loading_9.png</file>
<file>icon/loading/loading_10.png</file>
</qresource>
<qresource prefix="icon">
<file>theme/dark_pink/disabled/base.svg</file>
@ -181,9 +191,23 @@
<file>theme/light_pink/primary/uparrow.svg</file>
<file>theme/light_pink/primary/uparrow2.svg</file>
<file>theme/light_pink/primary/vline.svg</file>
<file>theme/scrollbar/scrollbar_arrowup_normal.png</file>
<file>theme/scrollbar/scrollbar_arrowleft_normal.png</file>
<file>theme/scrollbar/scrollbar_arrowup_down.png</file>
<file>theme/scrollbar/scrollbar_arrowleft_down.png</file>
<file>theme/scrollbar/scrollbar_arrowup_highlight.png</file>
<file>theme/scrollbar/scrollbar_arrowleft_highlight.png</file>
<file>theme/scrollbar/scrollbar_arrowdown_normal.png</file>
<file>theme/scrollbar/scrollbar_arrowright_normal.png</file>
<file>theme/scrollbar/scrollbar_arrowdown_down.png</file>
<file>theme/scrollbar/scrollbar_arrowright_down.png</file>
<file>theme/scrollbar/scrollbar_arrowdown_highlight.png</file>
<file>theme/scrollbar/scrollbar_arrowright_highlight.png</file>
</qresource>
<qresource prefix="file">
<file>theme/dark_pink.qss</file>
<file>theme/light_pink.qss</file>
<file>tr/tr_en.qm</file>
<file>tr/tr_hk.qm</file>
</qresource>
</RCC>

View File

@ -67,6 +67,14 @@ QTabWidget::pane {
border: none;
}
QListWidget {
background-color:transparent;
}
QScrollArea {
background-color:transparent;
}
/* ------------------------------------------------------------------------ */
/* Inputs */
@ -745,39 +753,116 @@ QProgressBar::chunk {
QScrollBar:horizontal {
border: 0;
background: #232629;
background: #31363b;
height: 8px;
padding-top:12px;
padding-bottom:12px;
}
QScrollBar:vertical {
border: 0;
background: #232629;
background: #31363b;
width: 8px;
padding-top:12px;
padding-bottom:12px;
}
QScrollBar::handle:horizontal {
background: #4f5b62;
min-width: 20px;
background: #A0A0A0;
min-width: 10px;
}
QScrollBar::handle:vertical {
background: #4f5b62;
min-height: 20px;
background: #A0A0A0;
min-height: 10px;
}
QScrollBar::handle:vertical:hover,
QScrollBar::handle:horizontal:hover {
background: #ff4081;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical,
QScrollBar::add-line:horizontal,
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
background: none;
}
/*纵向滚动条顶部三角形位置*/
QScrollBar::sub-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: top;
}
/*横向滚动条左侧三角形位置*/
QScrollBar::sub-line:horizontal {
border: 0;
background: transparent;
width: 0px;
height: 0px;
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: left;
}
/*纵向滚动条向上的三角形小图标*/
QScrollBar::up-arrow:vertical {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_normal.png);
}
/*横向滚动条左边的三角形小图标*/
QScrollBar::left-arrow:horizontal {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_normal.png);
}
/*纵向滚动条向上的三角形小图标 鼠标悬停*/
QScrollBar::up-arrow:vertical:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_down.png);
}
/*横向滚动条左边的三角形小图标 鼠标悬停*/
QScrollBar::left-arrow:horizontal:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_down.png);
}
/*纵向滚动条向上的三角形小图标 鼠标按下*/
QScrollBar::up-arrow:vertical:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_highlight.png);
}
/*横向滚动条左边的三角形小图标 鼠标按下*/
QScrollBar::left-arrow:horizontal:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_highlight.png);
}
/*纵向滚动条下面三角形部分*/
QScrollBar::add-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: bottom;
}
/*横向滚动条右边的三角形部分*/
QScrollBar::add-line:horizontal {
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: right;
}
/*纵向滚动条下面三角形图标*/
QScrollBar::down-arrow:vertical {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_normal.png);
}
/*横向滚动条右侧三角形图标*/
QScrollBar::right-arrow:horizontal {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_normal.png);
}
/*纵向滚动条下面三角形图标 鼠标悬停*/
QScrollBar::down-arrow:vertical:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_down.png);
}
/*横向滚动条右侧三角形图标 鼠标悬停*/
QScrollBar::right-arrow:horizontal:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_down.png);
}
/*纵向滚动条下面三角形图标 鼠标按下*/
QScrollBar::down-arrow:vertical:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_highlight.png);
}
/*横向滚动条右侧三角形图标 鼠标按下*/
QScrollBar::right-arrow:horizontal:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_highlight.png);
}
/* ------------------------------------------------------------------------ */
@ -905,26 +990,26 @@ QToolButton {
height: 40px;
margin: 3px;
padding: 3px;
border-right: 10px solid #31363b;
border-left: 10px solid #31363b;
border-right: 5px solid #31363b;
border-left: 5px solid #31363b;
}
QToolButton:hover {
background: #4f5b62;
border-right: 10px solid #4f5b62;
border-left: 10px solid #4f5b62;
border-right: 5px solid #4f5b62;
border-left: 5px solid #4f5b62;
}
QToolButton:pressed {
background: #232629;
border-right: 10px solid #232629;
border-left: 10px solid #232629;
border-right: 5px solid #232629;
border-left: 5px solid #232629;
}
QToolButton:checked {
background: #4f5b62;
border-left: 10px solid #4f5b62;
border-right: 10px solid #ff4081;
border-left: 5px solid #ff4081;
border-right: 5px solid #4f5b62;
}
/* ------------------------------------------------------------------------ */

View File

@ -35,11 +35,11 @@
/* Basic widgets */
QWidget {
background-color: #e6e6e6;
background-color: #f3f3f3;
}
QFrame {
background-color: #e6e6e6;
background-color: #f3f3f3;
border: 1px solid #f5f5f5;
border-radius: 4px;
}
@ -67,6 +67,14 @@ QTabWidget::pane {
border: none;
}
QListWidget {
background-color:transparent;
}
QScrollArea {
background-color:transparent;
}
/* ------------------------------------------------------------------------ */
/* Inputs */
@ -77,7 +85,7 @@ QTextEdit,
QLineEdit,
QPushButton {
color: #ff4081;
background-color: #e6e6e6;
background-color: #f3f3f3;
border: 2px solid #ff4081;
border-radius: 4px;
padding: 8px 16px ;
@ -103,7 +111,7 @@ QComboBox {
QPlainTextEdit {
border-radius: 4px;
padding: 8px 16px;
background-color: #e6e6e6;
background-color: #f3f3f3;
border: 1px solid #f5f5f5;
}
@ -243,7 +251,7 @@ QPushButton {
QPushButton:checked,
QPushButton:pressed {
color: #e6e6e6;
color: #f3f3f3;
background-color: #ff4081;
}
@ -266,7 +274,7 @@ QPushButton:flat:checked {
QPushButton:disabled,
QPushButton:flat:disabled {
color: rgba(255, 255, 255, 0.75);
color: rgba(255, 64, 129, 0.75);
background-color: transparent;
border-color: #f5f5f5;
}
@ -333,7 +341,7 @@ QTabBar::tab:left:hover {
QTabBar QToolButton:hover,
QTabBar QToolButton {
border: 20px;
background-color: #e6e6e6;
background-color: #f3f3f3;
}
QTabBar QToolButton::up-arrow {
@ -394,7 +402,7 @@ QGroupBox::title {
subcontrol-position: top left;
padding: 0 15px;
margin-top: 10px;
background-color: #e6e6e6;
background-color: #f3f3f3;
background-color: transparent;
height: 20px;
}
@ -743,41 +751,119 @@ QProgressBar::chunk {
/* ------------------------------------------------------------------------ */
/* QScrollBar */
QScrollBar:horizontal {
border: 0;
background: #f5f5f5;
background: #f3f3f3;
height: 8px;
padding-top:12px;
padding-bottom:12px;
}
QScrollBar:vertical {
border: 0;
background: #f5f5f5;
background: #f3f3f3;
width: 8px;
padding-top:12px;
padding-bottom:12px;
}
QScrollBar::handle:horizontal {
background: #ffffff;
min-width: 20px;
background: #878787;
min-width: 10px;
}
QScrollBar::handle:vertical {
background: #ffffff;
min-height: 20px;
background: #878787;
min-height: 10px;
}
QScrollBar::handle:vertical:hover,
QScrollBar::handle:horizontal:hover {
background: #ff4081;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical,
QScrollBar::add-line:horizontal,
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
background: none;
}
/*纵向滚动条顶部三角形位置*/
QScrollBar::sub-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: top;
}
/*横向滚动条左侧三角形位置*/
QScrollBar::sub-line:horizontal {
border: 0;
background: transparent;
width: 0px;
height: 0px;
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: left;
}
/*纵向滚动条向上的三角形小图标*/
QScrollBar::up-arrow:vertical {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_normal.png);
}
/*横向滚动条左边的三角形小图标*/
QScrollBar::left-arrow:horizontal {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_normal.png);
}
/*纵向滚动条向上的三角形小图标 鼠标悬停*/
QScrollBar::up-arrow:vertical:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_down.png);
}
/*横向滚动条左边的三角形小图标 鼠标悬停*/
QScrollBar::left-arrow:horizontal:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_down.png);
}
/*纵向滚动条向上的三角形小图标 鼠标按下*/
QScrollBar::up-arrow:vertical:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowup_highlight.png);
}
/*横向滚动条左边的三角形小图标 鼠标按下*/
QScrollBar::left-arrow:horizontal:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowleft_highlight.png);
}
/*纵向滚动条下面三角形部分*/
QScrollBar::add-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: bottom;
}
/*横向滚动条右边的三角形部分*/
QScrollBar::add-line:horizontal {
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: right;
}
/*纵向滚动条下面三角形图标*/
QScrollBar::down-arrow:vertical {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_normal.png);
}
/*横向滚动条右侧三角形图标*/
QScrollBar::right-arrow:horizontal {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_normal.png);
}
/*纵向滚动条下面三角形图标 鼠标悬停*/
QScrollBar::down-arrow:vertical:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_down.png);
}
/*横向滚动条右侧三角形图标 鼠标悬停*/
QScrollBar::right-arrow:horizontal:hover {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_down.png);
}
/*纵向滚动条下面三角形图标 鼠标按下*/
QScrollBar::down-arrow:vertical:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowdown_highlight.png);
}
/*横向滚动条右侧三角形图标 鼠标按下*/
QScrollBar::right-arrow:horizontal:pressed {
image: url(:/icon/theme/scrollbar/scrollbar_arrowright_highlight.png);
}
/* ------------------------------------------------------------------------ */
@ -864,7 +950,7 @@ QFrame[frameShape="5"] {
/* QToolBar */
QToolBar {
background: #e6e6e6;
background: #f3f3f3;
border: 0px solid;
}
@ -899,39 +985,41 @@ QToolBar::separator:vertical {
/* ------------------------------------------------------------------------ */
/* QToolButton */
QToolButton {
background: #e6e6e6;
background: #f3f3f3;
border: 0px;
height: 40px;
margin: 3px;
padding: 3px;
border-right: 10px solid #e6e6e6;
border-left: 10px solid #e6e6e6;
border-right: 5px solid #f3f3f3;
border-left: 5px solid #f3f3f3;
}
QToolButton:hover {
background: #ffffff;
border-right: 10px solid #ffffff;
border-left: 10px solid #ffffff;
background: #eaeaea;
border-right: 5px solid #eaeaea;
border-left: 5px solid #eaeaea;
}
QToolButton:pressed {
background: #f5f5f5;
border-right: 10px solid #f5f5f5;
border-left: 10px solid #f5f5f5;
background: #eaeaea;
border-right: 5px solid #f5f5f5;
border-left: 5px solid #f5f5f5;
}
QToolButton:checked {
background: #ffffff;
border-left: 10px solid #ffffff;
border-right: 10px solid #ff4081;
background: #eaeaea;
border-left: 5px solid #ff4081;
border-right: 5px solid #f3f3f3;
}
/* ------------------------------------------------------------------------ */
/* General viewers */
QTableView {
background-color: #e6e6e6;
background-color: #f3f3f3;
border: 1px solid #f5f5f5;
border-radius: 4px;
}
@ -1034,7 +1122,7 @@ QPushButton.danger {
QPushButton.danger:checked,
QPushButton.danger:pressed {
color: #e6e6e6;
color: #f3f3f3;
background-color: #dc3545;
}
@ -1045,7 +1133,7 @@ QPushButton.warning{
QPushButton.warning:checked,
QPushButton.warning:pressed {
color: #e6e6e6;
color: #f3f3f3;
background-color: #ffc107;
}
@ -1056,7 +1144,7 @@ QPushButton.success {
QPushButton.success:checked,
QPushButton.success:pressed {
color: #e6e6e6;
color: #f3f3f3;
background-color: #17a2b8;
}
@ -1098,7 +1186,7 @@ QTableCornerButton::section {
border-radius: 0px;
border-right: 1px solid;
border-bottom: 1px solid;
border-color: #e6e6e6;
border-color: #f3f3f3;
}
QTableView {
@ -1118,7 +1206,7 @@ QHeaderView::section {
border-radius: 0px;
border-right: 1px solid;
border-bottom: 1px solid;
border-color: #e6e6e6;
border-color: #f3f3f3;
}
@ -1167,7 +1255,7 @@ QListView QLineEdit {
QToolTip {
padding: 5px;
border: 1px solid #e6e6e6;
border: 1px solid #f3f3f3;
border-radius: 4px;
color: #555555;
background-color: #ffffff;

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
res/tr/tr_en.qm Normal file

Binary file not shown.

BIN
res/tr/tr_hk.qm Normal file

Binary file not shown.

0
script/__init__.py Normal file
View File

35
script/build_translate.py Normal file
View File

@ -0,0 +1,35 @@
import os
from tools.langconv import Converter
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 = ""
nextName = ""
for srcLine in f.readlines():
line = srcLine.strip()
if "<source>" in line:
name = line.replace("<source>", "").replace("</source>", "")
nextName = Converter('zh-hant').convert(name)
if "<translation type=\"unfinished\"></translation>" in line:
srcLine = srcLine.replace("<translation type=\"unfinished\"></translation>", "<translation>{}</translation>".format(nextName))
elif "<translation>" in line:
oldName = line.replace("<translation>", "").replace("</translation>", "").replace("\n", "")
srcLine = srcLine.replace(oldName, nextName)
elif "<translation type=\"vanished\">" in line:
oldName = line.replace("<translation type=\"vanished\">", "").replace("</translation>", "").replace("\n", "")
srcLine = srcLine.replace(" type=\"vanished\"", "").replace(oldName, nextName)
data += srcLine
f.close()
f = open(tsFile, "w+", encoding="utf-8")
f.write(data)
f.close()
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

@ -6,5 +6,5 @@ class WheelComboBox(QComboBox):
QComboBox.__init__(self, parent)
def wheelEvent(self, event):
return
event.ignore()

View File

@ -6,5 +6,5 @@ class WheelDoubleSpinBox(QDoubleSpinBox):
QDoubleSpinBox.__init__(self, parent)
def wheelEvent(self, event):
return
event.ignore()

View File

@ -0,0 +1,9 @@
from PySide6.QtWidgets import QSlider
class WheelSlider(QSlider):
def __init__(self, parent=None):
QSlider.__init__(self, parent)
def wheelEvent(self, event):
event.ignore()

View File

@ -6,5 +6,5 @@ class WheelSpinBox(QSpinBox):
QSpinBox.__init__(self, parent)
def wheelEvent(self, event):
return
event.ignore()

View File

@ -1,7 +1,9 @@
from PySide6 import QtWidgets, QtCore
from PySide6.QtCore import QTimer, QFile
from PySide6.QtGui import QGuiApplication
from PySide6.QtWidgets import QGridLayout
from component.label.gif_group_label import GifGroupLabel
from component.label.gif_label import GifLabel
@ -13,21 +15,18 @@ class LoadingDialog(QtWidgets.QDialog):
self.setWindowFlag(QtCore.Qt.Dialog)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.label = GifLabel(self)
self.label = GifGroupLabel(self)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.timer = QTimer(self.label)
self.timer.setInterval(100)
f = QFile(":/png/icon/loading2.gif")
f.open(QFile.ReadOnly)
self.label.Init(f.readAll())
f.close()
self.label.resize(200, 200)
self.label.Init()
self.label.resize(250, 250)
self.cnt = 0
self.closeCnt = 50
self.timer.timeout.connect(self.UpdatePic)
self.resize(200, 200)
self.resize(250, 250)
def show(self) -> None:
self.timer.start()
@ -40,6 +39,7 @@ class LoadingDialog(QtWidgets.QDialog):
def UpdatePic(self):
self.cnt += 1
self.label.ShowNextPixMap()
if self.cnt >= self.closeCnt:
self.close()
pass

View File

@ -0,0 +1,29 @@
from PySide6.QtCore import QByteArray, QBuffer, QTimer
from PySide6.QtGui import QMovie, Qt, QPixmap, QImage
from PySide6.QtWidgets import QLabel
class GifGroupLabel(QLabel):
def __init__(self, parent):
QLabel.__init__(self, parent)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.images = []
self.index = 0
def Init(self):
for i in range(10):
image = QImage(":/png/icon/loading/loading_{}.png".format(i+1))
self.images.append(image)
def ShowNextPixMap(self):
if not self.images:
return
if self.index >= len(self.images):
self.index = 0
image = self.images[self.index]
p = QPixmap(image)
radio = self.devicePixelRatio()
p.setDevicePixelRatio(radio)
self.setPixmap(p)
self.index += 1

View File

@ -1,5 +1,5 @@
from PySide6.QtCore import QByteArray, QBuffer
from PySide6.QtGui import QMovie, Qt
from PySide6.QtGui import QMovie, Qt, QPixmap
from PySide6.QtWidgets import QLabel
@ -11,16 +11,36 @@ class GifLabel(QLabel):
self.bBuffer = None
self.setAttribute(Qt.WA_TranslucentBackground)
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.movie.frameChanged.connect(self.FrameChange)
def FrameChange(self):
currentPixmap = self.movie.currentPixmap()
size = currentPixmap.size()
radioF = self.devicePixelRatioF()
pixmap = QPixmap()
pixmap.setDevicePixelRatio(radioF)
self.setPixmap(pixmap)
return
def Init(self, data):
self.resize(124, 124)
self.byteArray = QByteArray(data)
self.bBuffer = QBuffer(self.byteArray)
self.movie.setFormat(QByteArray(b"GIF"))
self.movie.setCacheMode(QMovie.CacheNone)
self.movie.setDevice(self.bBuffer)
# self.movie.setSpeed(100)
self.setMovie(self.movie)
self.movie.start()
self.setScaledContents(True)
def InitByFileName(self, name):
self.resize(300, 300)
self.movie = QMovie(name)
# self.movie.setFileName(name)
self.movie.setFormat(QByteArray(b"GIF"))
self.movie.start()
return

View File

@ -7,19 +7,22 @@ class HeadLabel(QLabel):
super(HeadLabel, self).__init__(*args, **kwargs)
self.antialiasing = True
self.radius = 100
self.target = None
def SetPicture(self, data, titleData=None):
self.target = QPixmap(self.size()) # 大小和控件一样
self.target.fill(Qt.transparent) # 填充背景为透明
q = QPixmap()
q.loadFromData(data)
radio = self.devicePixelRatio()
q.setDevicePixelRatio(radio)
offset = 0
if titleData:
offset = 20
p = q.scaled( # 加载图片并缩放和控件一样大
self.width()-offset, self.height()-offset, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
(self.width()-offset)*radio, (self.height()-offset)*radio, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
painter = QPainter(self.target)
if self.antialiasing:
@ -38,6 +41,7 @@ class HeadLabel(QLabel):
if titleData:
p = QPixmap()
p.loadFromData(titleData)
p.setDevicePixelRatio(self.devicePixelRatio())
titleP = p.scaled( # 加载图片并缩放和控件一样大
self.height(), self.width(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
painter = QPainter()

View File

@ -48,14 +48,21 @@ class SearchLineEdit(QLineEdit):
self.help.localWidget.Switch.connect(self.SetEnable)
# self.listView.setModel(self.model)
self.isNotReload = False
self.help.authorWidget.SetState(False)
# self.help.authorWidget.SetState(False)
# self.help.tagWidget.SetState(False)
self.help.categoryWidget.SetState(False)
self.isShowSearch = True
@property
def listView(self):
return self.help.listView
def SetDbError(self):
self.isShowSearch = False
self.help.localWidget.SetState(False)
self.SetEnable(False)
return
def SetEnable(self, isLocal):
self.help.titleLabel.setVisible(isLocal)
self.help.titleWidget.setVisible(isLocal)
@ -152,6 +159,8 @@ class SearchLineEdit(QLineEdit):
def ShowListView(self):
if not self.widget.isHidden():
return
if not self.isShowSearch:
return
self.widget.show()
pos = self.mapToGlobal(self.pos())
# print(pos, self.pos(), self.size())

View File

@ -80,7 +80,9 @@ class BaseListWidget(QListWidget, QtTaskBase):
def mousePressEvent(self, event: QMouseEvent):
if event.button() == Qt.ForwardButton:
QtOwner().SwitchWidgetNext()
# QtOwner().SwitchWidgetNext()
event.ignore()
elif event.button() == Qt.BackButton:
QtOwner().SwitchWidgetLast()
event.ignore()
# QtOwner().SwitchWidgetLast()
return QListWidget.mousePressEvent(self, event)

View File

@ -5,8 +5,10 @@ from PySide6.QtWidgets import QListWidgetItem
from component.list.base_list_widget import BaseListWidget
from component.widget.comic_item_widget import ComicItemWidget
from config import config
from config.setting import Setting
from tools.status import Status
from tools.str import Str
from tools.tool import ToolUtil
class CategoryListWidget(BaseListWidget):
@ -52,6 +54,11 @@ class CategoryListWidget(BaseListWidget):
item = self.item(index)
widget = self.itemWidget(item)
widget.SetPicture(data)
if Setting.CoverIsOpenWaifu.value:
item = self.item(index)
indexModel = self.indexFromItem(item)
self.Waifu2xPicture(indexModel)
pass
pass
else:
item = self.item(index)
@ -59,6 +66,25 @@ class CategoryListWidget(BaseListWidget):
widget.SetPictureErr()
return
def Waifu2xPicture(self, index):
widget = self.indexWidget(index)
if widget and widget.picData:
w, h = ToolUtil.GetPictureSize(widget.picData)
if max(w, h) <= Setting.CoverMaxNum.value:
model = ToolUtil.GetModelByIndex(Setting.CoverLookNoise.value, Setting.CoverLookScale.value, Setting.CoverLookModel.value)
self.AddConvertTask(widget.path, widget.picData, model, self.Waifu2xPictureBack, index)
def CancleWaifu2xPicture(self, index):
widget = self.indexWidget(index)
if widget.isWaifu2x and widget.picData:
widget.SetPicture(widget.picData)
def Waifu2xPictureBack(self, data, waifuId, index, tick):
widget = self.indexWidget(index)
if data and widget:
widget.SetWaifu2xData(data)
return
def GetAllSelectItem(self):
data = set()
for i in range(self.count()):

View File

@ -7,6 +7,7 @@ from PySide6.QtWidgets import QListWidgetItem, QMenu, QApplication
from component.list.base_list_widget import BaseListWidget
from component.widget.comic_item_widget import ComicItemWidget
from config import config
from config.setting import Setting
from qt_owner import QtOwner
from tools.status import Status
from tools.str import Str
@ -32,20 +33,28 @@ class ComicListWidget(BaseListWidget):
def SelectMenuBook(self, pos):
index = self.indexAt(pos)
if index.isValid():
widget = self.indexWidget(index)
if index.isValid() and widget:
popMenu = QMenu(self)
action = popMenu.addAction(self.tr("打开"))
action = popMenu.addAction(Str.GetStr(Str.Open))
action.triggered.connect(partial(self.OpenBookInfoHandler, index))
action = popMenu.addAction(self.tr("查看封面"))
action = popMenu.addAction(Str.GetStr(Str.LookCover))
action.triggered.connect(partial(self.OpenPicture, index))
action = popMenu.addAction(self.tr("重下封面"))
action = popMenu.addAction(Str.GetStr(Str.ReDownloadCover))
action.triggered.connect(partial(self.ReDownloadPicture, index))
action = popMenu.addAction(self.tr("复制标题"))
if config.CanWaifu2x and widget.picData:
if not widget.isWaifu2x:
action = popMenu.addAction(Str.GetStr(Str.Waifu2xConvert))
action.triggered.connect(partial(self.Waifu2xPicture, index))
else:
action = popMenu.addAction(Str.GetStr(Str.DelWaifu2xConvert))
action.triggered.connect(partial(self.CancleWaifu2xPicture, index))
action = popMenu.addAction(Str.GetStr(Str.CopyTitle))
action.triggered.connect(partial(self.CopyHandler, index))
action = popMenu.addAction(self.tr("下载"))
action = popMenu.addAction(Str.GetStr(Str.Download))
action.triggered.connect(partial(self.DownloadHandler, index))
if self.isDelMenu:
action = popMenu.addAction(self.tr("删除"))
action = popMenu.addAction(Str.GetStr(Str.Delete))
action.triggered.connect(partial(self.DelHandler, index))
popMenu.exec_(QCursor.pos())
return
@ -83,8 +92,7 @@ class ComicListWidget(BaseListWidget):
if isShowHistory:
info = QtOwner().owner.historyView.GetHistory(_id)
if info:
categories = self.tr("上次观看到第") + str(info.epsId + 1) + self.tr("") + "/" + str(v.epsCount) + self.tr(
"")
categories = Str.GetStr(Str.LastLook) + str(info.epsId + 1) + Str.GetStr(Str.Chapter) + "/" + str(v.epsCount) + Str.GetStr(Str.Chapter)
self.AddBookItem(_id, title, categories, url, path, likesCount, updated_at, pagesCount, finished)
def AddBookItemByHistory(self, v):
@ -92,7 +100,7 @@ class ComicListWidget(BaseListWidget):
title = v.name
path = v.path
url = v.url
categories = "{}看过".format(ToolUtil.GetUpdateStrByTick(v.tick))
categories = "{} {}".format(ToolUtil.GetUpdateStrByTick(v.tick), Str.GetStr(Str.Looked))
self.AddBookItem(_id, title, categories, url, path)
def AddBookItem(self, _id, title, categoryStr="", url="", path="", likesCount="", updated_at="", pagesCount="", finished=""):
@ -120,7 +128,7 @@ class ComicListWidget(BaseListWidget):
if pagesCount:
title += "<font color=#d5577c>{}</font>".format("("+str(pagesCount)+"P)")
if finished:
title += "<font color=#d5577c>{}</font>".format("(完)")
title += "<font color=#d5577c>{}</font>".format("({})".format(Str.GetStr(Str.ComicFinished)))
item = QListWidgetItem(self)
item.setFlags(item.flags() & ~Qt.ItemIsSelectable)
@ -138,6 +146,10 @@ class ComicListWidget(BaseListWidget):
if not widget:
return
widget.SetPicture(data)
if Setting.CoverIsOpenWaifu.value:
item = self.item(index)
indexModel = self.indexFromItem(item)
self.Waifu2xPicture(indexModel, True)
pass
else:
item = self.item(index)
@ -179,6 +191,25 @@ class ComicListWidget(BaseListWidget):
self.AddDownloadTask(widget.url, widget.path, None, self.LoadingPictureComplete, True, count, False)
pass
def Waifu2xPicture(self, index, isIfSize=False):
widget = self.indexWidget(index)
if widget and widget.picData:
w, h = ToolUtil.GetPictureSize(widget.picData)
if max(w, h) <= Setting.CoverMaxNum.value or not isIfSize:
model = ToolUtil.GetModelByIndex(Setting.CoverLookNoise.value, Setting.CoverLookScale.value, Setting.CoverLookModel.value)
self.AddConvertTask(widget.path, widget.picData, model, self.Waifu2xPictureBack, index)
def CancleWaifu2xPicture(self, index):
widget = self.indexWidget(index)
if widget.isWaifu2x and widget.picData:
widget.SetPicture(widget.picData)
def Waifu2xPictureBack(self, data, waifuId, index, tick):
widget = self.indexWidget(index)
if data and widget:
widget.SetWaifu2xData(data)
return
def CopyHandler(self, index):
widget = self.indexWidget(index)
if widget:

View File

@ -59,6 +59,10 @@ class DWaterProgress(QProgressBar):
self.stop()
return super(DWaterProgress, self).hide()
def close(self) -> bool:
self.stop()
return super(DWaterProgress, self).close()
@Slot()
def start(self):
self.timer.start()

View File

@ -37,6 +37,12 @@ class SmoothScrollBar(QScrollBar):
self.__value = min(self.maximum(), self.__value)
self.setValue(self.__value)
def ScrollTo(self, value):
self.__value = value
self.__value = max(self.minimum(), self.__value)
self.__value = min(self.maximum(), self.__value)
self.setValue(self.__value)
def ResetValue(self, value):
self.__value = value

View File

@ -2,6 +2,7 @@ from PySide6.QtCore import Qt, QSize
from PySide6.QtGui import QPixmap, QIcon, QFont
from PySide6.QtWidgets import QWidget
from config.setting import Setting
from interface.ui_comic_item import Ui_ComicItem
from tools.str import Str
@ -16,7 +17,10 @@ class ComicItemWidget(QWidget, Ui_ComicItem):
self.url = ""
self.path = ""
# TODO 如何自适应
self.picLabel.setFixedSize(300, 400)
rate = Setting.CoverSize.value
width = 250 * rate / 100
height = 340 * rate / 100
self.picLabel.setFixedSize(width, height)
# self.picLabel.setMinimumSize(300, 400)
# self.picLabel.setMaximumSize(220, 308)
@ -29,12 +33,13 @@ class ComicItemWidget(QWidget, Ui_ComicItem):
self.starButton.setMinimumHeight(24)
self.timeLabel.setMinimumHeight(24)
self.starButton.setMaximumWidth(280)
self.timeLabel.setMaximumWidth(280)
self.categoryLabel.setMaximumWidth(width-20)
self.starButton.setMaximumWidth(width-20)
self.timeLabel.setMaximumWidth(width-20)
# self.nameLable.setMinimumSize(210, 25)
# self.nameLable.setMaximumSize(210, 150)
self.nameLable.setMaximumWidth(280)
self.nameLable.setMaximumWidth(width-20)
self.nameLable.adjustSize()
self.nameLable.setWordWrap(True)
font = QFont()
@ -42,6 +47,7 @@ class ComicItemWidget(QWidget, Ui_ComicItem):
font.setBold(True)
self.nameLable.setFont(font)
self.adjustSize()
self.isWaifu2x = False
def GetTitle(self):
return self.nameLable.text()
@ -51,7 +57,22 @@ class ComicItemWidget(QWidget, Ui_ComicItem):
pic = QPixmap()
if data:
pic.loadFromData(data)
newPic = pic.scaled(self.picLabel.width(), self.picLabel.height(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.isWaifu2x = False
radio = self.devicePixelRatio()
pic.setDevicePixelRatio(radio)
newPic = pic.scaled(self.picLabel.width() * radio, self.picLabel.height() * radio, Qt.KeepAspectRatio,
Qt.SmoothTransformation)
self.picLabel.setPixmap(newPic)
def SetWaifu2xData(self, data):
pic = QPixmap()
if not data:
return
self.isWaifu2x = True
pic.loadFromData(data)
radio = self.devicePixelRatio()
pic.setDevicePixelRatio(radio)
newPic = pic.scaled(self.picLabel.width()*radio, self.picLabel.height()*radio, Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.picLabel.setPixmap(newPic)
def SetPictureErr(self):

View File

@ -87,21 +87,22 @@ class CommentWidget(QtWidgets.QWidget, Ui_Comment, QtTaskBase):
widget.SetLike(isLike)
def KillComment(self, cfgId):
for index in range(self.listWidget.count()):
item = self.listWidget.item(index)
if not item:
continue
widget = self.listWidget.itemWidget(item)
if not widget:
continue
if widget.id != cfgId:
continue
r = QtOwner().ShowMsgBox(QMessageBox.Question, self.tr('举报'),
self.tr('是否举报') + widget.nameLabel.text() + ",\n" + self.tr(
"评论:") +"\n"+ widget.commentLabel.text() + "\n")
if r == 0:
QtOwner().ShowLoading()
self.AddHttpTask(self.reqKillComment(widget.id), self.KillCommentBack, backParam=cfgId)
return
# for index in range(self.listWidget.count()):
# item = self.listWidget.item(index)
# if not item:
# continue
# widget = self.listWidget.itemWidget(item)
# if not widget:
# continue
# if widget.id != cfgId:
# continue
# r = QtOwner().ShowMsgBox(QMessageBox.Question, self.tr('举报'),
# self.tr('是否举报') + widget.nameLabel.text() + ",\n" + self.tr(
# "评论:") +"\n"+ widget.commentLabel.text() + "\n")
# if r == 0:
# QtOwner().ShowLoading()
# self.AddHttpTask(self.reqKillComment(widget.id), self.KillCommentBack, backParam=cfgId)
def KillCommentBack(self, raw, backId):
QtOwner().CloseLoading()

View File

@ -1,4 +1,4 @@
from PySide6.QtCore import QPropertyAnimation, QRect, QEasingCurve
from PySide6.QtCore import QPropertyAnimation, QRect, QEasingCurve, QFile
from PySide6.QtWidgets import QWidget
from config import config
@ -21,6 +21,10 @@ class NavigationWidget(QWidget, Ui_Navigation, QtTaskBase):
self.__ani = QPropertyAnimation(self, b"geometry")
self.__connect = None
self.pictureData = ""
f = QFile(u":/png/icon/placeholder_avatar.png")
f.open(QFile.ReadOnly)
self.picLabel.SetPicture(f.readAll())
f.close()
self.pushButton.clicked.connect(self.OpenLoginView)
def OpenLoginView(self):

View File

@ -4,19 +4,15 @@ from PySide6.QtWidgets import QWidget
from interface.ui_setting_item import Ui_SettingItem
class SettingItemWidget(QWidget, Ui_SettingItem):
class SettingItemWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
Ui_SettingItem.__init__(self)
self.setupUi(self)
self.widget.hide()
self.toolButton.clicked.connect(self._switchWidget)
def _switchWidget(self):
if self.widget.isHidden():
self.widget.show()
self.toolButton.setArrowType(Qt.ArrowType.DownArrow)
else:
self.widget.hide()
self.toolButton.setArrowType(Qt.ArrowType.UpArrow)
return
self.setStyleSheet("""
QWidget
{
background-color: rgb(253, 253, 253);
border:2px solid rgb(234,234,234);
border-radius:5px
}
""")

View File

@ -7,19 +7,13 @@ BuildVersion = "45"
Accept = "application/vnd.picacomic.com.v1+json"
Agent = "okhttp/3.8.1"
Platform = "android"
IsUpdate = 1 # 是否在启动时检查更新
Language = 'Chinese-Simplified' # 选择的语言
ThreadNum = 10 # 线程
DownloadThreadNum = 5 # 下载线程
ImageQuality = "original" # 画质original, low, medium, high
Uuid = "defaultUuid"
IsHttpProxy = 0 # 是否启用代理
HttpProxy = "" # 代理
ChatProxy = 1 # 聊天室启用代理
ChatSavePath = "chat"
SavePath = ''
ThreadNum = 10 # 线程
DownloadThreadNum = 5 # 下载线程
ChatSavePath = "chat"
SavePathDir = "commies" # 下载目录
ResetCnt = 5 # 下载重试次数
@ -31,10 +25,10 @@ PreLook = 4 # 预显示
IsLoadingPicture = True
UpdateUrl = "https://github.com/tonquer/picacg-windows/releases/latest"
UpdateUrlBack = "https://hub.fastgit.org/tonquer/picacg-windows/releases/latest"
UpdateUrl2 = "https://github.com/tonquer/picacg-windows/releases"
UpdateUrl2Back = "https://hub.fastgit.org/tonquer/picacg-windows/releases"
UpdateUrl = "https://github.com/tonquer/picacg-qt/releases/latest"
UpdateUrlBack = "https://hub.fastgit.org/tonquer/picacg-qt/releases/latest"
UpdateUrl2 = "https://github.com/tonquer/picacg-qt/releases"
UpdateUrl2Back = "https://hub.fastgit.org/tonquer/picacg-qt/releases"
DatabaseUpdate = "https://raw.githubusercontent.com/bika-robot/picacg-database/main/version.txt"
DatabaseDownload = "https://raw.githubusercontent.com/bika-robot/picacg-database/main/data/"
@ -47,52 +41,26 @@ UpdateVersion = "v1.2.8"
CanWaifu2x = True
ErrorMsg = ""
Encode = 0
Encode = 0 # 当前正在使用的索引
EncodeGpu = ""
SelectEncodeGpu = ""
Waifu2xThread = 2
Format = "jpg"
Waifu2xPath = "waifu2x"
IsOpenWaifu = 0
ThemeText = "dark" # 主题
ThemeIndex = 0 # 主题
ThemeIndex = 0 # 主题·
CurrentSetTheme = 0
LogIndex = 0 # Warn Info Debug
IsTips = 1
ChatSendAction = 2
DownloadModel = 0
DownloadNoise = 3
DownloadScale = 2.0
DownloadAuto = 0
# 看图模式
LookModel = 0
LookNoise = 3
LookScale = 2.0
LookReadMode = 1 # 看图模式
# LookReadScale = 2 # 默认缩放
LookReadFull = 0 # 是否全屏
TurnSpeed = 5000 # 翻页速度
ScrollSpeed = 400 # 滚动速度
# ISSUES
Issues = "https://github.com/tonquer/picacg-windows/issues"
Issues = "https://github.com/tonquer/picacg-qt/issues"
# 代理与分流相关
ProxyUrl = "https://github.com/tonquer/picacg-windows/discussions/48"
ProxyUrl = "https://github.com/tonquer/picacg-qt/discussions/48"
# Waifu2x相关
Waifu2xUrl = "https://github.com/tonquer/picacg-windows/discussions/76"
ProxySelectIndex = 1
IsUseHttps = 1 # 使用Https
Waifu2xUrl = "https://github.com/tonquer/picacg-qt/discussions/76"
Address = ['104.20.180.50', '104.20.181.50'] # 分类23 Ip列表
ImageServer = 'storage.wikawika.xyz' # 分流23 使用的图片服务器
@ -109,7 +77,3 @@ ImageDomain = [
"pica-pica.wikawika.xyz",
"www.picacomic.com"
]
# https://www.cloudflare.com/zh-cn/ips/
# https://cloud.tencent.com/developer/article/1675133
PreferCDNIP = "1.0.0.1" # CloudFlare的优选Ip

View File

@ -1,10 +1,149 @@
import os
import shutil
from PySide6.QtCore import QDir
class SettingValue:
def __init__(self, tag, defaultV, isNeedReset, des=None):
self.tag = tag # 分类
self.value = defaultV # 生效值
self.setV = defaultV # 设置的值
self.defaultV = defaultV # 默认值
self.isNeedReset = isNeedReset # 是否重启生效
self.des = des # 描述
self.autoValue = 0 # 选自动时,自动生效的值
self.name = ""
def InitValue(self, value, name):
value = self.GetSettingV(value, self.defaultV)
self.value = value
self.setV = value
self.name = name
return
@staticmethod
def GetSettingV(v, defV=None):
try:
if v:
if isinstance(defV, int):
if v == "true" or v == "True":
return 1
elif v == "false" or v == "False":
return 0
return int(v)
elif isinstance(defV, float):
return float(v)
else:
return v
return defV
except Exception as es:
from tools.log import Log
Log.Error(es)
return v
def GetIndexV(self):
if not isinstance(self.des, list):
return ""
if self.value >= len(self.des):
return ""
return self.des[self.value]
def SetValue(self, value):
if self.setV == value and self.value == value:
return
self.setV = value
if not self.isNeedReset:
self.value = value
self.autoValue = 0
Setting.SaveSettingV(self)
class Setting:
# 通用设置
IsUpdate = SettingValue("GeneraSetting", 1, False)
Language = SettingValue("GeneraSetting", 0, False, ["Auto", "zh", "hk", "en"]) # ch-zh ch-hk eu
ThemeIndex = SettingValue("GeneraSetting", 0, False, ["Auto", "light", "dark"]) #
LogIndex = SettingValue("GeneraSetting", 0, False, ["warn", "info", "debug"]) # Warn Info Debug
CoverSize = SettingValue("GeneraSetting", 100, False) #
ScaleLevel = SettingValue("GeneraSetting", 0, True, ["Auto", 100, 125, 150, 175, 200])
# 代理设置
IsHttpProxy = SettingValue("ProxySetting", 0, False)
HttpProxy = SettingValue("ProxySetting", "", False)
ChatProxy = SettingValue("ProxySetting", 0, False)
PreferCDNIP = SettingValue("ProxySetting", "1.0.0.1", False)
IsUseHttps = SettingValue("ProxySetting", 1, False)
ProxySelectIndex = SettingValue("ProxySetting", 1, False)
# 下载与缓存
SavePath = SettingValue("DownloadSetting", "", False)
# Waifu2x设置
SelectEncodeGpu = SettingValue("Waifu2xSetting", "", True)
Waifu2xThread = SettingValue("Waifu2xSetting", 2, True)
# 封面 Waifu2x
CoverIsOpenWaifu = SettingValue("Waifu2xSetting", 0, False)
CoverMaxNum = SettingValue("Waifu2xSetting", 400, False)
CoverLookModel = SettingValue("Waifu2xSetting", 0, False)
CoverLookNoise = SettingValue("Waifu2xSetting", 3, False)
CoverLookScale = SettingValue("Waifu2xSetting", 2.0, False)
IsOpenWaifu = SettingValue("Waifu2xSetting", 0, False)
LookMaxNum = SettingValue("Waifu2xSetting", 4096, False)
LookModel = SettingValue("Waifu2xSetting", 0, False)
LookNoise = SettingValue("Waifu2xSetting", 3, False)
LookScale = SettingValue("Waifu2xSetting", 2.0, False)
DownloadAuto = SettingValue("Waifu2xSetting", 0, False)
DownloadModel = SettingValue("Waifu2xSetting", 0, False)
DownloadNoise = SettingValue("Waifu2xSetting", 3, False)
DownloadScale = SettingValue("Waifu2xSetting", 2.0, False)
# 看图设置
LookReadMode = SettingValue("ReadSetting", 1, False)
LookReadFull = SettingValue("ReadSetting", 0, False)
TurnSpeed = SettingValue("ReadSetting", 5000, False)
ScrollSpeed = SettingValue("ReadSetting", 400, False)
# Other
UserId = SettingValue("Other", "", False)
Password = SettingValue("Other", "", False)
ChatSendAction = SettingValue("Other", 0, False, ["CtrlEnter", "Enter"])
ScreenIndex = SettingValue("Other", 0, False)
@staticmethod
def InitLoadSetting():
path = os.path.join(Setting.GetConfigPath(), "config.ini")
from PySide6.QtCore import QSettings
settings = QSettings(path, QSettings.IniFormat)
for name in dir(Setting):
setItem = getattr(Setting, name)
if isinstance(setItem, SettingValue):
value = settings.value(setItem.tag + "/" + name, setItem.defaultV)
setItem.InitValue(value, name)
from tools.log import Log
Log.UpdateLoggingLevel()
return
@staticmethod
def SaveSetting():
path = os.path.join(Setting.GetConfigPath(), "config.ini")
from PySide6.QtCore import QSettings
settings = QSettings(path, QSettings.IniFormat)
for name in dir(Setting):
setItem = getattr(Setting, name)
if isinstance(setItem, SettingValue):
settings.setValue(setItem.tag + "/" + name, setItem.setV)
return
@staticmethod
def SaveSettingV(setItem):
path = os.path.join(Setting.GetConfigPath(), "config.ini")
from PySide6.QtCore import QSettings
settings = QSettings(path, QSettings.IniFormat)
if isinstance(setItem, SettingValue) and setItem.name:
settings.setValue(setItem.tag + "/" + setItem.name, setItem.setV)
@staticmethod
def Init():
path = Setting.GetConfigPath()
@ -15,6 +154,7 @@ class Setting:
@staticmethod
def GetConfigPath():
from PySide6.QtCore import QDir
homePath = QDir.homePath()
projectName = ".picacg"
return os.path.join(homePath, projectName)

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,9 @@ class Ui_BookInfo(object):
"background-color:transparent;\n"
" border-right: 0px;\n"
" border-left: 0px;\n"
"}")
"}\n"
"QListWidget {background-color:transparent;}\n"
"QScrollArea {background-color:transparent;}")
self.gridLayout_2 = QGridLayout(BookInfo)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.epsListWidget = BaseListWidget(BookInfo)

View File

@ -15,7 +15,7 @@ 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, QFormLayout, QHBoxLayout, QLabel,
from PySide6.QtWidgets import (QApplication, QGridLayout, QHBoxLayout, QLabel,
QLineEdit, QPushButton, QSizePolicy, QSpacerItem,
QVBoxLayout, QWidget)
@ -23,7 +23,7 @@ class Ui_DownloadDir(object):
def setupUi(self, DownloadDir):
if not DownloadDir.objectName():
DownloadDir.setObjectName(u"DownloadDir")
DownloadDir.resize(400, 300)
DownloadDir.resize(401, 300)
self.verticalLayout = QVBoxLayout(DownloadDir)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
@ -56,50 +56,50 @@ class Ui_DownloadDir(object):
self.verticalLayout.addLayout(self.horizontalLayout)
self.formLayout = QFormLayout()
self.formLayout.setObjectName(u"formLayout")
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.label_3 = QLabel(DownloadDir)
self.label_3.setObjectName(u"label_3")
self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label_3)
self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1)
self.downloadDir = QLabel(DownloadDir)
self.downloadDir.setObjectName(u"downloadDir")
self.formLayout.setWidget(0, QFormLayout.FieldRole, self.downloadDir)
self.gridLayout.addWidget(self.downloadDir, 0, 1, 1, 1)
self.label_5 = QLabel(DownloadDir)
self.label_5.setObjectName(u"label_5")
self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_5)
self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1)
self.cacheDir = QLabel(DownloadDir)
self.cacheDir.setObjectName(u"cacheDir")
self.formLayout.setWidget(1, QFormLayout.FieldRole, self.cacheDir)
self.gridLayout.addWidget(self.cacheDir, 1, 1, 1, 1)
self.label_7 = QLabel(DownloadDir)
self.label_7.setObjectName(u"label_7")
self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_7)
self.gridLayout.addWidget(self.label_7, 2, 0, 1, 1)
self.chatDir = QLabel(DownloadDir)
self.chatDir.setObjectName(u"chatDir")
self.formLayout.setWidget(2, QFormLayout.FieldRole, self.chatDir)
self.gridLayout.addWidget(self.chatDir, 2, 1, 1, 1)
self.label_4 = QLabel(DownloadDir)
self.label_4.setObjectName(u"label_4")
self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_4)
self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1)
self.waifu2xDir = QLabel(DownloadDir)
self.waifu2xDir.setObjectName(u"waifu2xDir")
self.formLayout.setWidget(3, QFormLayout.FieldRole, self.waifu2xDir)
self.gridLayout.addWidget(self.waifu2xDir, 3, 1, 1, 1)
self.verticalLayout.addLayout(self.formLayout)
self.verticalLayout.addLayout(self.gridLayout)
self.saveDir = QPushButton(DownloadDir)
self.saveDir.setObjectName(u"saveDir")

View File

@ -25,14 +25,14 @@ class Ui_Favorite(object):
def setupUi(self, Favorite):
if not Favorite.objectName():
Favorite.setObjectName(u"Favorite")
Favorite.resize(628, 335)
Favorite.resize(628, 334)
self.gridLayout_2 = QGridLayout(Favorite)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.bookList = ComicListWidget(Favorite)
self.bookList.setObjectName(u"bookList")
self.bookList.setStyleSheet(u"QListWidget {background-color:transparent;}")
self.bookList.setStyleSheet(u"")
self.gridLayout_3.addWidget(self.bookList, 0, 0, 1, 1)
@ -48,6 +48,36 @@ class Ui_Favorite(object):
self.horizontalLayout.addWidget(self.msgLabel)
self.sortKeyCombox = QComboBox(Favorite)
self.sortKeyCombox.addItem("")
self.sortKeyCombox.addItem("")
self.sortKeyCombox.addItem("")
self.sortKeyCombox.addItem("")
self.sortKeyCombox.addItem("")
self.sortKeyCombox.addItem("")
self.sortKeyCombox.setObjectName(u"sortKeyCombox")
self.sortKeyCombox.setEnabled(True)
self.sortKeyCombox.setMinimumSize(QSize(100, 0))
self.horizontalLayout.addWidget(self.sortKeyCombox)
self.sortIdCombox = QComboBox(Favorite)
self.sortIdCombox.addItem("")
self.sortIdCombox.addItem("")
self.sortIdCombox.setObjectName(u"sortIdCombox")
self.sortIdCombox.setEnabled(True)
self.horizontalLayout.addWidget(self.sortIdCombox)
self.sortCombox = QComboBox(Favorite)
self.sortCombox.addItem("")
self.sortCombox.addItem("")
self.sortCombox.addItem("")
self.sortCombox.addItem("")
self.sortCombox.setObjectName(u"sortCombox")
self.horizontalLayout.addWidget(self.sortCombox)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout.addItem(self.horizontalSpacer)
@ -77,27 +107,6 @@ class Ui_Favorite(object):
self.horizontalLayout.addWidget(self.line)
self.comboBox = QComboBox(Favorite)
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.setObjectName(u"comboBox")
self.comboBox.setMinimumSize(QSize(75, 30))
self.horizontalLayout.addWidget(self.comboBox)
self.comboBox_2 = QComboBox(Favorite)
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.comboBox_2.setObjectName(u"comboBox_2")
self.comboBox_2.setMinimumSize(QSize(40, 30))
self.horizontalLayout.addWidget(self.comboBox_2)
self.line_4 = QFrame(Favorite)
self.line_4.setObjectName(u"line_4")
self.line_4.setFrameShape(QFrame.VLine)
@ -135,8 +144,6 @@ class Ui_Favorite(object):
self.retranslateUi(Favorite)
self.jumpButton.clicked.connect(Favorite.JumpPage)
self.comboBox.currentIndexChanged.connect(Favorite.RefreshDataFocus)
self.comboBox_2.currentIndexChanged.connect(Favorite.RefreshDataFocus)
QMetaObject.connectSlotsByName(Favorite)
# setupUi
@ -144,19 +151,23 @@ class Ui_Favorite(object):
def retranslateUi(self, Favorite):
Favorite.setWindowTitle(QCoreApplication.translate("Favorite", u"\u6536\u85cf", None))
self.msgLabel.setText("")
self.sortKeyCombox.setItemText(0, QCoreApplication.translate("Favorite", u"\u66f4\u65b0\u65f6\u95f4", None))
self.sortKeyCombox.setItemText(1, QCoreApplication.translate("Favorite", u"\u521b\u5efa\u65f6\u95f4", None))
self.sortKeyCombox.setItemText(2, QCoreApplication.translate("Favorite", u"\u7231\u5fc3\u6570", None))
self.sortKeyCombox.setItemText(3, QCoreApplication.translate("Favorite", u"\u89c2\u770b\u6570", None))
self.sortKeyCombox.setItemText(4, QCoreApplication.translate("Favorite", u"\u7ae0\u8282\u6570", None))
self.sortKeyCombox.setItemText(5, QCoreApplication.translate("Favorite", u"\u56fe\u7247\u6570", None))
self.sortIdCombox.setItemText(0, QCoreApplication.translate("Favorite", u"\u964d\u5e8f", None))
self.sortIdCombox.setItemText(1, QCoreApplication.translate("Favorite", u"\u5347\u5e8f", None))
self.sortCombox.setItemText(0, QCoreApplication.translate("Favorite", u"\u65b0\u5230\u65e7", None))
self.sortCombox.setItemText(1, QCoreApplication.translate("Favorite", u"\u65e7\u5230\u65b0", None))
self.sortCombox.setItemText(2, QCoreApplication.translate("Favorite", u"\u6700\u591a\u7231\u5fc3", None))
self.sortCombox.setItemText(3, QCoreApplication.translate("Favorite", u"\u6700\u591a\u7ec5\u58eb\u6307\u6570", None))
self.nums.setText(QCoreApplication.translate("Favorite", u"\u6536\u85cf\u6570\uff1a", None))
self.pages.setText(QCoreApplication.translate("Favorite", u"\u9875", None))
self.comboBox.setItemText(0, QCoreApplication.translate("Favorite", u"\u66f4\u65b0\u65f6\u95f4", None))
self.comboBox.setItemText(1, QCoreApplication.translate("Favorite", u"\u6536\u85cf\u65f6\u95f4", None))
self.comboBox.setItemText(2, QCoreApplication.translate("Favorite", u"\u521b\u5efa\u65f6\u95f4", None))
self.comboBox.setItemText(3, QCoreApplication.translate("Favorite", u"\u7231\u5fc3\u6570", None))
self.comboBox.setItemText(4, QCoreApplication.translate("Favorite", u"\u7ae0\u8282\u6570", None))
self.comboBox.setItemText(5, QCoreApplication.translate("Favorite", u"\u7ae0\u8282\u6570", None))
self.comboBox.setItemText(6, QCoreApplication.translate("Favorite", u"\u56fe\u7247\u6570", None))
self.comboBox_2.setItemText(0, QCoreApplication.translate("Favorite", u"\u964d\u5e8f", None))
self.comboBox_2.setItemText(1, QCoreApplication.translate("Favorite", u"\u5347\u5e8f", None))
self.jumpButton.setText(QCoreApplication.translate("Favorite", u"\u8df3\u8f6c", None))
#if QT_CONFIG(shortcut)
self.jumpButton.setShortcut(QCoreApplication.translate("Favorite", u"Return", None))

View File

@ -15,7 +15,7 @@ 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, QFormLayout, QHBoxLayout, QLabel,
from PySide6.QtWidgets import (QApplication, QGridLayout, QHBoxLayout, QLabel,
QPushButton, QSizePolicy, QSpacerItem, QVBoxLayout,
QWidget)
import images_rc
@ -24,7 +24,9 @@ class Ui_Help(object):
def setupUi(self, Help):
if not Help.objectName():
Help.setObjectName(u"Help")
Help.resize(426, 516)
Help.resize(545, 582)
Help.setStyleSheet(u"QListWidget {background-color:transparent;}\n"
"QScrollArea {background-color:transparent;}")
self.verticalLayout = QVBoxLayout(Help)
self.verticalLayout.setObjectName(u"verticalLayout")
self.horizontalLayout = QHBoxLayout()
@ -49,11 +51,15 @@ class Ui_Help(object):
self.label_2 = QLabel(self.widget)
self.label_2.setObjectName(u"label_2")
font = QFont()
font.setPointSize(12)
self.label_2.setFont(font)
self.verticalLayout_2.addWidget(self.label_2, 0, Qt.AlignHCenter)
self.label_3 = QLabel(self.widget)
self.label_3.setObjectName(u"label_3")
self.label_3.setFont(font)
self.verticalLayout_2.addWidget(self.label_3, 0, Qt.AlignHCenter)
@ -64,57 +70,92 @@ class Ui_Help(object):
self.widget_2 = QWidget(self.widget)
self.widget_2.setObjectName(u"widget_2")
self.formLayout = QFormLayout(self.widget_2)
self.formLayout.setObjectName(u"formLayout")
self.label_4 = QLabel(self.widget_2)
self.label_4.setObjectName(u"label_4")
self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label_4)
self.version = QLabel(self.widget_2)
self.version.setObjectName(u"version")
self.formLayout.setWidget(0, QFormLayout.FieldRole, self.version)
self.label_6 = QLabel(self.widget_2)
self.label_6.setObjectName(u"label_6")
self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_6)
self.waifu2x = QLabel(self.widget_2)
self.waifu2x.setObjectName(u"waifu2x")
self.formLayout.setWidget(1, QFormLayout.FieldRole, self.waifu2x)
self.label_8 = QLabel(self.widget_2)
self.label_8.setObjectName(u"label_8")
self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_8)
self.local = QLabel(self.widget_2)
self.local.setObjectName(u"local")
self.formLayout.setWidget(2, QFormLayout.FieldRole, self.local)
self.gridLayout = QGridLayout(self.widget_2)
self.gridLayout.setObjectName(u"gridLayout")
self.label_5 = QLabel(self.widget_2)
self.label_5.setObjectName(u"label_5")
self.label_5.setMinimumSize(QSize(80, 50))
self.label_5.setFont(font)
self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_5)
self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
self.localNum = QLabel(self.widget_2)
self.localNum.setObjectName(u"localNum")
self.verCheck = QPushButton(self.widget_2)
self.verCheck.setObjectName(u"verCheck")
self.formLayout.setWidget(3, QFormLayout.FieldRole, self.localNum)
self.label_7 = QLabel(self.widget_2)
self.label_7.setObjectName(u"label_7")
self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_7)
self.gridLayout.addWidget(self.verCheck, 1, 2, 1, 1)
self.logButton = QPushButton(self.widget_2)
self.logButton.setObjectName(u"logButton")
self.formLayout.setWidget(4, QFormLayout.FieldRole, self.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.label_4 = QLabel(self.widget_2)
self.label_4.setObjectName(u"label_4")
self.label_4.setMinimumSize(QSize(80, 50))
self.label_4.setFont(font)
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.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.label_6 = QLabel(self.widget_2)
self.label_6.setObjectName(u"label_6")
self.label_6.setMinimumSize(QSize(80, 50))
self.label_6.setFont(font)
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.label_10 = QLabel(self.widget_2)
self.label_10.setObjectName(u"label_10")
self.label_10.setFont(font)
self.gridLayout.addWidget(self.label_10, 1, 1, 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.verticalLayout_2.addWidget(self.widget_2)
@ -140,20 +181,24 @@ class Ui_Help(object):
# setupUi
def retranslateUi(self, Help):
Help.setWindowTitle(QCoreApplication.translate("Help", u"Form", None))
Help.setWindowTitle(QCoreApplication.translate("Help", u"\u5e2e\u52a9", None))
self.label.setText("")
self.label_2.setText(QCoreApplication.translate("Help", u"\u9700\u8981\u53cd\u9988\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u7684\u95ee\u9898\uff1f", None))
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.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.label_10.setText(QCoreApplication.translate("Help", u"2021-11-27", None))
self.waifu2x.setText(QCoreApplication.translate("Help", u"v1.0.8", None))
self.label_8.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u5e93\u7248\u672c:", None))
self.local.setText("")
self.label_5.setText(QCoreApplication.translate("Help", u"\u672c\u5730\u5e93\u6570\u91cf:", None))
self.localNum.setText("")
self.label_7.setText(QCoreApplication.translate("Help", u"\u65e5\u5fd7:", None))
self.logButton.setText(QCoreApplication.translate("Help", u"\u6253\u5f00\u65e5\u5fd7\u76ee\u5f55", None))
# retranslateUi

View File

@ -26,7 +26,6 @@ class Ui_Index(object):
if not Index.objectName():
Index.setObjectName(u"Index")
Index.resize(400, 300)
Index.setStyleSheet(u"")
self.verticalLayout_2 = QVBoxLayout(Index)
self.verticalLayout_2.setSpacing(0)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")

View File

@ -29,7 +29,6 @@ class Ui_Login(object):
Login.resize(350, 305)
Login.setMinimumSize(QSize(350, 0))
Login.setMaximumSize(QSize(500, 16777215))
Login.setStyleSheet(u"")
self.verticalLayout_2 = QVBoxLayout(Login)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.verticalLayout_2.setContentsMargins(6, 6, 6, 6)
@ -60,13 +59,6 @@ class Ui_Login(object):
self.horizontalLayout_3.addWidget(self.loginButton)
self.closeButton = QPushButton(Login)
self.closeButton.setObjectName(u"closeButton")
self.closeButton.setMaximumSize(QSize(150, 30))
self.closeButton.setStyleSheet(u"")
self.horizontalLayout_3.addWidget(self.closeButton)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
@ -87,10 +79,6 @@ class Ui_Login(object):
self.loginButton.setText(QCoreApplication.translate("Login", u"\u786e\u5b9a", None))
#if QT_CONFIG(shortcut)
self.loginButton.setShortcut(QCoreApplication.translate("Login", u"Return", None))
#endif // QT_CONFIG(shortcut)
self.closeButton.setText(QCoreApplication.translate("Login", u"\u53d6\u6d88", None))
#if QT_CONFIG(shortcut)
self.closeButton.setShortcut(QCoreApplication.translate("Login", u"Esc", None))
#endif // QT_CONFIG(shortcut)
# retranslateUi

View File

@ -171,7 +171,7 @@ class Ui_MainWindow(object):
# setupUi
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"PicACG", None))
self.menuButton.setText(QCoreApplication.translate("MainWindow", u"\u83dc\u5355", None))
self.label.setText(QCoreApplication.translate("MainWindow", u">", None))
# retranslateUi

View File

@ -16,8 +16,8 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QButtonGroup, QFrame, QHBoxLayout,
QLabel, QPushButton, QSizePolicy, QToolButton,
QVBoxLayout, QWidget)
QLabel, QPushButton, QSizePolicy, QSpacerItem,
QToolButton, QVBoxLayout, QWidget)
from component.label.head_label import HeadLabel
from component.scroll_area.smooth_scroll_area import SmoothScrollArea
@ -46,6 +46,17 @@ class Ui_Navigation(object):
self.verticalLayout.addWidget(self.picLabel, 0, Qt.AlignHCenter)
self.pushButton = QPushButton(self.widget)
self.pushButton.setObjectName(u"pushButton")
sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
self.pushButton.setSizePolicy(sizePolicy)
self.pushButton.setFocusPolicy(Qt.NoFocus)
self.verticalLayout.addWidget(self.pushButton, 0, Qt.AlignHCenter)
self.nameLabel = QLabel(self.widget)
self.nameLabel.setObjectName(u"nameLabel")
@ -53,6 +64,7 @@ class Ui_Navigation(object):
self.titleLabel = QLabel(self.widget)
self.titleLabel.setObjectName(u"titleLabel")
self.titleLabel.setMinimumSize(QSize(150, 0))
self.verticalLayout.addWidget(self.titleLabel)
@ -71,17 +83,19 @@ class Ui_Navigation(object):
self.verticalLayout.addLayout(self.horizontalLayout)
self.pushButton = QPushButton(self.widget)
self.pushButton.setObjectName(u"pushButton")
self.line_4 = QFrame(self.widget)
self.line_4.setObjectName(u"line_4")
self.line_4.setFrameShape(QFrame.HLine)
self.line_4.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.pushButton)
self.verticalLayout.addWidget(self.line_4)
self.scrollArea = SmoothScrollArea(self.widget)
self.scrollArea.setObjectName(u"scrollArea")
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 230, 602))
self.scrollAreaWidgetContents.setGeometry(QRect(0, -460, 211, 608))
self.verticalLayout_3 = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_3.setSpacing(6)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
@ -96,7 +110,13 @@ class Ui_Navigation(object):
self.buttonGroup.setObjectName(u"buttonGroup")
self.buttonGroup.addButton(self.collectButton)
self.collectButton.setObjectName(u"collectButton")
self.collectButton.setMinimumSize(QSize(230, 40))
sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.collectButton.sizePolicy().hasHeightForWidth())
self.collectButton.setSizePolicy(sizePolicy1)
self.collectButton.setMinimumSize(QSize(150, 40))
self.collectButton.setFocusPolicy(Qt.NoFocus)
icon = QIcon()
icon.addFile(u":/images/menu/Contact.png", QSize(), QIcon.Normal, QIcon.Off)
self.collectButton.setIcon(icon)
@ -109,7 +129,10 @@ class Ui_Navigation(object):
self.myCommentButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.myCommentButton)
self.myCommentButton.setObjectName(u"myCommentButton")
self.myCommentButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.myCommentButton.sizePolicy().hasHeightForWidth())
self.myCommentButton.setSizePolicy(sizePolicy1)
self.myCommentButton.setMinimumSize(QSize(150, 40))
self.myCommentButton.setFocusPolicy(Qt.NoFocus)
self.myCommentButton.setIcon(icon)
self.myCommentButton.setIconSize(QSize(32, 32))
self.myCommentButton.setCheckable(True)
@ -120,7 +143,10 @@ class Ui_Navigation(object):
self.lookButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.lookButton)
self.lookButton.setObjectName(u"lookButton")
self.lookButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.lookButton.sizePolicy().hasHeightForWidth())
self.lookButton.setSizePolicy(sizePolicy1)
self.lookButton.setMinimumSize(QSize(150, 40))
self.lookButton.setFocusPolicy(Qt.NoFocus)
self.lookButton.setIcon(icon)
self.lookButton.setIconSize(QSize(32, 32))
self.lookButton.setCheckable(True)
@ -143,7 +169,10 @@ class Ui_Navigation(object):
self.indexButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.indexButton)
self.indexButton.setObjectName(u"indexButton")
self.indexButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.indexButton.sizePolicy().hasHeightForWidth())
self.indexButton.setSizePolicy(sizePolicy1)
self.indexButton.setMinimumSize(QSize(150, 40))
self.indexButton.setFocusPolicy(Qt.NoFocus)
self.indexButton.setIcon(icon)
self.indexButton.setIconSize(QSize(32, 32))
self.indexButton.setCheckable(True)
@ -157,7 +186,10 @@ class Ui_Navigation(object):
self.searchButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.searchButton)
self.searchButton.setObjectName(u"searchButton")
self.searchButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.searchButton.sizePolicy().hasHeightForWidth())
self.searchButton.setSizePolicy(sizePolicy1)
self.searchButton.setMinimumSize(QSize(150, 40))
self.searchButton.setFocusPolicy(Qt.NoFocus)
self.searchButton.setIcon(icon)
self.searchButton.setIconSize(QSize(32, 32))
self.searchButton.setCheckable(True)
@ -170,7 +202,10 @@ class Ui_Navigation(object):
self.msgButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.msgButton)
self.msgButton.setObjectName(u"msgButton")
self.msgButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.msgButton.sizePolicy().hasHeightForWidth())
self.msgButton.setSizePolicy(sizePolicy1)
self.msgButton.setMinimumSize(QSize(150, 40))
self.msgButton.setFocusPolicy(Qt.NoFocus)
self.msgButton.setIcon(icon)
self.msgButton.setIconSize(QSize(32, 32))
self.msgButton.setCheckable(True)
@ -183,7 +218,10 @@ class Ui_Navigation(object):
self.categoryButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.categoryButton)
self.categoryButton.setObjectName(u"categoryButton")
self.categoryButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.categoryButton.sizePolicy().hasHeightForWidth())
self.categoryButton.setSizePolicy(sizePolicy1)
self.categoryButton.setMinimumSize(QSize(150, 40))
self.categoryButton.setFocusPolicy(Qt.NoFocus)
self.categoryButton.setIcon(icon)
self.categoryButton.setIconSize(QSize(32, 32))
self.categoryButton.setCheckable(True)
@ -194,7 +232,10 @@ class Ui_Navigation(object):
self.rankButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.rankButton)
self.rankButton.setObjectName(u"rankButton")
self.rankButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.rankButton.sizePolicy().hasHeightForWidth())
self.rankButton.setSizePolicy(sizePolicy1)
self.rankButton.setMinimumSize(QSize(150, 40))
self.rankButton.setFocusPolicy(Qt.NoFocus)
self.rankButton.setIcon(icon)
self.rankButton.setIconSize(QSize(32, 32))
self.rankButton.setCheckable(True)
@ -205,7 +246,10 @@ class Ui_Navigation(object):
self.chatButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.chatButton)
self.chatButton.setObjectName(u"chatButton")
self.chatButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.chatButton.sizePolicy().hasHeightForWidth())
self.chatButton.setSizePolicy(sizePolicy1)
self.chatButton.setMinimumSize(QSize(150, 40))
self.chatButton.setFocusPolicy(Qt.NoFocus)
self.chatButton.setIcon(icon)
self.chatButton.setIconSize(QSize(32, 32))
self.chatButton.setCheckable(True)
@ -216,7 +260,10 @@ class Ui_Navigation(object):
self.gameButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.gameButton)
self.gameButton.setObjectName(u"gameButton")
self.gameButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.gameButton.sizePolicy().hasHeightForWidth())
self.gameButton.setSizePolicy(sizePolicy1)
self.gameButton.setMinimumSize(QSize(150, 40))
self.gameButton.setFocusPolicy(Qt.NoFocus)
self.gameButton.setIcon(icon)
self.gameButton.setIconSize(QSize(32, 32))
self.gameButton.setCheckable(True)
@ -239,7 +286,10 @@ class Ui_Navigation(object):
self.downloadButton = QToolButton(self.scrollAreaWidgetContents)
self.buttonGroup.addButton(self.downloadButton)
self.downloadButton.setObjectName(u"downloadButton")
self.downloadButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.downloadButton.sizePolicy().hasHeightForWidth())
self.downloadButton.setSizePolicy(sizePolicy1)
self.downloadButton.setMinimumSize(QSize(150, 40))
self.downloadButton.setFocusPolicy(Qt.NoFocus)
self.downloadButton.setIcon(icon)
self.downloadButton.setIconSize(QSize(32, 32))
self.downloadButton.setCheckable(True)
@ -247,6 +297,10 @@ class Ui_Navigation(object):
self.verticalLayout_3.addWidget(self.downloadButton)
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.verticalLayout_3.addItem(self.verticalSpacer)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout.addWidget(self.scrollArea)
@ -261,7 +315,10 @@ class Ui_Navigation(object):
self.helpButton = QToolButton(self.widget)
self.buttonGroup.addButton(self.helpButton)
self.helpButton.setObjectName(u"helpButton")
self.helpButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.helpButton.sizePolicy().hasHeightForWidth())
self.helpButton.setSizePolicy(sizePolicy1)
self.helpButton.setMinimumSize(QSize(0, 40))
self.helpButton.setFocusPolicy(Qt.NoFocus)
self.helpButton.setIcon(icon)
self.helpButton.setIconSize(QSize(32, 32))
self.helpButton.setCheckable(True)
@ -272,7 +329,10 @@ class Ui_Navigation(object):
self.settingButton = QToolButton(self.widget)
self.buttonGroup.addButton(self.settingButton)
self.settingButton.setObjectName(u"settingButton")
self.settingButton.setMinimumSize(QSize(230, 40))
sizePolicy1.setHeightForWidth(self.settingButton.sizePolicy().hasHeightForWidth())
self.settingButton.setSizePolicy(sizePolicy1)
self.settingButton.setMinimumSize(QSize(150, 40))
self.settingButton.setFocusPolicy(Qt.NoFocus)
self.settingButton.setStyleSheet(u"")
self.settingButton.setIcon(icon)
self.settingButton.setIconSize(QSize(32, 32))
@ -294,11 +354,11 @@ class Ui_Navigation(object):
def retranslateUi(self, Navigation):
Navigation.setWindowTitle(QCoreApplication.translate("Navigation", u"\u5bfc\u822a", None))
self.picLabel.setText("")
self.pushButton.setText(QCoreApplication.translate("Navigation", u"\u767b\u5f55", None))
self.nameLabel.setText("")
self.titleLabel.setText("")
self.expLabel.setText("")
self.levelLabel.setText("")
self.pushButton.setText(QCoreApplication.translate("Navigation", u"\u767b\u5f55", None))
self.label.setText(QCoreApplication.translate("Navigation", u"\u7528\u6237", None))
self.collectButton.setText(QCoreApplication.translate("Navigation", u"\u6211\u7684\u6536\u85cf", None))
self.myCommentButton.setText(QCoreApplication.translate("Navigation", u"\u6211\u7684\u8bc4\u8bba", None))

View File

@ -15,75 +15,84 @@ 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, QCheckBox, QComboBox, QDoubleSpinBox,
QFrame, QGridLayout, QHBoxLayout, QLabel,
QLayout, QPushButton, QSizePolicy, QSlider,
QSpinBox, QVBoxLayout, QWidget)
from PySide6.QtWidgets import (QApplication, QCheckBox, QFrame, QGridLayout,
QHBoxLayout, QLabel, QLayout, QPushButton,
QSizePolicy, QSpacerItem, QVBoxLayout, QWidget)
from component.box.wheel_combo_box import WheelComboBox
from component.box.wheel_double_spin_box import WheelDoubleSpinBox
from component.box.wheel_slider import WheelSlider
from component.box.wheel_spin_box import WheelSpinBox
from component.scroll_area.smooth_scroll_area import SmoothScrollArea
class Ui_ReadImg(object):
def setupUi(self, ReadImg):
if not ReadImg.objectName():
ReadImg.setObjectName(u"ReadImg")
ReadImg.resize(314, 825)
ReadImg.resize(328, 825)
ReadImg.setAutoFillBackground(False)
ReadImg.setStyleSheet(u"")
self.gridLayout_2 = QGridLayout(ReadImg)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout_2.setContentsMargins(4, 4, 4, 4)
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setSpacing(6)
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.horizontalLayout_2.setContentsMargins(4, 4, 4, 4)
self.scrollArea22 = SmoothScrollArea(ReadImg)
self.scrollArea22.setObjectName(u"scrollArea22")
self.scrollArea22.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 318, 815))
self.verticalLayout_2 = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.verticalLayout = QVBoxLayout()
self.verticalLayout.setSpacing(6)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setSizeConstraint(QLayout.SetDefaultConstraint)
self.verticalLayout.setContentsMargins(4, 4, 4, 4)
self.line_6 = QFrame(ReadImg)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.line_6 = QFrame(self.scrollAreaWidgetContents)
self.line_6.setObjectName(u"line_6")
self.line_6.setFrameShape(QFrame.HLine)
self.line_6.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.line_6)
self.label_4 = QLabel(ReadImg)
self.label_4 = QLabel(self.scrollAreaWidgetContents)
self.label_4.setObjectName(u"label_4")
self.label_4.setStyleSheet(u"color: #ee2a24")
self.label_4.setAlignment(Qt.AlignCenter)
self.verticalLayout.addWidget(self.label_4)
self.resolutionLabel = QLabel(ReadImg)
self.resolutionLabel = QLabel(self.scrollAreaWidgetContents)
self.resolutionLabel.setObjectName(u"resolutionLabel")
self.resolutionLabel.setStyleSheet(u"")
self.verticalLayout.addWidget(self.resolutionLabel)
self.sizeLabel = QLabel(ReadImg)
self.sizeLabel = QLabel(self.scrollAreaWidgetContents)
self.sizeLabel.setObjectName(u"sizeLabel")
self.verticalLayout.addWidget(self.sizeLabel)
self.stateLable = QLabel(ReadImg)
self.stateLable = QLabel(self.scrollAreaWidgetContents)
self.stateLable.setObjectName(u"stateLable")
self.verticalLayout.addWidget(self.stateLable)
self.epsLabel = QLabel(ReadImg)
self.epsLabel = QLabel(self.scrollAreaWidgetContents)
self.epsLabel.setObjectName(u"epsLabel")
self.epsLabel.setMinimumSize(QSize(0, 20))
self.epsLabel.setMaximumSize(QSize(16777215, 20))
self.verticalLayout.addWidget(self.epsLabel)
self.line = QFrame(ReadImg)
self.line = QFrame(self.scrollAreaWidgetContents)
self.line.setObjectName(u"line")
self.line.setFrameShape(QFrame.HLine)
self.line.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.line)
self.label = QLabel(ReadImg)
self.label = QLabel(self.scrollAreaWidgetContents)
self.label.setObjectName(u"label")
self.label.setStyleSheet(u"color: #ee2a24")
self.label.setAlignment(Qt.AlignCenter)
@ -92,19 +101,19 @@ class Ui_ReadImg(object):
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.resolutionWaifu = QLabel(ReadImg)
self.resolutionWaifu = QLabel(self.scrollAreaWidgetContents)
self.resolutionWaifu.setObjectName(u"resolutionWaifu")
self.gridLayout.addWidget(self.resolutionWaifu, 5, 0, 1, 1)
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.noiseLabel = QLabel(ReadImg)
self.noiseLabel = QLabel(self.scrollAreaWidgetContents)
self.noiseLabel.setObjectName(u"noiseLabel")
self.horizontalLayout_3.addWidget(self.noiseLabel)
self.noiseBox = QComboBox(ReadImg)
self.noiseBox = WheelComboBox(self.scrollAreaWidgetContents)
self.noiseBox.addItem("")
self.noiseBox.addItem("")
self.noiseBox.addItem("")
@ -117,42 +126,42 @@ class Ui_ReadImg(object):
self.gridLayout.addLayout(self.horizontalLayout_3, 1, 1, 1, 1)
self.checkBox = QCheckBox(ReadImg)
self.checkBox = QCheckBox(self.scrollAreaWidgetContents)
self.checkBox.setObjectName(u"checkBox")
self.checkBox.setStyleSheet(u"")
self.checkBox.setChecked(True)
self.gridLayout.addWidget(self.checkBox, 0, 0, 1, 1)
self.sizeWaifu = QLabel(ReadImg)
self.sizeWaifu = QLabel(self.scrollAreaWidgetContents)
self.sizeWaifu.setObjectName(u"sizeWaifu")
self.gridLayout.addWidget(self.sizeWaifu, 6, 0, 1, 1)
self.label_8 = QLabel(ReadImg)
self.label_8 = QLabel(self.scrollAreaWidgetContents)
self.label_8.setObjectName(u"label_8")
self.label_8.setMaximumSize(QSize(35, 16777215))
self.gridLayout.addWidget(self.label_8, 3, 0, 1, 1)
self.label_3 = QLabel(ReadImg)
self.label_3 = QLabel(self.scrollAreaWidgetContents)
self.label_3.setObjectName(u"label_3")
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
self.stateWaifu = QLabel(ReadImg)
self.stateWaifu = QLabel(self.scrollAreaWidgetContents)
self.stateWaifu.setObjectName(u"stateWaifu")
self.gridLayout.addWidget(self.stateWaifu, 8, 0, 1, 1)
self.horizontalLayout_6 = QHBoxLayout()
self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
self.scaleLabel = QLabel(ReadImg)
self.scaleLabel = QLabel(self.scrollAreaWidgetContents)
self.scaleLabel.setObjectName(u"scaleLabel")
self.horizontalLayout_6.addWidget(self.scaleLabel)
self.scaleBox = QDoubleSpinBox(ReadImg)
self.scaleBox = WheelDoubleSpinBox(self.scrollAreaWidgetContents)
self.scaleBox.setObjectName(u"scaleBox")
self.scaleBox.setDecimals(1)
self.scaleBox.setMaximum(32.000000000000000)
@ -164,29 +173,29 @@ class Ui_ReadImg(object):
self.gridLayout.addLayout(self.horizontalLayout_6, 2, 1, 1, 1)
self.label_2 = QLabel(ReadImg)
self.label_2 = QLabel(self.scrollAreaWidgetContents)
self.label_2.setObjectName(u"label_2")
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
self.tickLabel = QLabel(ReadImg)
self.tickLabel = QLabel(self.scrollAreaWidgetContents)
self.tickLabel.setObjectName(u"tickLabel")
self.gridLayout.addWidget(self.tickLabel, 7, 0, 1, 1)
self.label_9 = QLabel(ReadImg)
self.label_9 = QLabel(self.scrollAreaWidgetContents)
self.label_9.setObjectName(u"label_9")
self.gridLayout.addWidget(self.label_9, 4, 0, 1, 1)
self.horizontalLayout_8 = QHBoxLayout()
self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
self.modelLabel = QLabel(ReadImg)
self.modelLabel = QLabel(self.scrollAreaWidgetContents)
self.modelLabel.setObjectName(u"modelLabel")
self.horizontalLayout_8.addWidget(self.modelLabel)
self.modelBox = QComboBox(ReadImg)
self.modelBox = WheelComboBox(self.scrollAreaWidgetContents)
self.modelBox.addItem("")
self.modelBox.addItem("")
self.modelBox.addItem("")
@ -198,39 +207,39 @@ class Ui_ReadImg(object):
self.gridLayout.addLayout(self.horizontalLayout_8, 3, 1, 1, 1)
self.gpuLabel = QLabel(ReadImg)
self.gpuLabel = QLabel(self.scrollAreaWidgetContents)
self.gpuLabel.setObjectName(u"gpuLabel")
self.gridLayout.addWidget(self.gpuLabel, 4, 1, 1, 1)
self.waifu2xRes = QLabel(ReadImg)
self.waifu2xRes = QLabel(self.scrollAreaWidgetContents)
self.waifu2xRes.setObjectName(u"waifu2xRes")
self.gridLayout.addWidget(self.waifu2xRes, 5, 1, 1, 1)
self.waifu2xSize = QLabel(ReadImg)
self.waifu2xSize = QLabel(self.scrollAreaWidgetContents)
self.waifu2xSize.setObjectName(u"waifu2xSize")
self.gridLayout.addWidget(self.waifu2xSize, 6, 1, 1, 1)
self.waifu2xTick = QLabel(ReadImg)
self.waifu2xTick = QLabel(self.scrollAreaWidgetContents)
self.waifu2xTick.setObjectName(u"waifu2xTick")
self.gridLayout.addWidget(self.waifu2xTick, 7, 1, 1, 1)
self.waifu2xStatus = QLabel(ReadImg)
self.waifu2xStatus = QLabel(self.scrollAreaWidgetContents)
self.waifu2xStatus.setObjectName(u"waifu2xStatus")
self.gridLayout.addWidget(self.waifu2xStatus, 8, 1, 1, 1)
self.horizontalLayout_9 = QHBoxLayout()
self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
self.waifu2xSave = QPushButton(ReadImg)
self.waifu2xSave = QPushButton(self.scrollAreaWidgetContents)
self.waifu2xSave.setObjectName(u"waifu2xSave")
self.horizontalLayout_9.addWidget(self.waifu2xSave)
self.waifu2xCancle = QPushButton(ReadImg)
self.waifu2xCancle = QPushButton(self.scrollAreaWidgetContents)
self.waifu2xCancle.setObjectName(u"waifu2xCancle")
self.horizontalLayout_9.addWidget(self.waifu2xCancle)
@ -241,14 +250,14 @@ class Ui_ReadImg(object):
self.verticalLayout.addLayout(self.gridLayout)
self.line_2 = QFrame(ReadImg)
self.line_2 = QFrame(self.scrollAreaWidgetContents)
self.line_2.setObjectName(u"line_2")
self.line_2.setFrameShape(QFrame.HLine)
self.line_2.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.line_2)
self.label_6 = QLabel(ReadImg)
self.label_6 = QLabel(self.scrollAreaWidgetContents)
self.label_6.setObjectName(u"label_6")
self.label_6.setStyleSheet(u"color: #ee2a24")
self.label_6.setAlignment(Qt.AlignCenter)
@ -257,7 +266,7 @@ class Ui_ReadImg(object):
self.horizontalLayout_11 = QHBoxLayout()
self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
self.label_5 = QLabel(ReadImg)
self.label_5 = QLabel(self.scrollAreaWidgetContents)
self.label_5.setObjectName(u"label_5")
self.label_5.setMaximumSize(QSize(90, 16777215))
self.label_5.setStyleSheet(u"")
@ -265,7 +274,7 @@ class Ui_ReadImg(object):
self.horizontalLayout_11.addWidget(self.label_5)
self.comboBox = QComboBox(ReadImg)
self.comboBox = WheelComboBox(self.scrollAreaWidgetContents)
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
@ -281,12 +290,12 @@ class Ui_ReadImg(object):
self.horizontalLayout_10 = QHBoxLayout()
self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
self.zoomLabel = QLabel(ReadImg)
self.zoomLabel = QLabel(self.scrollAreaWidgetContents)
self.zoomLabel.setObjectName(u"zoomLabel")
self.horizontalLayout_10.addWidget(self.zoomLabel)
self.zoomSlider = QSlider(ReadImg)
self.zoomSlider = WheelSlider(self.scrollAreaWidgetContents)
self.zoomSlider.setObjectName(u"zoomSlider")
self.zoomSlider.setStyleSheet(u"")
self.zoomSlider.setMinimum(10)
@ -300,14 +309,14 @@ class Ui_ReadImg(object):
self.verticalLayout.addLayout(self.horizontalLayout_10)
self.line_3 = QFrame(ReadImg)
self.line_3 = QFrame(self.scrollAreaWidgetContents)
self.line_3.setObjectName(u"line_3")
self.line_3.setFrameShape(QFrame.HLine)
self.line_3.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.line_3)
self.label_7 = QLabel(ReadImg)
self.label_7 = QLabel(self.scrollAreaWidgetContents)
self.label_7.setObjectName(u"label_7")
self.label_7.setStyleSheet(u"color: #ee2a24")
self.label_7.setAlignment(Qt.AlignCenter)
@ -316,13 +325,13 @@ class Ui_ReadImg(object):
self.horizontalLayout_12 = QHBoxLayout()
self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
self.label_10 = QLabel(ReadImg)
self.label_10 = QLabel(self.scrollAreaWidgetContents)
self.label_10.setObjectName(u"label_10")
self.label_10.setMaximumSize(QSize(90, 16777215))
self.horizontalLayout_12.addWidget(self.label_10)
self.scrollSpeed = QSpinBox(ReadImg)
self.scrollSpeed = WheelSpinBox(self.scrollAreaWidgetContents)
self.scrollSpeed.setObjectName(u"scrollSpeed")
self.scrollSpeed.setMinimum(1)
self.scrollSpeed.setMaximum(4000)
@ -335,13 +344,13 @@ class Ui_ReadImg(object):
self.horizontalLayout_13 = QHBoxLayout()
self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
self.label_11 = QLabel(ReadImg)
self.label_11 = QLabel(self.scrollAreaWidgetContents)
self.label_11.setObjectName(u"label_11")
self.label_11.setMaximumSize(QSize(90, 16777215))
self.horizontalLayout_13.addWidget(self.label_11)
self.turnSpeed = QDoubleSpinBox(ReadImg)
self.turnSpeed = WheelDoubleSpinBox(self.scrollAreaWidgetContents)
self.turnSpeed.setObjectName(u"turnSpeed")
self.turnSpeed.setMinimum(0.100000000000000)
self.turnSpeed.setSingleStep(0.100000000000000)
@ -352,31 +361,31 @@ class Ui_ReadImg(object):
self.verticalLayout.addLayout(self.horizontalLayout_13)
self.line_8 = QFrame(ReadImg)
self.line_8 = QFrame(self.scrollAreaWidgetContents)
self.line_8.setObjectName(u"line_8")
self.line_8.setFrameShape(QFrame.HLine)
self.line_8.setFrameShadow(QFrame.Sunken)
self.verticalLayout.addWidget(self.line_8)
self.pushButton_2 = QPushButton(ReadImg)
self.pushButton_2 = QPushButton(self.scrollAreaWidgetContents)
self.pushButton_2.setObjectName(u"pushButton_2")
self.verticalLayout.addWidget(self.pushButton_2)
self.fullButton = QPushButton(ReadImg)
self.fullButton = QPushButton(self.scrollAreaWidgetContents)
self.fullButton.setObjectName(u"fullButton")
self.verticalLayout.addWidget(self.fullButton)
self.returePage = QPushButton(ReadImg)
self.returePage = QPushButton(self.scrollAreaWidgetContents)
self.returePage.setObjectName(u"returePage")
self.returePage.setMinimumSize(QSize(0, 0))
self.returePage.setMaximumSize(QSize(16777215, 16777215))
self.verticalLayout.addWidget(self.returePage)
self.line_5 = QFrame(ReadImg)
self.line_5 = QFrame(self.scrollAreaWidgetContents)
self.line_5.setObjectName(u"line_5")
self.line_5.setFrameShape(QFrame.HLine)
self.line_5.setFrameShadow(QFrame.Sunken)
@ -390,12 +399,12 @@ class Ui_ReadImg(object):
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.pushButton_4 = QPushButton(ReadImg)
self.pushButton_4 = QPushButton(self.scrollAreaWidgetContents)
self.pushButton_4.setObjectName(u"pushButton_4")
self.horizontalLayout_5.addWidget(self.pushButton_4)
self.pushButton_5 = QPushButton(ReadImg)
self.pushButton_5 = QPushButton(self.scrollAreaWidgetContents)
self.pushButton_5.setObjectName(u"pushButton_5")
self.horizontalLayout_5.addWidget(self.pushButton_5)
@ -403,7 +412,7 @@ class Ui_ReadImg(object):
self.verticalLayout.addLayout(self.horizontalLayout_5)
self.line_7 = QFrame(ReadImg)
self.line_7 = QFrame(self.scrollAreaWidgetContents)
self.line_7.setObjectName(u"line_7")
self.line_7.setFrameShape(QFrame.HLine)
self.line_7.setFrameShadow(QFrame.Sunken)
@ -412,14 +421,14 @@ class Ui_ReadImg(object):
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.lastPage = QPushButton(ReadImg)
self.lastPage = QPushButton(self.scrollAreaWidgetContents)
self.lastPage.setObjectName(u"lastPage")
self.lastPage.setMinimumSize(QSize(0, 0))
self.lastPage.setMaximumSize(QSize(16777215, 16777215))
self.horizontalLayout.addWidget(self.lastPage)
self.nextPage = QPushButton(ReadImg)
self.nextPage = QPushButton(self.scrollAreaWidgetContents)
self.nextPage.setObjectName(u"nextPage")
self.nextPage.setMinimumSize(QSize(0, 0))
self.nextPage.setMaximumSize(QSize(16777215, 16777215))
@ -429,7 +438,11 @@ class Ui_ReadImg(object):
self.verticalLayout.addLayout(self.horizontalLayout)
self.line_4 = QFrame(ReadImg)
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.verticalLayout.addItem(self.verticalSpacer)
self.line_4 = QFrame(self.scrollAreaWidgetContents)
self.line_4.setObjectName(u"line_4")
self.line_4.setFrameShape(QFrame.HLine)
self.line_4.setFrameShadow(QFrame.Sunken)
@ -437,10 +450,11 @@ class Ui_ReadImg(object):
self.verticalLayout.addWidget(self.line_4)
self.horizontalLayout_2.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.scrollArea22.setWidget(self.scrollAreaWidgetContents)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
self.gridLayout_2.addWidget(self.scrollArea22, 0, 0, 1, 1)
self.retranslateUi(ReadImg)
@ -461,7 +475,7 @@ class Ui_ReadImg(object):
# setupUi
def retranslateUi(self, ReadImg):
ReadImg.setWindowTitle(QCoreApplication.translate("ReadImg", u"Form", None))
ReadImg.setWindowTitle(QCoreApplication.translate("ReadImg", u"\u5de5\u5177", None))
self.label_4.setText(QCoreApplication.translate("ReadImg", u"\u56fe\u7247\u4fe1\u606f", None))
self.resolutionLabel.setText(QCoreApplication.translate("ReadImg", u"\u5206\u8fa8\u7387\uff1a", None))
self.sizeLabel.setText(QCoreApplication.translate("ReadImg", u"\u5927\u5c0f\uff1a", None))

View File

@ -1,635 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'ui_setting.ui'
##
## Created by: Qt User Interface Compiler version 6.2.1
##
## 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, QButtonGroup, QCheckBox, QComboBox,
QFrame, QGridLayout, QHBoxLayout, QLabel,
QLineEdit, QPushButton, QRadioButton, QSizePolicy,
QToolButton, QVBoxLayout, QWidget)
from component.box.wheel_combo_box import WheelComboBox
from component.box.wheel_double_spin_box import WheelDoubleSpinBox
from component.box.wheel_spin_box import WheelSpinBox
from component.scroll_area.smooth_scroll_area import SmoothScrollArea
class Ui_Setting(object):
def setupUi(self, Setting):
if not Setting.objectName():
Setting.setObjectName(u"Setting")
Setting.resize(494, 649)
Setting.setMaximumSize(QSize(16777215, 16777215))
self.verticalLayout = QVBoxLayout(Setting)
self.verticalLayout.setObjectName(u"verticalLayout")
self.scrollArea = SmoothScrollArea(Setting)
self.scrollArea.setObjectName(u"scrollArea")
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 474, 629))
self.verticalLayout_2 = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.gridLayout_5 = QGridLayout()
self.gridLayout_5.setObjectName(u"gridLayout_5")
self.line_9 = QFrame(self.scrollAreaWidgetContents)
self.line_9.setObjectName(u"line_9")
self.line_9.setFrameShape(QFrame.VLine)
self.line_9.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_9, 0, 1, 1, 1)
self.label_update = QLabel(self.scrollAreaWidgetContents)
self.label_update.setObjectName(u"label_update")
self.label_update.setMaximumSize(QSize(16777215, 19))
self.gridLayout_5.addWidget(self.label_update, 2, 0, 1, 1)
self.encodeSelect = QComboBox(self.scrollAreaWidgetContents)
self.encodeSelect.setObjectName(u"encodeSelect")
self.gridLayout_5.addWidget(self.encodeSelect, 12, 2, 1, 1)
self.line_18 = QFrame(self.scrollAreaWidgetContents)
self.line_18.setObjectName(u"line_18")
self.line_18.setFrameShape(QFrame.VLine)
self.line_18.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_18, 12, 1, 1, 1)
self.line_8 = QFrame(self.scrollAreaWidgetContents)
self.line_8.setObjectName(u"line_8")
self.line_8.setFrameShape(QFrame.HLine)
self.line_8.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_8, 9, 2, 1, 1)
self.line_10 = QFrame(self.scrollAreaWidgetContents)
self.line_10.setObjectName(u"line_10")
self.line_10.setFrameShape(QFrame.VLine)
self.line_10.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_10, 2, 1, 1, 1)
self.checkBox = QCheckBox(self.scrollAreaWidgetContents)
self.checkBox.setObjectName(u"checkBox")
self.gridLayout_5.addWidget(self.checkBox, 10, 2, 1, 1)
self.label_2 = QLabel(self.scrollAreaWidgetContents)
self.label_2.setObjectName(u"label_2")
self.label_2.setMaximumSize(QSize(16777215, 26))
self.gridLayout_5.addWidget(self.label_2, 5, 0, 1, 1)
self.langSelect = WheelComboBox(self.scrollAreaWidgetContents)
self.langSelect.addItem("")
self.langSelect.addItem("")
self.langSelect.addItem("")
self.langSelect.setObjectName(u"langSelect")
self.gridLayout_5.addWidget(self.langSelect, 3, 2, 1, 1)
self.label_6 = QLabel(self.scrollAreaWidgetContents)
self.label_6.setObjectName(u"label_6")
self.label_6.setMaximumSize(QSize(16777215, 19))
self.gridLayout_5.addWidget(self.label_6, 10, 0, 1, 1)
self.line_14 = QFrame(self.scrollAreaWidgetContents)
self.line_14.setObjectName(u"line_14")
self.line_14.setFrameShape(QFrame.VLine)
self.line_14.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_14, 7, 1, 1, 1)
self.chatProxy = QCheckBox(self.scrollAreaWidgetContents)
self.chatProxy.setObjectName(u"chatProxy")
self.chatProxy.setChecked(False)
self.gridLayout_5.addWidget(self.chatProxy, 6, 2, 1, 1)
self.line_20 = QFrame(self.scrollAreaWidgetContents)
self.line_20.setObjectName(u"line_20")
self.line_20.setFrameShape(QFrame.VLine)
self.line_20.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_20, 16, 1, 1, 1)
self.line_17 = QFrame(self.scrollAreaWidgetContents)
self.line_17.setObjectName(u"line_17")
self.line_17.setFrameShape(QFrame.VLine)
self.line_17.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_17, 11, 1, 1, 1)
self.line = QFrame(self.scrollAreaWidgetContents)
self.line.setObjectName(u"line")
self.line.setFrameShape(QFrame.HLine)
self.line.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line, 15, 0, 1, 1)
self.label = QLabel(self.scrollAreaWidgetContents)
self.label.setObjectName(u"label")
self.label.setMaximumSize(QSize(16777215, 21))
self.label.setFrameShape(QFrame.NoFrame)
self.gridLayout_5.addWidget(self.label, 4, 0, 1, 1)
self.comboBox = WheelComboBox(self.scrollAreaWidgetContents)
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.setObjectName(u"comboBox")
self.gridLayout_5.addWidget(self.comboBox, 4, 2, 1, 1)
self.line_19 = QFrame(self.scrollAreaWidgetContents)
self.line_19.setObjectName(u"line_19")
self.line_19.setFrameShape(QFrame.VLine)
self.line_19.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_19, 14, 1, 1, 1)
self.gridLayout_3 = QGridLayout()
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.line_4 = QFrame(self.scrollAreaWidgetContents)
self.line_4.setObjectName(u"line_4")
self.line_4.setFrameShape(QFrame.HLine)
self.line_4.setFrameShadow(QFrame.Sunken)
self.gridLayout_3.addWidget(self.line_4, 0, 0, 1, 1)
self.gridLayout_4 = QGridLayout()
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.readNoise = WheelComboBox(self.scrollAreaWidgetContents)
self.readNoise.addItem("")
self.readNoise.addItem("")
self.readNoise.addItem("")
self.readNoise.addItem("")
self.readNoise.addItem("")
self.readNoise.setObjectName(u"readNoise")
self.gridLayout_4.addWidget(self.readNoise, 0, 2, 1, 1)
self.label_13 = QLabel(self.scrollAreaWidgetContents)
self.label_13.setObjectName(u"label_13")
self.label_13.setMaximumSize(QSize(156, 16777215))
self.gridLayout_4.addWidget(self.label_13, 0, 0, 1, 1)
self.readModel = WheelComboBox(self.scrollAreaWidgetContents)
self.readModel.addItem("")
self.readModel.addItem("")
self.readModel.addItem("")
self.readModel.addItem("")
self.readModel.setObjectName(u"readModel")
self.gridLayout_4.addWidget(self.readModel, 1, 2, 1, 1)
self.label_15 = QLabel(self.scrollAreaWidgetContents)
self.label_15.setObjectName(u"label_15")
self.label_15.setMaximumSize(QSize(156, 16777215))
self.gridLayout_4.addWidget(self.label_15, 2, 0, 1, 1)
self.label_14 = QLabel(self.scrollAreaWidgetContents)
self.label_14.setObjectName(u"label_14")
self.label_14.setMaximumSize(QSize(156, 16777215))
self.gridLayout_4.addWidget(self.label_14, 1, 0, 1, 1)
self.readScale = WheelDoubleSpinBox(self.scrollAreaWidgetContents)
self.readScale.setObjectName(u"readScale")
self.readScale.setDecimals(1)
self.readScale.setMaximum(32.000000000000000)
self.readScale.setSingleStep(0.100000000000000)
self.readScale.setValue(2.000000000000000)
self.gridLayout_4.addWidget(self.readScale, 2, 2, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout_4, 1, 0, 1, 1)
self.gridLayout_5.addLayout(self.gridLayout_3, 13, 2, 2, 1)
self.line_12 = QFrame(self.scrollAreaWidgetContents)
self.line_12.setObjectName(u"line_12")
self.line_12.setFrameShape(QFrame.VLine)
self.line_12.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_12, 5, 1, 1, 1)
self.label_lang = QLabel(self.scrollAreaWidgetContents)
self.label_lang.setObjectName(u"label_lang")
self.gridLayout_5.addWidget(self.label_lang, 3, 0, 1, 1)
self.line_22 = QFrame(self.scrollAreaWidgetContents)
self.line_22.setObjectName(u"line_22")
self.line_22.setFrameShape(QFrame.VLine)
self.line_22.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_22, 3, 1, 1, 1)
self.label_7 = QLabel(self.scrollAreaWidgetContents)
self.label_7.setObjectName(u"label_7")
self.label_7.setMaximumSize(QSize(16777215, 24))
self.gridLayout_5.addWidget(self.label_7, 7, 0, 1, 1)
self.label_9 = QLabel(self.scrollAreaWidgetContents)
self.label_9.setObjectName(u"label_9")
self.label_9.setMaximumSize(QSize(16777215, 19))
self.gridLayout_5.addWidget(self.label_9, 6, 0, 1, 1)
self.preDownNum = WheelSpinBox(self.scrollAreaWidgetContents)
self.preDownNum.setObjectName(u"preDownNum")
self.preDownNum.setFocusPolicy(Qt.StrongFocus)
self.preDownNum.setMinimum(1)
self.preDownNum.setValue(10)
self.gridLayout_5.addWidget(self.preDownNum, 7, 2, 1, 1)
self.line_21 = QFrame(self.scrollAreaWidgetContents)
self.line_21.setObjectName(u"line_21")
self.line_21.setFrameShape(QFrame.VLine)
self.line_21.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_21, 18, 1, 1, 1)
self.gridLayout_2 = QGridLayout()
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.line_2 = QFrame(self.scrollAreaWidgetContents)
self.line_2.setObjectName(u"line_2")
self.line_2.setFrameShape(QFrame.HLine)
self.line_2.setFrameShadow(QFrame.Sunken)
self.gridLayout_2.addWidget(self.line_2, 0, 0, 1, 1)
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.label_17 = QLabel(self.scrollAreaWidgetContents)
self.label_17.setObjectName(u"label_17")
self.label_17.setMaximumSize(QSize(156, 16777215))
self.gridLayout.addWidget(self.label_17, 0, 0, 1, 1)
self.downModel = WheelComboBox(self.scrollAreaWidgetContents)
self.downModel.addItem("")
self.downModel.addItem("")
self.downModel.addItem("")
self.downModel.addItem("")
self.downModel.setObjectName(u"downModel")
self.gridLayout.addWidget(self.downModel, 1, 1, 1, 1)
self.label_19 = QLabel(self.scrollAreaWidgetContents)
self.label_19.setObjectName(u"label_19")
self.label_19.setMaximumSize(QSize(156, 16777215))
self.gridLayout.addWidget(self.label_19, 2, 0, 1, 1)
self.label_18 = QLabel(self.scrollAreaWidgetContents)
self.label_18.setObjectName(u"label_18")
self.label_18.setMaximumSize(QSize(156, 16777215))
self.gridLayout.addWidget(self.label_18, 1, 0, 1, 1)
self.downScale = WheelDoubleSpinBox(self.scrollAreaWidgetContents)
self.downScale.setObjectName(u"downScale")
self.downScale.setDecimals(1)
self.downScale.setMaximum(32.000000000000000)
self.downScale.setSingleStep(0.100000000000000)
self.downScale.setValue(2.000000000000000)
self.gridLayout.addWidget(self.downScale, 2, 1, 1, 1)
self.downNoise = WheelComboBox(self.scrollAreaWidgetContents)
self.downNoise.addItem("")
self.downNoise.addItem("")
self.downNoise.addItem("")
self.downNoise.addItem("")
self.downNoise.addItem("")
self.downNoise.setObjectName(u"downNoise")
self.gridLayout.addWidget(self.downNoise, 0, 1, 1, 1)
self.downAuto = QCheckBox(self.scrollAreaWidgetContents)
self.downAuto.setObjectName(u"downAuto")
self.downAuto.setChecked(True)
self.gridLayout.addWidget(self.downAuto, 3, 0, 1, 2)
self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1)
self.gridLayout_5.addLayout(self.gridLayout_2, 15, 2, 2, 1)
self.checkBox_IsUpdate = QCheckBox(self.scrollAreaWidgetContents)
self.checkBox_IsUpdate.setObjectName(u"checkBox_IsUpdate")
self.gridLayout_5.addWidget(self.checkBox_IsUpdate, 2, 2, 1, 1)
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.horizontalLayout_4 = QHBoxLayout()
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.saveEdit = QLineEdit(self.scrollAreaWidgetContents)
self.saveEdit.setObjectName(u"saveEdit")
self.horizontalLayout_4.addWidget(self.saveEdit)
self.pushButton = QPushButton(self.scrollAreaWidgetContents)
self.pushButton.setObjectName(u"pushButton")
self.horizontalLayout_4.addWidget(self.pushButton)
self.horizontalLayout_3.addLayout(self.horizontalLayout_4)
self.gridLayout_5.addLayout(self.horizontalLayout_3, 8, 2, 1, 1)
self.label_12 = QLabel(self.scrollAreaWidgetContents)
self.label_12.setObjectName(u"label_12")
self.label_12.setMaximumSize(QSize(16777215, 84))
self.gridLayout_5.addWidget(self.label_12, 14, 0, 1, 1)
self.label_3 = QLabel(self.scrollAreaWidgetContents)
self.label_3.setObjectName(u"label_3")
self.label_3.setMaximumSize(QSize(16777215, 21))
self.gridLayout_5.addWidget(self.label_3, 12, 0, 1, 1)
self.line_16 = QFrame(self.scrollAreaWidgetContents)
self.line_16.setObjectName(u"line_16")
self.line_16.setFrameShape(QFrame.VLine)
self.line_16.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_16, 10, 1, 1, 1)
self.label_8 = QLabel(self.scrollAreaWidgetContents)
self.label_8.setObjectName(u"label_8")
self.label_8.setMaximumSize(QSize(16777215, 21))
self.gridLayout_5.addWidget(self.label_8, 11, 0, 1, 1)
self.threadSelect = WheelComboBox(self.scrollAreaWidgetContents)
self.threadSelect.addItem("")
self.threadSelect.setObjectName(u"threadSelect")
self.threadSelect.setFocusPolicy(Qt.StrongFocus)
self.gridLayout_5.addWidget(self.threadSelect, 11, 2, 1, 1)
self.line_15 = QFrame(self.scrollAreaWidgetContents)
self.line_15.setObjectName(u"line_15")
self.line_15.setFrameShape(QFrame.VLine)
self.line_15.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_15, 8, 1, 1, 1)
self.line_6 = QFrame(self.scrollAreaWidgetContents)
self.line_6.setObjectName(u"line_6")
self.line_6.setFrameShape(QFrame.HLine)
self.line_6.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_6, 17, 2, 1, 1)
self.line_7 = QFrame(self.scrollAreaWidgetContents)
self.line_7.setObjectName(u"line_7")
self.line_7.setFrameShape(QFrame.HLine)
self.line_7.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_7, 9, 0, 1, 1)
self.label_5 = QLabel(self.scrollAreaWidgetContents)
self.label_5.setObjectName(u"label_5")
self.label_5.setMaximumSize(QSize(16777215, 32))
self.gridLayout_5.addWidget(self.label_5, 8, 0, 1, 1)
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.httpProxy = QCheckBox(self.scrollAreaWidgetContents)
self.httpProxy.setObjectName(u"httpProxy")
self.horizontalLayout_5.addWidget(self.httpProxy)
self.httpEdit = QLineEdit(self.scrollAreaWidgetContents)
self.httpEdit.setObjectName(u"httpEdit")
self.horizontalLayout_5.addWidget(self.httpEdit)
self.toolButton = QToolButton(self.scrollAreaWidgetContents)
self.toolButton.setObjectName(u"toolButton")
self.toolButton.setCheckable(False)
self.horizontalLayout_5.addWidget(self.toolButton)
self.gridLayout_5.addLayout(self.horizontalLayout_5, 5, 2, 1, 1)
self.line_11 = QFrame(self.scrollAreaWidgetContents)
self.line_11.setObjectName(u"line_11")
self.line_11.setFrameShape(QFrame.VLine)
self.line_11.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_11, 4, 1, 1, 1)
self.logBox = WheelComboBox(self.scrollAreaWidgetContents)
self.logBox.addItem("")
self.logBox.addItem("")
self.logBox.addItem("")
self.logBox.setObjectName(u"logBox")
self.logBox.setFocusPolicy(Qt.StrongFocus)
self.gridLayout_5.addWidget(self.logBox, 18, 2, 1, 1)
self.label_4 = QLabel(self.scrollAreaWidgetContents)
self.label_4.setObjectName(u"label_4")
self.label_4.setMaximumSize(QSize(16777215, 21))
self.gridLayout_5.addWidget(self.label_4, 0, 0, 1, 1)
self.line_3 = QFrame(self.scrollAreaWidgetContents)
self.line_3.setObjectName(u"line_3")
self.line_3.setFrameShape(QFrame.HLine)
self.line_3.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_3, 13, 0, 1, 1)
self.label_16 = QLabel(self.scrollAreaWidgetContents)
self.label_16.setObjectName(u"label_16")
self.label_16.setMaximumSize(QSize(16777215, 110))
self.gridLayout_5.addWidget(self.label_16, 16, 0, 1, 1)
self.label_10 = QLabel(self.scrollAreaWidgetContents)
self.label_10.setObjectName(u"label_10")
self.label_10.setMaximumSize(QSize(16777215, 21))
self.gridLayout_5.addWidget(self.label_10, 18, 0, 1, 1)
self.line_5 = QFrame(self.scrollAreaWidgetContents)
self.line_5.setObjectName(u"line_5")
self.line_5.setFrameShape(QFrame.HLine)
self.line_5.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_5, 17, 0, 1, 1)
self.line_13 = QFrame(self.scrollAreaWidgetContents)
self.line_13.setObjectName(u"line_13")
self.line_13.setFrameShape(QFrame.VLine)
self.line_13.setFrameShadow(QFrame.Sunken)
self.gridLayout_5.addWidget(self.line_13, 6, 1, 1, 1)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.themeButton2 = QRadioButton(self.scrollAreaWidgetContents)
self.themeGroup = QButtonGroup(Setting)
self.themeGroup.setObjectName(u"themeGroup")
self.themeGroup.addButton(self.themeButton2)
self.themeButton2.setObjectName(u"themeButton2")
self.horizontalLayout.addWidget(self.themeButton2)
self.themeButton1 = QRadioButton(self.scrollAreaWidgetContents)
self.themeGroup.addButton(self.themeButton1)
self.themeButton1.setObjectName(u"themeButton1")
self.horizontalLayout.addWidget(self.themeButton1)
self.themeButton0 = QRadioButton(self.scrollAreaWidgetContents)
self.themeGroup.addButton(self.themeButton0)
self.themeButton0.setObjectName(u"themeButton0")
self.themeButton0.setChecked(True)
self.horizontalLayout.addWidget(self.themeButton0)
self.gridLayout_5.addLayout(self.horizontalLayout, 0, 2, 1, 1)
self.verticalLayout_2.addLayout(self.gridLayout_5)
self.saveButton = QPushButton(self.scrollAreaWidgetContents)
self.saveButton.setObjectName(u"saveButton")
self.verticalLayout_2.addWidget(self.saveButton)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout.addWidget(self.scrollArea)
self.retranslateUi(Setting)
self.pushButton.clicked.connect(Setting.SelectSavePath)
self.saveButton.clicked.connect(Setting.SaveSetting)
QMetaObject.connectSlotsByName(Setting)
# setupUi
def retranslateUi(self, Setting):
Setting.setWindowTitle(QCoreApplication.translate("Setting", u"\u8bbe\u7f6e", None))
self.label_update.setText(QCoreApplication.translate("Setting", u"\u66f4\u65b0", None))
self.checkBox.setText(QCoreApplication.translate("Setting", u"\u662f\u5426\u542f\u7528", None))
self.label_2.setText(QCoreApplication.translate("Setting", u"http\u4ee3\u7406", None))
self.langSelect.setItemText(0, QCoreApplication.translate("Setting", u"Chinese-Simplified", None))
self.langSelect.setItemText(1, QCoreApplication.translate("Setting", u"Chinese-Traditional", None))
self.langSelect.setItemText(2, QCoreApplication.translate("Setting", u"English", None))
self.label_6.setText(QCoreApplication.translate("Setting", u"waifu2x\u8bbe\u7f6e", None))
self.chatProxy.setText(QCoreApplication.translate("Setting", u"\u542f\u7528\u4ee3\u7406", None))
self.label.setText(QCoreApplication.translate("Setting", u"\u4e0b\u8f7d\u7ebf\u7a0b\u6570", None))
self.comboBox.setItemText(0, QCoreApplication.translate("Setting", u"2", None))
self.comboBox.setItemText(1, QCoreApplication.translate("Setting", u"3", None))
self.comboBox.setItemText(2, QCoreApplication.translate("Setting", u"4", None))
self.comboBox.setItemText(3, QCoreApplication.translate("Setting", u"5", None))
self.comboBox.setItemText(4, QCoreApplication.translate("Setting", u"6", None))
self.comboBox.setPlaceholderText("")
self.readNoise.setItemText(0, QCoreApplication.translate("Setting", u"\u81ea\u52a8", None))
self.readNoise.setItemText(1, QCoreApplication.translate("Setting", u"0", None))
self.readNoise.setItemText(2, QCoreApplication.translate("Setting", u"1", None))
self.readNoise.setItemText(3, QCoreApplication.translate("Setting", u"2", None))
self.readNoise.setItemText(4, QCoreApplication.translate("Setting", u"3", None))
self.label_13.setText(QCoreApplication.translate("Setting", u"\u53bb\u566a\u7b49\u7ea7", None))
self.readModel.setItemText(0, QCoreApplication.translate("Setting", u"\u81ea\u52a8", None))
self.readModel.setItemText(1, QCoreApplication.translate("Setting", u"cunet", None))
self.readModel.setItemText(2, QCoreApplication.translate("Setting", u"photo", None))
self.readModel.setItemText(3, QCoreApplication.translate("Setting", u"anime_style_art_rgb", None))
self.label_15.setText(QCoreApplication.translate("Setting", u"\u653e\u5927\u500d\u6570", None))
self.label_14.setText(QCoreApplication.translate("Setting", u"\u6a21\u578b", None))
self.label_lang.setText(QCoreApplication.translate("Setting", u"\u8bed\u8a00", None))
self.label_7.setText(QCoreApplication.translate("Setting", u"\u770b\u56fe\u9884\u52a0\u8f7d\u6570", None))
self.label_9.setText(QCoreApplication.translate("Setting", u"\u804a\u5929\u5ba4", None))
self.label_17.setText(QCoreApplication.translate("Setting", u"\u53bb\u566a\u7b49\u7ea7", None))
self.downModel.setItemText(0, QCoreApplication.translate("Setting", u"\u81ea\u52a8", None))
self.downModel.setItemText(1, QCoreApplication.translate("Setting", u"cunet", None))
self.downModel.setItemText(2, QCoreApplication.translate("Setting", u"photo", None))
self.downModel.setItemText(3, QCoreApplication.translate("Setting", u"anime_style_art_rgb", None))
self.label_19.setText(QCoreApplication.translate("Setting", u"\u653e\u5927\u500d\u6570", None))
self.label_18.setText(QCoreApplication.translate("Setting", u"\u6a21\u578b", None))
self.downNoise.setItemText(0, QCoreApplication.translate("Setting", u"\u81ea\u52a8", None))
self.downNoise.setItemText(1, QCoreApplication.translate("Setting", u"0", None))
self.downNoise.setItemText(2, QCoreApplication.translate("Setting", u"1", None))
self.downNoise.setItemText(3, QCoreApplication.translate("Setting", u"2", None))
self.downNoise.setItemText(4, QCoreApplication.translate("Setting", u"3", None))
self.downAuto.setText(QCoreApplication.translate("Setting", u"\u4e0b\u8f7d\u5b8c\u540e\u81ea\u52a8\u8f6c\u6362", None))
self.checkBox_IsUpdate.setText(QCoreApplication.translate("Setting", u"\u542f\u52a8\u65f6\u68c0\u67e5\u66f4\u65b0", None))
self.pushButton.setText(QCoreApplication.translate("Setting", u"...", None))
self.label_12.setText(QCoreApplication.translate("Setting", u"Waifu2x\u770b\u56fe\u6a21\u5f0f", None))
self.label_3.setText(QCoreApplication.translate("Setting", u"\u89e3\u7801\u5668\uff08\u9700\u91cd\u542f\uff09", None))
self.label_8.setText(QCoreApplication.translate("Setting", u"waifu2x\u7ebf\u7a0b\u6570", None))
self.threadSelect.setItemText(0, QCoreApplication.translate("Setting", u"2", None))
self.label_5.setText(QCoreApplication.translate("Setting", u"\u4e0b\u8f7d\u548c\u7f13\u5b58\u8def\u5f84", None))
#if QT_CONFIG(tooltip)
self.httpProxy.setToolTip(QCoreApplication.translate("Setting", u"<html><head/><body><p>\u8bf7\u586b\u5199\u4f60\u7684\u4ee3\u7406\u8f6f\u4ef6\u63d0\u4f9b\u7684\u4ee3\u7406\u5730\u5740</p><p>\u5982:</p><p>v2ray\u53ef\u80fd\u662f http://127.0.0.1:10809</p><p>shadowsocks\u53ef\u80fd\u662f http://127.0.0.1:1080</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.httpProxy.setText(QCoreApplication.translate("Setting", u"\u542f\u7528\u4ee3\u7406", None))
#if QT_CONFIG(tooltip)
self.httpEdit.setToolTip(QCoreApplication.translate("Setting", u"<html><head/><body><p>\u8bf7\u586b\u5199\u4f60\u7684\u4ee3\u7406\u8f6f\u4ef6\u63d0\u4f9b\u7684\u4ee3\u7406\u5730\u5740</p><p>\u5982:</p><p>v2ray\u53ef\u80fd\u662f http://127.0.0.1:10809</p><p>shadowsocks\u53ef\u80fd\u662f http://127.0.0.1:1080</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.httpEdit.setPlaceholderText("")
#if QT_CONFIG(tooltip)
self.toolButton.setToolTip(QCoreApplication.translate("Setting", u"<html><head/><body><p>\u8bf7\u586b\u5199\u4f60\u7684\u4ee3\u7406\u8f6f\u4ef6\u63d0\u4f9b\u7684\u4ee3\u7406\u5730\u5740</p><p>\u5982:</p><p>v2ray\u53ef\u80fd\u662f http://127.0.0.1:10809</p><p>shadowsocks\u53ef\u80fd\u662f http://127.0.0.1:1080</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.toolButton.setText(QCoreApplication.translate("Setting", u"?", None))
self.logBox.setItemText(0, QCoreApplication.translate("Setting", u"WARN", None))
self.logBox.setItemText(1, QCoreApplication.translate("Setting", u"INFO", None))
self.logBox.setItemText(2, QCoreApplication.translate("Setting", u"DEBUG", None))
self.label_4.setText(QCoreApplication.translate("Setting", u"\u4e3b\u9898", None))
self.label_16.setText(QCoreApplication.translate("Setting", u"waifu2x\u4e0b\u8f7d\u6a21\u5f0f", None))
self.label_10.setText(QCoreApplication.translate("Setting", u"\u65e5\u5fd7\u7b49\u7ea7", None))
self.themeButton2.setText(QCoreApplication.translate("Setting", u"\u767d", None))
self.themeButton1.setText(QCoreApplication.translate("Setting", u"\u9ed1", None))
self.themeButton0.setText(QCoreApplication.translate("Setting", u"\u8ddf\u968f\u7cfb\u7edf", None))
self.saveButton.setText(QCoreApplication.translate("Setting", u"\u4fdd\u5b58\u8bbe\u7f6e", None))
# retranslateUi

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,12 @@ class QtOwner(Singleton):
Singleton.__init__(self)
self._owner = None
self._app = None
self.isUseDb = True
# db不可使用
def SetDbError(self):
self.owner.searchView.SetDbError()
return
def ShowError(self, msg):
return MsgLabel.ShowErrorEx(self.owner, msg)
@ -16,6 +22,16 @@ class QtOwner(Singleton):
def ShowMsg(self, msg):
return MsgLabel.ShowMsgEx(self.owner, msg)
def ShowMsgOne(self, msg):
if not hasattr(self.owner, "msgLabel"):
return
return self.owner.msgLabel.ShowMsg(msg)
def ShowErrOne(self, msg):
if not hasattr(self.owner, "msgLabel"):
return
return self.owner.msgLabel.ShowError(msg)
def ShowLoading(self):
self.owner.loadingDialog.show()
return
@ -56,7 +72,7 @@ class QtOwner(Singleton):
@property
def favoriteView(self):
return self.owner.favoriteView
return self.owner.favorityView
@property
def indexView(self):
@ -142,12 +158,6 @@ class QtOwner(Singleton):
# def ShowError(self, data):
# return self.owner.msgForm.ShowError(data)
def GetV(self, k, defV=""):
return self.owner.settingView.GetSettingV(k, defV)
def SetV(self, k, v):
return self.owner.settingView.SetSettingV(k, v)
# def ShowMsgBox(self, type, title, msg):
# msg = QMessageBox(type, title, msg)
# msg.addButton("Yes", QMessageBox.AcceptRole)

View File

@ -2,6 +2,7 @@ import base64
from urllib.parse import quote
from config import config
from config.setting import Setting
from tools.tool import ToolUtil
@ -13,21 +14,24 @@ class ServerReq(object):
self.method = method
self.isParseRes = True
self.useImgProxy = True
if config.IsHttpProxy:
self.proxy = {"http": config.HttpProxy, "https": config.HttpProxy}
self.isUseHttps = True
if Setting.IsHttpProxy.value:
self.proxy = {"http": Setting.HttpProxy.value, "https": Setting.HttpProxy.value}
else:
self.proxy = {}
def __str__(self):
if config.LogIndex == 0:
if Setting.LogIndex.value == 0:
return self.__class__.__name__
elif Setting.LogIndex.value == 1:
return "{}, url:{}".format(self.__class__.__name__, self.url)
headers = dict()
headers.update(self.headers)
if config.LogIndex == 1 and "authorization" in headers:
if Setting.LogIndex.value == 1 and "authorization" in headers:
headers["authorization"] = "**********"
params = dict()
params.update(self.params)
if config.LogIndex == 1 and "password" in params:
if Setting.LogIndex.value == 1 and "password" in params:
params["password"] = "******"
return "{}, url:{}, proxy:{}, method:{}, headers:{}, params:{}".format(self.__class__.__name__, self.url, self.proxy, self.method, headers, params)

View File

@ -1,4 +1,5 @@
from config import config
from config.setting import Setting
from tools.tool import ToolUtil
@ -15,8 +16,11 @@ class BaseRes(object):
ToolUtil.ParseFromData(self, self.raw.text)
def __str__(self):
if config.LogIndex == 0:
if Setting.LogIndex.value == 0:
return ""
elif Setting.LogIndex.value == 1:
return "code:{}".format(self.code)
if self.isParseRes:
data = self.GetText()
else:

View File

@ -137,7 +137,7 @@ class Server(Singleton):
if not is_ipaddress(self.imageServer):
request.url = request.url.replace(host, self.imageServer)
if not config.IsUseHttps:
if not request.isUseHttps:
request.url = request.url.replace("https://", "http://")
# host = ToolUtil.GetUrlHost(request.url)
@ -187,7 +187,7 @@ class Server(Singleton):
Log.Warn(task.req.url + " " + es.__repr__())
Log.Debug(es)
finally:
Log.Info("response-> backId:{}, {}, {}".format(task.bakParam, task.req.__class__.__name__, task.res))
Log.Info("response-> backId:{}, {}, st:{}, {}".format(task.bakParam, task.req.__class__.__name__, task.status, task.res))
try:
self.handler.get(task.req.__class__.__name__)(task)
if task.res.raw:
@ -254,6 +254,7 @@ class Server(Singleton):
if data:
TaskBase.taskObj.downloadBack.emit(task.bakParam, len(data), data)
TaskBase.taskObj.downloadBack.emit(task.bakParam, 0, b"")
Log.Info("request cache -> backId:{}, {}".format(task.bakParam, task.req))
return
request = task.req
if request.params == None:

View File

@ -1,11 +1,14 @@
import os
import pickle
import sqlite3
import sys
import threading
import time
from queue import Queue
# 一本书
from config import config
from config.setting import Setting
from task.task_sql import TaskSql
from tools.book import BookMgr
from tools.langconv import Converter
@ -42,6 +45,7 @@ class SqlServer(Singleton):
DbInfos = dict()
DbInfos["book"] = "data/book.db"
TaskCheck = 0
TaskTypeSql = 1
TaskTypeSelectBook = 100
TaskTypeSelectWord = 101
@ -69,7 +73,20 @@ class SqlServer(Singleton):
def _Run(self, bookName):
bookPath = self.DbInfos.get(bookName)
conn = sqlite3.connect(bookPath)
isInit = True
conn = None
try:
if sys.platform == "linux":
path = os.path.join(Setting.GetConfigPath(), bookPath)
conn = sqlite3.connect(path)
else:
conn = sqlite3.connect(bookPath)
except Exception as es:
Log.Error(es)
from qt_owner import QtOwner
QtOwner().isUseDb = False
isInit = False
inQueue = self._inQueue[bookName]
while True:
try:
@ -80,7 +97,16 @@ class SqlServer(Singleton):
inQueue.task_done()
try:
(taskType, data, backId) = task
if taskType == self.TaskTypeSql:
if taskType == self.TaskTypeClose:
break
if not isInit:
TaskSql().taskObj.sqlBack.emit(backId, pickle.dumps(""))
continue
if taskType == self.TaskCheck:
data2 = pickle.dumps(str(int(isInit)))
TaskSql().taskObj.sqlBack.emit(backId, data2)
elif taskType == self.TaskTypeSql:
cur = conn.cursor()
cur.execute(data)
cur.execute("COMMIT")
@ -101,11 +127,10 @@ class SqlServer(Singleton):
self._UpdateFavorite(conn, data, backId)
elif taskType == self.TaskTypeUpdateBook:
self._UpdateBookInfo(conn, data, backId)
elif taskType == self.TaskTypeClose:
break
except Exception as es:
Log.Error(es)
conn.close()
if conn:
conn.close()
Log.Info("db: close conn:{}".format(bookName))
return
@ -171,10 +196,11 @@ class SqlServer(Singleton):
def _SelectFavoriteIds(self, conn, sql, backId):
cur = conn.cursor()
cur.execute("select * from favorite where user ='{}'".format(User().userId))
sql = "select id,sortId from favorite where user ='{}'".format(User().userId)
cur.execute(sql)
allFavoriteIds = []
for data in cur.fetchall():
allFavoriteIds.append(data[0])
allFavoriteIds.append((data[0], data[1]))
data = pickle.dumps(allFavoriteIds)
if backId:
TaskSql().taskObj.sqlBack.emit(backId, data)

View File

@ -5,6 +5,9 @@ import sys
# macOS 修复
import time
from PySide6.QtCore import Qt, QCoreApplication
from PySide6.QtGui import QGuiApplication
from config import config
from config.setting import Setting
from qt_owner import QtOwner
@ -39,8 +42,20 @@ DbBook()
if __name__ == "__main__":
Log.Init()
Setting.Init()
Setting.InitLoadSetting()
Str.Reload()
# QtWidgets.QApplication.testAttribute(Qt.HighDpiScaleFactorRoundingPolicy)
indexV = Setting.ScaleLevel.GetIndexV()
if indexV and indexV != "Auto":
if indexV == 100:
QGuiApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Floor)
else:
os.environ["QT_SCALE_FACTOR"] = str(indexV / 100)
# print(QtWidgets.QApplication.testAttribute(Qt.AA_EnableHighDpiScaling))
# print(QtWidgets.QApplication.testAttribute(Qt.AA_UseHighDpiPixmaps))
# QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
# print(QGuiApplication.highDpiScaleFactorRoundingPolicy())
# QGuiApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Floor)
app = QtWidgets.QApplication(sys.argv) # 建立application对象
try:

View File

@ -67,8 +67,10 @@ class QtTaskBase:
def ClearTask(self):
from task.task_http import TaskHttp
from task.task_download import TaskDownload
from task.task_waifu2x import TaskWaifu2x
TaskDownload().Cancel(self.__taskFlagId)
return TaskHttp().Cancel(self.__taskFlagId)
TaskHttp().Cancel(self.__taskFlagId)
TaskWaifu2x().Cancel(self.__taskFlagId)
def ClearConvert(self):
from task.task_waifu2x import TaskWaifu2x

View File

@ -2,6 +2,7 @@ import hashlib
import os
from config import config
from config.setting import Setting
from task.qt_task import TaskBase, QtDownloadTask
from tools.log import Log
from tools.status import Status
@ -33,8 +34,8 @@ class TaskDownload(TaskBase):
a = hashlib.md5(url.encode("utf-8")).hexdigest()
else:
a = hashlib.md5(path.encode("utf-8")).hexdigest()
if config.SavePath:
filePath2 = os.path.join(os.path.join(config.SavePath, config.CachePathDir), os.path.dirname(path))
if Setting.SavePath.value:
filePath2 = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir), os.path.dirname(path))
filePath2 = os.path.join(filePath2, a)
data.cacheAndLoadPath = filePath2
if filePath:

View File

@ -5,6 +5,7 @@ import time
from zlib import crc32
from config import config
from config.setting import Setting
from task.qt_task import TaskBase, QtDownloadTask
from tools.log import Log
from tools.tool import CTime, ToolUtil
@ -106,8 +107,8 @@ class TaskWaifu2x(TaskBase):
info.model = model
if path:
a = crc32(json.dumps(model).encode("utf-8"))
if config.SavePath:
path2 = os.path.join(os.path.join(config.SavePath, config.CachePathDir), config.Waifu2xPath)
if Setting.SavePath.value:
path2 = os.path.join(os.path.join(Setting.SavePath.value, config.CachePathDir), config.Waifu2xPath)
path = os.path.join(path2, path)
info.cacheAndLoadPath = path + "-{}".format(a)
if cleanFlag:

View File

@ -12,11 +12,11 @@ class Log(object):
@staticmethod
def UpdateLoggingLevel():
if config.LogIndex == 0:
if Setting.LogIndex.value == 0:
Log.logger.setLevel(logging.WARN)
elif config.LogIndex == 1:
elif Setting.LogIndex.value == 1:
Log.logger.setLevel(logging.INFO)
elif config.LogIndex == 2:
elif Setting.LogIndex.value == 2:
Log.logger.setLevel(logging.DEBUG)
return

View File

@ -7,6 +7,8 @@ class QtStrObj(QObject):
class Str:
IconList = "😄😆😊😃😏😍😘😚😳😌😆😁😉😜😝😀😗😙😛😴😟😦😧😮😬😕😯😑😒😅😓😥😩😔😞😖😨😰😣😢😭😂😲😱😫😠😡😤😪😋😷😎😵👿😈😐😶😇👽💛💙💜💚💔💆💇💅👦👧👩👨👶👵👴👱👲👳👷👮👼👸😺😸😻😽😼🙀😿😹😾👹👺🙈🙉🙊💂💀🐾👄💋💧👂👀👃👅💌👤👥💬💭"
obj = QtStrObj()
strDict = dict()
@ -47,6 +49,7 @@ class Str:
WaifuStateCancle = 3006 # "不转换"
WaifuStateEnd = 3007 # "转换完成"
WaifuStateFail = 3008 # "转换失败"
OverResolution = 3009 # "超过设置分辨率"
LoadingPicture = 1 # "图片加载中..."
LoadingFail = 2 # "图片加载失败"
@ -97,7 +100,7 @@ class Str:
SpeedTest = 48 # 测速
PasswordShort = 49 # 密码太短
RegisterSuc = 50 # 注册成功
ComicFinished = 51 # 完
ComicFinished = 51 # 完
SelectFold = 52 # 选择文件夹
Save = 53 # 保存
CommentLoadFail = 54 # 评论加载失败
@ -134,6 +137,32 @@ class Str:
StartConvert = 85 # 开始转换
PauseConvert = 86 # 暂停转换
Open = 87 # 打开
LookCover = 88 # 查看封面
ReDownloadCover = 89 # 重下封面
Waifu2xConvert = 90 # Waifu2x转换
CopyTitle = 91 # 复制标题
Download = 92 # 下载
Delete = 93 # 删除
CurVersion = 94 # 当前版本
CheckUpdateAndUp = 95 # 检查到更新,是否前往更新
CopyAndroid = 96 # 复制Android下载地址
CopyIos = 97 # 复制IOS下载地址
SetDir = 98 # 请设置目录
AddDownload = 99 # 添加下载成功
LookFirst = 100 # 观看第1章
LastLook = 101 # 上次看到第
Chapter = 102 # 章
Looked = 103 # 看过
PressEnter = 104 # 按Enter发送消息
PressCtrlEnter = 105 # 按Ctrl+Enter发送消息
DelWaifu2xConvert = 106 # 取消Waifu2x转换
NeedResetSave = 107 # 需要重启保存
CheckUp = 108 # 检查更新
DailyUpdated = 109 # 今日已更新
HaveUpdate = 110 # 有更新
AlreadyUpdate = 111 # 已是最新
@classmethod
def Reload(cls):
cls.strDict[cls.Ok] = cls.obj.tr("成功")
@ -176,6 +205,7 @@ class Str:
cls.strDict[cls.WaifuStateCancle] = cls.obj.tr("不转换")
cls.strDict[cls.WaifuStateEnd] = cls.obj.tr("转换完成")
cls.strDict[cls.WaifuStateFail] = cls.obj.tr("转换失败")
cls.strDict[cls.OverResolution] = cls.obj.tr("超过设置分辨率")
cls.strDict[cls.Menu] = cls.obj.tr("菜单")
cls.strDict[cls.FullSwitch] = cls.obj.tr("全屏切换")
@ -219,7 +249,7 @@ class Str:
cls.strDict[cls.SpeedTest] = cls.obj.tr("测速")
cls.strDict[cls.PasswordShort] = cls.obj.tr("密码太短")
cls.strDict[cls.RegisterSuc] = cls.obj.tr("注册成功")
cls.strDict[cls.ComicFinished] = cls.obj.tr("")
cls.strDict[cls.ComicFinished] = cls.obj.tr("")
cls.strDict[cls.SelectFold] = cls.obj.tr("选择文件夹")
cls.strDict[cls.Save] = cls.obj.tr("保存")
cls.strDict[cls.CommentLoadFail] = cls.obj.tr("评论加载失败")
@ -255,6 +285,31 @@ class Str:
cls.strDict[cls.Start] = cls.obj.tr("开始")
cls.strDict[cls.StartConvert] = cls.obj.tr("开始转换")
cls.strDict[cls.PauseConvert] = cls.obj.tr("暂停转换")
cls.strDict[cls.Open] = cls.obj.tr("打开")
cls.strDict[cls.LookCover] = cls.obj.tr("查看封面")
cls.strDict[cls.ReDownloadCover] = cls.obj.tr("重下封面")
cls.strDict[cls.Waifu2xConvert] = cls.obj.tr("Waifu2x转换")
cls.strDict[cls.CopyTitle] = cls.obj.tr("复制标题")
cls.strDict[cls.Download] = cls.obj.tr("下载")
cls.strDict[cls.Delete] = cls.obj.tr("删除")
cls.strDict[cls.CurVersion] = cls.obj.tr("当前版本")
cls.strDict[cls.CheckUpdateAndUp] = cls.obj.tr("检查到更新,是否前往更新")
cls.strDict[cls.CopyAndroid] = cls.obj.tr("复制Android下载地址")
cls.strDict[cls.CopyIos] = cls.obj.tr("复制IOS下载地址")
cls.strDict[cls.SetDir] = cls.obj.tr("请设置目录")
cls.strDict[cls.AddDownload] = cls.obj.tr("添加下载成功")
cls.strDict[cls.LookFirst] = cls.obj.tr("观看第1章")
cls.strDict[cls.LastLook] = cls.obj.tr("上次看到第")
cls.strDict[cls.Chapter] = cls.obj.tr("")
cls.strDict[cls.Looked] = cls.obj.tr("看过")
cls.strDict[cls.PressEnter] = cls.obj.tr("按Enter发送消息")
cls.strDict[cls.PressCtrlEnter] = cls.obj.tr("按Ctrl+Enter发送消息")
cls.strDict[cls.DelWaifu2xConvert] = cls.obj.tr("取消Waifu2x转换")
cls.strDict[cls.NeedResetSave] = cls.obj.tr("需要重启保存")
cls.strDict[cls.CheckUp] = cls.obj.tr("检查更新")
cls.strDict[cls.DailyUpdated] = cls.obj.tr("今日已更新")
cls.strDict[cls.HaveUpdate] = cls.obj.tr("有更新")
cls.strDict[cls.AlreadyUpdate] = cls.obj.tr("已是最新")
@classmethod
def GetStr(cls, enumType):

View File

@ -6,6 +6,7 @@ import uuid
from hashlib import sha256
from config import config
from config.setting import Setting
from tools.log import Log
@ -234,7 +235,7 @@ class ToolUtil(object):
@staticmethod
def GetLookScaleModel(category):
return ToolUtil.GetModelByIndex(config.LookNoise, config.LookScale, ToolUtil.GetLookModel(category))
return ToolUtil.GetModelByIndex(Setting.LookNoise.value, Setting.LookScale.value, ToolUtil.GetLookModel(category))
@staticmethod
def GetDownloadScaleModel(w, h):
@ -242,7 +243,7 @@ class ToolUtil(object):
# 条漫不放大
if not config.CanWaifu2x:
return {}
return ToolUtil.GetModelByIndex(config.DownloadNoise, config.DownloadScale, config.DownloadModel)
return ToolUtil.GetModelByIndex(Setting.DownloadNoise.value, Setting.DownloadScale.value, Setting.DownloadModel.value)
@staticmethod
def GetPictureFormat(data):
@ -254,6 +255,8 @@ class ToolUtil(object):
@staticmethod
def GetPictureSize(data):
if not data:
return 0, 0
from PIL import Image
from io import BytesIO
a = BytesIO(data)
@ -314,12 +317,12 @@ class ToolUtil(object):
@staticmethod
def GetLookModel(category):
if config.LookModel == 0:
if Setting.LookModel.value == 0:
if "Cosplay" in category or "cosplay" in category or "CosPlay" in category or "COSPLAY" in category:
return 2
return 3
else:
return config.LookModel
return Setting.LookModel.value
@staticmethod

View File

@ -18,7 +18,9 @@ class CategoryView(QtWidgets.QWidget, Ui_Category, QtTaskBase):
self.bookList.itemClicked.connect(self.SelectItem)
def SwitchCurrent(self, **kwargs):
if self.bookList.count() <= 0:
refresh = kwargs.get("refresh")
if refresh or self.bookList.count() <= 0:
QtOwner().ShowLoading()
self.AddHttpTask(req.CategoryReq(), callBack=self.InitCateGoryBack)
pass
@ -27,6 +29,7 @@ class CategoryView(QtWidgets.QWidget, Ui_Category, QtTaskBase):
QtOwner().CloseLoading()
st = raw["st"]
if st == Status.Ok:
self.bookList.clear()
for index, info in enumerate(CateGoryMgr().idToCateGoryBase):
self.bookList.AddBookItem(info.id, info.title, info.thumb.get("fileServer"), info.thumb.get("path"))
# QtOwner().owner.searchForm.InitCheckBox()

View File

@ -59,9 +59,9 @@ class RankView(QtWidgets.QWidget, Ui_Rank, QtTaskBase):
else:
assert False
data = json.loads(raw["data"])
st = raw["st"]
if st == Status.Ok:
data = json.loads(raw["data"])
for v in data.get("data").get("comics"):
bookList.AddBookByDict(v)
else:

View File

@ -15,7 +15,7 @@ class ChatMsgWidget(QtWidgets.QWidget, Ui_ChatRoomMsg):
# self.setWindowFlag(Qt.FramelessWindowHint)
# self.setWindowFlag(Qt.Dialog)
self.resize(400, 100)
self.setWindowTitle(self.tr("PicACG"))
self.setWindowTitle("PicACG")
self.setWindowIcon(QIcon(":/png/icon/logo_round.png"))
# p = QPixmap()
@ -91,6 +91,7 @@ class ChatMsgWidget(QtWidgets.QWidget, Ui_ChatRoomMsg):
def SetPictureComment(self, data):
pic = QPixmap()
pic.loadFromData(data)
pic.setDevicePixelRatio(self.devicePixelRatio())
self.data = data
newPic = pic.scaled(500, 400, Qt.KeepAspectRatio, Qt.SmoothTransformation)
# print(newPic.height(), newPic.width())
@ -106,9 +107,11 @@ class ChatMsgWidget(QtWidgets.QWidget, Ui_ChatRoomMsg):
if event.button() == Qt.LeftButton:
if self.picData and (obj == self.picLabel):
QtOwner().OpenWaifu2xTool(self.picData)
return True
elif self.data and obj == self.commentLabel:
QtOwner().OpenWaifu2xTool(self.data)
return True
return True
return False
else:
return False
else:

View File

@ -4,13 +4,14 @@ import os
import random
import time
from PySide6.QtCore import Signal, QTimer, Qt, QEvent
from PySide6.QtGui import QFont, QTextCursor, QAction, QGuiApplication
from PySide6.QtWidgets import QMenu, QWidget, QLabel
from PySide6.QtCore import Signal, QTimer, Qt, QEvent, QSize
from PySide6.QtGui import QFont, QTextCursor, QAction, QGuiApplication, QIcon
from PySide6.QtWidgets import QMenu, QWidget, QLabel, QListWidgetItem
from component.dialog.loading_dialog import LoadingDialog
from component.label.msg_label import MsgLabel
from config import config
from config.setting import Setting
from interface.ui_chat_room import Ui_ChatRoom
from qt_owner import QtOwner
from task.qt_task import QtTaskBase
@ -38,7 +39,8 @@ class ChatRoomWidget(QWidget, Ui_ChatRoom, QtTaskBase):
Ui_ChatRoom.__init__(self)
QtTaskBase.__init__(self)
self.setupUi(self)
self.setWindowTitle("PicACG")
self.setWindowIcon(QIcon(":/png/icon/logo_round.png"))
# self.titleBar = Ui_TitleBar()
# self.titleBar.setupUi(self.widget)
# self.titleBar.closeButton.clicked.connect(self.close)
@ -75,24 +77,24 @@ class ChatRoomWidget(QWidget, Ui_ChatRoom, QtTaskBase):
self.cachePath = "."
f = QFont()
f.setPointSize(14)
# for icon in IconList:
# item = QListWidgetItem(icon)
# item.setTextAlignment(Qt.AlignCenter)
# item.setFont(f)
# item.setSizeHint(QSize(40, 40))
# self.listWidget.addItem(item)
for icon in Str.IconList:
item = QListWidgetItem(icon)
item.setTextAlignment(Qt.AlignCenter)
item.setFont(f)
item.setSizeHint(QSize(40, 40))
self.listWidget.addItem(item)
self.listWidget.setVisible(False)
# ToolUtil.SetIcon(self)
self.toolMenu = QMenu(self.toolButton)
self.action1 = QAction('按Enter发送消息', self.toolMenu, triggered=self.CheckAction1)
self.action1 = QAction(Str.GetStr(Str.PressEnter), self.toolMenu, triggered=self.CheckAction1)
self.action1.setCheckable(True)
self.action2 = QAction('按Ctrl+Enter发送消息', self.toolMenu, triggered=self.CheckAction2)
self.action2 = QAction(Str.GetStr(Str.PressCtrlEnter), self.toolMenu, triggered=self.CheckAction2)
self.action2.setCheckable(True)
self.toolMenu.addAction(self.action1)
self.toolMenu.addAction(self.action2)
self.toolButton.setMenu(self.toolMenu)
if config.ChatSendAction == 2:
if Setting.ChatSendAction == 2:
self.action2.setChecked(True)
else:
self.action1.setChecked(True)
@ -105,17 +107,17 @@ class ChatRoomWidget(QWidget, Ui_ChatRoom, QtTaskBase):
def CheckAction1(self):
self.action2.setChecked(not self.action1.isChecked())
config.ChatSendAction = 1
Setting.ChatSendAction.SetValue(1)
def CheckAction2(self):
self.action1.setChecked(not self.action2.isChecked())
config.ChatSendAction = 2
Setting.ChatSendAction.SetValue(0)
def eventFilter(self, obj, event):
if obj == self.textEdit and event.type() == QEvent.KeyPress:
if event.key() == Qt.Key_Return:
# print(event.modifiers() == Qt.ControlModifier)
if (config.ChatSendAction == 2 and event.modifiers() != Qt.ControlModifier) or (config.ChatSendAction == 1 and (event.modifiers() == Qt.ControlModifier)):
if (Setting.ChatSendAction.value == 0 and event.modifiers() != Qt.ControlModifier) or (Setting.ChatSendAction.value == 1 and (event.modifiers() == Qt.ControlModifier)):
cursor = self.textEdit.textCursor()
textCursor = QTextCursor(self.textEdit.document())
textCursor.setPosition(cursor.position())
@ -132,8 +134,8 @@ class ChatRoomWidget(QWidget, Ui_ChatRoom, QtTaskBase):
def keyPressEvent(self, event) -> None:
if event.key() == Qt.Key_Return:
if (config.ChatSendAction == 2 and event.modifiers() != Qt.ControlModifier) or (
config.ChatSendAction == 1 and (event.modifiers() == Qt.ControlModifier)):
if (Setting.ChatSendAction.value == 0 and event.modifiers() != Qt.ControlModifier) or (
Setting.ChatSendAction.value == 1 and (event.modifiers() == Qt.ControlModifier)):
return
else:
self.SendMsg()
@ -263,8 +265,8 @@ class ChatRoomWidget(QWidget, Ui_ChatRoom, QtTaskBase):
try:
saveName = str(int(time.time())) + "_" + str(random.randint(1, 1000)) + ".3gp"
info.toolButton.setText(saveName)
if config.SavePath:
path = os.path.join(config.SavePath, config.ChatSavePath)
if Setting.SavePath.value:
path = os.path.join(Setting.SavePath.value, config.ChatSavePath)
saveName = os.path.join(path, saveName)
info.audioData = saveName
if not os.path.isdir(path):

View File

@ -5,6 +5,7 @@ from queue import Queue
import websocket
from config import config
from config.setting import Setting
from tools.log import Log
@ -84,8 +85,8 @@ class ChatWebSocket:
on_error=self.on_error,
on_close=self.on_close)
self.ws = ws
if config.HttpProxy and config.ChatProxy:
data = config.HttpProxy.split(":")
if Setting.HttpProxy.value and Setting.ChatProxy.value:
data = Setting.HttpProxy.value.split(":")
if len(data) == 3:
port = data[2]
host = data[1].replace("//", "")

View File

@ -5,9 +5,11 @@ from PySide6.QtWidgets import QFileDialog
from component.dialog.base_mask_dialog import BaseMaskDialog
from config import config
from config.setting import Setting
from interface.ui_download_dir import Ui_DownloadDir
from qt_owner import QtOwner
from task.qt_task import QtTaskBase
from tools.str import Str
class DownloadDirView(BaseMaskDialog, Ui_DownloadDir, QtTaskBase):
@ -23,7 +25,7 @@ class DownloadDirView(BaseMaskDialog, Ui_DownloadDir, QtTaskBase):
self.saveDir.clicked.connect(self.SavePath)
def SelectSavePath(self):
url = QFileDialog.getExistingDirectory(self, self.tr("选择文件夹"))
url = QFileDialog.getExistingDirectory(self, Str.GetStr(Str.SelectFold))
if url:
self.lineEdit.setText(url)
self.downloadDir.setText(os.path.join(url, config.SavePathDir))
@ -34,9 +36,7 @@ class DownloadDirView(BaseMaskDialog, Ui_DownloadDir, QtTaskBase):
def SavePath(self):
path = self.lineEdit.text()
if not path:
QtOwner().ShowMsg(self.tr("请设置目录"))
QtOwner().ShowMsg(Str.GetStr(Str.SetDir))
return
config.SavePath = path
QtOwner().SetV("SavePath", config.SavePath)
Setting.SavePath.SetValue(path)
self.close()

View File

@ -1,6 +1,7 @@
import os
import weakref
from config.setting import Setting
from server import req, config
from server.sql_server import SqlServer
from task.qt_task import QtTaskBase
@ -160,18 +161,18 @@ class DownloadInfo(QtTaskBase):
self.SetStatu(self.Error)
return
else:
if not config.SavePath:
if not Setting.SavePath.value:
self.SetStatu(self.Error)
return
book = BookMgr().books.get(self.bookId)
self.title = book.title
if not self.savePath:
self.savePath = os.path.join(os.path.join(config.SavePath, config.SavePathDir),
self.savePath = os.path.join(os.path.join(Setting.SavePath.value, config.SavePathDir),
ToolUtil.GetCanSaveName(self.title))
self.savePath = os.path.join(self.savePath, "original")
if not self.convertPath:
self.convertPath = os.path.join(os.path.join(config.SavePath, config.SavePathDir),
self.convertPath = os.path.join(os.path.join(Setting.SavePath.value, config.SavePathDir),
ToolUtil.GetCanSaveName(self.title))
self.convertPath = os.path.join(self.convertPath, "waifu2x")
self.AddBookEpsInfos()
@ -217,7 +218,7 @@ class DownloadInfo(QtTaskBase):
if self in self.parent.downloadingList:
self.parent.downloadingList.remove(self)
self.parent.HandlerDownloadList()
if config.DownloadAuto:
if Setting.DownloadAuto.value:
self.SetConvertStatu(self.Waiting)
self.parent.AddConvert(self.bookId)
else:

View File

@ -7,6 +7,7 @@ from PySide6.QtGui import QCursor, QDesktopServices, QAction
from PySide6.QtWidgets import QHeaderView, QAbstractItemView, QMenu, QTableWidgetItem
from config import config
from config.setting import Setting
from interface.ui_download import Ui_Download
from qt_owner import QtOwner
from tools.log import Log
@ -54,7 +55,7 @@ class DownloadView(QtWidgets.QWidget, Ui_Download):
self.order = {}
self.db = DownloadDb()
self.radioButton.setChecked(config.DownloadAuto)
self.radioButton.setChecked(Setting.DownloadAuto.value)
datas = self.db.LoadDownload(self)
for task in datas.values():
self.downloadDict[task.bookId] = task
@ -545,7 +546,7 @@ class DownloadView(QtWidgets.QWidget, Ui_Download):
task.SetConvertStatu(task.Pause)
def SetAutoConvert(self):
config.DownloadAuto = int(self.radioButton.isChecked())
Setting.DownloadAuto.SetValue(int(self.radioButton.isChecked()))
def Sort(self, col):
order = self.order.get(col, 1)

View File

@ -2,8 +2,8 @@ import base64
import pickle
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QWidget
from PySide6.QtGui import QDesktopServices, Qt
from PySide6.QtWidgets import QWidget, QMessageBox
from config import config
from config.setting import Setting
@ -12,6 +12,7 @@ from server import req
from server.sql_server import SqlServer
from task.qt_task import QtTaskBase
from tools.log import Log
from tools.str import Str
from tools.tool import ToolUtil
@ -22,8 +23,8 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
Ui_Help.__init__(self)
QtTaskBase.__init__(self)
self.setupUi(self)
self.updateUrl = [config.DatabaseUpdate2, config.DatabaseUpdate]
self.updateDbUrl = [config.DatabaseDownload2, config.DatabaseDownload]
self.dbUpdateUrl = [config.DatabaseUpdate2, config.DatabaseUpdate]
self.dbUpdateDbUrl = [config.DatabaseDownload2, config.DatabaseDownload]
self.curIndex = 0
self.curSubVersion = 0
self.curUpdateTick = 0
@ -32,14 +33,64 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
self.isCheckUp = False
self.logButton.clicked.connect(self.OpenLogDir)
self.isHaveDb = False
self.dbCheck.clicked.connect(self.InitUpdateDatabase)
self.verCheck.clicked.connect(self.InitUpdate)
self.updateUrl = [config.UpdateUrl, config.UpdateUrl2]
self.checkUpdateIndex = 0
def Init(self):
self.CheckDb()
# self.UpdateDbInfo()
def InitUpdate(self):
self.checkUpdateIndex = 0
self.UpdateText(self.verCheck, Str.CheckUp, "#7fb80e", False)
self.StartUpdate()
def StartUpdate(self):
if self.checkUpdateIndex > len(self.updateUrl) -1:
self.UpdateText(self.verCheck, Str.AlreadyUpdate, "#ff4081", True)
return
self.AddHttpTask(req.CheckUpdateReq(self.updateUrl[self.checkUpdateIndex]), self.InitUpdateBack)
def InitUpdateBack(self, raw):
try:
data = raw["data"]
if not data:
self.checkUpdateIndex += 1
self.StartUpdate()
return
r = QMessageBox.information(self, Str.GetStr(Str.Update), Str.GetStr(Str.CurVersion) + config.UpdateVersion + ", "+ Str.GetStr(Str.CheckUpdateAndUp) + "\n" + data,
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if r == QMessageBox.Yes:
QDesktopServices.openUrl(QUrl(self.updateUrl[self.checkUpdateIndex]))
self.UpdateText(self.verCheck, Str.HaveUpdate, "#d71345", True)
except Exception as es:
Log.Error(es)
def CheckDb(self):
self.AddSqlTask("book", "", SqlServer.TaskCheck, self.CheckDbBack)
def CheckDbBack(self, data):
if not data:
Log.Error("Not found book.db !!!!!!!!!!!!!!!")
from qt_owner import QtOwner
QtOwner().SetDbError()
return
self.isHaveDb = True
self.UpdateDbInfo()
return
def SwitchCurrent(self, **kwargs):
self.UpdateDbInfo()
return
def UpdateDbInfo(self):
if not self.isHaveDb:
return
self.AddSqlTask("book", "", SqlServer.TaskTypeSelectUpdate, self.UpdateDbInfoBack)
def UpdateDbInfoBack(self, data):
@ -47,7 +98,7 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
self.curSubVersion = version
self.curUpdateTick = ToolUtil.GetTimeTickEx(timeStr)
self.localNum.setText(str(num))
self.local.setText(timeStr)
self.localTime.setText(timeStr)
if not self.isCheckUp:
self.isCheckUp = True
self.InitUpdateDatabase()
@ -56,10 +107,12 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
def InitUpdateDatabase(self):
if self.curUpdateTick <= 0:
return
# self.searchForm.SetUpdateText(self.tr("正在更新"), "#7fb80e", False)
if self.curIndex >= len(self.updateUrl):
if self.curIndex >= len(self.dbUpdateUrl):
return
url = self.updateUrl[self.curIndex]
self.UpdateText(self.dbCheck, Str.CheckUp, "#7fb80e", False)
self.dbCheck.setEnabled(False)
url = self.dbUpdateUrl[self.curIndex]
self.AddHttpTask(req.CheckUpdateDatabaseReq(url), self.InitUpdateDatabaseBack)
def InitUpdateDatabaseBack(self, raw):
@ -72,17 +125,28 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
Log.Error(es)
self.curIndex += 1
self.InitUpdateDatabase()
# self.searchForm.SetUpdateText(self.tr("无法连接 raw.githubusercontent.com"), "#d71345", True)
self.UpdateText(self.dbCheck, Str.NetError, "#d71345", True)
def UpdateText(self, label, text, color, enable):
label.setStyleSheet("background-color:transparent;color:{}".format(color))
label.setText("{}".format(Str.GetStr(text)))
label.setEnabled(enable)
if enable:
label.setCursor(Qt.PointingHandCursor)
else:
label.setCursor(Qt.ArrowCursor)
return
def CheckLoadNextDayData(self, newTick):
if newTick <= self.curUpdateTick:
# if self.curSubVersion > 0:
# self.searchForm.SetUpdateText(self.tr("今日已更新") + str(self.curSubVersion), "#7fb80e", True)
# else:
# self.searchForm.SetUpdateText(self.tr("已更新"), "#7fb80e", True)
if self.curSubVersion > 0:
self.UpdateText(self.dbCheck, Str.DailyUpdated, "#7fb80e", True)
else:
self.UpdateText(self.dbCheck, Str.Updated, "#7fb80e", True)
return
day = ToolUtil.DiffDays(newTick, self.curUpdateTick)
url = self.updateDbUrl[self.curIndex]
url = self.dbUpdateDbUrl[self.curIndex]
if day <= 0:
self.AddHttpTask(req.DownloadDatabaseReq(url, newTick), self.DownloadDataBack, backParam=(newTick, newTick))
else:
@ -95,12 +159,11 @@ class HelpView(QWidget, Ui_Help, QtTaskBase):
try:
data = raw["data"]
if not data:
# self.searchForm.SetUpdateText(self.tr("无法连接 raw.githubusercontent.com"), "#d71345", True)
return
Log.Info("db: check update, {}->{}->{}".format(self.curUpdateTick, updateTick, newTick))
if len(data) <= 100:
Log.Info("Update code: {}".format(data))
pass
return
elif data:
if ToolUtil.DiffDays(updateTick, self.curUpdateTick) <= 0:
# 分割数据

View File

@ -26,7 +26,8 @@ class IndexView(QWidget, Ui_Index, QtTaskBase):
def SwitchCurrent(self, **kwargs):
if User().token:
self.Init()
if not self.godList.count():
self.Init()
if not self.randomList.count():
self.InitRandom()
pass

View File

@ -10,6 +10,7 @@ from server.sql_server import SqlServer
from task.qt_task import QtTaskBase
from tools.book import BookMgr
from tools.status import Status
from tools.str import Str
class BookEpsView(QtWidgets.QWidget, Ui_BookEps, QtTaskBase):
@ -128,6 +129,6 @@ class BookEpsView(QtWidgets.QWidget, Ui_BookEps, QtTaskBase):
if not downloadIds:
return
QtOwner().downloadView.AddDownload(self.bookId, downloadIds)
QtOwner().ShowMsg(self.tr("添加下载成功"))
QtOwner().ShowMsg(Str.GetStr(Str.AddDownload))
self.UpdateEpsInfo()
return

View File

@ -3,6 +3,7 @@ from PySide6.QtCore import Qt, QSize, QEvent
from PySide6.QtGui import QColor, QFont, QPixmap, QIcon
from PySide6.QtWidgets import QListWidgetItem, QLabel
from config.setting import Setting
from interface.ui_book_info import Ui_BookInfo
from qt_owner import QtOwner
from server import req, ToolUtil, config, Status
@ -85,7 +86,6 @@ class BookInfoView(QtWidgets.QWidget, Ui_BookInfo, QtTaskBase):
else:
self.starButton.setIcon(QIcon(":/png/icon/icon_bookmark_on.png"))
def Clear(self):
self.ClearTask()
self.epsListWidget.clear()
@ -190,13 +190,30 @@ class BookInfoView(QtWidgets.QWidget, Ui_BookInfo, QtTaskBase):
self.pictureData = data
pic = QtGui.QPixmap()
pic.loadFromData(data)
newPic = pic.scaled(self.picture.size(), QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
radio = self.devicePixelRatio()
pic.setDevicePixelRatio(radio)
newPic = pic.scaled(self.picture.size()*radio, QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.picture.setPixmap(newPic)
# self.picture.setScaledContents(True)
if Setting.CoverIsOpenWaifu.value:
w, h = ToolUtil.GetPictureSize(self.pictureData)
if max(w, h) <= Setting.CoverMaxNum.value:
model = ToolUtil.GetModelByIndex(Setting.CoverLookNoise.value, Setting.CoverLookScale.value, Setting.CoverLookModel.value)
self.AddConvertTask(self.path, self.pictureData, model, self.Waifu2xPictureBack)
else:
self.picture.setText(Str.GetStr(Str.LoadingFail))
return
def Waifu2xPictureBack(self, data, waifuId, index, tick):
if data:
pic = QtGui.QPixmap()
pic.loadFromData(data)
radio = self.devicePixelRatio()
pic.setDevicePixelRatio(radio)
newPic = pic.scaled(self.picture.size()*radio, QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.picture.setPixmap(newPic)
return
def GetEpsBack(self, raw):
st = raw["st"]
if st == Status.Ok:
@ -283,12 +300,11 @@ class BookInfoView(QtWidgets.QWidget, Ui_BookInfo, QtTaskBase):
def LoadHistory(self):
info = QtOwner().historyView.GetHistory(self.bookId)
if not info:
self.startRead.setText(self.tr("观看第1章"))
self.startRead.setText(Str.GetStr(Str.LookFirst))
return
if self.lastEpsId == info.epsId:
self.lastIndex = info.picIndex
self.startRead.setText(
self.tr("上次看到第") + str(self.lastEpsId + 1) + self.tr("") + str(info.picIndex + 1) + self.tr(""))
self.startRead.setText(Str.GetStr(Str.LastLook) + str(self.lastEpsId + 1) + Str.GetStr(Str.Chapter) + str(info.picIndex + 1) + Str.GetStr(Str.Page))
return
if self.lastEpsId >= 0:
@ -306,8 +322,7 @@ class BookInfoView(QtWidgets.QWidget, Ui_BookInfo, QtTaskBase):
item.setBackground(QColor(238, 162, 164))
self.lastEpsId = info.epsId
self.lastIndex = info.picIndex
self.startRead.setText(
self.tr("上次看到第") + str(self.lastEpsId + 1) + self.tr("") + str(info.picIndex + 1) + self.tr(""))
self.startRead.setText(Str.GetStr(Str.LastLook) + str(self.lastEpsId + 1) + Str.GetStr(Str.Chapter) + str(info.picIndex + 1) + Str.GetStr(Str.Page))
def ClickCategoriesItem(self, item):
text = item.text()

View File

@ -66,13 +66,13 @@ class GameInfoView(QtWidgets.QWidget, Ui_GameInfo, QtTaskBase):
def CopyIos(self):
clipboard = QApplication.clipboard()
clipboard.setText(self.iosLink)
QtOwner().ShowMsg(self.tr("复制IOS下载地址"))
QtOwner().ShowMsg(Str.GetStr(Str.CopyIos))
return
def CopyAndroid(self):
clipboard = QApplication.clipboard()
clipboard.setText(self.androidLink)
QtOwner().ShowMsg(self.tr("复制Android下载地址"))
QtOwner().ShowMsg(Str.GetStr(Str.CopyAndroid))
return
# def OpenAutor(self):
@ -129,7 +129,7 @@ class GameInfoView(QtWidgets.QWidget, Ui_GameInfo, QtTaskBase):
if data.get("data").get("game").get("ios"):
self.icon_4.setVisible(True)
self.description.setPlainText(description)
self.picture.setText(self.tr("图片加载中..."))
self.picture.setText(Str.GetStr(Str.LoadingPicture))
fileServer = data.get("data").get("game").get("icon").get("fileServer")
path = data.get("data").get("game").get("icon").get("path")
self.url = fileServer
@ -170,7 +170,9 @@ class GameInfoView(QtWidgets.QWidget, Ui_GameInfo, QtTaskBase):
self.pictureData = data
pic = QtGui.QPixmap()
pic.loadFromData(data)
newPic = pic.scaled(self.picture.size(), QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
radio = self.devicePixelRatio()
pic.setDevicePixelRatio(radio)
newPic = pic.scaled(self.picture.size()*radio, QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.picture.setPixmap(newPic)
# self.picture.setScaledContents(True)
else:
@ -190,6 +192,7 @@ class GameInfoView(QtWidgets.QWidget, Ui_GameInfo, QtTaskBase):
self.listPictureInfo[backId] = data
pic = QtGui.QPixmap()
pic.loadFromData(data)
pic.setDevicePixelRatio(self.devicePixelRatio())
newPic = pic.scaled(QSize(self.width()-40, 300), QtCore.Qt.KeepAspectRatio, Qt.SmoothTransformation)
widget.setPixmap(newPic)

View File

@ -1,18 +1,22 @@
import sys
from functools import partial
from PySide6.QtCore import Qt, QUrl
from PySide6.QtGui import QIcon, QMouseEvent, QGuiApplication, QDesktopServices
from PySide6.QtWidgets import QButtonGroup, QToolButton, QLabel, QMainWindow, QMessageBox
from PySide6.QtCore import Qt, QUrl, QEvent, QPoint
from PySide6.QtGui import QIcon, QMouseEvent, QGuiApplication, QDesktopServices, QPalette
from PySide6.QtWidgets import QButtonGroup, QToolButton, QLabel, QMainWindow, QMessageBox, QApplication
from component.dialog.loading_dialog import LoadingDialog
from component.label.msg_label import MsgLabel
from component.widget.frame_less_widget import FrameLessWidget
from config import config
from config.setting import Setting
from interface.ui_main_windows import Ui_MainWindow
from qt_owner import QtOwner
from server import req
from server.sql_server import SqlServer
from task.qt_task import QtTaskBase
from tools.log import Log
from tools.str import Str
from view.download.download_dir_view import DownloadDirView
@ -25,15 +29,21 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
QtOwner().SetOwner(self)
self.setupUi(self)
self.resize(600, 600)
self.setWindowTitle(self.tr("PicACG"))
self.setWindowTitle("PicACG")
self.setWindowIcon(QIcon(":/png/icon/logo_round.png"))
# self.setAttribute(Qt.WA_TranslucentBackground)
desktop = QGuiApplication.primaryScreen().geometry()
screens = QGuiApplication.screens()
# print(screens[0].geometry(), screens[1].geometry())
if Setting.ScreenIndex.value >= len(screens):
desktop = QGuiApplication.primaryScreen().geometry()
else:
desktop = screens[Setting.ScreenIndex.value].geometry()
self.resize(desktop.width() // 4 * 3, desktop.height() // 4 * 3)
self.move(desktop.width() // 8, desktop.height() // 8)
self.move(desktop.width() // 8+desktop.x(), desktop.height() // 8+desktop.y())
# self.setAttribute(Qt.WA_StyledBackground, True)
self.loadingDialog = LoadingDialog(self)
self.__initWidget()
@ -47,10 +57,8 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
self.subStackWidget.setCurrentIndex(0)
self.settingView.LoadSetting()
self.readView.LoadSetting()
# self.readView.LoadSetting()
self.updateUrl = [config.UpdateUrl, config.UpdateUrl2]
self.checkUpdateIndex = 0
@property
def subStackList(self):
@ -75,7 +83,24 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
self.navigationWidget.gameButton.clicked.connect(partial(self.SwitchWidgetAndClear, self.subStackWidget.indexOf(self.gameView)))
self.navigationWidget.helpButton.clicked.connect(partial(self.SwitchWidgetAndClear, self.subStackWidget.indexOf(self.helpView)))
# self.navigationWidget.chatButton.clicked.connect(partial(self.SwitchWidgetAndClear, self.subStackWidget.indexOf(self.chatView)))
def RetranslateUi(self):
Ui_MainWindow.retranslateUi(self, self)
self.indexView.retranslateUi(self.indexView)
self.settingView.retranslateUi(self.settingView)
self.downloadView.retranslateUi(self.downloadView)
self.categoryView.retranslateUi(self.categoryView)
self.searchView.retranslateUi(self.searchView)
self.rankView.retranslateUi(self.rankView)
self.commentView.retranslateUi(self.commentView)
self.chatView.retranslateUi(self.chatView)
self.favorityView.retranslateUi(self.favorityView)
self.readView.retranslateUi(self.readView)
self.myCommentView.retranslateUi(self.myCommentView)
self.gameCommentView.retranslateUi(self.gameCommentView)
self.subCommentView.retranslateUi(self.subCommentView)
self.gameView.retranslateUi(self.gameView)
self.helpView.retranslateUi(self.helpView)
self.waifu2xToolView.retranslateUi(self.waifu2xToolView)
def Init(self):
IsCanUse = False
@ -97,7 +122,7 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
# if not gpuInfo or (gpuInfo and config.Encode < 0) or (gpuInfo and config.Encode >= len(gpuInfo)):
# config.Encode = 0
sts = waifu2x_vulkan.initSet(config.Encode, config.Waifu2xThread)
sts = waifu2x_vulkan.initSet(config.Encode, Setting.Waifu2xThread.value)
Log.Info("waifu2x初始化: " + str(stat) + " encode: " + str(
config.Encode) + " version:" + waifu2x_vulkan.getVersion() + " code:" + str(sts))
else:
@ -107,20 +132,22 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
if not IsCanUse:
self.settingView.checkBox.setEnabled(False)
self.readView.frame.qtTool.checkBox.setEnabled(False)
config.DownloadAuto = 0
Setting.DownloadAuto.SetValue(0)
self.downloadView.radioButton.setEnabled(False)
self.waifu2xToolView.checkBox.setEnabled(False)
self.waifu2xToolView.changeButton.setEnabled(False)
self.waifu2xToolView.changeButton.setEnabled(False)
self.waifu2xToolView.comboBox.setEnabled(False)
self.waifu2xToolView.SetStatus(False)
config.IsOpenWaifu = 0
Setting.IsOpenWaifu.SetValue(0)
if config.IsUpdate:
self.InitUpdate()
if Setting.IsUpdate.value:
self.helpView.InitUpdate()
self.searchView.InitWord()
if not config.SavePath:
self.msgLabel = MsgLabel(self)
self.msgLabel.hide()
if not Setting.SavePath.value:
view = DownloadDirView(self)
view.exec()
self.OpenLoginView()
@ -219,12 +246,19 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
def closeEvent(self, a0) -> None:
super().closeEvent(a0)
# reply = QtOwner().ShowMsgBox(QMessageBox.Question, self.tr('提示'), self.tr('确定要退出吗?'))
reply = 0
if reply == 0:
a0.accept()
self.settingView.ExitSaveSetting(self.size())
else:
a0.ignore()
self.GetExitScreen()
a0.accept()
def GetExitScreen(self):
screens = QGuiApplication.screens()
# print(self.pos())
# for screen in screens:
# print(screen.geometry())
screen = QGuiApplication.screenAt(self.pos()+QPoint(self.width()//2, self.height()//2))
if screen in screens:
index = screens.index(screen)
Setting.ScreenIndex.SetValue(index)
Log.Info("Exit screen index:{}".format(str(index)))
def CheckShowMenu(self):
if self.navigationWidget.isHidden():
@ -236,7 +270,7 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
def keyReleaseEvent(self, event) -> None:
if event.key() == Qt.Key_Escape:
self.SwitchWidgetLast()
return FrameLessWidget.keyReleaseEvent(self, event)
return super(self.__class__, self).keyReleaseEvent(event)
def mousePressEvent(self, event: QMouseEvent):
if event.button() == Qt.ForwardButton:
@ -244,7 +278,21 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
elif event.button() == Qt.BackButton:
self.SwitchWidgetLast()
self.searchView.lineEdit.CheckClick(event.pos())
return QMainWindow.mousePressEvent(self, event)
return super(self.__class__, self).mousePressEvent(event)
#
# def changeEvent(self, ev):
# if sys.platform == 'darwin':
# OSX_LIGHT_MODE = 236
# OSX_DARK_MODE = 50
# if ev.type() == QEvent.PaletteChange:
# bg = self.palette().color(QPalette.Active, QPalette.Window)
# if bg.lightness() == OSX_LIGHT_MODE:
# print("MacOS light theme")
# return
# elif bg.lightness() == OSX_DARK_MODE:
# print("MacOS dark theme")
# return
# return super(self.__class__, self).changeEvent(ev)
def nativeEvent(self, eventType, message):
# print(eventType, message)
@ -257,32 +305,15 @@ class MainView(QMainWindow, Ui_MainWindow, QtTaskBase):
msg = ctypes.wintypes.MSG.from_address(message.__int__())
# print(msg.message, self.GetWinSysColor())
if msg.message == 26:
if config.ThemeIndex == 0:
self.settingView.SetTheme()
if msg.message == 26 and config.ThemeIndex == 0:
self.settingView.SetTheme()
return super(self.__class__, self).nativeEvent(eventType, message)
def Close(self):
# TODO 停止所有的定时器以及线程
self.loadingDialog.close()
self.downloadView.Close()
SqlServer().Stop()
# QtTask().Stop()
def InitUpdate(self):
if self.checkUpdateIndex > len(self.updateUrl) -1:
return
self.AddHttpTask(req.CheckUpdateReq(self.updateUrl[self.checkUpdateIndex]), self.InitUpdateBack)
def InitUpdateBack(self, raw):
try:
data = raw["data"]
if not data:
self.checkUpdateIndex += 1
self.InitUpdate()
return
r = QMessageBox.information(self, self.tr("更新"), self.tr("当前版本") + config.UpdateVersion + ", "+ self.tr("检查到更新,是否前往更新\n") + data,
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if r == QMessageBox.Yes:
QDesktopServices.openUrl(QUrl(self.updateUrl[self.checkUpdateIndex]))
except Exception as es:
Log.Error(es)

View File

@ -1,8 +1,9 @@
from enum import Enum
from PySide6.QtCore import QSize
from PySide6.QtCore import QSize, QPoint
from config import config
from config.setting import Setting
from tools.str import Str
from tools.tool import ToolUtil
@ -29,6 +30,7 @@ class QtFileData(object):
WaifuStateCancle = Str.WaifuStateCancle
WaifuStateEnd = Str.WaifuStateEnd
WaifuStateFail = Str.WaifuStateFail
OverResolution = Str.OverResolution
def __init__(self):
self.size = 0
@ -62,8 +64,17 @@ class QtFileData(object):
if not data:
self.state = self.DownloadError
return
if config.IsOpenWaifu:
self.waifuState = self.WaifuWait
w, h = ToolUtil.GetPictureSize(data)
if max(w, h) <= Setting.LookMaxNum.value:
if Setting.IsOpenWaifu.value:
self.waifuState = self.WaifuWait
else:
self.waifuState = self.WaifuStateCancle
else:
self.waifuState = self.OverResolution
self.data = data
self.w, self.h = ToolUtil.GetPictureSize(data)
self.model = ToolUtil.GetLookScaleModel(category)
@ -80,3 +91,63 @@ class QtFileData(object):
self.scaleW, self.scaleH = ToolUtil.GetPictureSize(data)
self.waifuTick = tick
return
@staticmethod
def GetReadScale(stripModel, scaleCnt, maxWidth, maxHeight):
if stripModel == ReadMode.LeftRight:
scale = (1 + scaleCnt * 0.1)
wight = min(maxWidth, int(maxWidth * scale))
height = maxHeight * scale
toScaleW = wight
toScaleH = height
elif stripModel in [ReadMode.RightLeftDouble]:
scale = (1 + scaleCnt * 0.1)
toScaleW = min(maxWidth // 2, int(maxWidth // 2 * scale))
toScaleH = maxHeight * scale
elif stripModel in [ReadMode.LeftRightDouble]:
scale = (1 + scaleCnt * 0.1)
toScaleW = min(maxWidth // 2, int(maxWidth // 2 * scale))
toScaleH = maxHeight * scale
elif stripModel in [ReadMode.LeftRightScroll]:
scale = (1 + scaleCnt * 0.1)
toScaleW = maxWidth * scale * 10
toScaleH = min(maxHeight, maxHeight * scale)
elif stripModel in [ReadMode.RightLeftScroll]:
scale = (1 + scaleCnt * 0.1)
toScaleW = maxWidth * scale * 10
toScaleH = min(maxHeight, maxHeight * scale)
elif stripModel in [ReadMode.UpDown]:
scale = (0.5 + scaleCnt * 0.1)
toScaleW = min(maxWidth, maxWidth * scale)
toScaleH = maxHeight * scale * 10
else:
return maxWidth, maxHeight
return toScaleW, toScaleH
@staticmethod
def GetReadToPos(stripModel, maxWidth, maxHeight, toWidth, toHeight, index, curIndex):
if stripModel == ReadMode.LeftRight:
return QPoint(maxWidth//2 - toWidth//2, max(0, maxHeight//2-toHeight//2))
elif stripModel in [ReadMode.RightLeftDouble]:
if index == curIndex:
return QPoint(maxWidth//2, maxHeight//2 - toHeight//2)
else:
return QPoint(maxWidth//2-toWidth, maxHeight//2 - toHeight//2)
elif stripModel in [ReadMode.LeftRightDouble]:
if index != curIndex:
return QPoint(maxWidth//2, maxHeight//2 - toHeight//2)
else:
return QPoint(maxWidth//2-toWidth, maxHeight//2 - toHeight//2)
elif stripModel in [ReadMode.LeftRightScroll]:
return QPoint(0, max(0, maxHeight // 2 - toHeight // 2))
elif stripModel in [ReadMode.RightLeftScroll]:
return QPoint(0, max(0, maxHeight // 2 - toHeight // 2))
elif stripModel in [ReadMode.UpDown]:
return QPoint(maxWidth//2 - toWidth//2, 0)
else:
return QPoint(0, 0)

View File

@ -28,6 +28,7 @@ class ReadFrame(QFrame):
self.startPos = QPoint()
self.endPos = QPoint()
self.process = DWaterProgress(self)
self.process.hide()
self.waifu2xProcess = GifLabel(self)
self.waifu2xProcess.setVisible(False)
f = QFile(":/png/icon/loading_gif.gif")
@ -108,7 +109,8 @@ class ReadFrame(QFrame):
h = size.height()
self.scrollArea.setGeometry(0, 0, w, h)
# h2 = min(800, h)
self.qtTool.setGeometry(w - 220, 0, 220, h)
# self.qtTool.adjustSize()
self.qtTool.setGeometry(w - 300, 0, 300, h)
# w = max((w - 150)//2, 0)
# h = max((h - 150)//2, 0)

Some files were not shown because too many files have changed in this diff Show More