Esempio n. 1
0
    def __init__(self):
        items = []
        for step in steps.get_steps():
            items.append(NavigatorEntry(step))
        walker = urwid.SimpleListWalker(items)
        self._walker = walker
        self._active_entry = self._walker.get_focus()[0]

        urwid.connect_signal(walker, 'modified', self._on_focus_changed)

        linebox = urwid.LineBox(urwid.ListBox(walker))
        linebox = urwid.AttrMap(linebox, 'default', 'button.active')
        super(Navigator, self).__init__(linebox)
Esempio n. 2
0
 def _load_step_views(self):
     for step in steps.get_steps():
         try:
             # Import view's module if available
             mod = import_module('.' + step.view_module_name,
                                 self.__module__)
         except ImportError:
             logger.debug("no module view for step '%s'" % step.name)
             step.view_data = None
         else:
             # Retrieve view's class and instantiate it.
             view = getattr(mod, step.view_class_name + 'View')(self, step)
             step.view_data = view
Esempio n. 3
0
    def __run_steps(self):
        self._retcode = 1

        for step in steps.get_steps():
            assert (not step.is_disabled())

            if not step.view_data:
                step.view_data = StepView(None, step)
            view = step.view_data

            if self._args.progress:
                self._progress_bar = ProgressBar(step.name)
                timer = GLib.timeout_add_seconds(1, self._on_timeout, step)

            view.run(self._args)

            if not step.is_done():
                return

        self._retcode = 0
Esempio n. 4
0
 def set_focus(self, step):
     assert (not step.is_disabled())
     self._walker.set_focus(steps.get_steps().index(step))
Esempio n. 5
0
 def get_focus(self):
     return steps.get_steps()[self._walker.get_focus()[1]]
Esempio n. 6
0
 def _select_next_step(self):
     start = steps.get_steps().index(self._current_step)
     for step in steps.get_steps()[start:]:
         if step.is_enabled() and not step.is_done():
             self._select_step(step)
             return
Esempio n. 7
0
 def _select_first_step(self):
     self._select_step(steps.get_steps()[0])
Esempio n. 8
0
 def _quit(self):
     # Stop the running step, if any.
     for s in steps.get_steps():
         s.cancel()
     logger.info(_("exiting..."))