2011-01-18 09:24:57 +00:00
|
|
|
#
|
|
|
|
# keyboard_text: text mode keyboard setup dialogs
|
|
|
|
#
|
|
|
|
# Copyright (C) 2001, 2002 Red Hat, Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
2013-01-23 17:28:19 +00:00
|
|
|
from pyanaconda import isys
|
2011-01-18 09:24:57 +00:00
|
|
|
from snack import *
|
|
|
|
from constants_text import *
|
2013-01-23 17:28:19 +00:00
|
|
|
from pyanaconda.flags import flags
|
2011-01-18 09:24:57 +00:00
|
|
|
|
2013-01-23 17:28:19 +00:00
|
|
|
from pyanaconda.constants import *
|
2011-01-18 09:24:57 +00:00
|
|
|
import gettext
|
|
|
|
_ = lambda x: gettext.ldgettext("anaconda", x)
|
|
|
|
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger("anaconda")
|
|
|
|
|
|
|
|
class KeyboardWindow:
|
|
|
|
def __call__(self, screen, anaconda):
|
|
|
|
if flags.serial or flags.virtpconsole:
|
|
|
|
return INSTALL_NOOP
|
|
|
|
keyboards = anaconda.keyboard.modelDict.keys()
|
|
|
|
keyboards.sort ()
|
|
|
|
|
|
|
|
if anaconda.keyboard.beenset:
|
|
|
|
default = anaconda.keyboard.get ()
|
|
|
|
else:
|
2013-01-23 17:28:19 +00:00
|
|
|
default = anaconda.instLanguage.getDefaultKeyboard()
|
2011-01-18 09:24:57 +00:00
|
|
|
|
|
|
|
if default not in keyboards:
|
|
|
|
default = 'us'
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
|
|
|
anaconda.keyboard.set (keyboards[choice])
|
|
|
|
anaconda.keyboard.beenset = 1
|
|
|
|
|
|
|
|
anaconda.keyboard.activate()
|
|
|
|
|
|
|
|
# FIXME: eventually, kbd.activate will do this
|
|
|
|
try:
|
|
|
|
isys.loadKeymap(keyboards[choice])
|
2013-01-23 17:28:19 +00:00
|
|
|
except SystemError as e:
|
|
|
|
log.error("Could not install keymap %s: %s" % (keyboards[choice], e))
|
2011-01-18 09:24:57 +00:00
|
|
|
return INSTALL_OK
|
|
|
|
|