From 5400d1afd30d83bb9877cbd3c0110553a7083b5c Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Wed, 15 May 2024 03:24:11 +0100 Subject: [PATCH 1/2] [deps] Bump dependencies versions --- client/requirements.txt | 2 +- scripts/build.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/requirements.txt b/client/requirements.txt index 434e22a..eb00f6f 100644 --- a/client/requirements.txt +++ b/client/requirements.txt @@ -1,5 +1,5 @@ requests -pypresence @ git+https://github.com/qwertyquerty/pypresence/@0ddf2c0483224339aff48467db570dd901d4793a +pypresence @ git+https://github.com/qwertyquerty/pypresence/@5b4cb5aa039c1561f1490abb333bd1cd1a69aaba qtpy autopep8 qtwidgets @ git+https://github.com/MCMi460/python-qtwidgets@e0fdba848725749775aceefc5d29e15865667bf0 diff --git a/scripts/build.bat b/scripts/build.bat index 9157ae0..52e32a8 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -30,7 +30,7 @@ if "%PYQT_PACKAGE%"=="" ( echo Building with %PYQT_PACKAGE% REM Install requirements -python -m pip install -r ../client/requirements.txt GitPython pypiwin32 winshell pyinstaller>=5.12 pyinstaller-hooks-contrib==2023.4 +python -m pip install -r ../client/requirements.txt GitPython pypiwin32 winshell pyinstaller>=6.6.0 pyinstaller-hooks-contrib==2024.6 REM Generate version.txt python _version.py From b320b151b86dc3734b28ecd09f1f9a0e24bfb927 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Wed, 15 May 2024 03:25:04 +0100 Subject: [PATCH 2/2] [Feat] Add toggle to hide total playtime --- client/app.py | 13 ++++++++++++- client/cli.py | 4 +++- client/layout/mainwindow.ui | 18 +++++++++++++++++- client/layout/qt5_layout.py | 9 +++++++-- client/layout/qt6_layout.py | 9 +++++++-- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/client/app.py b/client/app.py index 7294a0f..55df225 100644 --- a/client/app.py +++ b/client/app.py @@ -161,6 +161,7 @@ def timeSince(epoch: int): 'smallImagePFP': True, 'eShopButton': True, 'friendcode': '', + 'hideTotalPlaytime': False, } userSelected = '' @@ -312,7 +313,13 @@ def setSmallPFP(self, mode): settings['smallImagePFP'] = mode writeSettings() client.smallImagePFP = mode - + + def setHideTotalPlaytime(self, mode): + global settings + settings['hideTotalPlaytime'] = mode + writeSettings() + client.hideTotalPlaytime = mode + def setEShopButton(self, mode): global settings settings['eShopButton'] = mode @@ -444,6 +451,8 @@ def assignVariables(self): self.toggleSmallPFP.setGeometry(QRect(101, 440, 60, 41)) self.toggleEShopButton = AnimatedToggle(self.page_3, checked_color = '#09ab44') self.toggleEShopButton.setGeometry(QRect(101, 390, 60, 41)) + self.hideTotalPlaytime = AnimatedToggle(self.page_3, checked_color = '#09ab44') + self.hideTotalPlaytime.setGeometry(QRect(101, 340, 60, 41)) self.fakePushButton = QPushButton() self.fakePushButton.clicked.connect(lambda a: self.label_22.setText(altLink)) @@ -537,6 +546,8 @@ def changeState(self): self.toggleSmallPFP.toggled.connect(self.setSmallPFP) self.toggleEShopButton.setChecked(settings['eShopButton']) self.toggleEShopButton.toggled.connect(self.setEShopButton) + self.hideTotalPlaytime.setChecked(settings.get('hideTotalPlaytime', False)) + self.hideTotalPlaytime.toggled.connect(self.setHideTotalPlaytime) # Check Discord Errors self.checkDiscordError() diff --git a/client/cli.py b/client/cli.py index e66dc4d..546ff26 100644 --- a/client/cli.py +++ b/client/cli.py @@ -28,6 +28,7 @@ def __init__(self, session_token = None, user_lang = None, rpc = False, targetID self.smallImagePFP = False self.eShopButton = True self.friendcode = '' + self.hideTotalPlaytime = False def createCTX(self, session_token, user_lang, targetID = None, version = None): try: @@ -112,9 +113,10 @@ def update(self): 'details': presence.game.name, 'large_image': presence.game.imageUri, 'large_text': presence.game.name, - 'state': state, 'start': self.start, } + if not self.hideTotalPlaytime: + kwargs['state'] = state if self.smallImagePFP: kwargs['small_image'] = self.user.imageUri if self.friendcode: diff --git a/client/layout/mainwindow.ui b/client/layout/mainwindow.ui index ef7d666..bd42743 100644 --- a/client/layout/mainwindow.ui +++ b/client/layout/mainwindow.ui @@ -557,7 +557,7 @@ Please note that NSO-RPC requires two different Nintendo accounts. 0 0 - 385 + 382 599 @@ -691,6 +691,22 @@ Please note that NSO-RPC requires two different Nintendo accounts. true + + + + 10 + 340 + 101 + 41 + + + + Hide Total Playtime + + + true + + diff --git a/client/layout/qt5_layout.py b/client/layout/qt5_layout.py index eae8574..74b833d 100644 --- a/client/layout/qt5_layout.py +++ b/client/layout/qt5_layout.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mainwindow.ui' # -# Created by: PyQt5 UI code generator 5.15.10 +# Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -178,7 +178,7 @@ def setupUi(self, MainWindow): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 385, 599)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 382, 599)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.stackedWidget_2.addWidget(self.page_2) @@ -214,6 +214,10 @@ def setupUi(self, MainWindow): self.label_24.setGeometry(QtCore.QRect(10, 390, 101, 41)) self.label_24.setWordWrap(True) self.label_24.setObjectName("label_24") + self.label_26 = QtWidgets.QLabel(self.page_3) + self.label_26.setGeometry(QtCore.QRect(10, 340, 101, 41)) + self.label_26.setWordWrap(True) + self.label_26.setObjectName("label_26") self.stackedWidget_2.addWidget(self.page_3) self.stackedWidget.addWidget(self.home) @@ -249,6 +253,7 @@ def retranslateUi(self, MainWindow): self.label_23.setText(_translate("MainWindow", "Show PFP on Discord:")) self.friendCodeButton.setText(_translate("MainWindow", "Set friend code")) self.label_24.setText(_translate("MainWindow", "Show eShop link on Discord:")) + self.label_26.setText(_translate("MainWindow", "Hide Total Playtime")) if __name__ == "__main__": diff --git a/client/layout/qt6_layout.py b/client/layout/qt6_layout.py index efd4265..a724fd9 100644 --- a/client/layout/qt6_layout.py +++ b/client/layout/qt6_layout.py @@ -1,6 +1,6 @@ # Form implementation generated from reading ui file 'mainwindow.ui' # -# Created by: PyQt6 UI code generator 6.6.1 +# Created by: PyQt6 UI code generator 6.7.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. @@ -176,7 +176,7 @@ def setupUi(self, MainWindow): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 385, 599)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 382, 599)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.stackedWidget_2.addWidget(self.page_2) @@ -212,6 +212,10 @@ def setupUi(self, MainWindow): self.label_24.setGeometry(QtCore.QRect(10, 390, 101, 41)) self.label_24.setWordWrap(True) self.label_24.setObjectName("label_24") + self.label_26 = QtWidgets.QLabel(parent=self.page_3) + self.label_26.setGeometry(QtCore.QRect(10, 340, 101, 41)) + self.label_26.setWordWrap(True) + self.label_26.setObjectName("label_26") self.stackedWidget_2.addWidget(self.page_3) self.stackedWidget.addWidget(self.home) @@ -247,6 +251,7 @@ def retranslateUi(self, MainWindow): self.label_23.setText(_translate("MainWindow", "Show PFP on Discord:")) self.friendCodeButton.setText(_translate("MainWindow", "Set friend code")) self.label_24.setText(_translate("MainWindow", "Show eShop link on Discord:")) + self.label_26.setText(_translate("MainWindow", "Hide Total Playtime")) if __name__ == "__main__":