Skip to content

Commit

Permalink
Add buttons and sections for implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMi460 committed Dec 3, 2022
1 parent 0861f23 commit 9f14cb2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
22 changes: 22 additions & 0 deletions client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def timeSince(epoch:int):
settings = {
'dark': False,
'startInSystemTray': False,
'startOnLaunch': False,
}
userSelected = ''
def writeSettings():
Expand Down Expand Up @@ -158,6 +159,23 @@ def setVisability(self,mode):
settings['startInSystemTray'] = mode
writeSettings()

def setLaunchMode(self,mode):
global settings
try:
if os.name == 'nt': # This is where Windows code should go
raise Exception('not implemented yet')
elif sys.platform.startswith('darwin'): # This is where macOS code should go
raise Exception('not implemented yet')
elif sys.platform.startswith('linux'): # This is where Linux code should go
raise Exception('not implemented yet')
else:
raise Exception('not implemented yet')
settings['startOnLaunch'] = mode
except:
settings['startOnLaunch'] = False
self.startOnLaunch.setChecked(settings.get('startOnLaunch', False))
writeSettings()

def selfService(self):
self.mode = 1
self.setMode(settings['dark'])
Expand Down Expand Up @@ -247,6 +265,8 @@ def assignVariables(self):
self.toggleTheme.setGeometry(QRect(101,80,60,41))
self.startInSystemTray = AnimatedToggle(self.page_3, checked_color = '#09ab44')
self.startInSystemTray.setGeometry(QRect(101,120,60,41))
self.startOnLaunch = AnimatedToggle(self.page_3, checked_color = '#09ab44')
self.startOnLaunch.setGeometry(QRect(101,160,60,41))

def closeEvent(self, event = None):
if self.mode == 1:
Expand Down Expand Up @@ -316,6 +336,8 @@ def changeState(self):
self.toggleDiscord.toggled.connect(self.toggleConnect)
self.startInSystemTray.setChecked(settings.get("startInSystemTray", False))
self.startInSystemTray.toggled.connect(self.setVisability)
self.startOnLaunch.setChecked(settings.get('startOnLaunch', False))
self.startOnLaunch.toggled.connect(self.setLaunchMode)

# Set home
self.switchMe()
Expand Down
8 changes: 6 additions & 2 deletions client/layout/__init__.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.6
# Created by: PyQt5 UI code generator 5.15.7
#
# 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 @@ -158,7 +158,7 @@ def setupUi(self, MainWindow):
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 382, 599))
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 385, 599))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.stackedWidget_2.addWidget(self.page_2)
Expand All @@ -179,6 +179,9 @@ def setupUi(self, MainWindow):
self.label_17 = QtWidgets.QLabel(self.page_3)
self.label_17.setGeometry(QtCore.QRect(10, 130, 101, 21))
self.label_17.setObjectName("label_17")
self.label_19 = QtWidgets.QLabel(self.page_3)
self.label_19.setGeometry(QtCore.QRect(10, 170, 101, 21))
self.label_19.setObjectName("label_19")
self.stackedWidget_2.addWidget(self.page_3)
self.stackedWidget.addWidget(self.home)

Expand Down Expand Up @@ -207,6 +210,7 @@ def retranslateUi(self, MainWindow):
self.label_15.setText(_translate("MainWindow", "Update Status:"))
self.label_16.setText(_translate("MainWindow", "Dark Mode:"))
self.label_17.setText(_translate("MainWindow", "Start Minimized:"))
self.label_19.setText(_translate("MainWindow", "Start on Launch:"))


if __name__ == "__main__":
Expand Down
15 changes: 14 additions & 1 deletion client/layout/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ If you'd like to use this app for Discord Rich Presence purposes, please link an
<rect>
<x>0</x>
<y>0</y>
<width>382</width>
<width>385</width>
<height>599</height>
</rect>
</property>
Expand Down Expand Up @@ -560,6 +560,19 @@ If you'd like to use this app for Discord Rich Presence purposes, please link an
<string>Start Minimized:</string>
</property>
</widget>
<widget class="QLabel" name="label_19">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Start on Launch:</string>
</property>
</widget>
</widget>
</widget>
</widget>
Expand Down

0 comments on commit 9f14cb2

Please sign in to comment.