def createWidgets(self, screens=[]): if not self.screens: self.screens = screens self.ui.mainStack.removeWidget(self.ui.page) for screen in screens: # if ctx.flags.debug: # debug all screens. # weave_all_object_methods(ctx.aspect, screen) # enable navigation buttons before shown weave_object_method(enableNavButtonsAspect, screen, "shown") # disable navigation buttons before the execute. weave_object_method(disableNavButtonsAspect, screen, "execute") try: self.ui.mainStack.addWidget(screen()) except Exception, msg: rc = ctx.interface.messageWindow( _("Error"), _("An error occurred when attempting " "to load screens:%s") % msg, type="custom", customIcon="error", customButtons=[_("Exit")], ) if not rc: sys.exit(0)
def createWidgets(self, screens=[]): if not self.screens: self.screens = screens self.ui.mainStack.removeWidget(self.ui.page) for screen in screens: #if ctx.flags.debug: # debug all screens. # weave_all_object_methods(ctx.aspect, screen) # enable navigation buttons before shown weave_object_method(enableNavButtonsAspect, screen, "shown") # disable navigation buttons before the execute. weave_object_method(disableNavButtonsAspect, screen, "execute") try: self.ui.mainStack.addWidget(screen()) except Exception, msg: rc = ctx.interface.messageWindow( _("Error"), _("An error occurred when attempting " "to load screens:%s") % msg, type="custom", customIcon="error", customButtons=[_("Exit")]) if not rc: sys.exit(0)
def __init__(self): _all_stages = [ {'num': 1, 'text': _("Prepare for install")}, {'num': 2, 'text': _("Install system")}, {'num': 3, 'text': _("Basic setup")} ] _all_screens = [ {'stage': 1, 'module': Welcome}, {'stage': 1, 'module': Keyboard}, {'stage': 1, 'module': AutoPartitioning}, {'stage': 1, 'module': Partitioning}, {'stage': 2, 'module': InstallSystem}, {'stage': 3, 'module': SetupRootpass}, {'stage': 3, 'module': SetupUsers}, {'stage': 3, 'module': SetupBootloader}, {'stage': 3, 'module': Goodbye} ] self._app = QApplication(sys.argv) self._window = YaliWindow.Widget() # default style and font self._app.setStyle("Windows") f = QFont( "Bitstream Vera Sans", 10); self._window.setFont(f) # add stages for stg in _all_stages: ctx.stages.addStage(stg['num'], stg['text']) # add screens num = 0 for scr in _all_screens: num += 1 w = scr['module'].Widget() # disableNavButtonsAspect disabled the navigation buttons # before the method. weave_object_method(disableNavButtonsAspect, w, "execute") ctx.screens.addScreen(num, scr['stage'], w) self._app.connect(self._app, SIGNAL("lastWindowClosed()"), self._app, SLOT("quit()")) self._app.connect(ctx.screens, PYSIGNAL("signalCurrent"), ctx.stages.slotScreenChanged) self._app.connect(ctx.screens, PYSIGNAL("signalProcessEvents"), self._app.processEvents) # set the current screen and stage to 1 at startup... ctx.stages.setCurrent(1) ctx.screens.setCurrent(1)