[PATCH 2/5] Move constants_text out of the textw directory.

Chris Lumens clumens at redhat.com
Tue Jan 15 18:44:30 UTC 2013


It's needed for rescue mode, and the textw directory is about to go away.
---
 pyanaconda/constants_text.py       | 50 ++++++++++++++++++++++
 pyanaconda/rescue.py               |  2 +-
 pyanaconda/textw/constants_text.py | 88 --------------------------------------
 3 files changed, 51 insertions(+), 89 deletions(-)
 create mode 100644 pyanaconda/constants_text.py
 delete mode 100644 pyanaconda/textw/constants_text.py

diff --git a/pyanaconda/constants_text.py b/pyanaconda/constants_text.py
new file mode 100644
index 0000000..b93829e
--- /dev/null
+++ b/pyanaconda/constants_text.py
@@ -0,0 +1,50 @@
+#
+# constants_text.py: text mode constants
+#
+# Copyright (C) 2000, 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/>.
+#
+
+from pyanaconda.constants import *
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
+class Translator:
+    """A simple class to facilitate on-the-fly translation for newt buttons"""
+    def __init__(self, button, check):
+        self.button = button
+        self.check = check
+
+    def __getitem__(self, which):
+        if which == 0:
+            return _(self.button)
+        elif which == 1:
+            return self.check
+        raise IndexError
+
+    def __len__(self):
+        return 2
+
+TEXT_OK_STR = N_("OK")
+TEXT_OK_CHECK  = "ok"
+TEXT_OK_BUTTON = Translator(TEXT_OK_STR, TEXT_OK_CHECK)
+
+TEXT_YES_STR = N_("Yes")
+TEXT_YES_CHECK = "yes"
+TEXT_YES_BUTTON = Translator(TEXT_YES_STR, TEXT_YES_CHECK)
+
+TEXT_NO_STR = N_("No")
+TEXT_NO_CHECK = "no"
+TEXT_NO_BUTTON = Translator(TEXT_NO_STR, TEXT_NO_CHECK)
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index ed06592..86d15cb 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -22,7 +22,7 @@
 
 from snack import *
 from constants import *
-from textw.constants_text import *
+from constants_text import *
 from text import WaitWindow, OkCancelWindow, ProgressWindow, PassphraseEntryWindow, stepToClasses
 from flags import flags
 import sys
diff --git a/pyanaconda/textw/constants_text.py b/pyanaconda/textw/constants_text.py
deleted file mode 100644
index 2563ffa..0000000
--- a/pyanaconda/textw/constants_text.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# constants_text.py: text mode constants
-#
-# Copyright (C) 2000, 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/>.
-#
-
-from pyanaconda.constants import *
-import gettext
-_ = lambda x: gettext.ldgettext("anaconda", x)
-
-INSTALL_OK = 0
-INSTALL_BACK = -1
-INSTALL_NOOP = -2
-
-class Translator:
-    """A simple class to facilitate on-the-fly translation for newt buttons"""
-    def __init__(self, button, check):
-        self.button = button
-        self.check = check
-
-    def __getitem__(self, which):
-        if which == 0:
-            return _(self.button)
-        elif which == 1:
-            return self.check
-        raise IndexError
-
-    def __len__(self):
-        return 2
-
-TEXT_OK_STR = N_("OK")
-TEXT_OK_CHECK  = "ok"
-TEXT_OK_BUTTON = Translator(TEXT_OK_STR, TEXT_OK_CHECK)
-
-TEXT_CANCEL_STR = N_("Cancel")
-TEXT_CANCEL_CHECK  = "cancel"
-TEXT_CANCEL_BUTTON = Translator(TEXT_CANCEL_STR, TEXT_CANCEL_CHECK)
-
-TEXT_BACK_STR = N_("Back")
-TEXT_BACK_CHECK = "back"
-TEXT_BACK_BUTTON = Translator(TEXT_BACK_STR, TEXT_BACK_CHECK)
-
-TEXT_YES_STR = N_("Yes")
-TEXT_YES_CHECK = "yes"
-TEXT_YES_BUTTON = Translator(TEXT_YES_STR, TEXT_YES_CHECK)
-
-TEXT_NO_STR = N_("No")
-TEXT_NO_CHECK = "no"
-TEXT_NO_BUTTON = Translator(TEXT_NO_STR, TEXT_NO_CHECK)
-
-TEXT_EDIT_STR = N_("Edit")
-TEXT_EDIT_CHECK = "edit"
-TEXT_EDIT_BUTTON = Translator(TEXT_EDIT_STR, TEXT_EDIT_CHECK)
-
-TEXT_RETRY_STR = N_("Retry")
-TEXT_RETRY_CHECK = "retry"
-TEXT_RETRY_BUTTON = Translator(TEXT_RETRY_STR, TEXT_RETRY_CHECK)
-
-TEXT_F12_CHECK = "F12"
-
-TEXT_REINITIALIZE = _(
-"""This storage device may contain data:
-
-%(description)s, %(size)s MB, %(devicePath)s
-
-We could not detect partitions or filesystems on this device. This could be \
-because the device is blank, unpartitioned, or virtual. If not, there may be \
-data on the device that can not be recovered if you use it in this \
-installation. We can remove the device from this installation to protect the \
-data.
-
-Are you sure this device does not contain valuable data?""")
-
-TEXT_REINITIALIZE_ALL = _(\
-    "Apply my choice to all devices with undetected partitions.")
-- 
1.7.11.2



More information about the anaconda-patches mailing list