Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon committed Oct 30, 2023
1 parent 47c62f6 commit 3d8bf0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sas/qtgui/MainWindow/media/preferences_help.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://doc.qt.io/qt-5/highdpi.html#high-dpi-support-in-qt>`_.

**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 <https://doc.qt.io/qt-6/stylesheet-reference.html>`_ *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*

Expand Down
6 changes: 6 additions & 0 deletions src/sas/system/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())


Expand Down
1 change: 1 addition & 0 deletions src/sas/system/themes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down

0 comments on commit 3d8bf0b

Please sign in to comment.