1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#
# keyboard_text: text mode keyboard setup dialogs
#
# Copyright 2001 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import isys
import iutil
from snack import *
from constants_text import *
from translate import _
from log import *
from flags import flags
class KeyboardWindow:
def __call__(self, screen, instLang, kbd, xconfig):
if flags.serial:
return INSTALL_NOOP
keyboards = kbd.available ()
keyboards.sort ()
if kbd.beenset:
default = kbd.get ()
else:
default = instLang.getDefaultKeyboard()
(button, choice) = \
ListboxChoiceWindow(screen, _("Keyboard Selection"),
_("Which model keyboard is attached to this computer?"), keyboards,
buttons = [TEXT_OK_BUTTON, TEXT_BACK_BUTTON], width = 30, scroll = 1, height = 8,
default = default, help = "kybd")
if button == TEXT_BACK_CHECK:
return INSTALL_BACK
kbd.set (keyboards[choice])
kbd.beenset = 1
if flags.reconfig:
iutil.execWithRedirect ("/bin/loadkeys",
["/bin/loadkeys", keyboards[choice]],
stderr = "/dev/null")
try:
isys.loadKeymap(keyboards[choice])
except SystemError, (errno, msg):
log("Could not install keymap %s: %s" % (keyboards[choice], msg))
return INSTALL_OK
|