def _instantiateAction(self, actionClass): # Instantiate an action on-demand, passing the arguments defining our # spoke API and setting up continue/quit signal handlers. obj = actionClass(self.data, self.storage, self.payload, self.instclass) # set spoke search paths in Hubs if hasattr(obj, "set_path"): obj.set_path("spokes", self.paths["spokes"]) obj.set_path("categories", self.paths["categories"]) # If we are doing a kickstart install, some standalone spokes # could already be filled out. In that case, we do not want # to display them. if self._is_standalone(obj): if obj.completed: del(obj) return None elif flags.automatedInstall: autoinstall_stopped("User interaction required on standalone spoke %s" % obj.__class__.__name__) # Use connect_after so classes can add actions before we change screens obj.window.connect_after("continue-clicked", self._on_continue_clicked) obj.window.connect_after("help-button-clicked", self._on_help_clicked, obj) obj.window.connect_after("quit-clicked", self._on_quit_clicked) return obj
def _instantiateAction(self, actionClass): # Check if this action is to be shown in the supported environments. if self._is_standalone_class(actionClass): if not any(actionClass.should_run(environ, self.data) for environ in flags.environs): return None # Instantiate an action on-demand, passing the arguments defining our # spoke API and setting up continue/quit signal handlers. obj = actionClass(self.data, self.storage, self.payload) # set spoke search paths in Hubs if hasattr(obj, "set_path"): obj.set_path("spokes", self.paths["spokes"]) obj.set_path("categories", self.paths["categories"]) # If we are doing a kickstart install, some standalone spokes # could already be filled out. In that case, we do not want # to display them. if self._is_standalone(obj): if obj.completed: del(obj) return None elif flags.automatedInstall: autoinstall_stopped("User interaction required on standalone spoke %s" % obj.__class__.__name__) # Use connect_after so classes can add actions before we change screens obj.window.connect_after("continue-clicked", self._on_continue_clicked) obj.window.connect_after("help-button-clicked", self._on_help_clicked, obj) obj.window.connect_after("quit-clicked", self._on_quit_clicked) return obj
def _update_spokes(self): from pyanaconda.ui.communication import hubQ import queue q = hubQ.q if not self._spokes and self.window.get_may_continue(): # no spokes, move on log.debug("no spokes available on %s, continuing automatically", self) gtk_call_once(self.window.emit, "continue-clicked") click_continue = False # Grab all messages that may have appeared since last time this method ran. while True: try: (code, args) = q.get(False) except queue.Empty: break # The first argument to all codes is the name of the spoke we are # acting on. If no such spoke exists, throw the message away. spoke = self._spokes.get(args[0], None) if not spoke or spoke.__class__.__name__ not in self._spokes: q.task_done() continue if code == hubQ.HUB_CODE_NOT_READY: self._updateCompleteness(spoke) if spoke not in self._notReadySpokes: self._notReadySpokes.append(spoke) self._updateContinueButton() log.debug("spoke is not ready: %s", spoke) elif code == hubQ.HUB_CODE_READY: self._updateCompleteness(spoke) if spoke in self._notReadySpokes: self._notReadySpokes.remove(spoke) self._updateContinueButton() log.debug("spoke is ready: %s", spoke) # If this is a real kickstart install (the kind with an input ks file) # and all spokes are now completed, we should skip ahead to the next # hub automatically. Take into account the possibility the user is # viewing a spoke right now, though. if flags.automatedInstall: spoke_title = spoke.title.replace("_", "") # Users might find it helpful to know why a kickstart install # went interactive. Log that here. if not spoke.completed and spoke.mandatory: autoinstall_stopped( "User interaction required on spoke %s" % spoke_title) else: log.debug("kickstart installation, spoke %s is ready", spoke_title) # Spokes that were not initially ready got the execute call in # _createBox skipped. Now that it's become ready, do it. Note # that we also provide a way to skip this processing (see comments # communication.py) to prevent getting caught in a loop. if not args[ 1] and spoke.changed and spoke.visitedSinceApplied: log.debug("execute spoke from event loop %s", spoke.title.replace("_", "")) spoke.execute() spoke.visitedSinceApplied = False if self.continuePossible: if self._inSpoke: self._autoContinue = False elif self._autoContinue: click_continue = True elif code == hubQ.HUB_CODE_MESSAGE: spoke.selector.set_property("status", args[1]) log.debug("setting %s status to: %s", spoke, args[1]) q.task_done() # queue is now empty, should continue be clicked? if self._autoContinue and click_continue and self.window.get_may_continue( ): # enqueue the emit to the Gtk message queue log.debug("_autoContinue clicking continue button") gtk_call_once(self.window.emit, "continue-clicked") return True
def _update_spokes(self): from pyanaconda.ui.communication import hubQ import queue q = hubQ.q if not self._spokes and self.window.get_may_continue() and self.continue_if_empty: # no spokes, move on log.debug("no spokes available on %s, continuing automatically", self) gtk_call_once(self.window.emit, "continue-clicked") click_continue = False # Grab all messages that may have appeared since last time this method ran. while True: try: (code, args) = q.get(False) except queue.Empty: break # The first argument to all codes is the name of the spoke we are # acting on. If no such spoke exists, throw the message away. spoke = self._spokes.get(args[0], None) if not spoke or spoke.__class__.__name__ not in self._spokes: q.task_done() continue if code == hubQ.HUB_CODE_NOT_READY: self._updateCompleteness(spoke) if spoke not in self._notReadySpokes: self._notReadySpokes.append(spoke) self._updateContinueButton() log.debug("spoke is not ready: %s", spoke) elif code == hubQ.HUB_CODE_READY: self._updateCompleteness(spoke) if spoke in self._notReadySpokes: self._notReadySpokes.remove(spoke) self._updateContinueButton() log.debug("spoke is ready: %s", spoke) # If this is a real kickstart install (the kind with an input ks file) # and all spokes are now completed, we should skip ahead to the next # hub automatically. Take into account the possibility the user is # viewing a spoke right now, though. if flags.automatedInstall: spoke_title = spoke.title.replace("_", "") # Users might find it helpful to know why a kickstart install # went interactive. Log that here. if not spoke.completed and spoke.mandatory: autoinstall_stopped("User interaction required on spoke %s" % spoke_title) else: log.debug("kickstart installation, spoke %s is ready", spoke_title) # Spokes that were not initially ready got the execute call in # _createBox skipped. Now that it's become ready, do it. Note # that we also provide a way to skip this processing (see comments # communication.py) to prevent getting caught in a loop. if not args[1] and spoke.changed and spoke.visitedSinceApplied: log.debug("execute spoke from event loop %s", spoke.title.replace("_", "")) spoke.execute() spoke.visitedSinceApplied = False if self.continuePossible: if self._inSpoke: self._autoContinue = False elif self._autoContinue: click_continue = True elif code == hubQ.HUB_CODE_MESSAGE: spoke.selector.set_property("status", args[1]) log.debug("setting %s status to: %s", spoke, args[1]) q.task_done() # queue is now empty, should continue be clicked? if self._autoContinue and click_continue and self.window.get_may_continue(): # enqueue the emit to the Gtk message queue log.debug("_autoContinue clicking continue button") gtk_call_once(self.window.emit, "continue-clicked") return True