summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbfox <bfox>2001-01-17 00:04:17 +0000
committerbfox <bfox>2001-01-17 00:04:17 +0000
commit3d3caa620b55473337675c49efbeb13e119b95b8 (patch)
tree1e38f864e1cd03c023ffb30e1908585841b53c0f
parentf4751959cfb86d2567f9f526530c8bcfc052612f (diff)
downloadanaconda-3d3caa620b55473337675c49efbeb13e119b95b8.tar.gz
anaconda-3d3caa620b55473337675c49efbeb13e119b95b8.tar.xz
anaconda-3d3caa620b55473337675c49efbeb13e119b95b8.zip
Wired up list widget.
-rw-r--r--iw/language_support_gui.py328
1 files changed, 205 insertions, 123 deletions
diff --git a/iw/language_support_gui.py b/iw/language_support_gui.py
index 8015035a2..7a52a7c9a 100644
--- a/iw/language_support_gui.py
+++ b/iw/language_support_gui.py
@@ -32,126 +32,149 @@ class LanguageSupportWindow (InstallWindow):
self.running = 0
def getNext (self):
+# self.todo.language.setSupported (self.langs)
+# self.todo.language.setByAbbrev (self.defaultLang)
+
+ self.langs = []
+ support_all = TRUE
+
+ for row in range(self.maxrows):
+ (val, row_data, header) = self.language.get_row_data (row)
+
+
+ if val == 1:
+ print "selected"
+ selected = self.language.get_text (row, 1)
+ self.langs.append (self.languages[selected])
+ else:
+ print "not selected"
+ support_all = FALSE
+
+ if support_all == TRUE:
+ print "Supporting all langs"
+ self.langs = None
+
+
+ self.defaultLang = self.languages[self.combo.entry.get_text()]
+
+ print "langs = ", self.langs
+ print "self.defaultLang = ", self.defaultLang
+
self.todo.language.setSupported (self.langs)
self.todo.language.setByAbbrev (self.defaultLang)
+
+
return None
- def available_select_row (self, clist, row, col, event):
- if event and event.type == _2BUTTON_PRESS:
- lang = clist.get_text (row, 0)
- clist.remove (row)
- self.langs.append (self.languages[lang])
- self.updateSelected ()
-
- def support_select_row (self, clist, row, col, event):
- if event and (col == 0 or col == -1):
- newDefault = clist.get_text (row, 1)
- self.defaultLang = self.languages[newDefault]
- self.updateSelected ()
- clist.select_row (row, col)
+ def support_select_row (self, clist, event):
+ print "support_select_row"
+ list = []
+ try:
+ row, col = self.language.get_selection_info (event.x, event.y)
+ selected = self.language.get_text (row, 1)
+# print "selected = ", selected
+ self.toggle_row (row)
+
+ for row in range(self.maxrows):
+ (val, row_data, header) = self.language.get_row_data (row)
+ if val == 1:
+ selected = self.language.get_text (row, 1)
+ list.append (selected)
- def updateSelected (self):
- self.language.freeze ()
- for i in range(self.language.rows):
- self.language.remove (0)
-
- i = 0
+# print len(list)
+ if len(list) == 0:
+ list = [""]
+ self.ics.setNextEnabled (FALSE)
+ else:
+ self.ics.setNextEnabled (TRUE)
+
+ self.combo.set_popdown_strings(list)
+
+ for row in range(self.maxrows):
+ if self.languages[self.language.get_text (row, 1)] == self.defaultLang:
+# print "self.defaultLang is ", self.defaultLang
+ default = self.language.get_text (row, 1)
+ index = list.index(default)
+# print "self.defaultLang is at index ", index
+ self.combo.list.select_item(index)
+ except:
+ pass
+
+ def toggle_row (self, row):
+ (val, row_data, header) = self.language.get_row_data(row)
+# print val, row_data, header
+ val = not val
+ self.language.set_row_data(row, (val, row_data, header))
+ self.language._update_row (row)
- language_keys = self.languages.keys ()
- language_keys.sort ()
- for locale in language_keys:
- if not self.langs or (self.languages[locale] in self.langs):
- row = self.language.append_row ((locale, "1"), TRUE, None)
-# if self.languages[locale] == self.defaultLang:
-# self.language.set_pixmap(i, 0, self.checkMark)
-# else:
-# self.language.set_pixmap(i, 0, self.checkMark_Off)
- i = i + 1
- self.language.thaw ()
-
-
- def allToggled (self, button):
- if not self.running:
- return
- language_keys = self.languages.keys ()
- language_keys.sort ()
- if button.get_active ():
- state = FALSE
- else:
- state = TRUE
-
- for widget in self.sensitiveList:
- widget.set_sensitive (state)
-
- if state == TRUE:
- # clear the current selection
- # set up for picking which lang we want.
- self.langs = self.lastLangs
- if not self.langs:
- self.langs.append (self.defaultLang)
- self.available = []
- for lang in language_keys:
- if not self.langs or (self.languages[lang] not in self.langs):
- self.available.append (lang)
- else:
- self.available = []
- # speicfy no languages.
- self.lastLangs = self.langs
- self.langs = []
-
- self.updateSelected()
-
+ def select_all (self, data):
+ self.ics.setNextEnabled (TRUE)
+ for row in range(self.maxrows):
+ (val, row_data, header) = self.language.get_row_data (row)
+ self.language.set_row_data (row, (TRUE, row_data, header))
+ self.language._update_row (row)
+
+ self.combo.set_popdown_strings (self.language_keys)
+
+ for row in range(self.maxrows):
+ if self.languages[self.language.get_text (row, 1)] == self.defaultLang:
+# print "self.defaultLang is ", self.defaultLang
+ default = self.language.get_text (row, 1)
+ index = self.language_keys.index(default)
+# print "self.defaultLang is at index ", index
+ self.combo.list.select_item(index)
+
+ def reset (self, data):
+ self.ics.setNextEnabled (TRUE)
+ for row in range(self.maxrows):
+ selected = self.languages[self.language.get_text (row, 1)]
+ (val, row_data, header) = self.language.get_row_data (row)
+
+ if selected == self.defaultLang:
+ self.language.set_row_data(row, (1, row_data, header))
+ self.language._update_row (row)
+
+ selected = self.language.get_text (row, 1)
+ list = []
+ list.append (selected)
+ self.combo.set_popdown_strings(list)
+# index = list.index(selected)
+# print index
+# self.combo.list.select_item(index)
+ else:
+ self.language.set_row_data(row, (0, row_data, header))
+ self.language._update_row (row)
- def onAdd (self, button):
- for i in self.languageAvailable.selection:
- lang = self.languageAvailable.get_text (i, 0)
- self.langs.append (self.languages[lang])
- self.available.remove (lang)
- self.updateSelected()
- self.updateAvailable()
-
- def onRemove (self, button):
- for i in self.language.selection:
- lang = self.language.get_text (i, 1)
- self.langs.remove (self.languages[lang])
- self.available.append (lang)
- self.updateSelected()
- self.updateAvailable()
# LanguageSupportWindow tag="langsupport"
def getScreen (self):
self.langs = self.todo.language.getSupported()
+
self.lastLangs = self.langs
+ print "Supported Langs are: ", self.langs
self.sensitiveList = []
self.running = 0
- self.defaultLang = self.todo.language.get()
-# print self.defaultLang
+ self.defaultLang = self.icw.getLanguage ()
+ print "self.defaultLang", self.defaultLang
+# self.defaultPosition = 0
- language_keys = self.languages.keys ()
- language_keys.sort ()
-
-# table = GtkTable ()
+ self.language_keys = self.languages.keys ()
+ self.language_keys.sort ()
vbox = GtkVBox (FALSE, 10)
-
hbox = GtkHBox (FALSE)
label = GtkLabel (_("Choose the default language: "))
-# label.set_alignment (0.01, 0.5)
-# label.set_line_wrap (TRUE)
hbox.pack_start (label, FALSE, 20)
- combo = GtkCombo ()
- combo.set_popdown_strings (language_keys)
-# alignment = GtkAlignment (1.0, 0.0)
-# alignment.add (combo)
+ self.combo = GtkCombo ()
+# combo.set_popdown_strings (language_keys)
- hbox.pack_start (combo, FALSE, 20)
+ hbox.pack_start (self.combo, FALSE, 20)
vbox.pack_start (hbox, FALSE, 50)
-
sep = GtkHSeparator ()
vbox.pack_start (sep, FALSE, 15)
@@ -160,61 +183,120 @@ class LanguageSupportWindow (InstallWindow):
label.set_line_wrap (TRUE)
vbox.pack_start (label, FALSE)
-# bb = GtkHButtonBox ()
-
-
hbox = GtkHBox (FALSE)
-
# langs we want to support
self.language = checklist.CheckList(1)
-# self.language.set_column_title (0, (_("Default")))
-# self.language.set_column_title (1, (_("Selected")))
-# self.language.column_titles_show ()
-# self.language.set_selection_mode (SELECTION_MULTIPLE)
-# self.language.connect ("select_row", self.support_select_row)
+ self.language.connect ('button_press_event', self.support_select_row)
-# i = 0
- for locale in language_keys:
-
- if self.languages[locale] == self.defaultLang:
+ self.maxrows = 0
+ list = []
+ comboCurr = 0
+ for locale in self.language_keys:
+ if self.languages[locale] == self.defaultLang or self.langs == None:
self.language.append_row((locale, ""), TRUE)
-# self.language.set_pixmap(i, 0, self.checkMark)
+ list.append(locale)
else:
- self.language.append_row((locale, ""), FALSE)
-# self.language.set_pixmap(i, 0, self.checkMark_Off)
-# i = i + 1
+ try:
+ if self.langs.index(self.languages[locale]) >= 0:
+ self.language.append_row((locale, ""), TRUE)
+ list.append(locale)
+ comboCurr = comboCurr + 1
+ except:
+ self.language.append_row((locale, ""), FALSE)
+
+ self.maxrows = self.maxrows + 1
+ self.todo.langMaxRows = self.maxrows
+
+ self.combo.set_popdown_strings (list)
+ print comboCurr
+ self.combo.list.select_item(comboCurr)
+
+
+
+
+
+
+# for locale in self.language_keys:
+# print locale
+# if self.langs == []:
+# print "ALL :", self.languages
+# self.language.append_row((locale, ""), TRUE)
+
+# for locale2 in self.language_keys:
+# list.append(locale2)
+# list.append (locale)
+
+# self.combo.set_popdown_strings (list)
+
+# if self.languages[locale] == self.defaultLang:
+# print "dddddddd", locale
+
+# print self.language_keys.index(self.languages[locale])
+# index = self.language_keys.index(locale)
+# print self.language_keys
+# print index
+# self.combo.list.select_item(5)
+
+# except:
+# pass
+
+# index = self.languages[self.defaultLang]
+
+# self.combo.list.select_item(index)
+
+
+# elif self.languages[locale] == self.defaultLang:
+# print "B"
+# self.language.append_row((locale, ""), TRUE)
+# list.append (locale)
+# self.combo.set_popdown_strings (list)
+# else:
+# print "C"
+# try:
+# print self.lastLangs.index(self.languages[locale])
+# self.language.append_row((locale, ""), TRUE)
+# list.append (locale)
+# self.combo.set_popdown_strings (list)
+# except:
+# self.language.append_row((locale, ""), FALSE)
+
+# self.combo.set_popdown_strings (list)
+# print self.defaultLang
+
+# if self.languages[locale] == self.defaultLang:
+# print "dddddddd", self.lastLangs
+# try:
+# print self.lastLangs.index(self.languages[locale])
+# index = self.lastLangs.index(self.languages[locale])
+# self.combo.list.select_item(index)
+# except:
+# pass
+
+# self.maxrows = self.maxrows + 1
+
sw = GtkScrolledWindow ()
sw.set_border_width (5)
sw.set_policy (POLICY_NEVER, POLICY_AUTOMATIC)
sw.add (self.language)
-# table.attach (sw, 2, 3, 3, 4, EXPAND|FILL, EXPAND|FILL)
-# vbox.pack_start (sw, TRUE)
vbox2 = GtkVBox (FALSE, 12)
all_button = GtkButton (_("Select all"))
all_button.set_usize(160, -1)
+ all_button.connect ('clicked', self.select_all)
a1 = GtkAlignment (0.5, 0.5)
a1.add (all_button)
reset_button = GtkButton (_("Reset"))
reset_button.set_usize(160, -1)
+ reset_button.connect ('clicked', self.reset)
a2 = GtkAlignment (0.5, 0.5)
a2.add (reset_button)
vbox2.pack_start (a1, FALSE, 10)
vbox2.pack_start (a2, FALSE)
-
-# vbox.pack_start (alignment, FALSE, 25)
-
-
-
-
-
-
-
hbox.pack_start (sw, TRUE, 10)
hbox.pack_start (vbox2, FALSE, 10)
vbox.pack_start (hbox, TRUE)
@@ -224,8 +306,6 @@ class LanguageSupportWindow (InstallWindow):
button = GtkButton (_("Select as default"))
alignment.add (button)
-# table.attach (alignment, 2, 3, 4, 5,
-# FALSE, FALSE, 5, 5)
self.running = 1
@@ -234,3 +314,5 @@ class LanguageSupportWindow (InstallWindow):
return vbox
# return table
+
+