Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Add toggle to hide Total Playtime from RPC & Update dependencies #149

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def timeSince(epoch: int):
'smallImagePFP': True,
'eShopButton': True,
'friendcode': '',
'hideTotalPlaytime': False,
}
userSelected = ''

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 17 additions & 1 deletion client/layout/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ Please note that NSO-RPC requires two different Nintendo accounts.</string>
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<width>382</width>
<height>599</height>
</rect>
</property>
Expand Down Expand Up @@ -691,6 +691,22 @@ Please note that NSO-RPC requires two different Nintendo accounts.</string>
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_26">
<property name="geometry">
<rect>
<x>10</x>
<y>340</y>
<width>101</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Hide Total Playtime</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
</widget>
</widget>
Expand Down
9 changes: 7 additions & 2 deletions client/layout/qt5_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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__":
Expand Down
9 changes: 7 additions & 2 deletions client/layout/qt6_layout.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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__":
Expand Down
2 changes: 1 addition & 1 deletion client/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down