Fully redesigned NUSGet interface

This commit is contained in:
Campbell 2024-05-05 14:26:13 -04:00
parent 5af6c202ee
commit a64c93f1a3
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
3 changed files with 220 additions and 68 deletions

View File

@ -66,6 +66,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
f"Title ID to begin.\n\nTitles marked with a checkmark are free and have a "
f"ticket available, and can be decrypted and packed into a WAD. Titles with an"
f" X do not have a ticket, and only their encrypted contents can be saved.")
# Add console entries to dropdown and attach on change signal.
self.ui.console_select_dropdown.addItem("Wii")
self.ui.console_select_dropdown.addItem("vWii")
self.ui.console_select_dropdown.currentIndexChanged.connect(self.selected_console_changed)
# Title tree building code.
wii_tree = self.ui.wii_title_tree
vwii_tree = self.ui.vwii_title_tree
@ -117,6 +121,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
selected_title = title
selected_version = item.text(0)
selected_region = item.parent().text(0)
self.ui.console_select_dropdown.setCurrentIndex(self.ui.platform_tabs.currentIndex())
self.load_title_data(selected_title, selected_version, selected_region)
def update_log_text(self, new_text):
@ -241,9 +246,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ui.create_dec_chkbox.setEnabled(True)
self.ui.use_local_chkbox.setEnabled(True)
self.ui.use_wiiu_nus_chkbox.setEnabled(True)
self.ui.pack_vwii_mode_chkbox.setEnabled(True)
if self.ui.pack_wad_chkbox.isChecked() is True:
self.ui.wad_file_entry.setEnabled(True)
# Call the dropdown callback because this will automagically handle setting console-specific settings based
# on the currently selected console, and saves on duplicate code.
self.selected_console_changed()
def run_nus_download(self, progress_callback):
# Actual NUS download function that runs in a separate thread.
@ -400,6 +407,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else:
self.ui.wad_file_entry.setEnabled(False)
def selected_console_changed(self):
# Callback function to enable or disable console-specific settings based on the selected console.
if self.ui.console_select_dropdown.currentText() == "vWii":
self.ui.pack_vwii_mode_chkbox.setEnabled(True)
elif self.ui.console_select_dropdown.currentText() == "Wii":
self.ui.pack_vwii_mode_chkbox.setEnabled(False)
if __name__ == "__main__":
app = QApplication(sys.argv)

View File

@ -15,34 +15,42 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QCheckBox, QHBoxLayout, QHeaderView,
QLabel, QLineEdit, QMainWindow, QMenuBar,
QPushButton, QSizePolicy, QTabWidget, QTextBrowser,
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget)
from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, QHBoxLayout,
QHeaderView, QLabel, QLayout, QLineEdit,
QMainWindow, QMenuBar, QPushButton, QSizePolicy,
QSpacerItem, QTabWidget, QTextBrowser, QTreeWidget,
QTreeWidgetItem, QVBoxLayout, QWidget)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(610, 625)
MainWindow.setMinimumSize(QSize(610, 625))
MainWindow.setMaximumSize(QSize(610, 625))
MainWindow.resize(1010, 625)
MainWindow.setMinimumSize(QSize(1010, 625))
MainWindow.setMaximumSize(QSize(1010, 625))
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.horizontalLayout_3 = QHBoxLayout(self.centralwidget)
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.verticalLayout = QVBoxLayout()
self.verticalLayout.setObjectName(u"verticalLayout")
self.vertical_layout_trees = QVBoxLayout()
self.vertical_layout_trees.setObjectName(u"vertical_layout_trees")
self.label_2 = QLabel(self.centralwidget)
self.label_2.setObjectName(u"label_2")
font = QFont()
font.setBold(True)
self.label_2.setFont(font)
self.verticalLayout.addWidget(self.label_2)
self.vertical_layout_trees.addWidget(self.label_2)
self.platform_tabs = QTabWidget(self.centralwidget)
self.platform_tabs.setObjectName(u"platform_tabs")
sizePolicy = QSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.platform_tabs.sizePolicy().hasHeightForWidth())
self.platform_tabs.setSizePolicy(sizePolicy)
self.platform_tabs.setMinimumSize(QSize(410, 0))
self.platform_tabs.setMaximumSize(QSize(410, 16777215))
self.wii_tab = QWidget()
self.wii_tab.setObjectName(u"wii_tab")
self.verticalLayout_2 = QVBoxLayout(self.wii_tab)
@ -78,102 +86,148 @@ class Ui_MainWindow(object):
self.verticalLayout_4.addWidget(self.vwii_title_tree)
self.pack_vwii_mode_chkbox = QCheckBox(self.vwii_tab)
self.pack_vwii_mode_chkbox.setObjectName(u"pack_vwii_mode_chkbox")
self.verticalLayout_4.addWidget(self.pack_vwii_mode_chkbox)
self.platform_tabs.addTab(self.vwii_tab, "")
self.verticalLayout.addWidget(self.platform_tabs)
self.vertical_layout_trees.addWidget(self.platform_tabs)
self.horizontalLayout_3.addLayout(self.verticalLayout)
self.horizontalLayout_3.addLayout(self.vertical_layout_trees)
self.verticalLayout_3 = QVBoxLayout()
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.vertical_layout_controls = QVBoxLayout()
self.vertical_layout_controls.setObjectName(u"vertical_layout_controls")
self.vertical_layout_controls.setSizeConstraint(QLayout.SetDefaultConstraint)
self.horizontal_layout_title_entry = QHBoxLayout()
self.horizontal_layout_title_entry.setObjectName(u"horizontal_layout_title_entry")
self.tid_entry = QLineEdit(self.centralwidget)
self.tid_entry.setObjectName(u"tid_entry")
self.horizontalLayout_2.addWidget(self.tid_entry)
self.horizontal_layout_title_entry.addWidget(self.tid_entry)
self.label = QLabel(self.centralwidget)
self.label.setObjectName(u"label")
self.horizontalLayout_2.addWidget(self.label)
self.horizontal_layout_title_entry.addWidget(self.label)
self.version_entry = QLineEdit(self.centralwidget)
self.version_entry.setObjectName(u"version_entry")
self.version_entry.setMaximumSize(QSize(75, 16777215))
self.version_entry.setMaximumSize(QSize(85, 16777215))
self.horizontalLayout_2.addWidget(self.version_entry)
self.horizontal_layout_title_entry.addWidget(self.version_entry)
self.label_5 = QLabel(self.centralwidget)
self.label_5.setObjectName(u"label_5")
self.horizontal_layout_title_entry.addWidget(self.label_5)
self.console_select_dropdown = QComboBox(self.centralwidget)
self.console_select_dropdown.setObjectName(u"console_select_dropdown")
self.console_select_dropdown.setMinimumSize(QSize(85, 0))
self.console_select_dropdown.setEditable(False)
self.horizontal_layout_title_entry.addWidget(self.console_select_dropdown)
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
self.vertical_layout_controls.addLayout(self.horizontal_layout_title_entry)
self.download_btn = QPushButton(self.centralwidget)
self.download_btn.setObjectName(u"download_btn")
self.verticalLayout_3.addWidget(self.download_btn)
self.vertical_layout_controls.addWidget(self.download_btn)
self.log_text_browser = QTextBrowser(self.centralwidget)
self.log_text_browser.setObjectName(u"log_text_browser")
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.verticalLayout_7 = QVBoxLayout()
self.verticalLayout_7.setObjectName(u"verticalLayout_7")
self.label_3 = QLabel(self.centralwidget)
self.label_3.setObjectName(u"label_3")
self.label_3.setFont(font)
self.verticalLayout_3.addWidget(self.log_text_browser)
self.verticalLayout_7.addWidget(self.label_3)
self.horizontalLayout_4 = QHBoxLayout()
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.pack_wad_chkbox = QCheckBox(self.centralwidget)
self.pack_wad_chkbox.setObjectName(u"pack_wad_chkbox")
self.horizontalLayout_4.addWidget(self.pack_wad_chkbox)
self.verticalLayout_7.addWidget(self.pack_wad_chkbox)
self.wad_file_entry = QLineEdit(self.centralwidget)
self.wad_file_entry.setObjectName(u"wad_file_entry")
self.wad_file_entry.setEnabled(False)
self.horizontalLayout_4.addWidget(self.wad_file_entry)
self.verticalLayout_3.addLayout(self.horizontalLayout_4)
self.verticalLayout_7.addWidget(self.wad_file_entry)
self.keep_enc_chkbox = QCheckBox(self.centralwidget)
self.keep_enc_chkbox.setObjectName(u"keep_enc_chkbox")
self.keep_enc_chkbox.setChecked(True)
self.verticalLayout_3.addWidget(self.keep_enc_chkbox)
self.verticalLayout_7.addWidget(self.keep_enc_chkbox)
self.create_dec_chkbox = QCheckBox(self.centralwidget)
self.create_dec_chkbox.setObjectName(u"create_dec_chkbox")
self.verticalLayout_3.addWidget(self.create_dec_chkbox)
self.verticalLayout_7.addWidget(self.create_dec_chkbox)
self.use_local_chkbox = QCheckBox(self.centralwidget)
self.use_local_chkbox.setObjectName(u"use_local_chkbox")
self.use_local_chkbox.setEnabled(True)
self.verticalLayout_3.addWidget(self.use_local_chkbox)
self.verticalLayout_7.addWidget(self.use_local_chkbox)
self.use_wiiu_nus_chkbox = QCheckBox(self.centralwidget)
self.use_wiiu_nus_chkbox.setObjectName(u"use_wiiu_nus_chkbox")
self.use_wiiu_nus_chkbox.setChecked(True)
self.verticalLayout_3.addWidget(self.use_wiiu_nus_chkbox)
self.verticalLayout_7.addWidget(self.use_wiiu_nus_chkbox)
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalLayout_7.addItem(self.verticalSpacer_2)
self.horizontalLayout_3.addLayout(self.verticalLayout_3)
self.horizontalLayout_5.addLayout(self.verticalLayout_7)
self.verticalLayout_8 = QVBoxLayout()
self.verticalLayout_8.setObjectName(u"verticalLayout_8")
self.label_4 = QLabel(self.centralwidget)
self.label_4.setObjectName(u"label_4")
self.label_4.setFont(font)
self.verticalLayout_8.addWidget(self.label_4)
self.pack_vwii_mode_chkbox = QCheckBox(self.centralwidget)
self.pack_vwii_mode_chkbox.setObjectName(u"pack_vwii_mode_chkbox")
self.pack_vwii_mode_chkbox.setEnabled(False)
self.verticalLayout_8.addWidget(self.pack_vwii_mode_chkbox)
self.verticalSpacer = QSpacerItem(20, 50, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalLayout_8.addItem(self.verticalSpacer)
self.horizontalLayout_5.addLayout(self.verticalLayout_8)
self.vertical_layout_controls.addLayout(self.horizontalLayout_5)
self.log_text_browser = QTextBrowser(self.centralwidget)
self.log_text_browser.setObjectName(u"log_text_browser")
self.log_text_browser.setMinimumSize(QSize(0, 312))
self.vertical_layout_controls.addWidget(self.log_text_browser)
self.horizontalLayout_3.addLayout(self.vertical_layout_controls)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 610, 29))
self.menubar.setGeometry(QRect(0, 0, 1010, 30))
MainWindow.setMenuBar(self.menubar)
self.retranslateUi(MainWindow)
self.platform_tabs.setCurrentIndex(0)
self.console_select_dropdown.setCurrentIndex(-1)
QMetaObject.connectSlotsByName(MainWindow)
@ -183,24 +237,28 @@ class Ui_MainWindow(object):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
self.label_2.setText(QCoreApplication.translate("MainWindow", u"Available Titles", None))
self.platform_tabs.setTabText(self.platform_tabs.indexOf(self.wii_tab), QCoreApplication.translate("MainWindow", u"Wii", None))
self.pack_vwii_mode_chkbox.setText(QCoreApplication.translate("MainWindow", u"Pack for vWii mode instead of Wii U mode", None))
self.platform_tabs.setTabText(self.platform_tabs.indexOf(self.vwii_tab), QCoreApplication.translate("MainWindow", u"vWii", None))
self.tid_entry.setText("")
self.tid_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Title ID", None))
self.label.setText(QCoreApplication.translate("MainWindow", u"v", None))
self.version_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Version", None))
self.download_btn.setText(QCoreApplication.translate("MainWindow", u"Start NUS Download!", None))
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"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<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;\"><br /></p></body></html>", None))
self.pack_wad_chkbox.setText(QCoreApplication.translate("MainWindow", u"Pack WAD", None))
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.label_3.setText(QCoreApplication.translate("MainWindow", u"General Settings", None))
self.pack_wad_chkbox.setText(QCoreApplication.translate("MainWindow", u"Pack installable archive (WAD/TAD)", None))
self.wad_file_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"File Name", None))
self.keep_enc_chkbox.setText(QCoreApplication.translate("MainWindow", u"Keep encrypted contents", None))
self.create_dec_chkbox.setText(QCoreApplication.translate("MainWindow", u"Create decrypted contents (*.app)", None))
self.use_local_chkbox.setText(QCoreApplication.translate("MainWindow", u"Use local files, if they exist", None))
self.use_wiiu_nus_chkbox.setText(QCoreApplication.translate("MainWindow", u"Use the Wii U NUS (faster)", None))
self.label_4.setText(QCoreApplication.translate("MainWindow", u"vWii Title Settings", None))
self.pack_vwii_mode_chkbox.setText(QCoreApplication.translate("MainWindow", u"Pack for vWii mode instead of Wii U mode", None))
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"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<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>", None))
# retranslateUi

View File

@ -6,19 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>610</width>
<width>1010</width>
<height>625</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>610</width>
<width>1010</width>
<height>625</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>610</width>
<width>1010</width>
<height>625</height>
</size>
</property>
@ -44,6 +44,24 @@
</item>
<item>
<widget class="QTabWidget" name="platform_tabs">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>410</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>410</width>
<height>16777215</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@ -107,13 +125,6 @@
</column>
</widget>
</item>
<item>
<widget class="QCheckBox" name="pack_vwii_mode_chkbox">
<property name="text">
<string>Pack for vWii mode instead of Wii U mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -122,6 +133,9 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -172,13 +186,33 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>General Settings</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="pack_wad_chkbox">
<property name="text">
@ -235,6 +269,52 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>vWii Title Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="pack_vwii_mode_chkbox">
<property name="text">
<string>Pack for vWii mode instead of Wii U mode</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -244,8 +324,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>610</width>
<height>29</height>
<width>1010</width>
<height>30</height>
</rect>
</property>
</widget>