[PATCH 2/8] Remove unused classes and their associated problems.
David Shea
dshea at redhat.com
Wed Dec 11 19:04:08 UTC 2013
The following classes did not make the cut:
- PersonalizationSpoke and its GUI and TUI subclasses
- TUI ProgressSpoke
- TUI WarningsSpoke
- StandaloneTUISpoke
Pretty sure the standalone TUI implementation didn't actually work.
---
po/POTFILES.in | 2 -
pyanaconda/ui/common.py | 17 -----
pyanaconda/ui/gui/spokes/__init__.py | 8 +-
pyanaconda/ui/tui/__init__.py | 28 -------
pyanaconda/ui/tui/spokes/__init__.py | 10 +--
pyanaconda/ui/tui/spokes/progress.py | 140 -----------------------------------
pyanaconda/ui/tui/spokes/warnings.py | 63 ----------------
7 files changed, 3 insertions(+), 265 deletions(-)
delete mode 100644 pyanaconda/ui/tui/spokes/progress.py
delete mode 100644 pyanaconda/ui/tui/spokes/warnings.py
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bcf71ba..595d516 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,8 +56,6 @@ pyanaconda/ui/tui/spokes/shell_spoke.py
pyanaconda/ui/tui/spokes/source.py
pyanaconda/ui/tui/spokes/software.py
pyanaconda/ui/tui/spokes/user.py
-pyanaconda/ui/tui/spokes/warnings.py
-pyanaconda/ui/tui/spokes/progress.py
pyanaconda/ui/tui/spokes/__init__.py
pyanaconda/ui/tui/__init__.py
diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index f689f6c..49a93e6 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -418,23 +418,6 @@ class StandaloneSpoke(NormalSpoke):
NormalSpoke.__init__(self, data, storage, payload, instclass)
-class PersonalizationSpoke(Spoke):
- """A PersonalizationSpoke is a Spoke subclass that is displayed when the
- user selects something on the Hub during package installation.
-
- From a layout perspective, a PersonalizationSpoke takes up the middle
- of the screen therefore hiding the Hub but leaving its action area
- displayed. This allows the user to continue seeing package installation
- progress being made. The PersonalizationSpoke also provides the same
- basic navigation information at the top of the screen as a NormalSpoke.
- """
- def __init__(self, data, storage, payload, instclass):
- """Create a PersonalizationSpoke instance."""
- if self.__class__ is PersonalizationSpoke:
- raise TypeError("PersonalizationSpoke is an abstract class")
-
- Spoke.__init__(self, data, storage, payload, instclass)
-
class Hub(UIObject):
"""A Hub is an overview UI screen. A Hub consists of one or more grids of
configuration options that the user may choose from. Each grid is
diff --git a/pyanaconda/ui/gui/spokes/__init__.py b/pyanaconda/ui/gui/spokes/__init__.py
index b5c6f7f..dd5adf9 100644
--- a/pyanaconda/ui/gui/spokes/__init__.py
+++ b/pyanaconda/ui/gui/spokes/__init__.py
@@ -24,8 +24,7 @@ from pyanaconda.ui.common import collect
from pyanaconda.ui.gui import GUIObject
import os.path
-__all__ = ["StandaloneSpoke", "NormalSpoke", "PersonalizationSpoke",
- "collect_spokes"]
+__all__ = ["StandaloneSpoke", "NormalSpoke", "collect_spokes"]
class Spoke(GUIObject):
def __init__(self, data):
@@ -91,11 +90,6 @@ class NormalSpoke(Spoke, common.NormalSpoke):
self.window.hide()
Gtk.main_quit()
-class PersonalizationSpoke(Spoke, common.PersonalizationSpoke):
- def __init__(self, data, storage, payload, instclass):
- Spoke.__init__(self, data)
- common.PersonalizationSpoke.__init__(self, data, storage, payload, instclass)
-
def collect_spokes(mask_paths, category):
"""Return a list of all spoke subclasses that should appear for a given
category. Look for them in files imported as module_path % basename(f)
diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py
index 402d625..c32cbfd 100644
--- a/pyanaconda/ui/tui/__init__.py
+++ b/pyanaconda/ui/tui/__init__.py
@@ -25,7 +25,6 @@ from pyanaconda.flags import flags
from pyanaconda.threads import threadMgr
from pyanaconda.ui.tui import simpleline as tui
from pyanaconda.ui.tui.hubs.summary import SummaryHub
-from pyanaconda.ui.tui.spokes import StandaloneSpoke
from pyanaconda.ui.tui.tuiobject import YesNoDialog, ErrorDialog
import os
@@ -125,10 +124,6 @@ class TextUserInterface(ui.UserInterface):
"""returns the list of hubs to use"""
return [SummaryHub]
- def _is_standalone(self, spoke):
- """checks if the passed spoke is standalone"""
- return isinstance(spoke, StandaloneSpoke)
-
def setup(self, data):
"""Construct all the objects required to implement this interface.
This method must be provided by all subclasses.
@@ -145,29 +140,6 @@ class TextUserInterface(ui.UserInterface):
_hubs = self._list_hubs()
- # First, grab a list of all the standalone spokes.
- path = os.path.join(os.path.dirname(__file__), "spokes")
- spokes = self._collectActionClasses(self.paths["spokes"], StandaloneSpoke)
- actionClasses = self._orderActionClasses(spokes, _hubs)
-
- for klass in actionClasses:
- obj = klass(self._app, data, self.storage, self.payload, self.instclass)
-
- # If we are doing a kickstart install, some standalone spokes
- # could already be filled out. In taht case, we do not want
- # to display them.
- if self._is_standalone(obj) and obj.completed:
- del(obj)
- continue
-
- if hasattr(obj, "set_path"):
- obj.set_path("spokes", self.paths["spokes"])
-
- should_schedule = obj.setup(self.ENVIRONMENT)
-
- if should_schedule:
- self._app.schedule_screen(obj)
-
def run(self):
"""Run the interface. This should do little more than just pass
through to something else's run method, but is provided here in
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index 9972c26..7975d6e 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -20,7 +20,7 @@
#
from pyanaconda.ui.tui import simpleline as tui
from pyanaconda.ui.tui.tuiobject import TUIObject, YesNoDialog
-from pyanaconda.ui.common import Spoke, StandaloneSpoke, NormalSpoke, PersonalizationSpoke, collect
+from pyanaconda.ui.common import Spoke, NormalSpoke, collect
from pyanaconda.users import validatePassword, cryptPassword
import re
from collections import namedtuple
@@ -29,8 +29,7 @@ from pyanaconda.i18n import N_, _
from pyanaconda.constants import PASSWORD_CONFIRM_ERROR_TUI
__all__ = ["TUISpoke", "EditTUISpoke", "EditTUIDialog", "EditTUISpokeEntry",
- "StandaloneTUISpoke", "NormalTUISpoke", "PersonalizationSpoke",
- "collect_spokes", "collect_categories"]
+ "NormalTUISpoke", "collect_spokes", "collect_categories"]
class TUISpoke(TUIObject, tui.Widget, Spoke):
"""Base TUI Spoke class implementing the pyanaconda.ui.common.Spoke API.
@@ -292,11 +291,6 @@ class EditTUISpoke(NormalTUISpoke):
return NormalTUISpoke.input(self, args, key)
-class StandaloneTUISpoke(TUISpoke, StandaloneSpoke):
- pass
-
-class PersonalizationTUISpoke(TUISpoke, PersonalizationSpoke):
- pass
def collect_spokes(mask_paths, category):
"""Return a list of all spoke subclasses that should appear for a given
diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py
deleted file mode 100644
index 4ed8b21..0000000
--- a/pyanaconda/ui/tui/spokes/progress.py
+++ /dev/null
@@ -1,140 +0,0 @@
-# Text progress hub classes
-#
-# Copyright (C) 2012 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties 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. Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-# Red Hat Author(s): Jesse Keating <jkeating at redhat.com>
-#
-
-import sys
-
-from pyanaconda.flags import flags
-from pyanaconda.i18n import N_, _
-from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION
-from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
-
-from pyanaconda.ui.tui.spokes import StandaloneTUISpoke
-from pyanaconda.ui.tui.hubs.summary import SummaryHub
-from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
-
-__all__ = ["ProgressSpoke"]
-
-class ProgressSpoke(StandaloneTUISpoke):
- title = N_("Progress")
-
- postForHub = SummaryHub
- priority = 0
-
- def __init__(self, app, ksdata, storage, payload, instclass):
- StandaloneTUISpoke.__init__(self, app, ksdata, storage, payload, instclass)
- self._stepped = False
-
- @property
- def completed(self):
- # this spoke is never completed, initially
- return False
-
- def _update_progress(self):
- """Handle progress updates from install thread."""
-
- from pyanaconda.progress import progressQ
- import Queue
-
- q = progressQ.q
-
- # Grab all messages may have appeared since last time this method ran.
- while True:
- # Attempt to get a message out of the queue for how we should update
- # the progress bar. If there's no message, don't error out.
- # Also flush the communication Queue at least once a second and
- # process it's events so we can react to async evens (like a thread
- # throwing an exception)
- while True:
- try:
- (code, args) = q.get(timeout = 1)
- break
- except Queue.Empty:
- pass
- finally:
- self.app.process_events()
-
- if code == progressQ.PROGRESS_CODE_INIT:
- # Text mode doesn't have a finite progress bar
- pass
- elif code == progressQ.PROGRESS_CODE_STEP:
- # Instead of updating a progress bar, we just print a pip
- # but print it without a new line.
- sys.stdout.write('.')
- sys.stdout.flush()
- # Use _stepped as an indication to if we need a newline before
- # the next message
- self._stepped = True
- elif code == progressQ.PROGRESS_CODE_MESSAGE:
- # This should already be translated
- if self._stepped:
- # Get a new line in case we've done a step before
- self._stepped = False
- print('')
- print(args[0])
- elif code == progressQ.PROGRESS_CODE_COMPLETE:
- # There shouldn't be any more progress updates, so return
- q.task_done()
-
-
- if self._stepped:
- print('')
- return True
- elif code == progressQ.PROGRESS_CODE_QUIT:
- sys.exit(args[0])
-
- q.task_done()
- return True
-
- def refresh(self, args = None):
- from pyanaconda.install import doInstall, doConfiguration
- from pyanaconda.threads import threadMgr, AnacondaThread
-
- # We print this here because we don't really use the window object
- print(_(self.title))
-
- threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
- args=(self.storage, self.payload, self.data,
- self.instclass)))
-
- # This will run until we're all done with the install thread.
- self._update_progress()
-
- threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
- args=(self.storage, self.payload, self.data,
- self.instclass)))
-
- # This will run until we're all done with the configuration thread.
- self._update_progress()
-
- # kickstart install, continue automatically if reboot or shutdown selected
- if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
- # Just pretend like we got input, and our input doesn't care
- # what it gets, it just quits.
- self.input(None, None)
-
- return True
-
- def prompt(self, args = None):
- return(_("\tInstallation complete. Press return to quit"))
-
- def input(self, args, key):
- # There is nothing to do here, just raise to exit the spoke
- raise ExitAllMainLoops()
diff --git a/pyanaconda/ui/tui/spokes/warnings.py b/pyanaconda/ui/tui/spokes/warnings.py
deleted file mode 100644
index be83929..0000000
--- a/pyanaconda/ui/tui/spokes/warnings.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Ask vnc text spoke
-#
-# Copyright (C) 2013 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties 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. Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-# Red Hat Author(s): Brian C. Lane <bcl at redhat.com>
-#
-
-from pyanaconda.ui.tui.spokes import StandaloneTUISpoke
-from pyanaconda.ui.tui.simpleline import TextWidget
-from pyanaconda.ui.tui.hubs.summary import SummaryHub
-from pyanaconda.i18n import N_, _
-
-from pyanaconda.iutil import is_unsupported_hw
-from pyanaconda.product import productName
-
-import logging
-log = logging.getLogger("anaconda")
-
-__all__ = ["WarningsSpoke"]
-
-class WarningsSpoke(StandaloneTUISpoke):
- title = N_("Warnings")
-
- preForHub = SummaryHub
- priority = 0
-
- def __init__(self, *args, **kwargs):
- StandaloneTUISpoke.__init__(self, *args, **kwargs)
-
- self._message = _("This hardware (or a combination thereof) is not "
- "supported by Red Hat. For more information on "
- "supported hardware, please refer to "
- "http://www.redhat.com/hardware." )
- # Does anything need to be displayed?
- self._unsupported = productName.startswith("Red Hat Enterprise Linux") and \
- is_unsupported_hw() and \
- not self.data.unsupportedhardware.unsupported_hardware
-
- @property
- def completed(self):
- return not self._unsupported
-
- def refresh(self, args = None):
- StandaloneTUISpoke.refresh(self, args)
-
- self._window += [TextWidget(self._message), ""]
-
- return True
-
--
1.8.4.2
More information about the anaconda-patches
mailing list