From 47257c748b2977ab6e47f358af7a79d015282a09 Mon Sep 17 00:00:00 2001 From: tonquer Date: Sun, 17 Nov 2024 11:03:21 +0800 Subject: [PATCH] update --- .github/workflows/CI.yml | 106 ++++++- .github/workflows/release.yml | 270 +++++++++++++++++- script/build_universal2.py | 33 +++ .../progress_bar/dwater_progress_bar.py | 70 ++--- src/config/config.py | 6 +- src/config/setting.py | 5 +- src/interface/ui_book_eps.py | 2 +- src/interface/ui_book_info.py | 2 +- src/interface/ui_category.py | 2 +- src/interface/ui_comic_item.py | 2 +- src/interface/ui_comment.py | 2 +- src/interface/ui_comment_item.py | 2 +- src/interface/ui_doh_dns.py | 2 +- src/interface/ui_download.py | 2 +- src/interface/ui_download_all.py | 2 +- src/interface/ui_download_dir.py | 2 +- src/interface/ui_download_some.py | 2 +- src/interface/ui_download_some_edit.py | 2 +- src/interface/ui_exit.py | 2 +- src/interface/ui_favorite.py | 2 +- src/interface/ui_favorite_fold.py | 2 +- src/interface/ui_help.py | 2 +- src/interface/ui_help_log_widget.py | 2 +- src/interface/ui_history.py | 2 +- src/interface/ui_index.py | 2 +- src/interface/ui_line_edit_help_widget.py | 2 +- src/interface/ui_local.py | 2 +- src/interface/ui_local_all.py | 2 +- src/interface/ui_local_eps.py | 2 +- src/interface/ui_local_favorite.py | 2 +- src/interface/ui_local_fold.py | 2 +- src/interface/ui_login.py | 2 +- src/interface/ui_login_proxy_widget.py | 2 +- src/interface/ui_login_widget.py | 2 +- src/interface/ui_main.py | 2 +- src/interface/ui_main_windows.py | 2 +- src/interface/ui_nas.py | 2 +- src/interface/ui_nas_add.py | 2 +- src/interface/ui_nas_item.py | 2 +- src/interface/ui_navigation.py | 2 +- src/interface/ui_read_tool.py | 7 +- src/interface/ui_register_widget.py | 2 +- src/interface/ui_search.py | 4 +- src/interface/ui_setting_new.py | 83 ++---- src/interface/ui_sign_widget.py | 2 +- src/interface/ui_sr_select_widget.py | 2 +- src/interface/ui_sub_comment.py | 2 +- src/interface/ui_title_bar.py | 2 +- src/interface/ui_user_manager_widget.py | 2 +- src/interface/ui_waifu2x_tool.py | 6 +- src/interface/ui_week.py | 2 +- src/requirements.txt | 2 +- src/requirements_macos.txt | 8 +- src/start.py | 16 +- src/task/task_qimage.py | 21 +- src/view/read/read_enum.py | 43 +++ src/view/read/read_tool.py | 5 +- src/view/read/read_view.py | 30 +- src/view/setting/setting_view.py | 11 +- src/view/tool/waifu2x_tool_view.py | 160 +++++++---- ui/component/ui_read_tool.ui | 7 +- ui/ui_search.ui | 2 +- ui/ui_setting_new.ui | 127 +++----- ui/ui_waifu2x_tool.ui | 4 +- 64 files changed, 764 insertions(+), 344 deletions(-) create mode 100644 script/build_universal2.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7a51caf..ccf7efc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,7 +23,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 pip install -r src\requirements.txt pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl - name: Build @@ -31,7 +30,7 @@ jobs: cd src cp ..\res\icon\icon.ico .\ - pyinstaller --hidden-import=_cffi_backend --collect-data curl_cffi --add-data "..\lib\win\*;." -F -w -i icon.ico start.py + pyinstaller -F -w -i icon.ico start.py mv dist jmcomic cp ..\LICENSE jmcomic\ cp ..\CHANGELOG jmcomic\ @@ -66,7 +65,7 @@ jobs: run: | cd src cp ..\res\icon\icon.ico .\ - pyinstaller --hidden-import=_cffi_backend --collect-data curl_cffi --add-data "..\lib\win\*;." -F -w -i icon.ico start.py + pyinstaller -F -w -i icon.ico start.py mv dist jmcomic cp ..\LICENSE jmcomic\ cp ..\CHANGELOG jmcomic\ @@ -79,4 +78,105 @@ jobs: with: name: ${{ env.PACKAGENAME }} path: ${{ env.PACKAGENAME }} + retention-days: 7 + + ubuntu: + runs-on: ubuntu-20.04 + env: + PACKAGENAME: jmcomic_py37_linux + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + - name: Install dependencies + run: | + sudo apt-get install -y fuse libfuse2 + python -m pip install --upgrade pip + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp37-abi3-linux_x86_64.whl + pip install -r src/requirements.txt + - name: Build + run: | + cd src + pyinstaller -w start.py + cd dist + mkdir -p jmcomic.AppRun/usr/bin + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool-x86_64.AppImage + cp -r ../../res/appimage/* jmcomic.AppRun/ + cp -r ../../res/icon/logo_round.png jmcomic.AppRun/JMComic.png + cp -r start/* jmcomic.AppRun/usr/bin/ + + mv jmcomic.AppRun/usr/bin/start jmcomic.AppRun/usr/bin/JMComic + chmod +x jmcomic.AppRun/AppRun + chmod +x jmcomic.AppRun/usr/bin/JMComic + ./appimagetool-x86_64.AppImage jmcomic.AppRun + mv JMComic-x86_64.AppImage ../../${{ env.PACKAGENAME }}-x86_64.AppImage + cd ../.. + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGENAME }} + path: ${{ env.PACKAGENAME }}-x86_64.AppImage + retention-days: 7 + + macos: + runs-on: macos-latest + env: + PACKAGENAME: jmcomic_py37_macos + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + python build_universal2.py cffi + python build_universal2.py curl_cffi + python build_universal2.py pyyaml + pip install *.whl + cd .. + pip install -r src/requirements_macos.txt + brew install create-dmg + - name: Build + run: | + cd src + cp ../res/icon/Icon.icns ./ + pyinstaller --target-architecture=universal2 --clean --onedir --name JMComic \ + --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ + --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ + --hidden-import config \ + --hidden-import component \ + --hidden-import server \ + --hidden-import task \ + --hidden-import tools \ + --hidden-import view \ + --strip --windowed -i Icon.icns \ + start.py + xattr -cr dist/JMComic.app + create-dmg --volname "JMComic" --volicon "Icon.icns" --icon "JMComic.app" 200 190 \ + --window-pos 200 120 \ + --window-size 800 400 \ + --icon-size 100 \ + --hide-extension "JMComic.app" --app-drop-link 600 185 \ + ${{ env.PACKAGENAME }}.dmg dist/JMComic.app + + zip -9 jmcomic.zip ${{ env.PACKAGENAME }}.dmg + mv ${{ env.PACKAGENAME }}.dmg .. + mv jmcomic.zip .. + cd .. + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGENAME }} + path: ${{ env.PACKAGENAME }}.dmg retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e451faa..12f39cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,6 +41,142 @@ jobs: draft: true prerelease: true + macos: + needs: [setup, release] + runs-on: macos-latest + env: + PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_macos_universal2 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + python build_universal2.py cffi + python build_universal2.py curl_cffi + python build_universal2.py pyyaml + pip install *.whl + cd .. + pip install -r src/requirements_macos.txt + - name: Build + run: | + cd src + cp ../res/icon/Icon.icns ./ + pyinstaller --target-architecture=universal2 --clean --onedir --name JMComic \ + --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ + --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ + --hidden-import config \ + --hidden-import component \ + --hidden-import server \ + --hidden-import task \ + --hidden-import tools \ + --hidden-import view \ + --strip --windowed -i Icon.icns \ + start.py + xattr -cr dist/JMComic.app + create-dmg --volname "JMComic" --volicon "Icon.icns" --icon "JMComic.app" 200 190 \ + --window-pos 200 120 \ + --window-size 800 400 \ + --icon-size 100 \ + --hide-extension "JMComic.app" --app-drop-link 600 185 \ + ${{ env.PACKAGENAME }}.dmg dist/JMComic.app + + zip -9 jmcomic.zip ${{ env.PACKAGENAME }}.dmg + mv ${{ env.PACKAGENAME }}.dmg .. + mv jmcomic.zip .. + cd .. + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGENAME }} + path: jmcomic.zip + - name: upload-macos + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.Up_Url }} + asset_path: ${{ env.PACKAGENAME }}.dmg + asset_name: ${{ env.PACKAGENAME }}.dmg + asset_content_type: application/gzip + + macos-nosr: + needs: [setup, release] + runs-on: macos-latest + env: + PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_macos_nosr_universal2 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + # pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + python build_universal2.py cffi + python build_universal2.py curl_cffi + python build_universal2.py pyyaml + pip install *.whl + cd .. + pip install -r src/requirements_macos.txt + - name: Build + run: | + cd src + cp ../res/icon/Icon.icns ./ + pyinstaller --target-architecture=universal2 --clean --onedir --name JMComic \ + --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ + --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ + --hidden-import config \ + --hidden-import component \ + --hidden-import server \ + --hidden-import task \ + --hidden-import tools \ + --hidden-import view \ + --strip --windowed -i Icon.icns \ + start.py + xattr -cr dist/JMComic.app + create-dmg --volname "JMComic" --volicon "Icon.icns" --icon "JMComic.app" 200 190 \ + --window-pos 200 120 \ + --window-size 800 400 \ + --icon-size 100 \ + --hide-extension "JMComic.app" --app-drop-link 600 185 \ + ${{ env.PACKAGENAME }}.dmg dist/JMComic.app + + zip -9 jmcomic.zip ${{ env.PACKAGENAME }}.dmg + mv ${{ env.PACKAGENAME }}.dmg .. + mv jmcomic.zip .. + cd .. + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGENAME }} + path: jmcomic.zip + - name: upload-macos + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.Up_Url }} + asset_path: ${{ env.PACKAGENAME }}.dmg + asset_name: ${{ env.PACKAGENAME }}.dmg + asset_content_type: application/gzip + windows: needs: [setup, release] runs-on: windows-latest @@ -56,14 +192,52 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl pip install -r src\requirements.txt - name: Build run: | cd src cp ..\res\icon\icon.ico .\ - pyinstaller --hidden-import=_cffi_backend --collect-data curl_cffi --add-data "..\lib\win\*;." -F -w -i icon.ico start.py + pyinstaller -F -w -i icon.ico start.py + mv dist jmcomic + cp ..\LICENSE jmcomic\ + cp ..\CHANGELOG jmcomic\ + cd .. + mkdir ${{ env.PACKAGENAME }} + mv src\jmcomic ${{ env.PACKAGENAME }} + 7z a -r "$($Env:PACKAGENAME + '.zip')" "jmcomic" + - name: upload-macos + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.Up_Url }} + asset_path: ${{ env.PACKAGENAME }}.zip + asset_name: ${{ env.PACKAGENAME }}.zip + asset_content_type: application/zip + + windows-nosr: + needs: [setup, release] + runs-on: windows-latest + env: + PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows_nosr_x64 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl + pip install -r src\requirements.txt + - name: Build + run: | + cd src + cp ..\res\icon\icon.ico .\ + pyinstaller -F -w -i icon.ico start.py mv dist jmcomic cp ..\LICENSE jmcomic\ cp ..\CHANGELOG jmcomic\ @@ -103,7 +277,47 @@ jobs: run: | cd src cp ..\res\icon\icon.ico .\ - pyinstaller --hidden-import=_cffi_backend --collect-data curl_cffi --add-data "..\lib\win\*;." -F -w -i icon.ico start.py + pyinstaller -F -w -i icon.ico start.py + mv dist jmcomic + cp ..\LICENSE jmcomic\ + cp ..\CHANGELOG jmcomic\ + cd .. + mkdir ${{ env.PACKAGENAME }} + mv src\jmcomic ${{ env.PACKAGENAME }} + 7z a -r "$($Env:PACKAGENAME + '.zip')" "jmcomic" + - name: upload-win + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.Up_Url }} + asset_path: ${{ env.PACKAGENAME }}.zip + asset_name: ${{ env.PACKAGENAME }}.zip + asset_content_type: application/zip + + windows7-nosr: + needs: [setup, release] + runs-on: windows-latest + env: + PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows7_nosr_x64 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller==4.6 + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl + pip install -r src\requirements_win7.txt + - name: Build + run: | + cd src + cp ..\res\icon\icon.ico .\ + pyinstaller -F -w -i icon.ico start.py mv dist jmcomic cp ..\LICENSE jmcomic\ cp ..\CHANGELOG jmcomic\ @@ -120,3 +334,53 @@ jobs: asset_path: ${{ env.PACKAGENAME }}.zip asset_name: ${{ env.PACKAGENAME }}.zip asset_content_type: application/zip + + ubuntu: + needs: [setup, release] + runs-on: ubuntu-20.04 + env: + PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_linux_x64 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + - name: Install dependencies + run: | + sudo apt-get install -y fuse libfuse2 + python -m pip install --upgrade pip + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp37-abi3-linux_x86_64.whl + pip install -r src/requirements.txt + - name: Build + run: | + cd src + pyinstaller -w start.py + cd dist + mkdir -p jmcomic.AppRun/usr/bin + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool-x86_64.AppImage + cp -r ../../res/appimage/* jmcomic.AppRun/ + cp -r ../../res/icon/logo_round.png jmcomic.AppRun/JMComic.png + cp -r start/* jmcomic.AppRun/usr/bin/ + + mv jmcomic.AppRun/usr/bin/start jmcomic.AppRun/usr/bin/JMComic + chmod +x jmcomic.AppRun/AppRun + chmod +x jmcomic.AppRun/usr/bin/JMComic + ./appimagetool-x86_64.AppImage jmcomic.AppRun + mv JMComic-x86_64.AppImage ../../${{ env.PACKAGENAME }}-x86_64.AppImage + cd ../.. + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGENAME }} + path: ${{ env.PACKAGENAME }}-x86_64.AppImage + - name: upload-win + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.Up_Url }} + asset_path: ${{ env.PACKAGENAME }}-x86_64.AppImage + asset_name: ${{ env.PACKAGENAME }}-x86_64.AppImage + asset_content_type: application/zip \ No newline at end of file diff --git a/script/build_universal2.py b/script/build_universal2.py new file mode 100644 index 0000000..10bdf90 --- /dev/null +++ b/script/build_universal2.py @@ -0,0 +1,33 @@ +import tempfile +import subprocess +import glob +import os +import sys +from wheel_filename import parse_wheel_filename +from delocate import fuse + + +cwd = "." +class Universal2Bundler: + + def build(self, dest_dir, package): + with tempfile.TemporaryDirectory() as tmp_dir: + + amd64_binary = "macosx_10_10_x86_64" + arm64_binary = "macosx_11_0_arm64" + subprocess.check_call(['python', '-m', 'pip', 'download', '--only-binary=:all:','--no-deps','--platform', amd64_binary, package, '-d', tmp_dir]) + subprocess.check_call(['python', '-m', 'pip', 'download', '--only-binary=:all:','--no-deps','--platform', arm64_binary, package, '-d', tmp_dir]) + universal_wheels = glob.glob("{0}/*".format(tmp_dir)) + + wheel = parse_wheel_filename(universal_wheels[0]) + universal2_wheel = os.path.join(dest_dir, "{0}-{1}-{2}-{3}-macosx_10_10_universal2.whl".format(package, wheel.version, wheel.python_tags[0], wheel.abi_tags[0])) + fuse.fuse_wheels(*universal_wheels, universal2_wheel) + print("Successfully created universal2 wheel ", universal2_wheel) +# python3 -m pip download --only-binary=:all: --platform macosx_10_10_x86_64 Pillow +# python3 -m pip download --only-binary=:all: --platform macosx_11_0_arm64 Pillow +name = sys.argv[1] +bundler = Universal2Bundler() +#bundler.build(cwd, "pillow") +#bundler.build(cwd, "cffi") +#bundler.build(cwd, "curl_cffi") +bundler.build(cwd, name) \ No newline at end of file diff --git a/src/component/progress_bar/dwater_progress_bar.py b/src/component/progress_bar/dwater_progress_bar.py index fefcf1d..45f57a2 100644 --- a/src/component/progress_bar/dwater_progress_bar.py +++ b/src/component/progress_bar/dwater_progress_bar.py @@ -5,6 +5,8 @@ from PySide6.QtSvg import QSvgRenderer from PySide6.QtWidgets import QProgressBar, QGraphicsDropShadowEffect +from tools.log import Log + WATER_FRONT = """ @@ -93,38 +95,42 @@ def resizePixmap(self, sz): self.waterBackImage = image def onTimerOut(self): - # interval can not be zero, and limit to 1 - self.interval = max(1, self.interval) - # move 60% per second - frontXDeta = 40.0 / (1000.0 / self.interval) - # move 90% per second - backXDeta = 60.0 / (1000.0 / self.interval) - - canvasWidth = int(self.width() * self.devicePixelRatioF()) - self.frontXOffset -= frontXDeta * canvasWidth / 100 - self.backXOffset += backXDeta * canvasWidth / 100 - - if self.frontXOffset > canvasWidth: - self.frontXOffset = canvasWidth - - if self.frontXOffset < - (self.waterFrontImage.width() - canvasWidth): - self.frontXOffset = canvasWidth - - if self.backXOffset > self.waterBackImage.width(): - self.backXOffset = 0 - - # update pop - # move 25% per second default - speed = 25 / (1000.0 / self.interval) # 100 / self.height() - for pop in self.pops: - # yOffset 0 ~ 100 - pop.yOffset += speed * pop.ySpeed - if pop.yOffset < 0: - pass - if pop.yOffset > self.value(): - pop.yOffset = 0 - pop.xOffset = math.sin((pop.yOffset / 100) * 2 * 3.14) * 18 * pop.xSpeed + 50 - self.update() + try: + # interval can not be zero, and limit to 1 + self.interval = max(1, self.interval) + # move 60% per second + frontXDeta = 40.0 / (1000.0 / self.interval) + # move 90% per second + backXDeta = 60.0 / (1000.0 / self.interval) + + canvasWidth = int(self.width() * self.devicePixelRatioF()) + self.frontXOffset -= frontXDeta * canvasWidth / 100 + self.backXOffset += backXDeta * canvasWidth / 100 + + if self.frontXOffset > canvasWidth: + self.frontXOffset = canvasWidth + + if self.frontXOffset < - (self.waterFrontImage.width() - canvasWidth): + self.frontXOffset = canvasWidth + + if self.backXOffset > self.waterBackImage.width(): + self.backXOffset = 0 + + # update pop + # move 25% per second default + speed = 25 / (1000.0 / self.interval) # 100 / self.height() + for pop in self.pops: + # yOffset 0 ~ 100 + pop.yOffset += speed * pop.ySpeed + if pop.yOffset < 0: + pass + if pop.yOffset > self.value(): + pop.yOffset = 0 + pop.xOffset = math.sin((pop.yOffset / 100) * 2 * 3.14) * 18 * pop.xSpeed + 50 + self.update() + except Exception as es: + Log.Error(es) + self.timer.stop() def paint(self, painter): painter.setRenderHint(QPainter.Antialiasing) diff --git a/src/config/config.py b/src/config/config.py index 87b2986..9c77a69 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -22,9 +22,9 @@ UpdateUrl2Back = "https://hub.ggo.icu/tonquer/JMComic-qt/" UpdateUrl3Back = "https://hub.fastgit.xyz/tonquer/JMComic-qt" -UpdateVersion = "v1.2.5" -RealVersion = "v1.2.5" -VersionTime = "2024-10-15" +UpdateVersion = "v1.2.6" +RealVersion = "v1.2.6" +VersionTime = "2024-11-17" Waifu2xVersion = "1.2.0" LoginUserName = "" diff --git a/src/config/setting.py b/src/config/setting.py index 6d891e4..ef6debf 100644 --- a/src/config/setting.py +++ b/src/config/setting.py @@ -84,7 +84,10 @@ class Setting: TitleLine = SettingValue("GeneraSetting", 2, False) # NotCategoryShow = SettingValue("GeneraSetting", 0, False) # CategorySize = SettingValue("GeneraSetting", 80, False) # - ScaleLevel = SettingValue("GeneraSetting", 0, True, ["Auto", 100, 125, 150, 175, 200]) + # ScaleLevel = SettingValue("GeneraSetting", 0, True, ["Auto", 100, 125, 150, 175, 200]) + IsUseScaleFactor = SettingValue("GeneraSetting", 0, True) + ScaleFactor = SettingValue("GeneraSetting", 100, True) + IsUseTitleBar = SettingValue("GeneraSetting", 1, True) FontName = SettingValue("GeneraSetting", "", True) diff --git a/src/interface/ui_book_eps.py b/src/interface/ui_book_eps.py index d63d85e..a68ec7a 100644 --- a/src/interface/ui_book_eps.py +++ b/src/interface/ui_book_eps.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_book_eps.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_book_info.py b/src/interface/ui_book_info.py index d15aa76..21e823f 100644 --- a/src/interface/ui_book_info.py +++ b/src/interface/ui_book_info.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_book_info.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_category.py b/src/interface/ui_category.py index e9ccc07..d24e980 100644 --- a/src/interface/ui_category.py +++ b/src/interface/ui_category.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_category.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_comic_item.py b/src/interface/ui_comic_item.py index e1e2b51..4186ef8 100644 --- a/src/interface/ui_comic_item.py +++ b/src/interface/ui_comic_item.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_comic_item.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_comment.py b/src/interface/ui_comment.py index 2281e29..68ffc06 100644 --- a/src/interface/ui_comment.py +++ b/src/interface/ui_comment.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_comment.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_comment_item.py b/src/interface/ui_comment_item.py index df00bc1..3ac2486 100644 --- a/src/interface/ui_comment_item.py +++ b/src/interface/ui_comment_item.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_comment_item.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_doh_dns.py b/src/interface/ui_doh_dns.py index 9335e60..0ae80b5 100644 --- a/src/interface/ui_doh_dns.py +++ b/src/interface/ui_doh_dns.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_doh_dns.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_download.py b/src/interface/ui_download.py index a6d7bf8..4dd324f 100644 --- a/src/interface/ui_download.py +++ b/src/interface/ui_download.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_download.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_download_all.py b/src/interface/ui_download_all.py index d8f9c69..031f439 100644 --- a/src/interface/ui_download_all.py +++ b/src/interface/ui_download_all.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_download_all.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_download_dir.py b/src/interface/ui_download_dir.py index 11ed7c6..5966ffc 100644 --- a/src/interface/ui_download_dir.py +++ b/src/interface/ui_download_dir.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_download_dir.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_download_some.py b/src/interface/ui_download_some.py index 900fbb3..68bcecd 100644 --- a/src/interface/ui_download_some.py +++ b/src/interface/ui_download_some.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_download_some.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_download_some_edit.py b/src/interface/ui_download_some_edit.py index fcf84d2..6c91321 100644 --- a/src/interface/ui_download_some_edit.py +++ b/src/interface/ui_download_some_edit.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_download_some_edit.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_exit.py b/src/interface/ui_exit.py index 468749d..b973b30 100644 --- a/src/interface/ui_exit.py +++ b/src/interface/ui_exit.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_exit.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_favorite.py b/src/interface/ui_favorite.py index 8488939..47c7804 100644 --- a/src/interface/ui_favorite.py +++ b/src/interface/ui_favorite.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_favorite.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_favorite_fold.py b/src/interface/ui_favorite_fold.py index e36d580..e3f4026 100644 --- a/src/interface/ui_favorite_fold.py +++ b/src/interface/ui_favorite_fold.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_favorite_fold.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_help.py b/src/interface/ui_help.py index 2794545..dc7f4f7 100644 --- a/src/interface/ui_help.py +++ b/src/interface/ui_help.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_help.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_help_log_widget.py b/src/interface/ui_help_log_widget.py index 398672c..bf933b0 100644 --- a/src/interface/ui_help_log_widget.py +++ b/src/interface/ui_help_log_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_help_log_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_history.py b/src/interface/ui_history.py index 9248a63..ca498fa 100644 --- a/src/interface/ui_history.py +++ b/src/interface/ui_history.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_history.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_index.py b/src/interface/ui_index.py index 8f5d7db..251641c 100644 --- a/src/interface/ui_index.py +++ b/src/interface/ui_index.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_index.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_line_edit_help_widget.py b/src/interface/ui_line_edit_help_widget.py index ed09130..d4d2c2e 100644 --- a/src/interface/ui_line_edit_help_widget.py +++ b/src/interface/ui_line_edit_help_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_line_edit_help_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_local.py b/src/interface/ui_local.py index d577cbe..8325946 100644 --- a/src/interface/ui_local.py +++ b/src/interface/ui_local.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_local.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_local_all.py b/src/interface/ui_local_all.py index 1862fe6..f1e86ef 100644 --- a/src/interface/ui_local_all.py +++ b/src/interface/ui_local_all.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_local_all.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_local_eps.py b/src/interface/ui_local_eps.py index a8e2acc..48356ab 100644 --- a/src/interface/ui_local_eps.py +++ b/src/interface/ui_local_eps.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_local_eps.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_local_favorite.py b/src/interface/ui_local_favorite.py index 98ce262..d10bafe 100644 --- a/src/interface/ui_local_favorite.py +++ b/src/interface/ui_local_favorite.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_local_favorite.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_local_fold.py b/src/interface/ui_local_fold.py index 1519f1a..0d1c115 100644 --- a/src/interface/ui_local_fold.py +++ b/src/interface/ui_local_fold.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_local_fold.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_login.py b/src/interface/ui_login.py index 1618cb3..c3f3c52 100644 --- a/src/interface/ui_login.py +++ b/src/interface/ui_login.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_login.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_login_proxy_widget.py b/src/interface/ui_login_proxy_widget.py index a686414..35d867c 100644 --- a/src/interface/ui_login_proxy_widget.py +++ b/src/interface/ui_login_proxy_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_login_proxy_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_login_widget.py b/src/interface/ui_login_widget.py index 3ab2ef0..efb0460 100644 --- a/src/interface/ui_login_widget.py +++ b/src/interface/ui_login_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_login_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_main.py b/src/interface/ui_main.py index 072e136..1b01ff2 100644 --- a/src/interface/ui_main.py +++ b/src/interface/ui_main.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_main.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_main_windows.py b/src/interface/ui_main_windows.py index 25a3f1c..55d3de1 100644 --- a/src/interface/ui_main_windows.py +++ b/src/interface/ui_main_windows.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_main_windows.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_nas.py b/src/interface/ui_nas.py index 293f95b..309d3f2 100644 --- a/src/interface/ui_nas.py +++ b/src/interface/ui_nas.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_nas.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_nas_add.py b/src/interface/ui_nas_add.py index 30579c4..00fe99b 100644 --- a/src/interface/ui_nas_add.py +++ b/src/interface/ui_nas_add.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_nas_add.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_nas_item.py b/src/interface/ui_nas_item.py index be5cbe6..12f3533 100644 --- a/src/interface/ui_nas_item.py +++ b/src/interface/ui_nas_item.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_nas_item.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_navigation.py b/src/interface/ui_navigation.py index 3bb9b35..26cebf5 100644 --- a/src/interface/ui_navigation.py +++ b/src/interface/ui_navigation.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_navigation.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_read_tool.py b/src/interface/ui_read_tool.py index 98f0dc2..855193a 100644 --- a/src/interface/ui_read_tool.py +++ b/src/interface/ui_read_tool.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_read_tool.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -40,7 +40,7 @@ def setupUi(self, ReadImg): self.scrollArea22.setWidgetResizable(True) self.scrollAreaWidgetContents = QWidget() self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") - self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 301, 840)) + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 301, 841)) self.verticalLayout_2 = QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout = QVBoxLayout() @@ -245,9 +245,6 @@ def setupUi(self, ReadImg): self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.modelNameButton = QPushButton(self.scrollAreaWidgetContents) self.modelNameButton.setObjectName(u"modelNameButton") - font = QFont() - font.setPointSize(8) - self.modelNameButton.setFont(font) self.horizontalLayout_8.addWidget(self.modelNameButton) diff --git a/src/interface/ui_register_widget.py b/src/interface/ui_register_widget.py index d59e27f..4d6c14f 100644 --- a/src/interface/ui_register_widget.py +++ b/src/interface/ui_register_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_register_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_search.py b/src/interface/ui_search.py index ebde340..40679df 100644 --- a/src/interface/ui_search.py +++ b/src/interface/ui_search.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_search.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -161,7 +161,7 @@ def retranslateUi(self, Search): #endif // QT_CONFIG(tooltip) self.label_2.setText(QCoreApplication.translate("Search", u"\u641c\u7d22\uff1a", None)) #if QT_CONFIG(tooltip) - self.label_3.setToolTip(QCoreApplication.translate("Search", u"

\u641c\u5bfb\u7684\u6700\u4f73\u59ff\u52bf?

\u3010\u5305\u542b\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c][+]\u4eba\u59bb,\u4ec5\u663e\u793a\u5168\u5f69\u4e14\u662f\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 +\u4eba\u59bb

\u3010\u6392\u9664\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c][]\u4eba\u59bb,\u663e\u793a\u5168\u5f69\u5e76\u6392\u9664\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 -\u4eba\u59bb

\u3010\u6211\u90fd\u8981\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c]\u4eba\u59bb,\u4f1a\u663e\u793a\u6240\u6709\u5305\u542b\u5168\u5f69\u53ca\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 \u4eba\u59bb

", None)) + self.label_3.setToolTip(QCoreApplication.translate("Search", u"

\u641c\u5bfb\u7684\u6700\u4f73\u59ff\u52bf?

\u3010\u7cbe\u786e\u641c\u7d22\u3011

jm+\u53f7\u7801


\u3010\u5305\u542b\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c][+]\u4eba\u59bb,\u4ec5\u663e\u793a\u5168\u5f69\u4e14\u662f\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 +\u4eba\u59bb

\u3010\u6392\u9664\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c][]\u4eba\u59bb,\u663e\u793a\u5168\u5f69\u5e76\u6392\u9664\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 -\u4eba\u59bb

\u3010\u6211\u90fd\u8981\u641c\u5bfb\u3011

\u641c\u5bfb\u5168\u5f69[\u7a7a\u683c]\u4eba\u59bb,\u4f1a\u663e\u793a\u6240\u6709\u5305\u542b\u5168\u5f69\u53ca\u4eba\u59bb\u7684\u672c\u672c

\u8303\u4f8b:\u5168\u5f69 \u4eba\u59bb

", None)) #endif // QT_CONFIG(tooltip) self.label_3.setText(QCoreApplication.translate("Search", u"?", None)) self.searchButton.setText(QCoreApplication.translate("Search", u"\u641c\u7d22", None)) diff --git a/src/interface/ui_setting_new.py b/src/interface/ui_setting_new.py index 75b733e..0d96c4d 100644 --- a/src/interface/ui_setting_new.py +++ b/src/interface/ui_setting_new.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_setting_new.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -83,7 +83,7 @@ def setupUi(self, SettingNew): self.scrollArea.setWidgetResizable(True) self.scrollAreaWidgetContents = QWidget() self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") - self.scrollAreaWidgetContents.setGeometry(QRect(0, -919, 661, 2911)) + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 661, 2794)) self.scrollAreaWidgetContents.setStyleSheet(u"") self.verticalLayout_4 = QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_4.setObjectName(u"verticalLayout_4") @@ -324,68 +324,33 @@ def setupUi(self, SettingNew): self.verticalLayout_16.addWidget(self.label) - self.mainScaleButton0 = QRadioButton(self.frame_13) - self.mainScaleGroup = QButtonGroup(SettingNew) - self.mainScaleGroup.setObjectName(u"mainScaleGroup") - self.mainScaleGroup.addButton(self.mainScaleButton0) - self.mainScaleButton0.setObjectName(u"mainScaleButton0") - self.mainScaleButton0.setChecked(True) + self.mainScaleBox = QCheckBox(self.frame_13) + self.mainScaleBox.setObjectName(u"mainScaleBox") - self.verticalLayout_16.addWidget(self.mainScaleButton0) + self.verticalLayout_16.addWidget(self.mainScaleBox) - self.mainScaleButton1 = QRadioButton(self.frame_13) - self.mainScaleGroup.addButton(self.mainScaleButton1) - self.mainScaleButton1.setObjectName(u"mainScaleButton1") + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.label_13 = QLabel(self.frame_13) + self.label_13.setObjectName(u"label_13") + self.label_13.setMaximumSize(QSize(150, 16777215)) - self.verticalLayout_16.addWidget(self.mainScaleButton1) + self.horizontalLayout_4.addWidget(self.label_13) - self.mainScaleButton2 = QRadioButton(self.frame_13) - self.mainScaleGroup.addButton(self.mainScaleButton2) - self.mainScaleButton2.setObjectName(u"mainScaleButton2") + self.scaleBox = WheelSpinBox(self.frame_13) + self.scaleBox.setObjectName(u"scaleBox") + self.scaleBox.setMinimum(50) + self.scaleBox.setMaximum(300) + self.scaleBox.setValue(100) - self.verticalLayout_16.addWidget(self.mainScaleButton2) + self.horizontalLayout_4.addWidget(self.scaleBox) - self.mainScaleButton3 = QRadioButton(self.frame_13) - self.mainScaleGroup.addButton(self.mainScaleButton3) - self.mainScaleButton3.setObjectName(u"mainScaleButton3") - self.verticalLayout_16.addWidget(self.mainScaleButton3) - - self.mainScaleButton4 = QRadioButton(self.frame_13) - self.mainScaleGroup.addButton(self.mainScaleButton4) - self.mainScaleButton4.setObjectName(u"mainScaleButton4") - - self.verticalLayout_16.addWidget(self.mainScaleButton4) - - self.mainScaleButton5 = QRadioButton(self.frame_13) - self.mainScaleGroup.addButton(self.mainScaleButton5) - self.mainScaleButton5.setObjectName(u"mainScaleButton5") - - self.verticalLayout_16.addWidget(self.mainScaleButton5) + self.verticalLayout_16.addLayout(self.horizontalLayout_4) self.verticalLayout_4.addWidget(self.frame_13) - self.frame = QFrame(self.scrollAreaWidgetContents) - self.frame.setObjectName(u"frame") - self.frame.setFrameShape(QFrame.StyledPanel) - self.frame.setFrameShadow(QFrame.Raised) - self.verticalLayout_14 = QVBoxLayout(self.frame) - self.verticalLayout_14.setObjectName(u"verticalLayout_14") - self.label_30 = QLabel(self.frame) - self.label_30.setObjectName(u"label_30") - self.label_30.setFont(font1) - - self.verticalLayout_14.addWidget(self.label_30) - - self.titleBox = QCheckBox(self.frame) - self.titleBox.setObjectName(u"titleBox") - - self.verticalLayout_14.addWidget(self.titleBox) - - - self.verticalLayout_4.addWidget(self.frame) - self.frame_17 = QFrame(self.scrollAreaWidgetContents) self.frame_17.setObjectName(u"frame_17") self.frame_17.setFrameShape(QFrame.StyledPanel) @@ -1297,7 +1262,7 @@ def retranslateUi(self, SettingNew): self.generalLabel.setText(QCoreApplication.translate("SettingNew", u"\u901a\u7528", None)) self.label_update.setText(QCoreApplication.translate("SettingNew", u"\u66f4\u65b0\uff1a", None)) self.checkBox_IsUpdate.setText(QCoreApplication.translate("SettingNew", u"\u542f\u52a8\u65f6\u68c0\u67e5\u66f4\u65b0", None)) - self.label_37.setText(QCoreApplication.translate("SettingNew", u"\u89e6\u63a7\uff08\u91cd\u542f\u751f\u6548\uff09\uff1a", None)) + self.label_37.setText(QCoreApplication.translate("SettingNew", u"\u89e6\u63a7\uff08\u91cd\u542f\u751f\u6548\uff09\uff08\u5982\u679c\u51fa\u73b0\u70b9\u51fb\u56fe\u7247\u4f4d\u7f6e\u9519\u4e71\uff0c\u8bf7\u4f7f\u7528100%\u7f29\u653e\uff09\uff1a", None)) self.grabGestureBox.setText(QCoreApplication.translate("SettingNew", u"\u542f\u7528\u89e6\u63a7\u4f18\u5316", None)) self.label_6.setText(QCoreApplication.translate("SettingNew", u"\u4e3b\u9898\uff1a", None)) self.themeButton0.setText(QCoreApplication.translate("SettingNew", u"\u8ddf\u968f\u7cfb\u7edf", None)) @@ -1335,14 +1300,8 @@ def retranslateUi(self, SettingNew): self.fontStyle.setItemText(5, QCoreApplication.translate("SettingNew", u"\u9ed1\u4f53", None)) self.label.setText(QCoreApplication.translate("SettingNew", u"\u754c\u9762\u7f29\u653e\u663e\u793a\uff08\u9700\u91cd\u542f\u751f\u6548\uff09\uff1a", None)) - self.mainScaleButton0.setText(QCoreApplication.translate("SettingNew", u"\u6839\u636e\u7cfb\u7edf\u7f29\u653e", None)) - self.mainScaleButton1.setText(QCoreApplication.translate("SettingNew", u"100%\uff08\u4e0d\u7f29\u653e\uff09", None)) - self.mainScaleButton2.setText(QCoreApplication.translate("SettingNew", u"125%", None)) - self.mainScaleButton3.setText(QCoreApplication.translate("SettingNew", u"150%", None)) - self.mainScaleButton4.setText(QCoreApplication.translate("SettingNew", u"175%", None)) - self.mainScaleButton5.setText(QCoreApplication.translate("SettingNew", u"200%", None)) - self.label_30.setText(QCoreApplication.translate("SettingNew", u"\u6807\u9898\u680f\u8bbe\u7f6e\uff08\u9700\u91cd\u542f\uff09", None)) - self.titleBox.setText(QCoreApplication.translate("SettingNew", u"\u6807\u9898\u680f\u7f8e\u5316\uff08\u591a\u5c4f\u5efa\u8bae\u4e0d\u52fe\u9009\uff0cwin11\u53ef\u4e0d\u52fe\u9009\uff09", None)) + self.mainScaleBox.setText(QCoreApplication.translate("SettingNew", u"\u662f\u5426\u4f7f\u7528\u81ea\u5b9a\u4e49\u7f29\u653e\u6bd4\u4f8b", None)) + self.label_13.setText(QCoreApplication.translate("SettingNew", u"\u7f29\u653e\u6bd4\u4f8b\uff1a", None)) self.label_38.setText(QCoreApplication.translate("SettingNew", u"\u5173\u95ed\u8bbe\u7f6e", None)) self.showCloseButton0.setText(QCoreApplication.translate("SettingNew", u"\u5173\u95ed\u540e\u9000\u51fa", None)) self.showCloseButton1.setText(QCoreApplication.translate("SettingNew", u"\u5173\u95ed\u540e\u6700\u5c0f\u5316\u5230\u6258\u76d8", None)) diff --git a/src/interface/ui_sign_widget.py b/src/interface/ui_sign_widget.py index b01cbcf..25181e7 100644 --- a/src/interface/ui_sign_widget.py +++ b/src/interface/ui_sign_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_sign_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_sr_select_widget.py b/src/interface/ui_sr_select_widget.py index 49ed941..47ab353 100644 --- a/src/interface/ui_sr_select_widget.py +++ b/src/interface/ui_sr_select_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_sr_select_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_sub_comment.py b/src/interface/ui_sub_comment.py index 5e4ee7c..9047287 100644 --- a/src/interface/ui_sub_comment.py +++ b/src/interface/ui_sub_comment.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_sub_comment.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_title_bar.py b/src/interface/ui_title_bar.py index abbaa94..fe98368 100644 --- a/src/interface/ui_title_bar.py +++ b/src/interface/ui_title_bar.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_title_bar.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_user_manager_widget.py b/src/interface/ui_user_manager_widget.py index 36deba2..d26d5f5 100644 --- a/src/interface/ui_user_manager_widget.py +++ b/src/interface/ui_user_manager_widget.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_user_manager_widget.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/interface/ui_waifu2x_tool.py b/src/interface/ui_waifu2x_tool.py index 6e5f7c1..11b477f 100644 --- a/src/interface/ui_waifu2x_tool.py +++ b/src/interface/ui_waifu2x_tool.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_waifu2x_tool.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -214,7 +214,7 @@ def setupUi(self, Waifu2xTool): self.label_9.setObjectName(u"label_9") self.label_9.setMaximumSize(QSize(60, 16777215)) - self.horizontalLayout_11.addWidget(self.label_9) + self.horizontalLayout_11.addWidget(self.label_9, 0, Qt.AlignLeft) self.gpuLabel = QLabel(self.scrollAreaWidgetContents) self.gpuLabel.setObjectName(u"gpuLabel") @@ -297,7 +297,7 @@ def setupUi(self, Waifu2xTool): self.headButton.setObjectName(u"headButton") self.headButton.setMaximumSize(QSize(100, 16777215)) - self.verticalLayout_3.addWidget(self.headButton, 0, Qt.AlignLeft) + self.verticalLayout_3.addWidget(self.headButton, 0, Qt.AlignHCenter) self.verticalLayout_4.addLayout(self.verticalLayout_3) diff --git a/src/interface/ui_week.py b/src/interface/ui_week.py index 3ce8e23..3236db5 100644 --- a/src/interface/ui_week.py +++ b/src/interface/ui_week.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'ui_week.ui' ## -## Created by: Qt User Interface Compiler version 6.5.3 +## Created by: Qt User Interface Compiler version 6.2.4 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/src/requirements.txt b/src/requirements.txt index b33a748..3ac9d90 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,4 +1,4 @@ -pyside6-essentials==6.5.3 +pyside6==6.2.4 requests==2.26.0 urllib3==1.25.11 pillow==8.3.2 diff --git a/src/requirements_macos.txt b/src/requirements_macos.txt index 6889001..e5416e9 100644 --- a/src/requirements_macos.txt +++ b/src/requirements_macos.txt @@ -1,13 +1,13 @@ -PySide6==6.1.3 +PySide6==6.4.3 requests==2.26.0 urllib3==1.25.11 -pillow==8.3.2 +pillow bs4==0.0.1 -lxml==4.6.4 +lxml pycryptodomex==3.12.0 Pysocks==1.7.1 natsort==8.2.0 -curl_cffi==0.5.10 +curl_cffi jmcomic>=2.4.3 webdavclient3==3.14.6 tqdm==4.66.4 diff --git a/src/start.py b/src/start.py index e91e65c..541b660 100644 --- a/src/start.py +++ b/src/start.py @@ -5,10 +5,10 @@ # macOS 修复 import time import traceback - +import signal from config import config -from config.setting import Setting +from config.setting import Setting, SettingValue from qt_error import showError, showError2 from qt_owner import QtOwner from tools.log import Log @@ -29,7 +29,7 @@ config.ErrorMsg = es.msg from PySide6.QtGui import QFont -from PySide6 import QtWidgets # 导入PySide6部件 +from PySide6 import QtWidgets, QtGui # 导入PySide6部件 from PySide6.QtNetwork import QLocalSocket, QLocalServer # 此处不能删除 import images_rc @@ -40,9 +40,11 @@ Log.Init() Setting.Init() Setting.InitLoadSetting() - indexV = Setting.ScaleLevel.GetIndexV() - if indexV and indexV != "Auto": - os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "0" + os.environ['QT_IMAGEIO_MAXALLOC'] = "10000000000000000000000000000000000000000000000000000000000000000" + QtGui.QImageReader.setAllocationLimit(0) + if Setting.IsUseScaleFactor.value > 0: + indexV = Setting.ScaleFactor.value + # os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "0" os.environ["QT_SCALE_FACTOR"] = str(indexV / 100) except Exception as es: @@ -93,6 +95,8 @@ def excepthook(exc_type, exc_value, exc_tb): showError2(tb, app) sys.excepthook = excepthook + signal.signal(signal.SIGINT, signal.SIG_DFL) + sts = app.exec() sys.excepthook = oldHook socket.close() diff --git a/src/task/task_qimage.py b/src/task/task_qimage.py index 78dba88..2cf01c4 100644 --- a/src/task/task_qimage.py +++ b/src/task/task_qimage.py @@ -3,7 +3,7 @@ from task.qt_task import TaskBase from tools.log import Log -from tools.tool import ToolUtil +from tools.tool import ToolUtil, time_me class QtQImageTask(object): @@ -41,7 +41,6 @@ def Run(self): if taskId < 0: break - q = QImage() try: info = self.tasks.get(taskId) if not info: @@ -52,18 +51,24 @@ def Run(self): if isinstance(info.saveParams, tuple) and len(info.saveParams) > 1: epsId, scrambleId, pitureName = info.saveParams info.data = ToolUtil.SegmentationPicture(info.data, epsId, scrambleId, pitureName) - q.loadFromData(info.data) - q.setDevicePixelRatio(info.radio) - if info.toW > 0: - newQ = q.scaled(info.toW * info.radio, info.toH * info.radio, Qt.KeepAspectRatio, Qt.SmoothTransformation) - else: - newQ = q + newQ = self.ConverQImage(info) except Exception as es: Log.Error(es) finally: self.taskObj.imageBack.emit(taskId, newQ) + @time_me + def ConverQImage(self, info): + q = QImage() + q.loadFromData(info.data) + q.setDevicePixelRatio(info.radio) + if info.toW > 0: + newQ = q.scaled(info.toW * info.radio, info.toH * info.radio, Qt.KeepAspectRatio, Qt.SmoothTransformation) + else: + newQ = q + return newQ + def AddQImageTask(self, data, radio, toW, toH, model, saveParams, callBack=None, backParam=None, cleanFlag=None): self.taskId += 1 info = QtQImageTask(self.taskId) diff --git a/src/view/read/read_enum.py b/src/view/read/read_enum.py index 46374d7..8ef8186 100644 --- a/src/view/read/read_enum.py +++ b/src/view/read/read_enum.py @@ -182,6 +182,49 @@ def GetReadScale(stripModel, scaleCnt, maxWidth, maxHeight, isToQImage): toScaleW = 0 return toScaleW, toScaleH + @staticmethod + def GetReadScaleMax(stripModel, scaleCnt, maxWidth, maxHeight): + # 提前scaled + # 不进行缩放了,因为导致模糊 + if stripModel == ReadMode.LeftRight: + scale = (1 + scaleCnt * 0.1) + wight = int(maxWidth * scale) + height = maxHeight * scale + toScaleW = wight + toScaleH = height + elif stripModel in [ReadMode.RightLeftDouble, ReadMode.RightLeftDouble2]: + scale = (1 + scaleCnt * 0.1) + toScaleW =int(maxWidth // 2 * scale) + toScaleH = maxHeight * scale + + elif stripModel in [ReadMode.LeftRightDouble]: + scale = (1 + scaleCnt * 0.1) + + toScaleW = 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 = (1 + scaleCnt * 0.1) + toScaleW = min(maxWidth, maxWidth * scale) + toScaleH = maxHeight * scale * 10 + elif stripModel in [ReadMode.Samewight]: + scale = (1 + scaleCnt * 0.1) + toScaleW = maxWidth * scale + toScaleH = maxHeight * scale * 10 + else: + return maxWidth, maxHeight + + return toW, toH + @staticmethod def GetReadToPos(stripModel, maxWidth, maxHeight, toWidth, toHeight, index, curIndex, oldPos): if stripModel in [ReadMode.LeftRight, ReadMode.Samewight]: diff --git a/src/view/read/read_tool.py b/src/view/read/read_tool.py index d5f82b4..943f5f4 100644 --- a/src/view/read/read_tool.py +++ b/src/view/read/read_tool.py @@ -200,7 +200,8 @@ def _NextPage(self): else: bookInfo = BookMgr().GetBook(bookId) - if epsId + 1 < bookInfo.pageInfo.maxEps(): + nextEps = bookInfo.pageInfo.nextEps(epsId) + if not (nextEps == self.readImg.epsId or nextEps not in bookInfo.pageInfo.epsInfo): QtOwner().ShowMsg(Str.GetStr(Str.AutoSkipNext)) self.OpenNextEps() return @@ -412,7 +413,7 @@ def OpenNextEps(self): return else: nextEps = bookInfo.pageInfo.nextEps(epsId) - if nextEps >= bookInfo.pageInfo.maxEps(): + if nextEps == self.readImg.epsId or nextEps not in bookInfo.pageInfo.epsInfo: QtOwner().ShowMsg(Str.GetStr(Str.AlreadyNextChapter)) return diff --git a/src/view/read/read_view.py b/src/view/read/read_view.py index 15e2885..3405fa7 100644 --- a/src/view/read/read_view.py +++ b/src/view/read/read_view.py @@ -320,6 +320,13 @@ def CheckLoadPicture(self): preLoadList = list(range(self.curIndex, self.curIndex + config.PreLoading)) preQImage = list(range(self.curIndex, self.curIndex + config.PreLook)) + preRealQImage = list(range(self.curIndex, self.curIndex + config.PreLook)) + # if ReadMode.isScroll(self.stripModel): + # preRealQImage = list(range(self.curIndex, self.curIndex + config.PreLook)) + # elif ReadMode.isDouble(self.stripModel): + # preRealQImage = [self.curIndex, self.curIndex+1] + # else: + # preRealQImage = [self.curIndex] # 预加载上一页 if len(preLoadList) >= 2 and self.curIndex > 0: @@ -367,16 +374,17 @@ def CheckLoadPicture(self): if p.waifuState == p.WaifuStateStart: break - for i in preQImage: + for i in preRealQImage: p = self.pictureData.get(i) if not p or not p.data: continue assert isinstance(p, QtFileData) - if not (p.cacheImage or p.cacheImageTaskId > 0): - self.CheckToQImage(i, p, False) - + IsConvert = (p.cacheWaifu2xImageTaskId > 0 or not not p.cacheWaifu2xImage) if not (not p.waifuData or p.cacheWaifu2xImage or p.cacheWaifu2xImageTaskId > 0): - self.CheckToQImage(i, p, True) + IsConvert = self.CheckToQImage(i, p, True) + + if (not IsConvert or not p.isWaifu2x) and not (p.cacheImage or p.cacheImageTaskId > 0): + self.CheckToQImage(i, p, False) for i in set(self.pictureData.keys()) - set(preQImage): p = self.pictureData.get(i) @@ -467,10 +475,12 @@ def CompleteDownloadPic(self, data, st, index): def CheckToQImage(self, index, p, isWaifu2x=False): saveParams = None + + if not (self.isOffline or self.isLocal): bookInfo = BookMgr().GetBook(self.bookId) if not bookInfo: - return + return False epsInfo = bookInfo.pageInfo.epsInfo.get(self.epsId) pitureName = epsInfo.pictureName.get(index) @@ -488,11 +498,14 @@ def CheckToQImage(self, index, p, isWaifu2x=False): p.cacheImage = None p.cacheImageScale = self.frame.scaleCnt p.cacheImageTaskId = self.AddQImageTask(p.data, self.devicePixelRatio(), toW, toH, model, saveParams, self.ConvertQImageBack, index) + return True else: if p.waifuData: p.cacheWaifu2xImage = None p.cacheWaifu2xImageScale = self.frame.scaleCnt - p.cacheImageWaifu2xTaskId = self.AddQImageTask(p.waifuData, self.devicePixelRatio(), toW, toH, model, None, self.ConvertQImageWaifu2xBack, index) + p.cacheWaifu2xImageTaskId = self.AddQImageTask(p.waifuData, self.devicePixelRatio(), toW, toH, model, None, self.ConvertQImageWaifu2xBack, index) + return True + return False def ConvertQImageBack(self, data, index): assert isinstance(data, QImage) @@ -578,7 +591,8 @@ def ShowImg(self, index): return isCurIndex = index == self.curIndex p = self.pictureData.get(index) - if not p or (not p.data) or (not p.cacheImage): + IsHaveWaifu2xData = (not not p and p.isWaifu2x and p.cacheWaifu2xImage) + if not IsHaveWaifu2xData and (not p or (not p.data) or (not p.cacheImage)): self.scrollArea.SetPixIem(index, None) if isCurIndex: if not p or (not p.data): diff --git a/src/view/setting/setting_view.py b/src/view/setting/setting_view.py index f9a2440..d7099b3 100644 --- a/src/view/setting/setting_view.py +++ b/src/view/setting/setting_view.py @@ -40,18 +40,18 @@ def __init__(self, parent=None): self.themeGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.ThemeIndex)) self.languageGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.Language)) self.logGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.LogIndex)) - self.mainScaleGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.ScaleLevel)) self.proxyGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.IsHttpProxy)) self.saveNameGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.SaveNameType)) self.showCloseButtonGroup.buttonClicked.connect(partial(self.ButtonClickEvent, Setting.ShowCloseType)) # CheckButton: + self.mainScaleBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsUseScaleFactor, self.mainScaleBox)) self.checkBox_IsUpdate.clicked.connect(partial(self.CheckButtonEvent, Setting.IsUpdate, self.checkBox_IsUpdate)) self.readCheckBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsOpenWaifu, self.readCheckBox)) self.preDownWaifu2x.clicked.connect(partial(self.CheckButtonEvent, Setting.PreDownWaifu2x, self.preDownWaifu2x)) self.coverCheckBox.clicked.connect(partial(self.CheckButtonEvent, Setting.CoverIsOpenWaifu, self.coverCheckBox)) self.downAuto.clicked.connect(partial(self.CheckButtonEvent, Setting.DownloadAuto, self.downAuto)) - self.titleBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsUseTitleBar, self.titleBox)) + # self.titleBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsUseTitleBar, self.titleBox)) self.openglBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsOpenOpenGL, self.openglBox)) self.grabGestureBox.clicked.connect(partial(self.CheckButtonEvent, Setting.IsGrabGesture, self.grabGestureBox)) @@ -84,6 +84,7 @@ def __init__(self, parent=None): # spinBox # self.preDownNum.valueChanged.connect(partial(self.SpinBoxEvent, "", self.preDownNum)) + self.scaleBox.valueChanged.connect(partial(self.SpinBoxEvent, Setting.ScaleFactor)) self.coverSize.valueChanged.connect(partial(self.SpinBoxEvent, Setting.CoverSize)) self.categorySize.valueChanged.connect(partial(self.SpinBoxEvent, Setting.CategorySize)) self.readScale.valueChanged.connect(partial(self.SpinBoxEvent, Setting.LookScale)) @@ -235,9 +236,10 @@ def ExitSaveSetting(self, mainQsize): def InitSetting(self): self.checkBox_IsUpdate.setChecked(Setting.IsUpdate.value) + self.mainScaleBox.setChecked(Setting.IsUseScaleFactor.value) self.SetRadioGroup("themeButton", Setting.ThemeIndex.value) self.SetRadioGroup("languageButton", Setting.Language.value) - self.SetRadioGroup("mainScaleButton", Setting.ScaleLevel.value) + # self.SetRadioGroup("mainScaleButton", Setting.ScaleLevel.value) self.SetRadioGroup("proxy", Setting.IsHttpProxy.value) self.SetRadioGroup("saveNameButton", Setting.SaveNameType.value) self.SetRadioGroup("showCloseButton", Setting.ShowCloseType.value) @@ -246,7 +248,7 @@ def InitSetting(self): self.SetRadioGroup("logutton", Setting.LogIndex.value) self.httpEdit.setText(Setting.HttpProxy.value) self.sockEdit.setText(Setting.Sock5Proxy.value) - self.titleBox.setChecked(Setting.IsUseTitleBar.value) + # self.titleBox.setChecked(Setting.IsUseTitleBar.value) self.openglBox.setChecked(Setting.IsOpenOpenGL.value) self.grabGestureBox.setChecked(Setting.IsGrabGesture.value) for index in range(self.encodeSelect.count()): @@ -267,6 +269,7 @@ def InitSetting(self): self.preDownWaifu2x.setChecked(Setting.PreDownWaifu2x.value) # self.readNoise.setCurrentIndex(Setting.LookNoise.value) self.readScale.setValue(Setting.LookScale.value) + self.scaleBox.setValue(Setting.ScaleFactor.value) # self.readModel.setCurrentIndex(Setting.LookModel.value) self.categoryBox.setCurrentIndex(Setting.NotCategoryShow.value) diff --git a/src/view/tool/waifu2x_tool_view.py b/src/view/tool/waifu2x_tool_view.py index ef1192b..0f327bb 100644 --- a/src/view/tool/waifu2x_tool_view.py +++ b/src/view/tool/waifu2x_tool_view.py @@ -2,7 +2,7 @@ import time from PySide6 import QtWidgets, QtCore -from PySide6.QtCore import Qt, QRectF, QPointF, QSizeF, QEvent +from PySide6.QtCore import Qt, QRectF, QPointF, QSizeF, QEvent, QPoint from PySide6.QtGui import QPainter, QPixmap, QDoubleValidator, \ QIntValidator, QMouseEvent, QImage from PySide6.QtWidgets import QFrame, QGraphicsPixmapItem, QGraphicsScene, QApplication, QFileDialog, QLabel, QGraphicsView @@ -44,22 +44,22 @@ def __init__(self): self.graphicsView.setFrameStyle(QFrame.NoFrame) self.graphicsView.setObjectName("graphicsView") - + self.graphicsView.setAcceptDrops(True) # self.graphicsView.setBackgroundBrush(QColor(Qt.white)) self.graphicsView.setCursor(Qt.OpenHandCursor) self.graphicsView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graphicsView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graphicsView.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform) - self.graphicsView.setCacheMode(QGraphicsView.CacheBackground) - self.graphicsView.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate) + self.graphicsView.setCacheMode(QGraphicsView.CacheNone) + self.graphicsView.setViewportUpdateMode(QGraphicsView.FullViewportUpdate) self.graphicsItem = ReadQGraphicsProxyWidget() self.graphicsItem.setFlags(QGraphicsPixmapItem.ItemIsFocusable | QGraphicsPixmapItem.ItemIsMovable) + # self.graphicsView.setDragMode(QGraphicsView.RubberBandDrag) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.CopyPicture) - self.graphicsScene = QGraphicsScene(self) # 场景 self.graphicsView.setScene(self.graphicsScene) self.graphicsItem.setWidget(QLabel()) @@ -84,8 +84,8 @@ def __init__(self): self._delta = 0.1 self.scaleCnt = 0 - self.data = "" - self.waifu2xData = "" + self.data = b"" + self.waifu2xData = b"" self.backStatus = "" self.modelName.clicked.connect(self.OpenSrSelect) self.fmtComboBox.currentIndexChanged.connect(self.CheckStatus) @@ -141,17 +141,18 @@ def SwitchCurrent(self, **kwargs): self.ShowImg(self.data) def ShowImg(self, data): + self.gpuLabel.setText(config.EncodeGpu) - self.scaleCnt = 0 + # self.scaleCnt = 0 # radio = self.devicePixelRatio() # p.setDevicePixelRatio(radio) # self.pixMapData = data - self.show() + # self.show() + self.pixMap = QImage() self.pixMap.loadFromData(data) + self.pixMap.setDevicePixelRatio(self.graphicsView.devicePixelRatio()) - self.graphicsItem.SetGifData(data, self.pixMap.width(), self.pixMap.height()) - self.graphicsView.setSceneRect(QRectF(QPointF(0, 0), QPointF(self.pixMap.width(), self.pixMap.height()))) # self.graphicsView.setSceneRect(QRectF(QPointF(0, 0), QPointF(self.pixMap.width()*radio, self.pixMap.height()*radio))) size = ToolUtil.GetDownloadSize(len(data)) @@ -159,40 +160,69 @@ def ShowImg(self, data): weight, height, mat, _ = ToolUtil.GetPictureSize(data) self.format.setText(mat) self.resolutionLabel.setText(str(weight) + "x" + str(height)) - self.ScalePicture() - self.CheckScaleRadio() - def ScalePicture(self): - rect = QRectF(self.graphicsItem.pos(), QSizeF( - self.pixMap.size())) - unity = self.graphicsView.transform().mapRect(QRectF(0, 0, 1, 1)) - width = unity.width() - height = unity.height() - if width <= 0 or height <= 0: - return - self.graphicsView.scale(1 / width, 1 / height) - viewRect = self.graphicsView.viewport().rect() - sceneRect = self.graphicsView.transform().mapRect(rect) - if sceneRect.width() <= 0 or sceneRect.height() <= 0: - return - x_ratio = viewRect.width() / sceneRect.width() - y_ratio = viewRect.height() / sceneRect.height() - x_ratio = y_ratio = min(x_ratio, y_ratio) - - self.graphicsView.scale(x_ratio, y_ratio) - # if self.readImg.isStripModel: - # height2 = self.pixMap.size().height() / 2 - # height3 = self.graphicsView.size().height()/2 - # height3 = height3/x_ratio - # p = self.graphicsItem.pos() - # self.graphicsItem.setPos(p.x(), p.y()+height2-height3) - self.graphicsView.centerOn(rect.center()) - - for _ in range(abs(self.scaleCnt)): - if self.scaleCnt > 0: - self.graphicsView.scale(1.1, 1.1) - else: - self.graphicsView.scale(1/1.1, 1/1.1) + if mat == "gif": + self.graphicsItem.SetGifData(data, self.pixMap.width(), self.pixMap.height()) + # self.graphicsView.setSceneRect(QRectF(QPointF(0, 0), QPointF(self.pixMap.width(), self.pixMap.height()))) + else: + radio = self.pixMap.devicePixelRatio() + scale = (1 + self.scaleCnt * 0.1) + toW = int(self.graphicsView.width() * scale) + toH = self.graphicsView.height() * scale + + data2 = QPixmap(self.pixMap) + data2.setDevicePixelRatio(self.graphicsView.devicePixelRatio()) + newData = data2.scaled(toW * radio, toH * radio, Qt.KeepAspectRatio, Qt.SmoothTransformation) + pos = QPoint(max(0, self.graphicsView.width() // 2 - newData.width() / newData.devicePixelRatio() // 2), max(0, self.graphicsView.height() // 2 - newData.height() / newData.devicePixelRatio() // 2)) + self.graphicsItem.setPos(pos) + # print("set index, {}".format(index)) + self.graphicsItem.setPixmap(newData) + self.graphicsScene.setSceneRect(0, 0, self.graphicsView.width(), max(self.graphicsView.height(), + self.graphicsItem.pixmap().height() // self.graphicsItem.pixmap().devicePixelRatio())) + + self.CheckScaleRadio() + self.graphicsView.update() + + # def ScalePicture(self, data): + # + # radio = data.devicePixelRatio() + # toW, toH = QtFileData.GetReadScale(self.qtTool.stripModel, self.scaleCnt, self.width(), self.height(), False) + # data2 = QPixmap(data) + # newData = data2.scaled(toW * radio, toH * radio, Qt.KeepAspectRatio, Qt.SmoothTransformation) + # label.setPos(pos) + # # print("set index, {}".format(index)) + # label.setPixmap(newData) + + # rect = QRectF(self.graphicsItem.pos(), QSizeF( + # self.pixMap.size())) + # unity = self.graphicsView.transform().mapRect(QRectF(0, 0, 1, 1)) + # width = unity.width() + # height = unity.height() + # if width <= 0 or height <= 0: + # return + # self.graphicsView.scale(1 / width, 1 / height) + # viewRect = self.graphicsView.viewport().rect() + # sceneRect = self.graphicsView.transform().mapRect(rect) + # if sceneRect.width() <= 0 or sceneRect.height() <= 0: + # return + # x_ratio = viewRect.width() / sceneRect.width() + # y_ratio = viewRect.height() / sceneRect.height() + # x_ratio = y_ratio = min(x_ratio, y_ratio) + # + # self.graphicsView.scale(x_ratio, y_ratio) + # # if self.readImg.isStripModel: + # # height2 = self.pixMap.size().height() / 2 + # # height3 = self.graphicsView.size().height()/2 + # # height3 = height3/x_ratio + # # p = self.graphicsItem.pos() + # # self.graphicsItem.setPos(p.x(), p.y()+height2-height3) + # self.graphicsView.centerOn(rect.center()) + # + # for _ in range(abs(self.scaleCnt)): + # if self.scaleCnt > 0: + # self.graphicsView.scale(1.1, 1.1) + # else: + # self.graphicsView.scale(1/1.1, 1/1.1) def keyReleaseEvent(self, ev): if ev.key() == Qt.Key_Escape: @@ -209,7 +239,7 @@ def keyReleaseEvent(self, ev): def resizeEvent(self, event) -> None: super(self.__class__, self).resizeEvent(event) - self.ScalePicture() + self.CheckShowImg() def eventFilter(self, obj, ev): if ev.type() == QEvent.KeyPress: @@ -240,10 +270,22 @@ def mousePressEvent(self, event: QMouseEvent): return super(self.__class__, self).mousePressEvent(event) def wheelEvent(self, event): - if event.angleDelta().y() > 0: - self.zoomIn() - else: - self.zoomOut() + if (QApplication.keyboardModifiers() == Qt.ControlModifier): + if event.angleDelta().y() < 0: + self.zoomOut() + # self.Scale(1/1.1) + # self.qtTool.zoomSlider.setValue(self.qtTool.zoomSlider.value() - 10) + else: + self.zoomIn() + # self.frame.scaleCnt += 1 + # self.Scale(1.1) + # self.qtTool.zoomSlider.setValue(self.qtTool.zoomSlider.value() + 10) + # print("scale:{}".format(self.frame.scaleCnt)) + return + # if event.angleDelta().y() > 0: + # self.zoomIn() + # else: + # self.zoomOut() def zoomIn(self): """放大""" @@ -257,16 +299,17 @@ def zoom(self, factor): """缩放 :param factor: 缩放的比例因子 """ - _factor = self.graphicsView.transform().scale( - factor, factor).mapRect(QRectF(0, 0, 1, 1)).width() - if _factor < 0.07 or _factor > 100: - # 防止过大过小 - return + # _factor = self.graphicsView.transform().scale( + # factor, factor).mapRect(QRectF(0, 0, 1, 1)).width() + # if _factor < 0.07 or _factor > 100: + # # 防止过大过小 + # return if factor >= 1: self.scaleCnt += 1 else: self.scaleCnt -= 1 - self.graphicsView.scale(factor, factor) + self.CheckShowImg() + # self.graphicsView.scale(factor, factor) def CopyPicture(self): clipboard = QApplication.clipboard() @@ -379,6 +422,13 @@ def SwithPicture(self): self.ShowImg(self.data) return + def CheckShowImg(self): + if self.checkBox.isChecked() and self.waifu2xData: + self.ShowImg(self.waifu2xData) + else: + self.ShowImg(self.data) + return + # def ChangeModel(self, index): # if self.comboBox.currentIndex() == self.index: # return diff --git a/ui/component/ui_read_tool.ui b/ui/component/ui_read_tool.ui index 42715e9..f0d3e33 100644 --- a/ui/component/ui_read_tool.ui +++ b/ui/component/ui_read_tool.ui @@ -43,7 +43,7 @@ 0 0 301 - 840 + 841 @@ -365,11 +365,6 @@ - - - 8 - - diff --git a/ui/ui_search.ui b/ui/ui_search.ui index 4808956..adeb646 100644 --- a/ui/ui_search.ui +++ b/ui/ui_search.ui @@ -87,7 +87,7 @@ - <html><head/><body><p>搜寻的最佳姿势?</p><p>【包含搜寻】</p><p>搜寻全彩[空格][+]人妻,仅显示全彩且是人妻的本本</p><p>范例:全彩 +人妻<br/></p><p>【排除搜寻】</p><p>搜寻全彩[空格][]人妻,显示全彩并排除人妻的本本</p><p>范例:全彩 -人妻<br/></p><p>【我都要搜寻】</p><p>搜寻全彩[空格]人妻,会显示所有包含全彩及人妻的本本</p><p>范例:全彩 人妻</p></body></html> + <html><head/><body><p>搜寻的最佳姿势?</p><p>【精确搜索】</p><p>jm+号码</p><p><br/></p><p>【包含搜寻】</p><p>搜寻全彩[空格][+]人妻,仅显示全彩且是人妻的本本</p><p>范例:全彩 +人妻<br/></p><p>【排除搜寻】</p><p>搜寻全彩[空格][]人妻,显示全彩并排除人妻的本本</p><p>范例:全彩 -人妻<br/></p><p>【我都要搜寻】</p><p>搜寻全彩[空格]人妻,会显示所有包含全彩及人妻的本本</p><p>范例:全彩 人妻</p></body></html> -1 diff --git a/ui/ui_setting_new.ui b/ui/ui_setting_new.ui index 81ab1ec..652f8f4 100644 --- a/ui/ui_setting_new.ui +++ b/ui/ui_setting_new.ui @@ -95,9 +95,9 @@ 0 - -919 + 0 661 - 2911 + 2794 @@ -178,7 +178,7 @@ - 触控(重启生效): + 触控(重启生效)(如果出现点击图片位置错乱,请使用100%缩放): @@ -571,98 +571,41 @@ - + - 根据系统缩放 - - - true - - - mainScaleGroup - - - - - - - 100%(不缩放) - - - mainScaleGroup - - - - - - - 125% - - - mainScaleGroup - - - - - - - 150% - - - mainScaleGroup - - - - - - - 175% - - - mainScaleGroup - - - - - - - 200% - - - mainScaleGroup - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 12 - - - - 标题栏设置(需重启) + 是否使用自定义缩放比例 - - - 标题栏美化(多屏建议不勾选,win11可不勾选) - - + + + + + + 150 + 16777215 + + + + 缩放比例: + + + + + + + 50 + + + 300 + + + 100 + + + + @@ -2388,11 +2331,11 @@ + - - + diff --git a/ui/ui_waifu2x_tool.ui b/ui/ui_waifu2x_tool.ui index 5a3e046..ea30782 100644 --- a/ui/ui_waifu2x_tool.ui +++ b/ui/ui_waifu2x_tool.ui @@ -339,7 +339,7 @@ - + @@ -484,7 +484,7 @@ - +