def state_changed(self, oldstate, newstate, event, arg): if newstate == 'CONTACTS' and oldstate == 'STORAGE': self.event('next', {}) # TODO: # here just skip Contacts page! # we do not need that now, but can back to that soon when add chat from main import control control.request_update() installer.A('install_wizard.state', newstate)
def state_changed(self, oldstate, newstate, event, arg): if newstate == 'CONTACTS' and oldstate == 'STORAGE': self.event('next', {}) # TODO: # here just skip Contacts page! # we do not need that now, but can back to that soon when add chat if not settings.NewWebGUI(): from web import webcontrol reactor.callLater(0, webcontrol.OnUpdateInstallPage) else: from web import control control.request_update() installer.A('install_wizard.state', newstate)
def A(self, event, arg): #---AT_STARTUP--- if self.state == 'AT_STARTUP': if event == 'run': self.state = 'LOCAL' shutdowner.A('init') self.doInitLocal(arg) self.flagCmdLine = False elif event == 'run-cmd-line-register': self.state = 'INSTALL' shutdowner.A('init') self.flagCmdLine = True installer.A('register-cmd-line', arg) shutdowner.A('ready') elif event == 'run-cmd-line-recover': self.state = 'INSTALL' shutdowner.A('init') self.flagCmdLine = True installer.A('recover-cmd-line', arg) shutdowner.A('ready') #---LOCAL--- elif self.state == 'LOCAL': if event == 'init-local-done' and not self.isInstalled( arg) and self.isGUIPossible(arg): self.state = 'INSTALL' installer.A('init') shutdowner.A('ready') self.doInitInterfaces(arg) self.doShowGUI(arg) self.doUpdate(arg) elif (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'STOPPING' self.doDestroyMe(arg) elif event == 'init-local-done' and ( (not self.isInstalled(arg) and not self.isGUIPossible(arg)) or self.isInstalled(arg)): self.state = 'INTERFACES' shutdowner.A('ready') self.doInitInterfaces(arg) #---MODULES--- elif self.state == 'MODULES': if event == 'init-modules-done': self.state = 'READY' self.doUpdate(arg) self.doShowGUI(arg) elif (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doDestroyMe(arg) #---INSTALL--- elif self.state == 'INSTALL': if not self.flagCmdLine and (event == 'installer.state' and arg == 'DONE'): self.state = 'STOPPING' shutdowner.A('stop', "restartnshow") elif self.flagCmdLine and (event == 'installer.state' and arg == 'DONE'): self.state = 'STOPPING' shutdowner.A('stop', "exit") elif (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doDestroyMe(arg) #---READY--- elif self.state == 'READY': if (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doDestroyMe(arg) #---STOPPING--- elif self.state == 'STOPPING': if (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doUpdate(arg) self.doDestroyMe(arg) #---EXIT--- elif self.state == 'EXIT': pass #---SERVICES--- elif self.state == 'SERVICES': if event == 'init-services-done': self.state = 'MODULES' self.doInitModules(arg) shutdowner.A('ready') elif (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doDestroyMe(arg) #---INTERFACES--- elif self.state == 'INTERFACES': if event == 'init-interfaces-done': self.state = 'SERVICES' self.doInitServices(arg) elif (event == 'shutdowner.state' and arg == 'FINISHED'): self.state = 'EXIT' self.doDestroyMe(arg) return None