Merge lp:~bratsche/ubiquity/language-combobox into lp:ubiquity

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratsche/ubiquity/language-combobox
Merge into: lp:ubiquity
Diff against target: 78 lines (+35/-1)
1 file modified
bin/ubiquity-greeter-gtk (+35/-1)
To merge this branch: bzr merge lp:~bratsche/ubiquity/language-combobox
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+19352@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) wrote :

Adds combobox for language selection.

Revision history for this message
Colin Watson (cjwatson) wrote :

Will need some polish at our end, but looks good as it stands. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubiquity-greeter-gtk'
2--- bin/ubiquity-greeter-gtk 2010-02-12 21:31:40 +0000
3+++ bin/ubiquity-greeter-gtk 2010-02-15 18:47:20 +0000
4@@ -4,6 +4,7 @@
5 import optparse
6
7 import glib
8+import gobject
9 import gtk
10 import rsvg
11
12@@ -15,6 +16,7 @@
13 button1 = None
14 button2 = None
15 fixed = None
16+combo = None
17
18 def recompute_button_positions():
19 if button1:
20@@ -31,6 +33,13 @@
21 if button2.allocation.x != x or button2.allocation.y != y:
22 fixed.move(button2, int(x), int(y))
23
24+ if combo:
25+ requisition = combo.get_child_requisition()
26+ x = window.allocation.width / 2 - requisition[0] / 2
27+ y = window.allocation.height / 4
28+ if combo.allocation.x != x or combo.allocation.y != y:
29+ fixed.move(combo, int(x), int(y))
30+
31 return False
32
33 def button_mapped(button):
34@@ -46,11 +55,24 @@
35 return_value = 0
36 gtk.main_quit()
37
38+def combo_changed(combobox):
39+ print(combobox.get_active_text())
40+
41 def fixed_size_allocate(widget, allocation):
42 glib.timeout_add(100, recompute_button_positions)
43
44+def create_language_model():
45+ langs = ('English', 'French', 'German', 'Spanish')
46+
47+ store = gtk.ListStore(gobject.TYPE_STRING)
48+ for l in langs:
49+ iter = store.append()
50+ store.set(iter, 0, l)
51+
52+ return store
53+
54 def window_size_allocate(widget, allocation):
55- global image, button1, button2
56+ global image, button1, button2, combo
57
58 orig_pixbuf = gtk.gdk.pixbuf_new_from_file(options.filename)
59 pixbuf = orig_pixbuf.scale_simple(allocation.width, allocation.height,
60@@ -72,6 +94,18 @@
61 button2.connect('map', button_mapped)
62 fixed.put(button2, 0, 0)
63 button2.show()
64+
65+ combo = gtk.ComboBox(create_language_model())
66+ combo.set_title('Language')
67+
68+ renderer = gtk.CellRendererText()
69+ combo.pack_start(renderer, False)
70+ combo.set_attributes(renderer, text=0)
71+ combo.connect('changed', combo_changed)
72+ combo.set_active(0)
73+
74+ fixed.put(combo, 0, 0)
75+ combo.show()
76 else:
77 if (image.allocation.width != allocation.width or
78 image.allocation.height != allocation.height):

Subscribers

People subscribed via source and target branches

to status/vote changes: