Skip to content
Draft
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
5 changes: 3 additions & 2 deletions PyReconstruct/modules/datatypes/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ def get_username() -> str:
# series-related
"series_code_pattern": "[0-9A-Za-z]+", # MFO

# theme: "system" (follow OS light/dark), "light", or "dark".
# Legacy values "default"/"qdark" are migrated by gui.utils.theme.normalize_mode.
# theme: "system" (follow OS light/dark), "light", "dark", "studio"
# (cool dark + teal), or "atlas" (cool light + teal). Legacy values
# "default"/"qdark" are migrated by gui.utils.theme.normalize_mode.
"theme": "system", # MFO

# updates
Expand Down
12 changes: 8 additions & 4 deletions PyReconstruct/modules/gui/dialog/all_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,22 @@ def setOption(response):
("System", mode == "system"),
("Light", mode == "light"),
("Dark", mode == "dark"),
("Studio", mode == "studio"),
("Atlas", mode == "atlas"),
)],
]

def setOption(response):

theme = self.series.getOption("theme") # keep current if neither radio matched
if response[0][0][1]: theme = "system"
elif response[0][1][1]: theme = "light"
elif response[0][2][1]: theme = "dark"
flags = response[0]
if flags[0][1]: theme = "system"
elif flags[1][1]: theme = "light"
elif flags[2][1]: theme = "dark"
elif len(flags) > 3 and flags[3][1]: theme = "studio"
elif len(flags) > 4 and flags[4][1]: theme = "atlas"
self.series.setOption("theme", theme)


self.addOptionWidget("theme", structure, setOption)

# scale bar opts
Expand Down
18 changes: 13 additions & 5 deletions PyReconstruct/modules/gui/main/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3070,7 +3070,8 @@ def load3DScene(self):
def setTheme(self, new_theme=None):
"""Set the UI theme.

Modes: "system" (follow the OS light/dark scheme), "light", "dark".
Modes: "system" (follow the OS light/dark scheme), "light", "dark",
"studio" (cool dark, teal accent), "atlas" (cool light, teal accent).
Persisted app-wide via QSettings; legacy "default"/"qdark" are accepted
and migrated. Called with None from the menu to prompt; called with a
stored value at startup / after the options dialog to (re)apply."""
Expand All @@ -3081,20 +3082,27 @@ def setTheme(self, new_theme=None):
[("radio",
("System", mode == "system"),
("Light", mode == "light"),
("Dark", mode == "dark"))]
("Dark", mode == "dark"),
("Studio", mode == "studio"),
("Atlas", mode == "atlas"))]
]
response, confirmed = QuickDialog.get(
self, structure, "Theme"
)
if not confirmed:
return

if response[0][0][1]:
flags = response[0]
if flags[0][1]:
new_theme = "system"
elif response[0][1][1]:
elif flags[1][1]:
new_theme = "light"
elif response[0][2][1]:
elif flags[2][1]:
new_theme = "dark"
elif flags[3][1]:
new_theme = "studio"
elif flags[4][1]:
new_theme = "atlas"
else:
return

Expand Down
5 changes: 3 additions & 2 deletions PyReconstruct/modules/gui/palette/mouse_palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def refreshModeIcons(self):
stripped = self._stripped(name)
self._applyModeButtonStyle(b)
if icon_utils.has_icon(stripped):
color = theme.ACCENT_TEXT if b.isChecked() else resting
color = theme.accent_text() if b.isChecked() else resting
b.setIcon(icon_utils.tool_icon(stripped, icon_px, color))
b.setIconSize(QSize(icon_px, icon_px))

Expand All @@ -225,9 +225,10 @@ def _applyModeButtonStyle(button):
own styling. Re-applied on theme/active changes so it follows light/dark.
"""
if button.isChecked():
accent = theme.accent_color()
button.setStyleSheet(
"QPushButton { background-color: %s; border: 1px solid %s; "
"border-radius: 6px; }" % (theme.ACCENT, theme.ACCENT)
"border-radius: 6px; }" % (accent, accent)
)
else:
button.setStyleSheet("")
Expand Down
Loading