Skip to content

Commit

Permalink
Add Power Save Mode option in settings menu
Browse files Browse the repository at this point in the history
Signed-off-by: Loren Eteval <[email protected]>
  • Loading branch information
LorenEteval committed May 28, 2024
1 parent 5bcef97 commit 3f5dbe2
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions Furious/TrayActions/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

registerAppSettings('VPNMode', isBinary=True)
registerAppSettings('DarkMode', isBinary=True)
registerAppSettings('UseMonochromeTrayIcon', isBinary=True)
registerAppSettings('StartupOnBoot', isBinary=True, default=BinarySettings.ON_)
registerAppSettings('PowerSaveMode', isBinary=True)
registerAppSettings(
'ShowProgressBarWhenConnecting', isBinary=True, default=BinarySettings.ON_
)
registerAppSettings('ShowTabAndSpacesInEditor', isBinary=True)
registerAppSettings('UseMonochromeTrayIcon', isBinary=True)

needTrans = functools.partial(needTransFn, source=__name__)

Expand Down Expand Up @@ -60,16 +61,7 @@ def triggeredCallback(self, checked):
else:
AppSettings.turnOFF('VPNMode')

try:
if APP().isSystemTrayConnected():
mbox = NewChangesNextTimeMBox()

# Show the MessageBox asynchronously
mbox.open()
except Exception:
# Any non-exit exceptions

pass
showNewChangesNextTimeMBox()


class SettingsChildAction(AppQAction):
Expand Down Expand Up @@ -97,7 +89,20 @@ def triggeredCallback(self, checked):
# Any non-exit exceptions

pass
if self.textCompare('Startup On Boot'):
elif self.textCompare('Use Monochrome Tray Icon'):
# Settings turn on/off order matters here
if checked:
AppSettings.turnON_('UseMonochromeTrayIcon')

APP().systemTray.setMonochromeIcon()
else:
AppSettings.turnOFF('UseMonochromeTrayIcon')

if APP().isSystemTrayConnected():
APP().systemTray.setConnectedIcon()
else:
APP().systemTray.setDisconnectedIcon()
elif self.textCompare('Startup On Boot'):
if checked:
StartupOnBoot.on_()

Expand All @@ -106,12 +111,19 @@ def triggeredCallback(self, checked):
StartupOnBoot.off()

AppSettings.turnOFF('StartupOnBoot')
if self.textCompare('Show Progress Bar When Connecting'):
elif self.textCompare('Power Save Mode'):
if checked:
AppSettings.turnON_('PowerSaveMode')
else:
AppSettings.turnOFF('PowerSaveMode')

showNewChangesNextTimeMBox()
elif self.textCompare('Show Progress Bar When Connecting'):
if checked:
AppSettings.turnON_('ShowProgressBarWhenConnecting')
else:
AppSettings.turnOFF('ShowProgressBarWhenConnecting')
if self.textCompare('Show Tab And Spaces In Editor'):
elif self.textCompare('Show Tab And Spaces In Editor'):
if checked:
APP().mainWindow.showTabAndSpaces()

Expand All @@ -120,28 +132,16 @@ def triggeredCallback(self, checked):
APP().mainWindow.hideTabAndSpaces()

AppSettings.turnOFF('ShowTabAndSpacesInEditor')
if self.textCompare('Use Monochrome Tray Icon'):
# Settings turn on/off order matters here
if checked:
AppSettings.turnON_('UseMonochromeTrayIcon')

APP().systemTray.setMonochromeIcon()
else:
AppSettings.turnOFF('UseMonochromeTrayIcon')

if APP().isSystemTrayConnected():
APP().systemTray.setConnectedIcon()
else:
APP().systemTray.setDisconnectedIcon()


needTrans(
'Settings',
'Dark Mode',
'Use Monochrome Tray Icon',
'Startup On Boot',
'Power Save Mode',
'Show Progress Bar When Connecting',
'Show Tab And Spaces In Editor',
'Use Monochrome Tray Icon',
)


Expand Down Expand Up @@ -173,11 +173,18 @@ def __init__(self, **kwargs):
checkable=True,
checked=AppSettings.isStateON_('UseMonochromeTrayIcon'),
),
AppQSeperator(),
SettingsChildAction(
_('Startup On Boot'),
checkable=True,
checked=AppSettings.isStateON_('StartupOnBoot'),
),
SettingsChildAction(
_('Power Save Mode'),
checkable=True,
checked=AppSettings.isStateON_('PowerSaveMode'),
),
AppQSeperator(),
SettingsChildAction(
_('Show Progress Bar When Connecting'),
checkable=True,
Expand Down

0 comments on commit 3f5dbe2

Please sign in to comment.