Skip to content

Commit

Permalink
theme switching with one button
Browse files Browse the repository at this point in the history
  • Loading branch information
Crackvignoule committed Mar 3, 2025
1 parent a412c9a commit 473c28c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions fitspy/apps/pyside/components/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ def __init__(self):
def init_ui(self):
self.actionManual = QAction(self, icon=QIcon(get_icon_path("manual.png")),
toolTip="Manual")
self.actionDarkMode = QAction(self, icon=QIcon(get_icon_path("dark.png")),
toolTip="Dark Mode")
self.actionLightMode = QAction(self, icon=QIcon(get_icon_path("light-mode.png")),
toolTip="Light Mode")
self.actionTheme = QAction(self, icon=QIcon(get_icon_path("dark-light.png")),
toolTip="Switch between dark and light mode")
self.actionAbout = QAction(self, icon=QIcon(get_icon_path("about.png")),
toolTip="About")
self.actionOpen = QAction(self, icon=QIcon(get_icon_path("icons8-folder-96.png")),
Expand Down Expand Up @@ -47,8 +45,7 @@ def init_ui(self):
self.actionRestoreDefaults,
None, # Separator
QWidget(self), # Spacer
self.actionDarkMode,
self.actionLightMode,
self.actionTheme,
None, # Separator
self.actionManual,
self.actionAbout,
Expand Down
6 changes: 2 additions & 4 deletions fitspy/apps/pyside/main_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ def setup_connections(self):
self.view.menuBar.actionClearEnv.triggered.connect(self.clear)

self.view.menuBar.actionRestoreDefaults.triggered.connect(self.model.restore_defaults)
self.view.menuBar.actionLightMode.triggered.connect(
lambda: self.set_setting("theme", "light"))
self.view.menuBar.actionDarkMode.triggered.connect(
lambda: self.set_setting("theme", "dark"))
self.view.menuBar.actionTheme.triggered.connect(
lambda: self.set_setting("theme", "light" if self.model.theme == "dark" else "dark"))
self.view.menuBar.actionManual.triggered.connect(self.open_manual)
self.view.menuBar.actionAbout.triggered.connect(self.view.about)
self.view.statusBox.ncpus.currentTextChanged.connect(
Expand Down
Binary file added fitspy/resources/iconpack/dark-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 473c28c

Please sign in to comment.