[PATCH 2/6] Remove the rc attribute and getrc methods
Vratislav Podzimek
vpodzime at redhat.com
Wed Jul 11 11:59:43 UTC 2012
These things are not necessary, we can return the return code directly
from the run() method.
---
meh/ui/__init__.py | 12 +++---------
meh/ui/text.py | 13 ++++++-------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/meh/ui/__init__.py b/meh/ui/__init__.py
index e0bf0ed..63980aa 100644
--- a/meh/ui/__init__.py
+++ b/meh/ui/__init__.py
@@ -88,7 +88,7 @@ class AbstractMainExceptionWindow(object):
longTracebackFile -- A file containing the output of
ExceptionDump.write().
"""
- self.rc = 0
+ pass
def destroy(self, *args, **kwargs):
"""Destroy the current dialog. This method must be provided by all
@@ -96,12 +96,6 @@ class AbstractMainExceptionWindow(object):
"""
raise NotImplementedError
- def getrc(self, *args, **kwargs):
- """Return which button was clicked on the interface. This method need
- not be overridden by subclasses.
- """
- return self.rc
-
def run(self, *args, **kwargs):
"""Run the window and set a return value. This method does everything
after the interface has been set up, but does not destroy it. This
@@ -122,7 +116,7 @@ class AbstractExitWindow(object):
title -- The window's title.
text -- The window's text.
"""
- self.rc = 0
+ pass
def destroy(self, *args, **kwargs):
"""Destroy the current dialog. This method must be provided by all
@@ -149,7 +143,7 @@ class AbstractMessageWindow(object):
title -- The window's title.
text -- The window's text.
"""
- self.rc = 0
+ pass
def destroy(self, *args, **kwargs):
"""Destroy the current dialog. This method must be provided by all
diff --git a/meh/ui/text.py b/meh/ui/text.py
index ef98205..5dd6fe1 100644
--- a/meh/ui/text.py
+++ b/meh/ui/text.py
@@ -76,18 +76,17 @@ class MainExceptionWindow(AbstractMainExceptionWindow):
self.screen.popWindow()
self.screen.refresh()
- def getrc(self, *args, **kwargs):
- if self.rc == string.lower(_("Debug")):
+ def run(self, *args, **kwargs):
+ response = ButtonChoiceWindow(self.screen, _("Exception Occurred"),
+ self.text, self.buttons)
+
+ if response == string.lower(_("Debug")):
return MAIN_RESPONSE_DEBUG
- elif self.rc == string.lower(_("Save")):
+ elif response == string.lower(_("Save")):
return MAIN_RESPONSE_SAVE
else:
return MAIN_RESPONSE_OK
- def run(self, *args, **kwargs):
- self.rc = ButtonChoiceWindow(self.screen, _("Exception Occurred"),
- self.text, self.buttons)
-
class MessageWindow(AbstractMessageWindow):
def __init__(self, title, text, *args, **kwargs):
AbstractMessageWindow.__init__(self, title, text, *args, **kwargs)
--
1.7.4.4
More information about the anaconda-patches
mailing list