Install Fedora Button for LiveCD

Bill Nottingham notting at redhat.com
Fri Apr 20 15:08:45 UTC 2012


Tom Callaway (tcallawa at redhat.com) said: 
> There seems to be at least some consensus that:
> 
> * The notification, unless permanent, is not an ideal solution here
> because once it goes away, the user is in the same situation of
> confusion as to how to install the Live Image to disk.

The notification that Matthias posted is permanent, until the user
explicitly goes through and clicks to remove it.

I've updated it so that it pulls translations from anaconda for the tile
and the action item.

Bill
-------------- next part --------------
#!/usr/bin/env python

from gi.repository import GLib
from gi.repository import Gio
from gi.repository import Notify
import sys
import os

def install_cb(n, action):
   assert action == "install"
   n.close()
   os.execlp("liveinst", "liveinst")

if __name__ == '__main__':
    appinfo = Gio.DesktopAppInfo()
    try:
       desktop = appinfo.new_from_filename("/usr/share/applications/liveinst.desktop")
    except:
       sys.exit(1)
    label = desktop.get_name()
    actionlabel = desktop.get_generic_name()

    if not Notify.init(label):
        sys.exit(1)

    n = Notify.Notification()
    n.set_property("summary",label)
    n.set_property("body", 
        "You are currently using an uninstalled live image.\n" +
        "If you want to keep using Fedora, you can install " +
        "it to your hard disk.")
    n.set_property("icon-name","anaconda")
    n.set_hint("resident", GLib.Variant('b',True))

    n.add_action("install", actionlabel, install_cb, None, None)

    if not n.show():
        print "Failed to send notification"
        sys.exit(1)

    GLib.MainLoop().run()


More information about the devel mailing list