[master/installclass] Add a stylesheet property to BaseInstallClass
Vratislav Podzimek
vpodzime at redhat.com
Mon Dec 8 08:19:20 UTC 2014
On Fri, 2014-12-05 at 15:26 -0500, David Shea wrote:
> If a stylesheet path is defined in the installclass, it will be applied
> at a priority between the default anaconda-gtk.css and stylesheets from
> updates/product.img.
> ---
> pyanaconda/installclass.py | 3 +++
> pyanaconda/ui/gui/__init__.py | 15 ++++++++++++---
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
> index 74254d9..223bae5 100644
> --- a/pyanaconda/installclass.py
> +++ b/pyanaconda/installclass.py
> @@ -64,6 +64,9 @@ class BaseInstallClass(object):
> help_placeholder = None
> help_placeholder_with_links = None
>
> + # path to the installclass stylesheet, if any
> + stylesheet = None
> +
> @property
> def l10n_domain(self):
> if self._l10n_domain is None:
> diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
> index 08c2573..7baba35 100644
> --- a/pyanaconda/ui/gui/__init__.py
> +++ b/pyanaconda/ui/gui/__init__.py
> @@ -48,10 +48,12 @@ 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.
> +# and stylesheets from the installclass, 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.
> STYLE_PROVIDER_PRIORITY_MISSING_ICON = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 10
> +STYLE_PROVIDER_PRIORITY_INSTALLCLASS = 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 +716,13 @@ class GraphicalUserInterface(UserInterface):
> Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
> Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
>
> + # Apply the installclass stylesheet
> + if self.instclass.stylesheet:
> + provider = Gtk.CssProvider()
> + provider.load_from_path(self.instclass.stylesheet)
> + Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
> + STYLE_PROVIDER_PRIORITY_INSTALLCLASS)
> +
> # 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
Most generic and thus best (here) solution. ACK.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list