Clicking the labels for checkboxes now toggles the checkboxes again

This commit is contained in:
Campbell 2025-01-05 01:18:44 -05:00
parent 5e37dce4e3
commit 87905eab2b
Signed by: NinjaCheetah
GPG Key ID: 670C282B3291D63D
10 changed files with 64 additions and 51 deletions

View File

@ -1,5 +1,5 @@
# "NUSGet.py", licensed under the MIT license # "NUSGet.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
# Nuitka options. These determine compilation settings based on the current OS. # Nuitka options. These determine compilation settings based on the current OS.
# nuitka-project-if: {OS} == "Darwin": # nuitka-project-if: {OS} == "Darwin":
@ -82,7 +82,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.threadpool = QThreadPool() self.threadpool = QThreadPool()
self.ui.download_btn.clicked.connect(self.download_btn_pressed) self.ui.download_btn.clicked.connect(self.download_btn_pressed)
self.ui.script_btn.clicked.connect(self.script_btn_pressed) self.ui.script_btn.clicked.connect(self.script_btn_pressed)
self.ui.pack_archive_chkbox.clicked.connect(self.pack_wad_chkbox_toggled) self.ui.pack_archive_chkbox.toggled.connect(
lambda: self.ui.archive_file_entry.setEnabled(self.ui.pack_archive_chkbox.isChecked()))
self.ui.tid_entry.textChanged.connect(self.tid_updated) self.ui.tid_entry.textChanged.connect(self.tid_updated)
# Basic intro text set to automatically show when the app loads. This may be changed in the future. # Basic intro text set to automatically show when the app loads. This may be changed in the future.
libwiipy_version = "v" + version("libWiiPy") libwiipy_version = "v" + version("libWiiPy")
@ -123,6 +124,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.trees[tree].collapsed.connect(lambda: self.resize_tree(self.ui.platform_tabs.currentIndex())) self.trees[tree].collapsed.connect(lambda: self.resize_tree(self.ui.platform_tabs.currentIndex()))
# Prevent resizing. # Prevent resizing.
self.setFixedSize(self.size()) self.setFixedSize(self.size())
# These connections allow for clicking the checkbox labels to toggle the checkboxes, if they're enabled. This is
# required because checkboxes can't word wrap, so regular labels must be used in their place.
connect_label_to_checkbox(self.ui.pack_archive_chkbox_lbl, self.ui.pack_archive_chkbox)
connect_label_to_checkbox(self.ui.keep_enc_chkbox_lbl, self.ui.keep_enc_chkbox)
connect_label_to_checkbox(self.ui.create_dec_chkbox_lbl, self.ui.create_dec_chkbox)
connect_label_to_checkbox(self.ui.use_local_chkbox_lbl, self.ui.use_local_chkbox)
connect_label_to_checkbox(self.ui.use_wiiu_nus_chkbox_lbl, self.ui.use_wiiu_nus_chkbox)
connect_label_to_checkbox(self.ui.patch_ios_chkbox_lbl, self.ui.patch_ios_chkbox)
connect_label_to_checkbox(self.ui.pack_vwii_mode_chkbox_lbl, self.ui.pack_vwii_mode_chkbox)
# Do a quick check to see if there's a newer release available, and inform the user if there is. # Do a quick check to see if there's a newer release available, and inform the user if there is.
worker = Worker(check_nusget_updates, app, nusget_version) worker = Worker(check_nusget_updates, app, nusget_version)
worker.signals.result.connect(self.prompt_for_update) worker.signals.result.connect(self.prompt_for_update)
@ -241,6 +251,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ui.keep_enc_chkbox.setEnabled(False) self.ui.keep_enc_chkbox.setEnabled(False)
self.ui.create_dec_chkbox.setEnabled(False) self.ui.create_dec_chkbox.setEnabled(False)
self.ui.use_local_chkbox.setEnabled(False) self.ui.use_local_chkbox.setEnabled(False)
self.ui.patch_ios_chkbox.setEnabled(False)
self.ui.use_wiiu_nus_chkbox.setEnabled(False) self.ui.use_wiiu_nus_chkbox.setEnabled(False)
self.ui.pack_vwii_mode_chkbox.setEnabled(False) self.ui.pack_vwii_mode_chkbox.setEnabled(False)
self.ui.archive_file_entry.setEnabled(False) self.ui.archive_file_entry.setEnabled(False)
@ -258,6 +269,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ui.keep_enc_chkbox.setEnabled(True) self.ui.keep_enc_chkbox.setEnabled(True)
self.ui.create_dec_chkbox.setEnabled(True) self.ui.create_dec_chkbox.setEnabled(True)
self.ui.use_local_chkbox.setEnabled(True) self.ui.use_local_chkbox.setEnabled(True)
self.ui.patch_ios_chkbox.setEnabled(True)
self.ui.use_wiiu_nus_chkbox.setEnabled(True) self.ui.use_wiiu_nus_chkbox.setEnabled(True)
self.ui.console_select_dropdown.setEnabled(True) self.ui.console_select_dropdown.setEnabled(True)
if self.ui.pack_archive_chkbox.isChecked() is True: if self.ui.pack_archive_chkbox.isChecked() is True:
@ -373,14 +385,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.update_log_text(f" - {title}") self.update_log_text(f" - {title}")
self.unlock_ui() self.unlock_ui()
def pack_wad_chkbox_toggled(self):
# Simple function to catch when the WAD/TAD checkbox is toggled and enable/disable the file name entry box
# accordingly.
if self.ui.pack_archive_chkbox.isChecked() is True:
self.ui.archive_file_entry.setEnabled(True)
else:
self.ui.archive_file_entry.setEnabled(False)
def selected_console_changed(self): def selected_console_changed(self):
# Callback function to enable or disable console-specific settings based on the selected console. # Callback function to enable or disable console-specific settings based on the selected console.
if self.ui.console_select_dropdown.currentText() == "vWii": if self.ui.console_select_dropdown.currentText() == "vWii":

View File

@ -1,5 +1,5 @@
# "build_translations.py", licensed under the MIT license # "build_translations.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
# This script exists to work around an issue in PySide6 where the "pyside6-project build" command incorrectly places # This script exists to work around an issue in PySide6 where the "pyside6-project build" command incorrectly places
# translation files in the root of the project directory while building. # translation files in the root of the project directory while building.

View File

@ -1,10 +1,12 @@
# "modules/core.py", licensed under the MIT license # "modules/core.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
import requests import requests
from dataclasses import dataclass from dataclasses import dataclass
from typing import List from typing import List
from PySide6.QtCore import Qt as _Qt
@dataclass @dataclass
class TitleData: class TitleData:
@ -36,6 +38,13 @@ class BatchResults:
failed_titles: List[str] failed_titles: List[str]
def connect_label_to_checkbox(label, checkbox):
def toggle_checkbox(event):
if checkbox.isEnabled() and event.button() == _Qt.LeftButton:
checkbox.toggle()
label.mousePressEvent = toggle_checkbox
def check_nusget_updates(app, current_version: str, progress_callback=None) -> str | None: def check_nusget_updates(app, current_version: str, progress_callback=None) -> str | None:
# Simple function to make a request to the GitHub API and then check if the latest available version is newer. # Simple function to make a request to the GitHub API and then check if the latest available version is newer.
gh_api_request = requests.get(url="https://api.github.com/repos/NinjaCheetah/NUSGet/releases/latest", stream=True) gh_api_request = requests.get(url="https://api.github.com/repos/NinjaCheetah/NUSGet/releases/latest", stream=True)

View File

@ -1,5 +1,5 @@
# "modules/download_batch.py", licensed under the MIT license # "modules/download_batch.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
import pathlib import pathlib
from typing import List from typing import List

View File

@ -1,5 +1,5 @@
# "modules/download_dsi.py", licensed under the MIT license # "modules/download_dsi.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
import pathlib import pathlib
from typing import List, Tuple from typing import List, Tuple

View File

@ -1,5 +1,5 @@
# "modules/download_wii.py", licensed under the MIT license # "modules/download_wii.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
import pathlib import pathlib
from typing import List, Tuple from typing import List, Tuple

View File

@ -1,5 +1,5 @@
# "modules/tree.py", licensed under the MIT license # "modules/tree.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
from modules.core import TitleData from modules.core import TitleData
from PySide6.QtCore import QAbstractItemModel, QModelIndex, Qt, QSortFilterProxyModel from PySide6.QtCore import QAbstractItemModel, QModelIndex, Qt, QSortFilterProxyModel

View File

@ -189,16 +189,16 @@ class Ui_MainWindow(object):
self.pack_archive_row.addWidget(self.pack_archive_chkbox) self.pack_archive_row.addWidget(self.pack_archive_chkbox)
self.label_7 = QLabel(self.centralwidget) self.pack_archive_chkbox_lbl = QLabel(self.centralwidget)
self.label_7.setObjectName(u"label_7") self.pack_archive_chkbox_lbl.setObjectName(u"pack_archive_chkbox_lbl")
sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.MinimumExpanding) sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.MinimumExpanding)
sizePolicy4.setHorizontalStretch(0) sizePolicy4.setHorizontalStretch(0)
sizePolicy4.setVerticalStretch(0) sizePolicy4.setVerticalStretch(0)
sizePolicy4.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) sizePolicy4.setHeightForWidth(self.pack_archive_chkbox_lbl.sizePolicy().hasHeightForWidth())
self.label_7.setSizePolicy(sizePolicy4) self.pack_archive_chkbox_lbl.setSizePolicy(sizePolicy4)
self.label_7.setWordWrap(True) self.pack_archive_chkbox_lbl.setWordWrap(True)
self.pack_archive_row.addWidget(self.label_7) self.pack_archive_row.addWidget(self.pack_archive_chkbox_lbl)
self.verticalLayout_7.addLayout(self.pack_archive_row) self.verticalLayout_7.addLayout(self.pack_archive_row)
@ -221,13 +221,13 @@ class Ui_MainWindow(object):
self.keep_enc_row.addWidget(self.keep_enc_chkbox) self.keep_enc_row.addWidget(self.keep_enc_chkbox)
self.label_6 = QLabel(self.centralwidget) self.keep_enc_chkbox_lbl = QLabel(self.centralwidget)
self.label_6.setObjectName(u"label_6") self.keep_enc_chkbox_lbl.setObjectName(u"keep_enc_chkbox_lbl")
sizePolicy4.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth()) sizePolicy4.setHeightForWidth(self.keep_enc_chkbox_lbl.sizePolicy().hasHeightForWidth())
self.label_6.setSizePolicy(sizePolicy4) self.keep_enc_chkbox_lbl.setSizePolicy(sizePolicy4)
self.label_6.setWordWrap(True) self.keep_enc_chkbox_lbl.setWordWrap(True)
self.keep_enc_row.addWidget(self.label_6) self.keep_enc_row.addWidget(self.keep_enc_chkbox_lbl)
self.verticalLayout_7.addLayout(self.keep_enc_row) self.verticalLayout_7.addLayout(self.keep_enc_row)
@ -314,14 +314,14 @@ class Ui_MainWindow(object):
self.patch_ios_row.addWidget(self.patch_ios_chkbox) self.patch_ios_row.addWidget(self.patch_ios_chkbox)
self.patch_ios_lbl = QLabel(self.centralwidget) self.patch_ios_chkbox_lbl = QLabel(self.centralwidget)
self.patch_ios_lbl.setObjectName(u"patch_ios_lbl") self.patch_ios_chkbox_lbl.setObjectName(u"patch_ios_chkbox_lbl")
self.patch_ios_lbl.setEnabled(True) self.patch_ios_chkbox_lbl.setEnabled(True)
sizePolicy4.setHeightForWidth(self.patch_ios_lbl.sizePolicy().hasHeightForWidth()) sizePolicy4.setHeightForWidth(self.patch_ios_chkbox_lbl.sizePolicy().hasHeightForWidth())
self.patch_ios_lbl.setSizePolicy(sizePolicy4) self.patch_ios_chkbox_lbl.setSizePolicy(sizePolicy4)
self.patch_ios_lbl.setWordWrap(True) self.patch_ios_chkbox_lbl.setWordWrap(True)
self.patch_ios_row.addWidget(self.patch_ios_lbl) self.patch_ios_row.addWidget(self.patch_ios_chkbox_lbl)
self.verticalLayout_7.addLayout(self.patch_ios_row) self.verticalLayout_7.addLayout(self.patch_ios_row)
@ -357,17 +357,17 @@ class Ui_MainWindow(object):
self.pack_vwii_mode_row.addWidget(self.pack_vwii_mode_chkbox) self.pack_vwii_mode_row.addWidget(self.pack_vwii_mode_chkbox)
self.pack_vwii_mode_lbl = QLabel(self.centralwidget) self.pack_vwii_mode_chkbox_lbl = QLabel(self.centralwidget)
self.pack_vwii_mode_lbl.setObjectName(u"pack_vwii_mode_lbl") self.pack_vwii_mode_chkbox_lbl.setObjectName(u"pack_vwii_mode_chkbox_lbl")
self.pack_vwii_mode_lbl.setEnabled(True) self.pack_vwii_mode_chkbox_lbl.setEnabled(True)
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred) sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred)
sizePolicy5.setHorizontalStretch(0) sizePolicy5.setHorizontalStretch(0)
sizePolicy5.setVerticalStretch(0) sizePolicy5.setVerticalStretch(0)
sizePolicy5.setHeightForWidth(self.pack_vwii_mode_lbl.sizePolicy().hasHeightForWidth()) sizePolicy5.setHeightForWidth(self.pack_vwii_mode_chkbox_lbl.sizePolicy().hasHeightForWidth())
self.pack_vwii_mode_lbl.setSizePolicy(sizePolicy5) self.pack_vwii_mode_chkbox_lbl.setSizePolicy(sizePolicy5)
self.pack_vwii_mode_lbl.setWordWrap(True) self.pack_vwii_mode_chkbox_lbl.setWordWrap(True)
self.pack_vwii_mode_row.addWidget(self.pack_vwii_mode_lbl) self.pack_vwii_mode_row.addWidget(self.pack_vwii_mode_chkbox_lbl)
self.verticalLayout_8.addLayout(self.pack_vwii_mode_row) self.verticalLayout_8.addLayout(self.pack_vwii_mode_row)
@ -426,15 +426,15 @@ class Ui_MainWindow(object):
self.download_btn.setText(QCoreApplication.translate("MainWindow", u"Start Download", None)) self.download_btn.setText(QCoreApplication.translate("MainWindow", u"Start Download", None))
self.script_btn.setText(QCoreApplication.translate("MainWindow", u"Run Script", None)) self.script_btn.setText(QCoreApplication.translate("MainWindow", u"Run Script", None))
self.label_3.setText(QCoreApplication.translate("MainWindow", u"General Settings", None)) self.label_3.setText(QCoreApplication.translate("MainWindow", u"General Settings", None))
self.label_7.setText(QCoreApplication.translate("MainWindow", u"Pack installable archive (WAD/TAD)", None)) self.pack_archive_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Pack installable archive (WAD/TAD)", None))
self.archive_file_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"File Name", None)) self.archive_file_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"File Name", None))
self.label_6.setText(QCoreApplication.translate("MainWindow", u"Keep encrypted contents", None)) self.keep_enc_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Keep encrypted contents", None))
self.create_dec_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Create decrypted contents (*.app)", None)) self.create_dec_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Create decrypted contents (*.app)", None))
self.use_local_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use local files, if they exist", None)) self.use_local_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use local files, if they exist", None))
self.use_wiiu_nus_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use the Wii U NUS (faster, only effects Wii/vWii)", None)) self.use_wiiu_nus_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use the Wii U NUS (faster, only effects Wii/vWii)", None))
self.patch_ios_lbl.setText(QCoreApplication.translate("MainWindow", u"Apply patches to IOS (Applies to WADs only)", None)) self.patch_ios_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Apply patches to IOS (Applies to WADs only)", None))
self.label_4.setText(QCoreApplication.translate("MainWindow", u"vWii Title Settings", None)) self.label_4.setText(QCoreApplication.translate("MainWindow", u"vWii Title Settings", None))
self.pack_vwii_mode_lbl.setText(QCoreApplication.translate("MainWindow", u"Re-encrypt title using the Wii Common Key", None)) self.pack_vwii_mode_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Re-encrypt title using the Wii Common Key", None))
self.log_text_browser.setMarkdown("") self.log_text_browser.setMarkdown("")
self.log_text_browser.setHtml(QCoreApplication.translate("MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" self.log_text_browser.setHtml(QCoreApplication.translate("MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"

View File

@ -258,7 +258,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="pack_archive_chkbox_lbl">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -307,7 +307,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="keep_enc_chkbox_lbl">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -466,7 +466,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="patch_ios_lbl"> <widget class="QLabel" name="patch_ios_chkbox_lbl">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -556,7 +556,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="pack_vwii_mode_lbl"> <widget class="QLabel" name="pack_vwii_mode_chkbox_lbl">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

@ -1,5 +1,5 @@
# "update_translations.py", licensed under the MIT license # "update_translations.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # Copyright 2024-2025 NinjaCheetah
# This script exists to work around an issue in PySide6 where the "pyside6-project lupdate" command doesn't work as # This script exists to work around an issue in PySide6 where the "pyside6-project lupdate" command doesn't work as
# expected, as it struggles to parse the paths in the .pyproject file. This does what it's meant to do for it. # expected, as it struggles to parse the paths in the .pyproject file. This does what it's meant to do for it.