safeguard against trying to load a missing theme
This commit is contained in:
parent
2c6a853a80
commit
b555768980
16
screen.py
16
screen.py
@ -437,17 +437,21 @@ class KlipperScreen(Gtk.Window):
|
|||||||
def init_style(self):
|
def init_style(self):
|
||||||
style_provider = Gtk.CssProvider()
|
style_provider = Gtk.CssProvider()
|
||||||
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
|
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
|
||||||
css_base_data = css.read()
|
css_data = css.read()
|
||||||
css.close()
|
css.close()
|
||||||
css = open(os.path.join(klipperscreendir, "styles", self.theme, "style.css"))
|
|
||||||
css_data = css_base_data + css.read()
|
|
||||||
css.close()
|
|
||||||
|
|
||||||
f = open(os.path.join(klipperscreendir, "styles", "base.conf"))
|
f = open(os.path.join(klipperscreendir, "styles", "base.conf"))
|
||||||
style_options = json.load(f)
|
style_options = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
theme_style_conf = os.path.join(klipperscreendir, "styles", self.theme, "style.conf")
|
# Load custom theme
|
||||||
|
theme = os.path.join(klipperscreendir, "styles", self.theme)
|
||||||
|
theme_style = os.path.join(theme, "style.css")
|
||||||
|
theme_style_conf = os.path.join(theme, "style.conf")
|
||||||
|
|
||||||
|
if os.path.exists(theme_style):
|
||||||
|
css = open(theme_style)
|
||||||
|
css_data += css.read()
|
||||||
|
css.close()
|
||||||
if os.path.exists(theme_style_conf):
|
if os.path.exists(theme_style_conf):
|
||||||
try:
|
try:
|
||||||
f = open(theme_style_conf)
|
f = open(theme_style_conf)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user