diff --git a/src/sas/qtgui/MainWindow/media/preferences_help.rst b/src/sas/qtgui/MainWindow/media/preferences_help.rst index 587cf293d6..4c9b6f9479 100644 --- a/src/sas/qtgui/MainWindow/media/preferences_help.rst +++ b/src/sas/qtgui/MainWindow/media/preferences_help.rst @@ -39,6 +39,12 @@ Display Preferences The display preferences modify underlying features of our GUI framework, Qt. For more information on each setting, please read more on the `Qt High DPI Settings `_. +**Theme**: A few basic themes are available for SasView. On selection of a new theme, the window will update as a preview. +Users can create their own themes and store them in `/.sasview/themes/` folder of their user directory. User themes will +use the `Classic` theme as a fall back for any styles not defined in the stylesheet. SasView assumes any file in the directory +is a stylesheet. For more information on writing Qt stylesheets, please see the +`Qt style sheet reference `_ *persistent* + **QT Screen Scale Factor**: A percent scaling factor that is applied all element sizes within the GUI. A restart of SasView is required to take effect. *persistent* diff --git a/src/sas/system/style.py b/src/sas/system/style.py index e79c0c21ec..0b1e2d200f 100644 --- a/src/sas/system/style.py +++ b/src/sas/system/style.py @@ -18,19 +18,25 @@ def __init__(self): @property def css(self) -> str: + """A property that exposes the css string to the public.""" self.theme = config.THEME self._css = load_theme(self.theme) return self._css @css.setter def css(self, theme: str): + """A way to set the theme from outside the class. This attempts to load the theme and will throw an + exception for undefined themes.""" self.theme = theme self._css = load_theme(theme) def update_theme_list(self): + """A helper method to find the latest list of themes. + Potential future use includes monitoring user theme changes.""" self._available_themes = find_available_themes() def get_theme_names(self) -> List[str]: + """Return a list of theme names for use by an external system.""" return list(self._available_themes.keys()) diff --git a/src/sas/system/themes/__init__.py b/src/sas/system/themes/__init__.py index 493efc4820..939833f20d 100644 --- a/src/sas/system/themes/__init__.py +++ b/src/sas/system/themes/__init__.py @@ -8,6 +8,7 @@ logger = logging.getLogger() +# The base dictionary mapping theme names to their location on disk. OPTIONS = { 'Default': Path(os.path.join(os.path.dirname(__file__), 'default.css')), 'Dark': Path(os.path.join(os.path.dirname(__file__), 'dark.css')),