ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
enlighten.ui.Stylesheets.Stylesheets Class Reference

Encapsulates application of CSS stylesheets to Qt widgets. More...

Public Member Functions

 __init__ (self, ctl)
 
 apply (self, widget, style_name, raw=False)
 apply CSS to a widget (don't change widget if stylesheet not found)
 
 clear (self)
 
 get (self, style_name)
 
 get_theme_list (self)
 
 load (self, theme)
 Load all the CSS stylesheets of the installed distribution into a dict, where the keys are the basename of each file (sans extension).
 
 set_benign (self, widget, flag=None)
 This was awkwardly designed, but allows a widget (including the Marquee) to be marked "benign" (good), "hazard" (bad) or "neutral" (default).
 
 set_dark_mode (self, flag)
 
 set_theme (self, theme)
 Programmatically set the theme (and make sure the settings combobox is updated)
 
 set_theme_combobox (self, index)
 Event handler for when theme combobox is changed (do NOT update the combobox again)
 
 update_widgets (self)
 

Public Attributes

dict css = {}
 
 ctl = ctl
 
str path = path if path else self.DEFAULT_PATH
 
 set_theme_combobox = self.ctl.config.get("theme", "theme")
 
 theme = self.get_theme_list()[index]
 
dict widget_last_style = {}
 

Static Public Attributes

str DEFAULT_PATH = "enlighten/assets/stylesheets"
 

Detailed Description

Encapsulates application of CSS stylesheets to Qt widgets.

Constructor & Destructor Documentation

◆ __init__()

enlighten.ui.Stylesheets.Stylesheets.__init__ ( self,
ctl )

Member Function Documentation

◆ apply()

enlighten.ui.Stylesheets.Stylesheets.apply ( self,
widget,
style_name,
raw = False )

apply CSS to a widget (don't change widget if stylesheet not found)

◆ clear()

enlighten.ui.Stylesheets.Stylesheets.clear ( self)

◆ get()

enlighten.ui.Stylesheets.Stylesheets.get ( self,
style_name )
Returns
a stylesheet by name (None on error)
Note
first checks selected theme, then "dark" as the fallback

◆ get_theme_list()

enlighten.ui.Stylesheets.Stylesheets.get_theme_list ( self)

◆ load()

enlighten.ui.Stylesheets.Stylesheets.load ( self,
theme )

Load all the CSS stylesheets of the installed distribution into a dict, where the keys are the basename of each file (sans extension).

◆ set_benign()

enlighten.ui.Stylesheets.Stylesheets.set_benign ( self,
widget,
flag = None )

This was awkwardly designed, but allows a widget (including the Marquee) to be marked "benign" (good), "hazard" (bad) or "neutral" (default).

Parameters
flaghas three possible values: None (neutral), True (benign), False (hazard)

◆ set_dark_mode()

enlighten.ui.Stylesheets.Stylesheets.set_dark_mode ( self,
flag )

◆ set_theme()

enlighten.ui.Stylesheets.Stylesheets.set_theme ( self,
theme )

Programmatically set the theme (and make sure the settings combobox is updated)

◆ set_theme_combobox()

enlighten.ui.Stylesheets.Stylesheets.set_theme_combobox ( self,
index )

Event handler for when theme combobox is changed (do NOT update the combobox again)

◆ update_widgets()

enlighten.ui.Stylesheets.Stylesheets.update_widgets ( self)

Member Data Documentation

◆ css

dict enlighten.ui.Stylesheets.Stylesheets.css = {}

◆ ctl

enlighten.ui.Stylesheets.Stylesheets.ctl = ctl

◆ DEFAULT_PATH

enlighten.ui.Stylesheets.Stylesheets.DEFAULT_PATH = "enlighten/assets/stylesheets"
static

◆ path

str enlighten.ui.Stylesheets.Stylesheets.path = path if path else self.DEFAULT_PATH

◆ set_theme_combobox

enlighten.ui.Stylesheets.Stylesheets.set_theme_combobox = self.ctl.config.get("theme", "theme")

◆ theme

enlighten.ui.Stylesheets.Stylesheets.theme = self.get_theme_list()[index]

◆ widget_last_style

dict enlighten.ui.Stylesheets.Stylesheets.widget_last_style = {}

The documentation for this class was generated from the following file: