Example #1
0
 def loadCurrentChapter(self, initial=False):
     afterBattle = self._cache.isAfterBattle()
     LOG_DEBUG('Chapter is loading', self._currentChapter, afterBattle)
     self._gui.showWaiting('chapter-loading', isSingle=True)
     if self._data is not None:
         self._data.clear()
     chapter = self._descriptor.getChapter(self._currentChapter)
     self._data = doc_loader.loadChapterData(chapter,
                                             afterBattle=afterBattle,
                                             initial=initial)
     if self._data is None:
         LOG_ERROR(
             'Chapter documentation is not valid. Tutorial is stopping',
             self._currentChapter)
         self._gui.hideWaiting('chapter-loading')
         self.stop()
         return
     else:
         self._flags = summary.FlagSummary(self._data.getFlags(),
                                           initial=self._cache.flags())
         self._vars = summary.VarSummary(self._data.getVarSets())
         self._funcInfo = self._ctrlFactory.createFuncInfo()
         self._funcInfo.invalidate()
         self._nextScene = self._data.getInitialScene()
         self._currentState = states.TutorialStateNextScene()
         LOG_DEBUG('Set new state TutorialStateNextScene',
                   self._nextScene.getID())
         self._nextChapter = False
         self._gui.lock()
         self._gui.hideWaiting('chapter-loading')
         return
Example #2
0
 def loadCurrentChapter(self, initial = False):
     """
     Loads current chapter: gets chapter summary from descriptor, loads
     full chapter data, creates the flags, creates the vars, gets initial
     scene ID and waits when this scene is loaded.
     :param initial: bool.
     """
     afterBattle = self._cache.isAfterBattle()
     LOG_DEBUG('Chapter is loading', self._currentChapter, afterBattle)
     self._gui.showWaiting('chapter-loading', isSingle=True)
     if self._data is not None:
         self._data.clear()
     chapter_ = self._descriptor.getChapter(self._currentChapter)
     self._data = doc_loader.loadChapterData(chapter_, self._settings.chapterParser, afterBattle=afterBattle, initial=initial)
     if self._data is None:
         LOG_ERROR('Chapter documentation is not valid. Tutorial is stopping', self._currentChapter)
         self._gui.hideWaiting('chapter-loading')
         self.stop()
         return
     else:
         self._flags = summary.FlagSummary(self._data.getFlags(), initial=self._cache.flags())
         self._vars = summary.VarSummary(self._data.getVarSets())
         self._funcInfo = self._ctrlFactory.createFuncInfo()
         self._funcInfo.invalidate()
         self._nextScene = self._data.getInitialScene()
         self._currentState = states.TutorialStateNextScene()
         LOG_DEBUG('Set new state TutorialStateNextScene', self._nextScene.getID())
         self._nextChapter = False
         self._gui.lock()
         self._gui.hideWaiting('chapter-loading')
         return