diff options
Diffstat (limited to 'inital_setup')
-rw-r--r-- | inital_setup/Makefile | 66 | ||||
-rw-r--r-- | inital_setup/gui/__init__.py | 0 | ||||
-rw-r--r-- | inital_setup/gui/__main__.py | 37 | ||||
-rw-r--r-- | inital_setup/gui/gui.py | 37 | ||||
-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 | ||||
-rw-r--r-- | inital_setup/gui/spokes/__init__.py | 0 |
8 files changed, 301 insertions, 0 deletions
diff --git a/inital_setup/Makefile b/inital_setup/Makefile new file mode 100644 index 0000000..c3919fc --- /dev/null +++ b/inital_setup/Makefile @@ -0,0 +1,66 @@ +# Makefile.am for anaconda +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Martin Sivak <msivak@redhat.com> + +ANACONDA_PATH=${HOME}/Work/anaconda/firstboot + +# GUI TESTING +rungui: + ANACONDA_DATA=${ANACONDA_PATH}/data \ + ANACONDA_WIDGETS_OVERRIDES=${ANACONDA_PATH}/widgets/python \ + ANACONDA_WIDGETS_DATA=${ANACONDA_PATH}/widgets/data \ + ANACONDA_INSTALL_CLASSES=${ANACONDA_PATH}/pyanaconda/installclasses \ + PYTHONPATH=.:${ANACONDA_PATH}/pyanaconda/isys/.libs:${ANACONDA_PATH}/widgets/python/:${ANACONDA_PATH}/widgets/src/.libs/:${ANACONDA_PATH} \ + LD_LIBRARY_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + UIPATH=gui/:${ANACONDA_PATH}/pyanaconda/ui/gui/ \ + GI_TYPELIB_PATH=${ANACONDA_PATH}/widgets/src/ \ + GLADE_CATALOG_SEARCH_PATH=${ANACONDA_PATH}/widgets/glade \ + GLADE_MODULE_SEARCH_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + python -m gui + +runtui: + ANACONDA_DATA=${ANACONDA_PATH}/data \ + ANACONDA_INSTALL_CLASSES=${ANACONDA_PATH}/pyanaconda/installclasses \ + PYTHONPATH=.:${ANACONDA_PATH}:${ANACONDA_PATH}/pyanaconda/isys/.libs \ + python -m tui + +runglade: + ANACONDA_DATA=${ANACONDA_PATH}/data \ + ANACONDA_WIDGETS_OVERRIDES=${ANACONDA_PATH}/widgets/python \ + ANACONDA_WIDGETS_DATA=${ANACONDA_PATH}/widgets/data \ + ANACONDA_INSTALL_CLASSES=${ANACONDA_PATH}/pyanaconda/installclasses \ + PYTHONPATH=.:${ANACONDA_PATH}:${ANACONDA_PATH}/pyanaconda/isys/.libs:${ANACONDA_PATH}/widgets/python/:${ANACONDA_PATH}/widgets/src/.libs/ \ + LD_LIBRARY_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + UIPATH=${ANACONDA_PATH}/pyanaconda/ui/gui/ \ + GI_TYPELIB_PATH=${ANACONDA_PATH}/widgets/src/ \ + GLADE_CATALOG_SEARCH_PATH=${ANACONDA_PATH}/widgets/glade \ + GLADE_MODULE_SEARCH_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + glade ${GLADE_FILE} + +runpy: + ANACONDA_DATA=${ANACONDA_PATH}/data \ + ANACONDA_WIDGETS_OVERRIDES=${ANACONDA_PATH}/widgets/python \ + ANACONDA_WIDGETS_DATA=${ANACONDA_PATH}/widgets/data \ + ANACONDA_INSTALL_CLASSES=${ANACONDA_PATH}/pyanaconda/installclasses \ + PYTHONPATH=.:${ANACONDA_PATH}:${ANACONDA_PATH}/pyanaconda/isys/.libs:${ANACONDA_PATH}/widgets/python/:${ANACONDA_PATH}/widgets/src/.libs/ \ + LD_LIBRARY_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + UIPATH=gui/:${ANACONDA_PATH}/pyanaconda/ui/gui/ \ + GI_TYPELIB_PATH=${ANACONDA_PATH}/widgets/src/ \ + GLADE_CATALOG_SEARCH_PATH=${ANACONDA_PATH}/widgets/glade \ + GLADE_MODULE_SEARCH_PATH=${ANACONDA_PATH}/widgets/src/.libs \ + ipython diff --git a/inital_setup/gui/__init__.py b/inital_setup/gui/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/inital_setup/gui/__init__.py diff --git a/inital_setup/gui/__main__.py b/inital_setup/gui/__main__.py new file mode 100644 index 0000000..a6485b9 --- /dev/null +++ b/inital_setup/gui/__main__.py @@ -0,0 +1,37 @@ +import os +from pyanaconda.addons import collect_addon_paths + +addon_paths = ["addons"] + + +addon_module_paths = collect_addon_paths(addon_paths) +print addon_module_paths + +# Too bad anaconda does not have modularized logging +from pyanaconda import anaconda_log +anaconda_log.init() + +# Prepare data object +from pyanaconda import kickstart +data = kickstart.AnacondaKSHandler(addon_module_paths["ks"]) + + +# Import gui specifics +import gui + +# Add to search paths +gui.FirstbootGraphicalUserInterface.update_paths(addon_module_paths) + +# We need this so we can tell GI to look for overrides objects +# also in anaconda source directories +import os +import gi.overrides +for p in os.environ.get("ANACONDA_WIDGETS_OVERRIDES", "").split(":"): + gi.overrides.__path__.insert(0, p) + + +g = gui.FirstbootGraphicalUserInterface(None, None, None) + +g.setup(data) + +g.run() diff --git a/inital_setup/gui/gui.py b/inital_setup/gui/gui.py new file mode 100644 index 0000000..e830a9f --- /dev/null +++ b/inital_setup/gui/gui.py @@ -0,0 +1,37 @@ +from pyanaconda.ui.gui import QuitDialog, GUIObject, GraphicalUserInterface +#from .product import productName, productVersion +from .hubs import FirstbootHub +from pyanaconda.ui.gui.spokes import StandaloneSpoke +import pyanaconda.ui.gui.spokes +from pyanaconda.ui.common import collect, FirstbootSpokeMixIn +import os.path + +productName = "Fedora" +productVersion = "rawhide" +isFinal = False + +class FirstbootQuitDialog(QuitDialog): + MESSAGE = "Are you sure you want to quit the configuration process?\nYou might end up with unusable system if you do." + +class FirstbootGraphicalUserInterface(GraphicalUserInterface): + """This is the main Gtk based firstboot interface. It inherits from + anaconda to make the look & feel as similar as possible. + """ + + TITLE = "%(productName)s %(productVersion)s SETUP" + + def __init__(self, storage, payload, instclass): + GraphicalUserInterface.__init__(self, storage, payload, instclass, + productName, productVersion, isFinal, + quitDialog = FirstbootQuitDialog) + + def _list_hubs(self): + return [FirstbootHub] + + basemask = "firstboot.gui" + basepath = os.path.dirname(__file__) + paths = GraphicalUserInterface.paths + { + "spokes": [(basemask + ".spokes.%s", os.path.join(basepath, "spokes"))], + "categories": [(basemask + ".categories.%s", os.path.join(basepath, "categories"))], + } + 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 + diff --git a/inital_setup/gui/spokes/__init__.py b/inital_setup/gui/spokes/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/inital_setup/gui/spokes/__init__.py |