1 |
From 8d96c5a5b7027dc227f12f14d5fefcd1705c3ca8 Mon Sep 17 00:00:00 2001 |
2 |
From: Shad L. Lords <slords@mail.com> |
3 |
Date: Mon, 26 Oct 2009 19:13:44 -0600 |
4 |
Subject: [PATCH] Pick keyboard based on language selection |
5 |
|
6 |
--- |
7 |
textw/language_text.py | 85 +++-------------------------------------------- |
8 |
1 files changed, 6 insertions(+), 79 deletions(-) |
9 |
|
10 |
diff --git a/textw/language_text.py b/textw/language_text.py |
11 |
index 19ffd99..741e9fc 100644 |
12 |
--- a/textw/language_text.py |
13 |
+++ b/textw/language_text.py |
14 |
@@ -91,85 +91,12 @@ class LanguageWindow: |
15 |
|
16 |
class LanguageSupportWindow: |
17 |
def __call__(self, screen, language): |
18 |
- |
19 |
- # should already be sorted |
20 |
- ct = CheckboxTree(height = 8, scroll = 1) |
21 |
- |
22 |
- for lang in language.getAllSupported(): |
23 |
- ct.append(lang, lang, 0) |
24 |
- |
25 |
- for lang in language.getSupported (): |
26 |
- ct.setEntryValue(lang, 1) |
27 |
- |
28 |
- current = language.getDefault() |
29 |
- ct.setCurrent(current) |
30 |
- ct.setEntryValue(current, 1) |
31 |
- |
32 |
- bb = ButtonBar (screen, (TEXT_OK_BUTTON, (_("Select All"), "all"), (_("Reset"), "reset"), TEXT_BACK_BUTTON)) |
33 |
- |
34 |
- message = (_("Choose additional languages that you would like to use " |
35 |
- "on this system:")) |
36 |
- tb = TextboxReflowed(50, message) |
37 |
- |
38 |
- g = GridFormHelp (screen, _("Language Support"), "langsupport", 1, 4) |
39 |
- |
40 |
- g.add (tb, 0, 0, (0, 0, 0, 1), anchorLeft = 1) |
41 |
- g.add (ct, 0, 1, (0, 0, 0, 1)) |
42 |
- g.add (bb, 0, 3, growx = 1) |
43 |
- |
44 |
- while 1: |
45 |
- result = g.run() |
46 |
- |
47 |
- rc = bb.buttonPressed (result) |
48 |
- |
49 |
- if rc == TEXT_BACK_CHECK: |
50 |
- screen.popWindow() |
51 |
- return INSTALL_BACK |
52 |
- |
53 |
- if rc == "all": |
54 |
- for lang in language.getAllSupported(): |
55 |
- ct.setEntryValue(lang, 1) |
56 |
- |
57 |
- if rc == "reset": |
58 |
- for lang in language.getAllSupported(): |
59 |
- if lang == current: |
60 |
- ct.setEntryValue(lang, 1) |
61 |
- else: |
62 |
- ct.setEntryValue(lang, 0) |
63 |
- |
64 |
- if rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK: |
65 |
- # --If they selected all langs, then set language.setSupported to |
66 |
- # None. This installs all langs |
67 |
- |
68 |
- if ct.getSelection() == []: |
69 |
- ButtonChoiceWindow(screen, _("Invalid Choice"), |
70 |
- _("You must select at least one language to install."), |
71 |
- buttons = [ TEXT_OK_BUTTON ], width = 40) |
72 |
- |
73 |
- else: |
74 |
- # set selected langs once |
75 |
- language.setSupported (ct.getSelection()) |
76 |
- |
77 |
- # we may need to reset the default language |
78 |
- default = language.getDefault() |
79 |
- if default not in ct.getSelection(): |
80 |
- sellangs = language.getSupported() |
81 |
- |
82 |
- if len(sellangs) > 0: |
83 |
- language.setDefault(sellangs[0]) |
84 |
- else: |
85 |
- language.setDefault(None) |
86 |
- |
87 |
- else: |
88 |
- language.setDefault(default) |
89 |
- |
90 |
- # now set new selected langs again in case old default |
91 |
- # lang was left in the list before we switched the default |
92 |
- language.setSupported (ct.getSelection()) |
93 |
- |
94 |
- screen.popWindow() |
95 |
- return INSTALL_OK |
96 |
- |
97 |
+ langs = [] |
98 |
+ default = language.getDefault() |
99 |
+ langs.append(default) |
100 |
+ language.setSupported(langs) |
101 |
+ language.setDefault(default) |
102 |
+ return INSTALL_OK |
103 |
|
104 |
class LanguageDefaultWindow: |
105 |
def __call__(self,screen, language): |
106 |
-- |
107 |
1.5.5.6 |
108 |
|