diff options
author | Chris Lumens <clumens@redhat.com> | 2012-02-28 15:01:20 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2012-02-28 15:45:55 -0500 |
commit | b09759b030f3fa87525dcc28d71bf7c5821278e6 (patch) | |
tree | 01341c802b73e81029d3dfeb189779f247c1e910 /pyanaconda | |
parent | cc443eac4777ba43a176d0287661d000d579950d (diff) | |
download | anaconda-b09759b030f3fa87525dcc28d71bf7c5821278e6.tar.gz anaconda-b09759b030f3fa87525dcc28d71bf7c5821278e6.tar.xz anaconda-b09759b030f3fa87525dcc28d71bf7c5821278e6.zip |
Make the base UI classes take a payload instance, just like they do devicetree.
Diffstat (limited to 'pyanaconda')
-rw-r--r-- | pyanaconda/ui/__init__.py | 6 | ||||
-rw-r--r-- | pyanaconda/ui/gui/__init__.py | 6 | ||||
-rw-r--r-- | pyanaconda/ui/gui/hubs/__init__.py | 8 | ||||
-rw-r--r-- | pyanaconda/ui/gui/hubs/progress.py | 4 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/__init__.py | 18 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/software.py | 8 | ||||
-rwxr-xr-x | pyanaconda/ui/gui/tools/run-hub.py | 7 | ||||
-rwxr-xr-x | pyanaconda/ui/gui/tools/run-spoke.py | 7 |
8 files changed, 45 insertions, 19 deletions
diff --git a/pyanaconda/ui/__init__.py b/pyanaconda/ui/__init__.py index 92e4007ce..4f2300fb3 100644 --- a/pyanaconda/ui/__init__.py +++ b/pyanaconda/ui/__init__.py @@ -24,7 +24,7 @@ class UserInterface(object): defines what kinds of dialogs and entry widgets every interface must provide that the rest of anaconda may rely upon. """ - def __init__(self, devicetree, instclass): + def __init__(self, devicetree, payload, instclass): """Create a new UserInterface instance. The arguments this base class accepts defines the API that interfaces @@ -35,6 +35,9 @@ class UserInterface(object): devicetree -- An instance of storage.devicetree.DeviceTree. This is useful for determining what storage devices are present and how they are configured. + payload -- An instance of a packaging.Payload subclass. This + is useful for displaying and selecting packages to + install, and in carrying out the actual installation. instclass -- An instance of a BaseInstallClass subclass. This is useful for determining distribution-specific installation information like default package @@ -44,6 +47,7 @@ class UserInterface(object): raise TypeError("UserInterface is an abstract class.") self.devicetree = devicetree + self.payload = payload self.instclass = instclass # Register this interface with the top-level ErrorHandler. diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index b969d5181..a59479a1c 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -34,8 +34,8 @@ class GraphicalUserInterface(UserInterface): """This is the standard GTK+ interface we try to steer everything to using. It is suitable for use both directly and via VNC. """ - def __init__(self, devicetree, instclass): - UserInterface.__init__(self, devicetree, instclass) + def __init__(self, devicetree, payload, instclass): + UserInterface.__init__(self, devicetree, payload, instclass) self._hubs = [] self._ui = None @@ -69,7 +69,7 @@ class GraphicalUserInterface(UserInterface): # signal handlers. self._actions = [] for klass in actionClasses: - obj = klass(data, self.devicetree, self.instclass) + obj = klass(data, self.devicetree, self.payload, self.instclass) obj.register_event_cb("continue", self._on_continue_clicked) obj.register_event_cb("quit", self._on_quit_clicked) diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py index 683ddde3c..a4110af93 100644 --- a/pyanaconda/ui/gui/hubs/__init__.py +++ b/pyanaconda/ui/gui/hubs/__init__.py @@ -48,7 +48,7 @@ class Hub(UIObject): additional standalone screens either before or after them. """ - def __init__(self, data, devicetree, instclass): + def __init__(self, data, devicetree, payload, instclass): """Create a new Hub instance. The arguments this base class accepts defines the API that Hubs @@ -62,6 +62,9 @@ class Hub(UIObject): devicetree -- An instance of storage.devicetree.DeviceTree. This is useful for determining what storage devices are present and how they are configured. + payload -- An instance of a packaging.Payload subclass. This + is useful for displaying and selecting packages to + install, and in carrying out the actual installation. instclass -- An instance of a BaseInstallClass subclass. This is useful for determining distribution-specific installation information like default package @@ -73,6 +76,7 @@ class Hub(UIObject): self._spokes = {} self.devicetree = devicetree + self.payload = payload self.instclass = instclass def _runSpoke(self, action): @@ -112,7 +116,7 @@ class Hub(UIObject): for spokeClass in sorted(collect_spokes(obj.__class__.__name__), key=lambda s: s.title): # Create the new spoke and populate its UI with whatever data. # From here on, this Spoke will always exist. - spoke = spokeClass(self.data, self.devicetree, self.instclass) + spoke = spokeClass(self.data, self.devicetree, self.payload, self.instclass) if not spoke.showable: continue diff --git a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py index e74836193..8d3da6dfd 100644 --- a/pyanaconda/ui/gui/hubs/progress.py +++ b/pyanaconda/ui/gui/hubs/progress.py @@ -33,8 +33,8 @@ class ProgressHub(Hub): mainWidgetName = "progressWindow" uiFile = "hubs/progress.ui" - def __init__(self, data, devicetree, instclass): - Hub.__init__(self, data, devicetree, instclass) + def __init__(self, data, devicetree, payload, instclass): + Hub.__init__(self, data, devicetree, payload, instclass) self._totalSteps = 0 self._currentStep = 0 diff --git a/pyanaconda/ui/gui/spokes/__init__.py b/pyanaconda/ui/gui/spokes/__init__.py index fa784c123..bf1b07362 100644 --- a/pyanaconda/ui/gui/spokes/__init__.py +++ b/pyanaconda/ui/gui/spokes/__init__.py @@ -55,7 +55,7 @@ class Spoke(UIObject): icon = None title = None - def __init__(self, data, devicetree, instclass): + def __init__(self, data, devicetree, payload, instclass): """Create a new Spoke instance. The arguments this base class accepts defines the API that spokes @@ -69,6 +69,9 @@ class Spoke(UIObject): devicetree -- An instance of storage.devicetree.DeviceTree. This is useful for determining what storage devices are present and how they are configured. + payload -- An instance of a packaging.Payload subclass. This + is useful for displaying and selecting packages to + install, and in carrying out the actual installation. instclass -- An instance of a BaseInstallClass subclass. This is useful for determining distribution-specific installation information like default package @@ -79,6 +82,7 @@ class Spoke(UIObject): UIObject.__init__(self, data) self.devicetree = devicetree + self.payload = payload self.instclass = instclass def apply(self): @@ -132,7 +136,7 @@ class StandaloneSpoke(Spoke): priority = 100 - def __init__(self, data, devicetree, instclass): + def __init__(self, data, devicetree, payload, instclass): """Create a StandaloneSpoke instance.""" if self.__class__ is StandaloneSpoke: raise TypeError("StandaloneSpoke is an abstract class") @@ -140,7 +144,7 @@ class StandaloneSpoke(Spoke): if self.preForHub and self.postForHub: raise AttributeError("StandaloneSpoke instance %s may not have both preForHub and postForHub set" % self) - Spoke.__init__(self, data, devicetree, instclass) + Spoke.__init__(self, data, devicetree, payload, instclass) def _on_continue_clicked(self, cb): self.apply() @@ -162,12 +166,12 @@ class NormalSpoke(Spoke): provides some basic navigation information (where you are, what you're installing, how to get back to the Hub) at the top of the screen. """ - def __init__(self, data, devicetree, instclass): + def __init__(self, data, devicetree, payload, instclass): """Create a NormalSpoke instance.""" if self.__class__ is NormalSpoke: raise TypeError("NormalSpoke is an abstract class") - Spoke.__init__(self, data, devicetree, instclass) + Spoke.__init__(self, data, devicetree, payload, instclass) self.selector = None def check(self): @@ -221,12 +225,12 @@ class PersonalizationSpoke(Spoke): 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, devicetree, instclass): + def __init__(self, data, devicetree, payload, instclass): """Create a PersonalizationSpoke instance.""" if self.__class__ is PersonalizationSpoke: raise TypeError("PersonalizationSpoke is an abstract class") - Spoke.__init__(self, data, devicetree, instclass) + Spoke.__init__(self, data, devicetree, payload, instclass) def collect_spokes(category): """Return a list of all spoke subclasses that should appear for a given diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index 11ddc165a..2aebe61f6 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -53,16 +53,20 @@ class SoftwareSelectionSpoke(NormalSpoke): return row[2] - def initialize(self): - NormalSpoke.initialize(self) + def refresh(self): + NormalSpoke.refresh(self) self._desktopStore = self.builder.get_object("desktopStore") + self._desktopStore.clear() + self._addSelection(self._desktopStore, "Desktop", "The default Fedora desktop.") self._addSelection(self._desktopStore, "KDE Plasma Desktop", "A complete, modern desktop built using KDE Plasma.") self._addSelection(self._desktopStore, "LXDE Desktop", "A light, fast, less resource-hungry desktop.") self._addSelection(self._desktopStore, "XFCE Desktop", "A complete, well-integrated desktop.") self._addonStore = self.builder.get_object("addonStore") + self._addonStore.clear() + self._addSelection(self._addonStore, "Security", "Security analysis tools.") self._addSelection(self._addonStore, "Games", "A perfect showcase of the best games available in Fedora.") self._addSelection(self._addonStore, "Electronic Lab", "Fedora's high-end hardware design and simulation platform.") diff --git a/pyanaconda/ui/gui/tools/run-hub.py b/pyanaconda/ui/gui/tools/run-hub.py index 4a00682ed..9651ef49b 100755 --- a/pyanaconda/ui/gui/tools/run-hub.py +++ b/pyanaconda/ui/gui/tools/run-hub.py @@ -13,6 +13,7 @@ anaconda_log.init() from pyanaconda.installclass import DefaultInstall from pyanaconda.storage import Storage from pyanaconda.threads import initThreading +from pyanaconda.packaging.yumpayload import YumPayload from pyanaconda.platform import getPlatform from pykickstart.version import makeVersion @@ -38,11 +39,15 @@ storage.reset() devicetree = storage.devicetree instclass = DefaultInstall() +payload = YumPayload(ksdata) +payload.setup(storage) +payload.install_log = sys.stdout + if not hubClass: print "You forgot to set hubClass to something." sys.exit(1) -hub = hubClass(ksdata, devicetree, instclass) +hub = hubClass(ksdata, devicetree, payload, instclass) hub.register_event_cb("continue", lambda: Gtk.main_quit()) hub.register_event_cb("quit", lambda: Gtk.main_quit()) hub.initialize() diff --git a/pyanaconda/ui/gui/tools/run-spoke.py b/pyanaconda/ui/gui/tools/run-spoke.py index d1630f35d..c65e47e43 100755 --- a/pyanaconda/ui/gui/tools/run-spoke.py +++ b/pyanaconda/ui/gui/tools/run-spoke.py @@ -13,6 +13,7 @@ anaconda_log.init() from pyanaconda.installclass import DefaultInstall from pyanaconda.storage import Storage from pyanaconda.threads import initThreading +from pyanaconda.packaging.yumpayload import YumPayload from pyanaconda.platform import getPlatform from pykickstart.version import makeVersion @@ -38,11 +39,15 @@ storage.reset() devicetree = storage.devicetree instclass = DefaultInstall() +payload = YumPayload(ksdata) +payload.setup(storage) +payload.install_log = sys.stdout + if not spokeClass: print "You forgot to set spokeClass to something." sys.exit(1) -spoke = spokeClass(ksdata, devicetree, instclass) +spoke = spokeClass(ksdata, devicetree, payload, instclass) if hasattr(spoke, "register_event_cb"): spoke.register_event_cb("continue", lambda: Gtk.main_quit()) spoke.register_event_cb("quit", lambda: Gtk.main_quit()) |