Attachment 'user-experience.py'
Download 1 #!/usr/bin/python
2
3 import gtk
4 import sys
5
6 builder = gtk.Builder()
7 builder.add_from_file("user-experience.ui")
8
9 def expose_warning_box(b, e):
10 a = b.get_allocation()
11
12 cr = e.window.cairo_create()
13
14 c = w.style.lookup_color("warning_bg_color")
15 if c is None:
16 c = gtk.gdk.Color(0xfc00, 0xaf00, 0x3e00)
17 cr.set_source_color(c)
18
19 cr.rectangle(a.x, a.y, a.width, a.height)
20 cr.fill()
21
22 for s in ('gnome-3-not-capable', 'gnome-2-not-installed'):
23 b = builder.get_object(s)
24 b.set_border_width(5)
25 b.connect('expose-event', expose_warning_box)
26
27 w = builder.get_object("user-experience")
28
29 if sys.argv[1] == "1":
30 builder.get_object('gnome-3-not-capable').hide()
31 builder.get_object('gnome-2-not-installed').hide()
32 w.show()
33 elif sys.argv[1] == "2":
34 builder.get_object("gnome-3-button").set_sensitive(False)
35 builder.get_object("gnome-3-label").set_sensitive(False)
36 builder.get_object('gnome-2-not-installed').hide()
37 w.show()
38 elif sys.argv[1] == "3":
39 builder.get_object('gnome-3-not-capable').hide()
40 builder.get_object("gnome-2-button").set_sensitive(False)
41 builder.get_object("gnome-2-label").set_sensitive(False)
42 w.show()
43 elif sys.argv[1] == "4":
44 w = gtk.MessageDialog(type=gtk.MESSAGE_WARNING)
45 w.set_markup("<big><b>Previous login failed</b></big>")
46 w.format_secondary_markup(
47 "It appears that the the system crashed the last time you logged into "
48 "your account. This might indicate a problem using \"GNOME 3\" "
49 "on this system. Switching to \"GNOME 2\" might allow you to log in.")
50
51 w.add_buttons("Switch to GNOME 2", 0,
52 "Log in with GNOME 3", 1)
53 w.show()
54 elif sys.argv[1] == "5":
55 w = gtk.MessageDialog(type=gtk.MESSAGE_WARNING)
56 w.set_markup("<big><b>System doesn't support GNOME 3</b></big>")
57 w.format_secondary_markup(
58 "The graphics capabilities of this system don't support GNOME 3. "
59 "The system will start using GNOME 2 instead.")
60
61 w.add_buttons("OK", 0)
62 w.show()
63 elif sys.argv[1] == "6":
64 w = gtk.MessageDialog(type=gtk.MESSAGE_INFO)
65 w.set_markup("<big><b>System now supports GNOME 3</b></big>")
66 w.format_secondary_markup(
67 "Your system is now capable of running the new GNOME 3 user "
68 "experience. GNOME 3 provides a faster and more efficient "
69 "way to use your computer.")
70
71 w.add_buttons("Select User Experience", 0)
72 w.add_buttons("Continue", 0)
73 w.show()
74
75 gtk.main()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.