From 7bc46c63e67215e10c3bae5e578537b37845b74d Mon Sep 17 00:00:00 2001 From: Parag Nemade Date: Aug 20 2015 08:35:41 +0000 Subject: Fix more coding style as per pep8 standard --- diff --git a/src/language_backend.py b/src/language_backend.py index e45ae27..bb008ac 100644 --- a/src/language_backend.py +++ b/src/language_backend.py @@ -1,22 +1,23 @@ -## languageBackend.py - The backend code needed for system-config-language -## Copyright (C) 2002-2015 Red Hat, Inc. -## Copyright (C) 2002, 2003 Brent Fox -## Copyright (C) Parag Nemade +# languageBackend.py - The backend code needed for system-config-language +# Copyright (C) 2002-2015 Red Hat, Inc. +# Copyright (C) 2002, 2003 Brent Fox +# Copyright (C) Parag Nemade ## -## 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 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. +# 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, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. from __future__ import print_function @@ -24,9 +25,12 @@ import string import os import gettext -_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" +_ = lambda x: gettext.translation( + "system-config-language", fallback=True).gettext(x) if x != "" else "" + class LanguageBackend(object): + def __init__(self): self.original_file = None self.path = '/etc/locale.conf' @@ -53,7 +57,7 @@ class LanguageBackend(object): if langs: for lang in langs: - #Chop off any encoding data. We don't really need it + # Chop off any encoding data. We don't really need it lang_base = self.remove_encoding(lang) langs[langs.index(lang)] = lang_base @@ -101,12 +105,12 @@ class LanguageBackend(object): for line in self.original_file: if line[:5] == "LANG=": fd.write('LANG="' + default_lang + '"\n') - #horrible hack to make simplified chinese work + # horrible hack to make simplified chinese work if default_lang == "zh_CN.GB18030": fd.write('LANGUAGE= \ "zh_CN.GB18030:zh_CN.GB2312:zh_CN"\n') elif line[:9] == 'LANGUAGE=': - #horrible hack to make simplified chinese work + # horrible hack to make simplified chinese work if default_lang != "zh_CN.GB18030": pass else: @@ -137,7 +141,7 @@ class LanguageBackend(object): for line in self.original_file: if line[:5] == "LANG=": fd.write('LANG="' + default_lang + '"\n') - #horrible hack to make simplified chinese work + # horrible hack to make simplified chinese work if default_lang == "zh_CN.GB18030": fd.write('LANGUAGE= \ "zh_CN.GB18030:zh_CN.GB2312:zh_CN"\n') @@ -146,7 +150,7 @@ class LanguageBackend(object): elif line[:11] == 'SYSFONTACM=': fd.write('SYSFONTACM="' + sysfontacm + '"\n') elif line[:9] == 'LANGUAGE=': - #horrible hack to make simplified chinese work + # horrible hack to make simplified chinese work if default_lang != "zh_CN.GB18030": pass else: @@ -158,10 +162,10 @@ class LanguageBackend(object): fd.write('SYSFONT="' + sysfont + '"\n') if sysfontacm != "utf8": fd.write('SYSFONTACM="' + sysfontacm + '"\n') - #horrible hack to make simplified chinese work + # horrible hack to make simplified chinese work if default_lang == "zh_CN.GB18030": fd.write('LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"\n') fd.close() else: - print("You should have /etc/locale.conf installed by systemd package") - + print( + "You should have /etc/locale.conf installed by systemd package") diff --git a/src/language_gui.py b/src/language_gui.py index 7cdec15..da19f7c 100644 --- a/src/language_gui.py +++ b/src/language_gui.py @@ -1,22 +1,23 @@ -## language_gui.py - Contains the UI code needed for system-config-language -## Copyright (C) 2002-2015 Red Hat, Inc. -## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Brent Fox -## Copyright (C) 2013-2015 Parag Nemade +# language_gui.py - Contains the UI code needed for system-config-language +# Copyright (C) 2002-2015 Red Hat, Inc. +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Brent Fox +# Copyright (C) 2013-2015 Parag Nemade ## -## 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 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. +# 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, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. from __future__ import absolute_import @@ -26,21 +27,24 @@ from gi.repository import Gtk import sys import language_backend import install_packages3 -import string import gettext -_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" +_ = lambda x: gettext.translation( + "system-config-language", fallback=True).gettext(x) if x != "" else "" N_ = lambda x: x + class ChildWindow(Gtk.ApplicationWindow): + ''' This class provides GUI for installing language support ''' + def __init__(self, app): ''' This is init method ''' Gtk.Window.__init__(self, title="Language Selection", application=app) self.title = Gtk.Label.new(_("Language Selection")) self.msglable = Gtk.Label.new(_("Please select the default language for " - "the system.")) + "the system.")) self.msglable.set_line_wrap(True) self.msglable.set_alignment(0.0, 0.5) self.msglable.set_padding(7, 0) @@ -50,7 +54,7 @@ class ChildWindow(Gtk.ApplicationWindow): self.instpkg = install_packages3.InstallLangpack() default_lang, self.installed_langs = \ - self.lang_backend.get_installed_langs() + self.lang_backend.get_installed_langs() self.original_lang = default_lang self.lang_changed_flag = 0 @@ -66,8 +70,8 @@ class ChildWindow(Gtk.ApplicationWindow): self.scrolled_window = Gtk.ScrolledWindow() self.scrolled_window.set_border_width(10) - self.scrolled_window.set_policy(Gtk.PolicyType.NEVER, \ - Gtk.PolicyType.ALWAYS) + self.scrolled_window.set_policy(Gtk.PolicyType.NEVER, + Gtk.PolicyType.ALWAYS) self.scrolled_window.set_min_content_height(600) self.scrolled_window.set_min_content_width(600) @@ -93,7 +97,8 @@ class ChildWindow(Gtk.ApplicationWindow): self.button_help.connect("clicked", self.help_btn) self.box3.pack_start(self.button_help, True, True, 5) # TRANSLATORS: GUI button to revert the system language to English - self.button_sys_def = Gtk.Button.new_with_mnemonic(_('System _Defaults')) + self.button_sys_def = Gtk.Button.new_with_mnemonic( + _('System _Defaults')) self.button_sys_def.connect("clicked", self.set_system_defaults) self.box3.pack_start(self.button_sys_def, True, True, 5) @@ -120,8 +125,8 @@ class ChildWindow(Gtk.ApplicationWindow): ''' This will create the available language support list ''' lines = self.lang_backend.read_table() - #If /etc/sysconfig/i18n file is empty for some reason, - #assume English is the only lang + # If /etc/sysconfig/i18n file is empty for some reason, + # assume English is the only lang if self.original_lang == None: itr = self.listmodel.append() self.listmodel.set_value(itr, 0, 'en_US.UTF-8') @@ -145,7 +150,8 @@ class ChildWindow(Gtk.ApplicationWindow): else: if '.' in tokens[0]: - #Chop encoding off so we can compare to self.installed_langs + # Chop encoding off so we can compare to + # self.installed_langs lang_base = self.lang_backend.remove_encoding(tokens[0]) if lang_base in self.installed_langs: @@ -162,18 +168,18 @@ class ChildWindow(Gtk.ApplicationWindow): ''' Handler for when focus changed on the list row ''' (model, itr) = selection.get_selected() if itr is not None: - self.label.set_text("%s %s" %(model[itr][0], model[itr][3])) + self.label.set_text("%s %s" % (model[itr][0], model[itr][3])) else: self.label.set_text("") return True def help_btn(self, button): ''' Method to handle Help button click ''' - sdlg = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=(_("system-config-language is a graphical user " - "interface \nthat allows the user to change the " - "default language \nof the system."))) + sdlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=(_("system-config-language is a graphical user " + "interface \nthat allows the user to change the " + "default language \nof the system."))) rc = sdlg.run() sdlg.destroy() @@ -183,10 +189,10 @@ class ChildWindow(Gtk.ApplicationWindow): def langpack_already_installed(self): ''' Method to check if requested language langpack is already installed ''' - sdlg = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=(_("Language support already installed. Therefore, " - "\nsetting the default language only."))) + sdlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=(_("Language support already installed. Therefore, " + "\nsetting the default language only."))) rc = sdlg.run() sdlg.destroy() @@ -201,10 +207,10 @@ class ChildWindow(Gtk.ApplicationWindow): default_lang = self.listmodel.get_value(itr, 0) if default_lang == "en_US.UTF-8": - dlg = Gtk.MessageDialog(transient_for=self, modal=True,\ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=(_("Already system in default language," - "\nNothing to do."))) + dlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=(_("Already system in default language," + "\nNothing to do."))) rc = dlg.run() dlg.destroy() @@ -212,10 +218,10 @@ class ChildWindow(Gtk.ApplicationWindow): return 1 mstr = _("Do you really want to change system language \nto default " - "[en_US]?") - d = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.OK_CANCEL,\ - text=mstr) + "[en_US]?") + d = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.OK_CANCEL, + text=mstr) d.set_default_response(Gtk.ResponseType.OK) rc = d.run() @@ -231,8 +237,8 @@ class ChildWindow(Gtk.ApplicationWindow): ''' Method to set default language ''' itr = self.listmodel.get_iter_first() while itr: - lang_base = self.lang_backend.remove_encoding( \ - self.listmodel.get_value(itr, 0)) + lang_base = self.lang_backend.remove_encoding( + self.listmodel.get_value(itr, 0)) if lang_base == default_lang: default_lang = self.listmodel.get_value(itr, 0) path = self.listmodel.get_path(itr) @@ -245,8 +251,8 @@ class ChildWindow(Gtk.ApplicationWindow): default language already ''' (model, itr) = self.selection.get_selected() if itr is not None: - selected_lang = self.lang_backend.remove_encoding( \ - self.listmodel.get_value(itr, 0)) + selected_lang = self.lang_backend.remove_encoding( + self.listmodel.get_value(itr, 0)) if selected_lang == self.original_lang: return 1 return 0 @@ -254,10 +260,10 @@ class ChildWindow(Gtk.ApplicationWindow): def langpkg_already_installed(self): ''' Method to check if requested language packages are already installed ''' - sdlg = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=(_("Language support packages are already installed. " - "Therefore, \nsetting the default language only."))) + sdlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=(_("Language support packages are already installed. " + "Therefore, \nsetting the default language only."))) rc = sdlg.run() sdlg.destroy() @@ -266,10 +272,10 @@ class ChildWindow(Gtk.ApplicationWindow): def no_pkg_support(self): """ There are no packages available to support this language """ - sdlg = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=(_("There are no packages available yet to support this " - "language. Therefore, \nsetting the default language only."))) + sdlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=(_("There are no packages available yet to support this " + "language. Therefore, \nsetting the default language only."))) rc = sdlg.run() sdlg.destroy() @@ -279,10 +285,10 @@ class ChildWindow(Gtk.ApplicationWindow): def installed_pkg_support(self, d_lang): """ Language packages are installed now for the requested language """ msgd = d_lang + _(" language support is now installed.\nSetting it as " - "the default system language.") - sdlg = Gtk.MessageDialog(transient_for=self, modal=True, \ - message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, - text=msgd) + "the default system language.") + sdlg = Gtk.MessageDialog(transient_for=self, modal=True, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, + text=msgd) rc = sdlg.run() sdlg.destroy() @@ -313,14 +319,14 @@ class ChildWindow(Gtk.ApplicationWindow): self.installed_pkg_support(dlang) if self.installed_langs == None: - self.lang_backend.write_locale_conf(default_lang, "", \ - sysfont, sysfontacm) + self.lang_backend.write_locale_conf(default_lang, "", + sysfont, sysfontacm) else: modules = self.installed_langs[0] for lang in self.installed_langs[1:]: modules = modules + ":" + lang - self.lang_backend.write_locale_conf(default_lang, modules, \ - sysfont, sysfontacm) + self.lang_backend.write_locale_conf(default_lang, modules, + sysfont, sysfontacm) self.destroy() sys.exit() @@ -332,7 +338,9 @@ class ChildWindow(Gtk.ApplicationWindow): class GUIWindow(Gtk.Application): + ''' Class to call actual GUI methods ''' + def __init__(self): ''' init method ''' Gtk.Application.__init__(self) @@ -343,5 +351,3 @@ class GUIWindow(Gtk.Application): def do_startup(self): Gtk.Application.do_startup(self) - - diff --git a/src/language_tui.py b/src/language_tui.py index 5275cfd..7eee4f9 100644 --- a/src/language_tui.py +++ b/src/language_tui.py @@ -1,22 +1,23 @@ -## language_tui.py: text mode language selection dialog -## Copyright (C) 2002-2015 Red Hat, Inc. -## Copyright (C) 2002, 2003 Brent Fox -## Copyright (C) 2013-2015 Parag Nemade +# language_tui.py: text mode language selection dialog +# Copyright (C) 2002-2015 Red Hat, Inc. +# Copyright (C) 2002, 2003 Brent Fox +# Copyright (C) 2013-2015 Parag Nemade ## -## 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 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. +# 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, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. import snack import locale @@ -24,15 +25,17 @@ import language_backend import install_packages3 import subprocess import gettext -import string locale.setlocale(locale.LC_ALL, "") -_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" +_ = lambda x: gettext.translation( + "system-config-language", fallback=True).gettext(x) if x != "" else "" N_ = lambda x: x gettext.bind_textdomain_codeset("system-config-language", locale.nl_langinfo(locale.CODESET)) + class LanguageWindow(object): + def __init__(self): self.lang_dict = {} self.langlist_with_cc = ['zh_CN', 'zh_TW', 'pt_BR'] @@ -41,18 +44,18 @@ class LanguageWindow(object): self.list_to_install = [] self.lang_backend = language_backend.LanguageBackend() self.default_lang, self.installed_langs = \ - self.lang_backend.get_installed_langs() + self.lang_backend.get_installed_langs() @classmethod def lang_already_installed(cls, langid): imsg = _(" language support is already installed, Therefore " - "setting only the default system language.") + "setting only the default system language.") imsg = langid + imsg screen = snack.SnackScreen() bb = snack.ButtonBar(screen, ["OK"]) text_box = snack.TextboxReflowed(40, imsg) g = snack.GridFormHelp(screen, _("Language already installed"), - "kbdtype", 1, 4) + "kbdtype", 1, 4) g.add(text_box, 0, 0) g.add(bb, 0, 3, growx=1) rc = g.runOnce() @@ -68,7 +71,7 @@ class LanguageWindow(object): bb = snack.ButtonBar(screen, ["OK"]) text_box = snack.TextboxReflowed(40, imsg) g = snack.GridFormHelp(screen, _("No packages available"), - "kbdtype", 1, 4) + "kbdtype", 1, 4) g.add(text_box, 0, 0) g.add(bb, 0, 3, growx=1) rc = g.runOnce() @@ -79,13 +82,13 @@ class LanguageWindow(object): @classmethod def install_lang_support(cls, langid): imsg = _(" language support is now installed. Setting" - " it as the default system language.") + " it as the default system language.") imsg = langid + imsg screen = snack.SnackScreen() bb = snack.ButtonBar(screen, ["OK"]) text_box = snack.TextboxReflowed(40, imsg) g = snack.GridFormHelp(screen, _("Language installed"), - "kbdtype", 1, 4) + "kbdtype", 1, 4) g.add(text_box, 0, 0) g.add(bb, 0, 3, growx=1) rc = g.runOnce() @@ -96,14 +99,14 @@ class LanguageWindow(object): @classmethod def mark_lang_is_installed(cls, langid): imsg = _(" language support packages are already " - "installed, Therefore setting only " - "the default system language.") + "installed, Therefore setting only " + "the default system language.") imsg = langid + imsg screen = snack.SnackScreen() bb = snack.ButtonBar(screen, ["OK"]) text_box = snack.TextboxReflowed(40, imsg) g = snack.GridFormHelp(screen, _("Language packages " - "already installed"), "kbdtype", 1, 4) + "already installed"), "kbdtype", 1, 4) g.add(text_box, 0, 0) g.add(bb, 0, 3, growx=1) rc = g.runOnce() @@ -145,14 +148,14 @@ class LanguageWindow(object): if installed is "no": screen.finish() cstr = _(" language support is not installed, do you want to " - "install it?") + "install it?") cstr = langid + cstr cscreen = snack.SnackScreen() bb = snack.ButtonBar(cscreen, ["OK", "Cancel"]) text_box = snack.TextboxReflowed(40, cstr) # TRANSLATORS: Confirming the installation gc = snack.GridFormHelp(screen, _("Installing Confirm"), - "kbdtype", 1, 4) + "kbdtype", 1, 4) gc.add(text_box, 0, 0) gc.add(bb, 0, 3, growx=1) rc = gc.runOnce() @@ -166,9 +169,10 @@ class LanguageWindow(object): def draw_ui(self, screen): bb = snack.ButtonBar(screen, ["Yes", "No"]) text_box = snack.TextboxReflowed(40, - _("Select the language for the system.")) + _("Select the language for the system.")) llist = self.populate_listbox(self.default_lang) - g = snack.GridFormHelp(screen, _("Language Selection"), "kbdtype", 1, 4) + g = snack.GridFormHelp( + screen, _("Language Selection"), "kbdtype", 1, 4) g.add(text_box, 0, 0) g.add(llist, 0, 1, padding=(0, 1, 0, 1)) g.add(bb, 0, 3, growx=1) @@ -182,15 +186,15 @@ class LanguageWindow(object): self.run_ui(screen) if self.installed_langs == None: - self.lang_backend.write_locale_conf(self.default_lang, "", \ - sysfont, sysfontacm) + self.lang_backend.write_locale_conf(self.default_lang, "", + sysfont, sysfontacm) else: modules = self.installed_langs[0] for lang in self.installed_langs[1:]: modules = modules + ":" + lang - self.lang_backend.write_locale_conf(self.default_lang, modules, \ - sysfont, sysfontacm) + self.lang_backend.write_locale_conf(self.default_lang, modules, + sysfont, sysfontacm) def populate_listbox(self, deflang): llist = snack.Listbox(8, scroll=1, returnExit=0) @@ -220,7 +224,8 @@ class LanguageWindow(object): else: if '.' in tokens[0]: - #Chop encoding off so we can compare to self.installed_langs + # Chop encoding off so we can compare to + # self.installed_langs lang_base = self.lang_backend.remove_encoding(tokens[0]) if lang_base in self.installed_langs: name = "" @@ -228,21 +233,23 @@ class LanguageWindow(object): name = name + " " + token if self.lang_backend.remove_encoding(deflang) == \ - lang_base: + lang_base: default = tokens[0] llist.append(name, tokens[0]) self.lang_dict[tokens[0]] = (tokens[0], tokens[1], - tokens[2]) + tokens[2]) llist.setCurrent(default) return llist + class TUIWindow(object): + def __init__(self): screen = snack.SnackScreen() screen.drawRootText(0, 0, "system-config-language - (C) 2004-2015 " - "Red Hat, Inc.") + "Red Hat, Inc.") lw = LanguageWindow() finished = 0 diff --git a/src/system-config-language.py b/src/system-config-language.py index 6259f23..9efee6f 100755 --- a/src/system-config-language.py +++ b/src/system-config-language.py @@ -1,23 +1,24 @@ -#!/usr/bin/python +#!/usr/bin/python3 -## system-config-language.py - The startup script for system-config-language -## Copyright (C) 2002-2015 Red Hat, Inc. -## Copyright (C) 2002, 2003 Brent Fox -## Copyright (C) 2013-2015 Parag Nemade +# system-config-language.py - The startup script for system-config-language +# Copyright (C) 2002-2015 Red Hat, Inc. +# Copyright (C) 2002, 2003 Brent Fox +# Copyright (C) 2013-2015 Parag Nemade ## -## 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 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. +# 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, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. from __future__ import print_function @@ -26,15 +27,18 @@ import getopt import os import gettext -_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" +_ = lambda x: gettext.translation( + "system-config-language", fallback=True).gettext(x) if x != "" else "" N_ = lambda x: x + class SystemConfigLanguage(object): @classmethod def use_text_mode(cls): import language_tui language_tui.TUIWindow() + @classmethod def use_gui_mode(cls): import language_gui @@ -70,4 +74,3 @@ class SystemConfigLanguage(object): if __name__ == "__main__": scl = SystemConfigLanguage() scl.run() -