100 lines
3.4 KiB
Diff
100 lines
3.4 KiB
Diff
|
From 3afcbef8ec3f03c7f5562bbedad86ceb778c318b Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Palenik <mpalenik@redhat.com>
|
||
|
Date: Thu, 3 Aug 2017 23:34:17 +0200
|
||
|
Subject: [PATCH 05/19] Fix missing priority color for proposed solutions
|
||
|
|
||
|
After clicking the Troubleshoot button, the colors (green, yellow, red) marking
|
||
|
the priority of the solution have not been shown. Instead, the color has always
|
||
|
been gray, while it should have been yellow by default.
|
||
|
|
||
|
This fix enables the colors that represent the priorities of the solutions.
|
||
|
---
|
||
|
framework/gui/Makefile.am | 1 +
|
||
|
framework/gui/style.css | 17 +++++++++++++++++
|
||
|
framework/src/setroubleshoot/browser.py | 28 +++++++++-------------------
|
||
|
3 files changed, 27 insertions(+), 19 deletions(-)
|
||
|
create mode 100644 framework/gui/style.css
|
||
|
|
||
|
diff --git a/framework/gui/Makefile.am b/framework/gui/Makefile.am
|
||
|
index cd4bfa4..83baab5 100644
|
||
|
--- a/framework/gui/Makefile.am
|
||
|
+++ b/framework/gui/Makefile.am
|
||
|
@@ -18,6 +18,7 @@ GUI_FILES = \
|
||
|
bug_report.glade \
|
||
|
fail_dialog.glade \
|
||
|
success_dialog.glade \
|
||
|
+ style.css \
|
||
|
$(NULL)
|
||
|
|
||
|
icondir = /usr/share/icons/hicolor/
|
||
|
diff --git a/framework/gui/style.css b/framework/gui/style.css
|
||
|
new file mode 100644
|
||
|
index 0000000..1215979
|
||
|
--- /dev/null
|
||
|
+++ b/framework/gui/style.css
|
||
|
@@ -0,0 +1,17 @@
|
||
|
+.toggle.green {
|
||
|
+ border-image: none;
|
||
|
+ background-image: none;
|
||
|
+ background-color: green;
|
||
|
+}
|
||
|
+
|
||
|
+.toggle.red {
|
||
|
+ border-image: none;
|
||
|
+ background-image: none;
|
||
|
+ background-color: red;
|
||
|
+}
|
||
|
+
|
||
|
+.toggle.yellow {
|
||
|
+ border-image: none;
|
||
|
+ background-image: none;
|
||
|
+ background-color: yellow;
|
||
|
+}
|
||
|
\ No newline at end of file
|
||
|
diff --git a/framework/src/setroubleshoot/browser.py b/framework/src/setroubleshoot/browser.py
|
||
|
index 2169693..a772f59 100644
|
||
|
--- a/framework/src/setroubleshoot/browser.py
|
||
|
+++ b/framework/src/setroubleshoot/browser.py
|
||
|
@@ -441,29 +441,19 @@ class BrowserApplet:
|
||
|
if not if_text:
|
||
|
return
|
||
|
|
||
|
- black = Gdk.Color(0,0,0)
|
||
|
+ sev_toggle = Gtk.ToggleButton()
|
||
|
if plugin.level == "red":
|
||
|
- color = Gdk.Color(65535,0,0)
|
||
|
+ sev_toggle.get_style_context().add_class("red")
|
||
|
elif plugin.level == "yellow":
|
||
|
- color = Gdk.Color(65535,65525,0)
|
||
|
+ sev_toggle.get_style_context().add_class("yellow")
|
||
|
elif plugin.level == "green":
|
||
|
- color = Gdk.Color(0,65535,0)
|
||
|
-
|
||
|
- sev_toggle = Gtk.ToggleButton()
|
||
|
-# sev_toggle.set_size_request(20,20)
|
||
|
- sev_toggle.modify_bg(Gtk.StateType.PRELIGHT, color)
|
||
|
- sev_toggle.modify_bg(Gtk.StateType.SELECTED, black)
|
||
|
- sev_toggle.modify_bg(Gtk.StateType.ACTIVE, color)
|
||
|
- sev_toggle.modify_bg(Gtk.StateType.NORMAL, color)
|
||
|
-
|
||
|
- sev_toggle.modify_fg(Gtk.StateType.PRELIGHT, color)
|
||
|
- sev_toggle.modify_fg(Gtk.StateType.SELECTED, black)
|
||
|
- sev_toggle.modify_fg(Gtk.StateType.ACTIVE, black)
|
||
|
- sev_toggle.modify_fg(Gtk.StateType.NORMAL, color)
|
||
|
-
|
||
|
- sev_toggle.modify_base(Gtk.StateType.SELECTED, black)
|
||
|
+ sev_toggle.get_style_context().add_class("green")
|
||
|
|
||
|
- sev_toggle.set_alignment(0.5, 0.0)
|
||
|
+ cssProvider = Gtk.CssProvider()
|
||
|
+ cssProvider.load_from_path('/usr/share/setroubleshoot/gui/style.css')
|
||
|
+ screen = Gdk.Screen.get_default()
|
||
|
+ styleContext = Gtk.StyleContext()
|
||
|
+ styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||
|
|
||
|
self.toggles.append(sev_toggle)
|
||
|
sev_toggle.show()
|
||
|
--
|
||
|
2.14.1
|
||
|
|