[master 1/2] Add an additional stylesheet path.

David Shea dshea at redhat.com
Thu Dec 4 20:22:59 UTC 2014


Look for a stylesheet at /usr/share/anaconda/anaconda-product.css, and
load that a higher priority than our usual stylesheets but a lower
priority than stylesheets loaded from updates.img or product.img. This
new path allows product-specific changes to be included in a stage2
compose for situations where a product.img overlay is not feasible
(live).
---
 pyanaconda/ui/gui/__init__.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 08c2573..aad9294 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -48,10 +48,14 @@ ANACONDA_WINDOW_GROUP = Gtk.WindowGroup()
 # Stylesheet priorities to use for product-specific stylesheets and our
 # missing icon overrides. The missing icon rules should be higher than
 # the regular stylesheet, applied at GTK_STYLE_PROVIDER_PRIORITY_APPLICATION,
-# and stylesheets from updates.img and product.img should be higher than that,
-# so that they can override background images and not get re-overriden by us.
-# Both should be lower than GTK_STYLE_PROVIDER_PRIORITY_USER.
+# product-specific stylesheets included as part of the stage2 should be higher,
+# and stylesheets from updates.img and product.img should be higher than that.
+# stage2 and *.img stylesheets need to be higher than the missing-icon so that
+# icon changes are not re-overriden by us.
+#
+# All levels should be lower than GTK_STYLE_PROVIDER_PRIORITY_USER.
 STYLE_PROVIDER_PRIORITY_MISSING_ICON = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 10
+STYLE_PROVIDER_PRIORITY_PRODUCT = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 15
 STYLE_PROVIDER_PRIORITY_UPDATES = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 20
 assert STYLE_PROVIDER_PRIORITY_UPDATES < Gtk.STYLE_PROVIDER_PRIORITY_USER
 
@@ -714,6 +718,14 @@ class GraphicalUserInterface(UserInterface):
         Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
                 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
 
+        # Look for a product-specific stylesheet provided in the stage2
+        product_css = "/usr/share/anaconda/anaconda-product.css"
+        if os.path.exists(product_css):
+            provider = Gtk.CssProvider()
+            provider.load_from_path(product_css)
+            Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
+                    STYLE_PROVIDER_PRIORITY_UPDATES)
+
         # Look for updates to the stylesheet and apply them at a higher priority
         for updates_dir in ("updates", "product"):
             updates_css = "/run/install/%s/anaconda-gtk.css" % updates_dir
-- 
2.1.0



More information about the anaconda-patches mailing list