diff options
Diffstat (limited to 'inital_setup/gui/hubs')
-rw-r--r-- | inital_setup/gui/hubs/__init__.py | 1 | ||||
-rw-r--r-- | inital_setup/gui/hubs/inital_setup.glade | 112 | ||||
-rw-r--r-- | inital_setup/gui/hubs/inital_setup.py | 48 |
3 files changed, 161 insertions, 0 deletions
diff --git a/inital_setup/gui/hubs/__init__.py b/inital_setup/gui/hubs/__init__.py new file mode 100644 index 0000000..d20b6cc --- /dev/null +++ b/inital_setup/gui/hubs/__init__.py @@ -0,0 +1 @@ +from firstboot import FirstbootHub diff --git a/inital_setup/gui/hubs/inital_setup.glade b/inital_setup/gui/hubs/inital_setup.glade new file mode 100644 index 0000000..fb7358a --- /dev/null +++ b/inital_setup/gui/hubs/inital_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">FIRSTBOOT</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/inital_setup/gui/hubs/inital_setup.py b/inital_setup/gui/hubs/inital_setup.py new file mode 100644 index 0000000..27124b9 --- /dev/null +++ b/inital_setup/gui/hubs/inital_setup.py @@ -0,0 +1,48 @@ +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 FirstbootHub(SummaryHub): + uiFile = "hubs/firstboot.glade" + + 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. + spokes = [spoke for spoke in collect_spokes(self.paths["spokes"]) \ + if spoke.should_run("firstboot", self.data)] + + for spoke in spokes: + ret.setdefault(spoke.category, []) + ret[spoke.category].append(spoke) + + return ret + |