From 0ac1dd8055c7d146eb69efe4da3dcfd6ea844180 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 21 Dec 2009 10:32:30 -0500 Subject: Move instLanguage to the Anaconda object. --- anaconda | 18 +++++++++++++++--- booty/bootloaderInfo.py | 4 +++- exception.py | 12 ++++++------ instdata.py | 7 +------ iw/kbd_gui.py | 2 +- iw/language_gui.py | 4 ++-- iw/timezone_gui.py | 2 +- kickstart.py | 6 +++--- text.py | 4 +--- textw/keyboard_text.py | 2 +- textw/language_text.py | 21 ++++++++++----------- textw/timezone_text.py | 2 +- yuminstall.py | 2 +- 13 files changed, 46 insertions(+), 40 deletions(-) diff --git a/anaconda b/anaconda index 2ee3f9225..e71a3ddb1 100755 --- a/anaconda +++ b/anaconda @@ -445,6 +445,7 @@ class Anaconda(object): self.displayMode = None self.id = None self._instClass = None + self._instLanguage = None self._intf = None self.isHeadless = False self.ksdata = None @@ -484,6 +485,14 @@ class Anaconda(object): return self._instClass + @property + def instLanguage(self): + if not self._instLanguage: + import language + self._instLanguage = language.Language(self.displayMode) + + return self._instLanguage + @property def intf(self): if self._intf: @@ -590,6 +599,7 @@ class Anaconda(object): def write(self): self.writeXdriver() + self.instLanguage.write(self.rootPath) if self.ksdata: for svc in self.ksdata.services.disabled: @@ -656,6 +666,8 @@ class Anaconda(object): f.write(self.ksdata.services.__str__()) f.write(self.ksdata.reboot.__str__()) + self.instLanguage.writeKS(f) + # XXX: This is temporary until instdata goes away completely. self.id.writeKS(f) @@ -1067,9 +1079,9 @@ if __name__ == "__main__": # this is lame, but make things match what we expect (#443408) opts.lang = opts.lang.replace(".utf8", ".UTF-8") anaconda.dispatch.skipStep("language", permanent = 1) - anaconda.id.instLanguage.instLang = opts.lang - anaconda.id.instLanguage.systemLang = opts.lang - anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.instLanguage.instLang = opts.lang + anaconda.instLanguage.systemLang = opts.lang + anaconda.id.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) if opts.keymap: anaconda.dispatch.skipStep("keyboard", permanent = 1) diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index 8368e54fa..8bb7aebad 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -114,7 +114,7 @@ class KernelArguments: def get(self): args = "" for s in self.getDracutStorageArgs() + [ - self.id.instLanguage.dracutSetupString(), + self.anaconda.instLanguage.dracutSetupString(), self.id.keyboard.dracutSetupString(), self.args, self.appendArgs ]: @@ -157,6 +157,8 @@ class KernelArguments: newArgs = [] cfgFilename = "/tmp/install.cfg" + self.anaconda = instData.anaconda + if iutil.isS390(): self.cargs = [] f = open(cfgFilename) diff --git a/exception.py b/exception.py index 848c27af3..936148e88 100644 --- a/exception.py +++ b/exception.py @@ -101,12 +101,12 @@ def initExceptionHandling(anaconda): "id.dispatch", "id.hdList", "ksdata", - "id.instLanguage.font", - "id.instLanguage.kbd", - "id.instLanguage.info", - "id.instLanguage.localeInfo", - "id.instLanguage.nativeLangNames", - "id.instLanguage.tz", + "instLanguage.font", + "instLanguage.kbd", + "instLanguage.info", + "instLanguage.localeInfo", + "instLanguage.nativeLangNames", + "instLanguage.tz", "id.keyboard._mods._modelDict", "id.keyboard.modelDict", "id.storage.encryptionPassphrase", diff --git a/instdata.py b/instdata.py index b5f74c993..dcb2e17f4 100644 --- a/instdata.py +++ b/instdata.py @@ -24,7 +24,6 @@ import os, sys import stat import string -import language import network import firewall import security @@ -62,7 +61,7 @@ class InstallData: self.firewall = firewall.Firewall() self.security = security.Security() self.timezone = timezone.Timezone() - self.timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone(self.anaconda.rootPath)) + self.timezone.setTimezoneInfo(self.anaconda.instLanguage.getDefaultTimeZone(self.anaconda.rootPath)) self.users = None self.rootPassword = { "isCrypted": False, "password": "", "lock": False } self.auth = "--enableshadow --passalgo=sha512 --enablefingerprint" @@ -90,8 +89,6 @@ class InstallData: return None def write(self): - self.instLanguage.write (self.anaconda.rootPath) - if not self.anaconda.isHeadless: self.keyboard.write (self.anaconda.rootPath) @@ -146,7 +143,6 @@ class InstallData: log.error("User %s already exists, not creating." % ud.name) def writeKS(self, f): - self.instLanguage.writeKS(f) if not self.anaconda.isHeadless: self.keyboard.writeKS(f) self.network.writeKS(f) @@ -170,7 +166,6 @@ class InstallData: self.storage.writeKS(f) def __init__(self, anaconda, extraModules): - self.instLanguage = language.Language(anaconda.displayMode) self.keyboard = keyboard.Keyboard() self.anaconda = anaconda self.extraModules = extraModules diff --git a/iw/kbd_gui.py b/iw/kbd_gui.py index aa7b858e6..e8050ad48 100644 --- a/iw/kbd_gui.py +++ b/iw/kbd_gui.py @@ -34,6 +34,6 @@ class KeyboardWindow(InstallWindow, installKeyboardWindow): installKeyboardWindow.getNext(self) def getScreen(self, anaconda): - default = anaconda.id.instLanguage.getDefaultKeyboard(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultKeyboard(anaconda.rootPath) anaconda.id.keyboard.set(default) return installKeyboardWindow.getScreen(self, default, anaconda.id.keyboard) diff --git a/iw/language_gui.py b/iw/language_gui.py index d09213b8b..f023932d8 100644 --- a/iw/language_gui.py +++ b/iw/language_gui.py @@ -50,7 +50,7 @@ class LanguageWindow (InstallWindow): self.instLang.instLang = self.lang self.instLang.systemLang = self.lang - anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.id.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) self.ics.getICW().setLanguage() return None @@ -84,7 +84,7 @@ class LanguageWindow (InstallWindow): label.set_size_request(350, -1) hbox.pack_start(label, False) - self.instLang = anaconda.id.instLanguage + self.instLang = anaconda.instLanguage self.listStore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, diff --git a/iw/timezone_gui.py b/iw/timezone_gui.py index 226b776e8..38a93b080 100644 --- a/iw/timezone_gui.py +++ b/iw/timezone_gui.py @@ -92,7 +92,7 @@ class TimezoneWindow(InstallWindow): (self.default, asUTC) = self.timezone.getTimezoneInfo() if not self.default: - self.default = anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath) + self.default = anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath) asUTC = 0 if (string.find(self.default, "UTC") != -1): diff --git a/kickstart.py b/kickstart.py index c93581af6..c1f22f4e1 100644 --- a/kickstart.py +++ b/kickstart.py @@ -388,9 +388,9 @@ class Keyboard(commands.keyboard.FC3_Keyboard): class Lang(commands.lang.FC3_Lang): def execute(self, anaconda): - anaconda.id.instLanguage.instLang = self.lang - anaconda.id.instLanguage.systemLang = self.lang - anaconda.id.ksdata.skipSteps.append("language") + anaconda.instLanguage.instLang = self.lang + anaconda.instLanguage.systemLang = self.lang + anaconda.ksdata.skipSteps.append("language") class LogVolData(commands.logvol.F12_LogVolData): def execute(self, anaconda): diff --git a/text.py b/text.py index 503962522..e3c000cf5 100644 --- a/text.py +++ b/text.py @@ -569,7 +569,7 @@ class InstallInterface: def run(self, anaconda): self.anaconda = anaconda - instLang = anaconda.id.instLanguage + instLang = anaconda.instLanguage if instLang.getFontFile(instLang.instLang) == "none": if not anaconda.ksdata: @@ -586,8 +586,6 @@ class InstallInterface: if flags.debug: self.screen.suspendCallback(debugSelf, self.screen) - self.instLanguage = anaconda.id.instLanguage - # draw the frame after setting up the fallback self.drawFrame() diff --git a/textw/keyboard_text.py b/textw/keyboard_text.py index d136446df..3dbc2d6e9 100644 --- a/textw/keyboard_text.py +++ b/textw/keyboard_text.py @@ -39,7 +39,7 @@ class KeyboardWindow: if anaconda.id.keyboard.beenset: default = anaconda.id.keyboard.get () else: - default = anaconda.id.instLanguage.getDefaultKeyboard(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultKeyboard(anaconda.rootPath) if default not in keyboards: default = 'us' diff --git a/textw/language_text.py b/textw/language_text.py index 191a90d5d..bac78e4a3 100644 --- a/textw/language_text.py +++ b/textw/language_text.py @@ -30,18 +30,17 @@ log = logging.getLogger("anaconda") class LanguageWindow: def __call__(self, screen, anaconda): - id = anaconda.id - languages = id.instLanguage.available () + languages = anaconda.instLanguage.available () languages.sort() - current = id.instLanguage.instLang + current = anaconda.instLanguage.instLang height = min((8, len(languages))) buttons = [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] translated = [] for lang in languages: - translated.append ((_(lang), id.instLanguage.getLangByName(lang))) + translated.append ((_(lang), anaconda.instLanguage.getLangByName(lang))) (button, choice) = \ ListboxChoiceWindow(screen, _("Language Selection"), _("What language would you like to use during the " @@ -52,19 +51,19 @@ class LanguageWindow: if button == TEXT_BACK_CHECK: return INSTALL_BACK - if id.instLanguage.getFontFile(choice) == "none": + if anaconda.instLanguage.getFontFile(choice) == "none": ButtonChoiceWindow(screen, "Language Unavailable", "%s display is unavailable in text mode. The " "installation will continue in English." % (choice,), buttons=[TEXT_OK_BUTTON]) - id.instLanguage.instLang = choice - id.instLanguage.systemLang = choice - id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.instLanguage.instLang = choice + anaconda.instLanguage.systemLang = choice + anaconda.id.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) return INSTALL_OK - id.instLanguage.instLang = choice - id.instLanguage.systemLang = choice - id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.instLanguage.instLang = choice + anaconda.instLanguage.systemLang = choice + anaconda.id.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) anaconda.intf.drawFrame() diff --git a/textw/timezone_text.py b/textw/timezone_text.py index ab5ebe1bf..9d8dc2665 100644 --- a/textw/timezone_text.py +++ b/textw/timezone_text.py @@ -67,7 +67,7 @@ class TimezoneWindow: timezones = self.getTimezoneList() (default, asUtc) = anaconda.id.timezone.getTimezoneInfo() if not default: - default = anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath) bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) t = TextboxReflowed(30, diff --git a/yuminstall.py b/yuminstall.py index 9d6e96f72..8f7e6b2c8 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1279,7 +1279,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon self.ayum.repos.callback = None def getDefaultGroups(self, anaconda): - langs = anaconda.id.instLanguage.getCurrentLangSearchList() + langs = anaconda.instLanguage.getCurrentLangSearchList() rc = map(lambda x: x.groupid, filter(lambda x: x.default, self.ayum.comps.groups)) for g in self.ayum.comps.groups: -- cgit