def _switchToView(self, aliasName, *args, **kwargs): saveHistory = kwargs.pop('saveHistory', False) popHistory = kwargs.pop('popHistory', False) if popHistory: self._navigationHistory.pop() if saveHistory: self.__preserveHistory() NewYearNavigation.switchToView(aliasName, *args, **kwargs)
def __checkPresenters(self): if self.isGiftEventEnabled(): return else: subModelInfo = self.__contentPresentersMap[self.__ctx.menuName] if subModelInfo.canBeLoaded is not None and not subModelInfo.canBeLoaded( ): NewYearNavigation.switchToView(ViewAliases.GLADE_VIEW) if subModelInfo.ID == MainViews.INFO: subModelInfo.presenter.clearNavigationHistory() self.__backCallback = partial(NewYearNavigation.switchToView, ViewAliases.GLADE_VIEW) with self.viewModel.transaction() as tx: tx.backButton.setIsVisible(True) tx.backButton.setCaption( backport.text(R.strings.ny.backButton.label())) tx.backButton.setGoTo( backport.text(R.strings.ny.backButton.NyGladeView())) return
def __onSelectedDecoration(self): if not self.viewModel.getHasDecoration(): self.__craftCtrl.setSettings(isMegaOn=True) self.__flowLogger.logBigDecorationSlotClick( NewYearNavigation.getCurrentObject()) NewYearNavigation.switchToView(ViewAliases.CRAFT_VIEW) self.destroyWindow() return else: toyID = INVALID_TOY_ID if self.viewModel.getSelected( ) else self.viewModel.slot.getToyID() toy = self.__itemsCache.items.festivity.getToys().get(toyID) if toy is not None: isPureToy = toy.getPureCount() > 0 points = toy.getAtmosphere(isPureToy, self.__isPureSlot) toyUsage = TOY_SLOT_USAGE.PURE if isPureToy else TOY_SLOT_USAGE.USED else: points = 0 toyUsage = TOY_SLOT_USAGE.USED result = yield self._nyController.hangToy(toyID, self.__slotID, toyUsage) if result.success and self.viewStatus == ViewStatus.LOADED: g_eventBus.handleEvent(events.NewYearEvent( events.NewYearEvent.ON_TOY_INSTALLED, ctx={ 'toyID': toyID, 'slotID': self.__slotID, 'atmoshereBonus': points }), scope=EVENT_BUS_SCOPE.LOBBY) self.__isSelected = toyID != INVALID_TOY_ID with self.viewModel.transaction() as tx: tx.setSelected(self.__isSelected) self.__updateTitle(tx) if self.__isSelected: if self.__slotType in ToyTypes.MEGA: NewYearSoundsManager.playEvent( NewYearSoundEvents.ADD_TOY_MEGA) else: tx.slot.setIsNew(True) self.destroyWindow() return