diff options
| author | Martin Sivak <msivak@redhat.com> | 2013-01-17 14:35:30 +0100 |
|---|---|---|
| committer | Martin Sivak <msivak@redhat.com> | 2013-01-17 14:35:30 +0100 |
| commit | 168e0379dfcdf6cba2be09d958ea6bbe1f197500 (patch) | |
| tree | 2dd050b5844a42f8a65a06292546a31a8a11c37a /initial_setup/gui/hubs | |
| parent | 3d7cce6a292a405b90a053f1b4b12fd7cfd6064b (diff) | |
| download | firstboot2-168e0379dfcdf6cba2be09d958ea6bbe1f197500.tar.gz firstboot2-168e0379dfcdf6cba2be09d958ea6bbe1f197500.tar.xz firstboot2-168e0379dfcdf6cba2be09d958ea6bbe1f197500.zip | |
Fix a typo in project name and add some files under version control
Diffstat (limited to 'initial_setup/gui/hubs')
| -rw-r--r-- | initial_setup/gui/hubs/__init__.py | 1 | ||||
| -rw-r--r-- | initial_setup/gui/hubs/initial_setup.glade | 112 | ||||
| -rw-r--r-- | initial_setup/gui/hubs/initial_setup.py | 58 |
3 files changed, 171 insertions, 0 deletions
diff --git a/initial_setup/gui/hubs/__init__.py b/initial_setup/gui/hubs/__init__.py new file mode 100644 index 0000000..b6f577d --- /dev/null +++ b/initial_setup/gui/hubs/__init__.py @@ -0,0 +1 @@ +from initial_setup import InitalSetupMainHub diff --git a/initial_setup/gui/hubs/initial_setup.glade b/initial_setup/gui/hubs/initial_setup.glade new file mode 100644 index 0000000..75ff936 --- /dev/null +++ b/initial_setup/gui/hubs/initial_setup.glade @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires AnacondaWidgets 1.0 --> + <object class="AnacondaHubWindow" id="summaryWindow"> + <property name="startup_id">filler</property> + <property name="can_focus">False</property> + <property name="startup_id">filler</property> + <property name="mnemonics_visible">False</property> + <property name="focus_visible">False</property> + <property name="distribution">DISTRIBUTION SETUP</property> + <property name="window_name">INITAL SETUP</property> + <child internal-child="main_box"> + <object class="GtkBox" id="AnacondaHubWindow-main_box1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child internal-child="nav_area"> + <object class="GtkGrid" id="AnacondaHubWindow-nav_area1"> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child internal-child="alignment"> + <object class="GtkAlignment" id="AnacondaHubWindow-alignment1"> + <property name="can_focus">False</property> + <property name="yalign">0</property> + <property name="xscale">0.5</property> + <child internal-child="action_area"> + <object class="GtkBox" id="summaryWindow-actionArea"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child internal-child="scrolled_window"> + <object class="GtkScrolledWindow" id="summaryWindow-scroll"> + <property name="can_focus">True</property> + <property name="is_focus">True</property> + <property name="hscrollbar_policy">never</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButtonBox" id="buttonbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">6</property> + <property name="margin_right">6</property> + <property name="margin_bottom">6</property> + <child> + <object class="GtkButton" id="quitButton"> + <property name="label" translatable="yes">_QUIT</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">start</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="continueButton"> + <property name="label" translatable="yes">_FINISH CONFIGURATION</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">end</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> +</interface> diff --git a/initial_setup/gui/hubs/initial_setup.py b/initial_setup/gui/hubs/initial_setup.py new file mode 100644 index 0000000..a0f87db --- /dev/null +++ b/initial_setup/gui/hubs/initial_setup.py @@ -0,0 +1,58 @@ +from pyanaconda.ui.gui.hubs import Hub +from pyanaconda.ui.gui.spokes import Spoke +from pyanaconda.ui.common import collect +import os + +def collect_spokes(mask_paths): + """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) + + :param mask_paths: list of mask, path tuples to search for classes + :type mask_paths: list of (mask, path) + + :return: list of Spoke classes belonging to category + :rtype: list of Spoke classes + + """ + spokes = [] + for mask, path in mask_paths: + spokes.extend(collect(mask, path, + lambda obj: issubclass(obj, Spoke) and obj.should_run("firstboot", None))) + + print spokes + return spokes + + +class InitalSetupMainHub(Hub): + uiFile = "initial_setup.glade" + builderObjects = ["summaryWindow"] + mainWidgetName = "summaryWindow" + + def _collectCategoriesAndSpokes(self): + """collects categories and spokes to be displayed on this Hub + + :return: dictionary mapping category class to list of spoke classes + :rtype: dictionary[category class] -> [ list of spoke classes ] + """ + + ret = {} + + # Collect all the categories this hub displays, then collect all the + # spokes belonging to all those categories. + candidate_spokes = collect_spokes(self.paths["spokes"]) + spokes = [spoke for spoke in candidate_spokes \ + if spoke.should_run("firstboot", self.data)] + + for spoke in spokes: + ret.setdefault(spoke.category, []) + ret[spoke.category].append(spoke) + + return ret + + @property + def continueButton(self): + return self.builder.get_object("continueButton") + + @property + def quitButton(self): + return self.builder.get_object("quitButton") |
