From 39ddd053da32bc73797f6636b66503c0a6c4951c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 16 Oct 2017 13:45:35 +1000 Subject: [PATCH 26/30] Led: add an image for the led off page Ah, what a beautiful night sky... The CSS background taken from the control-center scroll test page. Apparently we can't use the SVG background and have to do this manually. Fixes #45 --- data/led-off.svg | 1068 ++++++++++++++++++++++++++++++++++++++++++++++ data/piper.gresource.xml | 1 + data/ui/LedDialog.ui | 6 +- piper/leddialog.py | 6 + 4 files changed, 1079 insertions(+), 2 deletions(-) create mode 100644 data/led-off.svg diff --git a/data/led-off.svg b/data/led-off.svg new file mode 100644 index 0000000..5ff7639 --- /dev/null +++ b/data/led-off.svg @@ -0,0 +1,1068 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/piper.gresource.xml b/data/piper.gresource.xml index 2776012..35f76ca 100644 --- a/data/piper.gresource.xml +++ b/data/piper.gresource.xml @@ -3,6 +3,7 @@ 404.svg enter-keyboard-shortcut.svg + led-off.svg AboutDialog.ui ui/ButtonDialog.ui diff --git a/data/ui/LedDialog.ui b/data/ui/LedDialog.ui index a782390..408fb0a 100644 --- a/data/ui/LedDialog.ui +++ b/data/ui/LedDialog.ui @@ -360,10 +360,10 @@ False vertical - + True False - gtk-missing-image + /org/freedesktop/Piper/led-off.svg True @@ -378,6 +378,8 @@ This LED is off center False + 10 + 5 True diff --git a/piper/leddialog.py b/piper/leddialog.py index 9611098..c8c73a5 100644 --- a/piper/leddialog.py +++ b/piper/leddialog.py @@ -34,6 +34,7 @@ class LedDialog(Gtk.Dialog): colorbutton = GtkTemplate.Child() adjustment_brightness = GtkTemplate.Child() adjustment_effect_rate = GtkTemplate.Child() + led_off_image = GtkTemplate.Child() def __init__(self, ratbagd_led, *args, **kwargs): """Instantiates a new LedDialog. @@ -60,6 +61,11 @@ class LedDialog(Gtk.Dialog): self.adjustment_brightness.set_value(self._led.brightness) self.adjustment_effect_rate.set_value(self._led.effect_rate) + sp = Gtk.CssProvider() + sp.load_from_data("* { background: #565854}".encode()) + Gtk.StyleContext.add_provider(self.led_off_image.get_style_context(), + sp, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + def _get_led_color_as_rgba(self): # Helper function to convert ratbagd's 0-255 color range to a Gdk.RGBA # with a 0.0-1.0 color range. -- 2.16.1