diff options
author | Matt Wilson <msw@redhat.com> | 2001-10-16 20:59:15 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2001-10-16 20:59:15 +0000 |
commit | cc02a97cc308be0ae7d6e4ac6c605518103c6f22 (patch) | |
tree | 21376b7119090a57bc496a2731b7952fd465b0a9 /iw/language_gui.py | |
parent | 584b653db54b96a7721cffeba67680495e59337c (diff) | |
download | anaconda-cc02a97cc308be0ae7d6e4ac6c605518103c6f22.tar.gz anaconda-cc02a97cc308be0ae7d6e4ac6c605518103c6f22.tar.xz anaconda-cc02a97cc308be0ae7d6e4ac6c605518103c6f22.zip |
merge anaconda-gtk-2-0-branch to HEAD
Diffstat (limited to 'iw/language_gui.py')
-rw-r--r-- | iw/language_gui.py | 83 |
1 files changed, 53 insertions, 30 deletions
diff --git a/iw/language_gui.py b/iw/language_gui.py index c0028e756..3c0cd91e8 100644 --- a/iw/language_gui.py +++ b/iw/language_gui.py @@ -11,7 +11,8 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -from gtk import * +import gobject +import gtk from iw_gui import * from translate import _, N_ @@ -24,60 +25,82 @@ class LanguageWindow (InstallWindow): InstallWindow.__init__ (self, ics) def getNext (self): + rc = self.listView.get_selection().get_selected() + if rc: + model, iter = rc + self.lang = self.listStore.get_value(iter, 1) + self.instLang.setRuntimeLanguage(self.lang) self.ics.getICW().setLanguage (self.instLang.getLangNick(self.lang)) return None - def select_row (self, clist, row, col, event): - if self.running: - self.lang = clist.get_row_data (clist.selection[0]) + def listScroll(self, widget, *args): + # recenter the list + rc = self.listView.get_selection().get_selected() + if rc is None: + return + model, iter = rc + + path = self.listStore.get_path(iter) + col = self.listView.get_column(0) + self.listView.scroll_to_cell(path, col, gtk.TRUE, 0.5, 0.5) # LanguageWindow tag="lang" def getScreen (self, intf, instLang): self.running = 0 - mainBox = GtkVBox (FALSE, 10) + mainBox = gtk.VBox (gtk.FALSE, 10) - hbox = GtkHBox(FALSE, 5) + hbox = gtk.HBox(gtk.FALSE, 5) pix = self.ics.readPixmap ("gnome-globe.png") if pix: - a = GtkAlignment () + a = gtk.Alignment () a.add (pix) - a.set (0.0, 0.0, 0.0, 0.0) - hbox.pack_start (a, FALSE) + hbox.pack_start (a, gtk.FALSE) - label = GtkLabel (_("What language would you like to use during the " + label = gtk.Label (_("What language would you like to use during the " "installation process?")) - label.set_line_wrap (TRUE) + label.set_line_wrap (gtk.TRUE) label.set_usize(350, -1) - hbox.pack_start(label, FALSE) + hbox.pack_start(label, gtk.FALSE) - self.language = GtkCList () - self.language.set_selection_mode (SELECTION_BROWSE) - self.language.connect ("select_row", self.select_row) self.instLang = instLang - default = -1 - n = 0 + self.listStore = gtk.ListStore(gobject.TYPE_STRING, + gobject.TYPE_STRING) + for locale in instLang.available(): - row = self.language.append ((_(locale),)) - self.language.set_row_data (row, locale) + iter = self.listStore.append() + self.listStore.set_value(iter, 0, _(locale)) + self.listStore.set_value(iter, 1, locale) + + self.listStore.set_sort_column_id(0, gtk.SORT_ASCENDING) - if locale == instLang.getCurrent(): - self.lang = locale - default = n - n = n + 1 + self.listView = gtk.TreeView(self.listStore) + col = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=0) + self.listView.append_column(col) + self.listView.set_property("headers-visible", gtk.FALSE) - if default > 0: - self.language.select_row (default, 0) + current = instLang.getCurrent() + iter = self.listStore.get_iter_root() + next = 1 + while next: + if self.listStore.get_value(iter, 1) == current: + selection = self.listView.get_selection() + selection.unselect_all() + selection.select_iter(iter) + break + next = self.listStore.iter_next(iter) + self.listView.connect("size-allocate", self.listScroll) - sw = GtkScrolledWindow () + sw = gtk.ScrolledWindow () sw.set_border_width (5) - sw.set_policy (POLICY_NEVER, POLICY_NEVER) - sw.add (self.language) + sw.set_shadow_type(gtk.SHADOW_IN) + sw.set_policy (gtk.POLICY_NEVER, gtk.POLICY_NEVER) + sw.add (self.listView) - mainBox.pack_start (hbox, FALSE, FALSE, 10) - mainBox.pack_start (sw, TRUE) + mainBox.pack_start (hbox, gtk.FALSE, gtk.FALSE, 10) + mainBox.pack_start (sw, gtk.TRUE, gtk.TRUE) self.running = 1 |