[PATCH] Move assureLogoImage to GraphicalUserInterface (#1102238)
David Shea
dshea at redhat.com
Thu Jun 5 17:00:06 UTC 2014
On 06/05/2014 05:02 AM, Martin Kolman wrote:
> On Wed, 2014-06-04 at 15:33 -0400, David Shea wrote:
>> This way the backup logo is used on all installs. Change assureLogoImage
>> to override the background image through CSS since it might be
>> considered rude to modify the filesystem in certain situations where it
>> could now be run (image, dirinstall).
>> ---
>> anaconda | 24 ------------------------
>> pyanaconda/ui/gui/__init__.py | 29 +++++++++++++++++++++++++++++
>> 2 files changed, 29 insertions(+), 24 deletions(-)
>>
>> diff --git a/anaconda b/anaconda
>> index 9c14933..30e91d7 100755
>> --- a/anaconda
>> +++ b/anaconda
>> @@ -136,34 +136,10 @@ def startAuditDaemon():
>> # auditd will turn into a daemon so catch the immediate child pid now:
>> os.waitpid(childpid, 0)
>>
>> -def assureLogoImage():
>> - # make sure there is a logo image present,
>> - # otherwise TTY1 will get spammed by errors
>> - replacement_image_path = None
>> - logo_path = "/usr/share/anaconda/pixmaps/logo.png"
>> - header_path = "/usr/share/anaconda/pixmaps/anaconda_header.png"
>> - sad_smiley_path = "/usr/share/icons/Adwaita/48x48/emotes/face-crying.png"
>> - if not os.path.exists(logo_path):
>> - # first try to replace the missing logo with the Anaconda header image
>> - if os.path.exists(header_path):
>> - replacement_image_path = header_path
>> - # if the header image is not present, use a sad smiley from GTK icons
>> - elif os.path.exists(sad_smiley_path):
>> - replacement_image_path = sad_smiley_path
>> -
>> - if replacement_image_path:
>> - log.warning("logo image is missing, using a substitute")
>> - os.symlink(replacement_image_path, logo_path)
>> - else:
>> - log.warning("logo image is missing")
>> -
>> # function to handle X startup special issues for anaconda
>> def doStartupX11Actions():
>> """Start window manager"""
>>
>> - # try to make sure a logo image is present
>> - assureLogoImage()
>> -
>> global wm_pid # pid of the anaconda fork where the window manager is running
>> # now start up the window manager
>> wm_pid = startMetacityWM()
>> diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
>> index a90ce90..70b22a1 100644
>> --- a/pyanaconda/ui/gui/__init__.py
>> +++ b/pyanaconda/ui/gui/__init__.py
>> @@ -277,6 +277,32 @@ class GraphicalUserInterface(UserInterface):
>> for path in pathlist]
>> }
>>
>> + def _assureLogoImage(self):
>> + # make sure there is a logo image present,
>> + # otherwise the console will get spammed by errors
>> + replacement_image_path = None
>> + logo_path = "/usr/share/anaconda/pixmaps/logo.png"
>> + header_path = "/usr/share/anaconda/pixmaps/anaconda_header.png"
>> + sad_smiley_path = "/usr/share/icons/Adwaita/48x48/emotes/face-crying.png"
>> + if not os.path.exists(logo_path):
>> + # first try to replace the missing logo with the Anaconda header image
>> + if os.path.exists(header_path):
>> + replacement_image_path = header_path
>> + # if the header image is not present, use a sad smiley from GTK icons
>> + elif os.path.exists(sad_smiley_path):
>> + replacement_image_path = sad_smiley_path
>> +
>> + if replacement_image_path:
>> + log.warning("logo image is missing, using a substitute")
>> +
>> + # Add a new stylesheet overriding the background-image for .logo
>> + provider = Gtk.CssProvider()
>> + provider.load_from_data(".logo { background-image: url('%s'); }" % replacement_image_path)
>> + Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
>> + Gtk.STYLE_PROVIDER_PRIORITY_USER)
> Oh, that's nice! I haven't known you can do this. :) I've been thinking
> how to handle the missing logo in Initial Setup as it is running on the
> installed system so again it would again be kinda rude to change the
> filesystem, if only due to making changes to files tracked by the
> package manager.
> But like this it will be non-invasive & I guess I can now also easily
> use the function directly from Initial Setup as a bonus! :)
initial-setup shouldn't have to do anything, actually, since it already
uses the GraphicalUserInterface class from anaconda.
More information about the anaconda-patches
mailing list