From ed90dd529b2d6401ae4e171062e5469286c628dc Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:16:03 -0500 Subject: [PATCH] Add open output folder button --- NUSGet.py | 23 +++++++++++++++- qt/py/ui_MainMenu.py | 14 +++++++--- qt/ui/MainMenu.ui | 14 ++++++++-- resources/folder_black.svg | 54 ++++++++++++++++++++++++++++++++++++++ resources/folder_white.svg | 54 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 resources/folder_black.svg create mode 100644 resources/folder_white.svg diff --git a/NUSGet.py b/NUSGet.py index 70b190c..ec0ff68 100644 --- a/NUSGet.py +++ b/NUSGet.py @@ -39,7 +39,7 @@ from modules.download_batch import run_nus_download_batch from modules.download_wii import run_nus_download_wii from modules.download_dsi import run_nus_download_dsi -nusget_version = "1.4.3" +nusget_version = "1.5.0" regions = {"World": ["41"], "USA/NTSC": ["45"], "Europe/PAL": ["50"], "Japan": ["4A"], "Korea": ["4B"], "China": ["43"], "Australia/NZ": ["55"]} @@ -82,6 +82,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.ui.setupUi(self) self.threadpool = QThreadPool() self.ui.download_btn.clicked.connect(self.download_btn_pressed) + self.ui.open_output_btn.clicked.connect(self.open_output_dir) self.ui.script_btn.clicked.connect(self.script_btn_pressed) self.ui.custom_out_dir_btn.clicked.connect(self.choose_output_dir) self.ui.pack_archive_checkbox.toggled.connect( @@ -191,6 +192,16 @@ class MainWindow(QMainWindow, Ui_MainWindow): dsi_model = NUSGetTreeModel(dsi_database, root_name="DSi Titles") self.tree_models = [wii_model, vwii_model, dsi_model] self.trees = [self.ui.wii_title_tree, self.ui.vwii_title_tree, self.ui.dsi_title_tree] + # --------- + # UI Tweaks + # --------- + # Any misc UI tweaks that need to be done when the UI loads. + # Set the appropriate folder icon for the open output folder button depending on the theme. + if is_dark_theme(config_data): + icon = QIcon(os.path.join(os.path.dirname(__file__), "resources", "folder_white.svg")) + else: + icon = QIcon(os.path.join(os.path.dirname(__file__), "resources", "folder_black.svg")) + self.ui.open_output_btn.setIcon(icon) # Build proxy models required for searching self.proxy_models = [TIDFilterProxyModel(self.ui.wii_title_tree), TIDFilterProxyModel(self.ui.vwii_title_tree), TIDFilterProxyModel(self.ui.dsi_title_tree)] @@ -613,6 +624,16 @@ class MainWindow(QMainWindow, Ui_MainWindow): worker.signals.progress.connect(self.download_progress_update) self.threadpool.start(worker) + def open_output_dir(self): + # Like all good things in life, this is a platform-dependent procedure. Did I say good? I meant annoying. + system = platform.system() + if system == "Windows": + subprocess.run(["explorer.exe", out_folder]) + elif system == "Darwin": + subprocess.run(["open", out_folder]) + else: + subprocess.run(["xdg-open", out_folder]) + def choose_output_dir(self): # Use this handy convenience method to prompt the user to select a directory. Then we just need to validate # that the directory does indeed exist and is a directory, and we can save it as the output directory. diff --git a/qt/py/ui_MainMenu.py b/qt/py/ui_MainMenu.py index 0e53182..3b97aa9 100644 --- a/qt/py/ui_MainMenu.py +++ b/qt/py/ui_MainMenu.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'MainMenu.ui' ## -## Created by: Qt User Interface Compiler version 6.9.0 +## Created by: Qt User Interface Compiler version 6.10.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -210,6 +210,13 @@ class Ui_MainWindow(object): self.horizontalLayout.addWidget(self.download_btn) + self.open_output_btn = QPushButton(self.centralwidget) + self.open_output_btn.setObjectName(u"open_output_btn") + icon1 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.FolderOpen)) + self.open_output_btn.setIcon(icon1) + + self.horizontalLayout.addWidget(self.open_output_btn) + self.script_btn = QPushButton(self.centralwidget) self.script_btn.setObjectName(u"script_btn") sizePolicy.setHeightForWidth(self.script_btn.sizePolicy().hasHeightForWidth()) @@ -371,7 +378,7 @@ class Ui_MainWindow(object): MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 1010, 21)) + self.menubar.setGeometry(QRect(0, 0, 1010, 30)) self.menu_help = QMenu(self.menubar) self.menu_help.setObjectName(u"menu_help") self.menu_options = QMenu(self.menubar) @@ -431,6 +438,7 @@ class Ui_MainWindow(object): self.label_5.setText(QCoreApplication.translate("MainWindow", u"Console:", None)) self.console_select_dropdown.setCurrentText("") self.download_btn.setText(QCoreApplication.translate("MainWindow", u"Start Download", None)) + self.open_output_btn.setText("") self.script_btn.setText(QCoreApplication.translate("MainWindow", u"Run Script", None)) self.label_3.setText(QCoreApplication.translate("MainWindow", u"General Settings", None)) self.archive_file_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"File Name", None)) @@ -445,7 +453,7 @@ class Ui_MainWindow(object): "hr { height: 1px; border-width: 0; }\n" "li.unchecked::marker { content: \"\\2610\"; }\n" "li.checked::marker { content: \"\\2612\"; }\n" -"\n" +"\n" "


", None)) self.menu_help.setTitle(QCoreApplication.translate("MainWindow", u"Help", None)) self.menu_options.setTitle(QCoreApplication.translate("MainWindow", u"Options", None)) diff --git a/qt/ui/MainMenu.ui b/qt/ui/MainMenu.ui index ecbed24..b4b399b 100755 --- a/qt/ui/MainMenu.ui +++ b/qt/ui/MainMenu.ui @@ -199,6 +199,16 @@ + + + + + + + + + + @@ -435,7 +445,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html> @@ -469,7 +479,7 @@ li.checked::marker { content: "\2612"; } 0 0 1010 - 21 + 30 diff --git a/resources/folder_black.svg b/resources/folder_black.svg new file mode 100644 index 0000000..53db9d1 --- /dev/null +++ b/resources/folder_black.svg @@ -0,0 +1,54 @@ + + + + diff --git a/resources/folder_white.svg b/resources/folder_white.svg new file mode 100644 index 0000000..38f9ad0 --- /dev/null +++ b/resources/folder_white.svg @@ -0,0 +1,54 @@ + + + +