def logCollectionsClick(self, rewardsTab): sourceView = Views.REWARDS.value + str( YEARS.getYearNumFromYearStr(rewardsTab)) destinationView = Views.ALBUMS.value + str( YEARS.getYearNumFromYearStr(rewardsTab)) self.log(sourceView=sourceView, destinationView=destinationView, transitionMethod=TransitionMethods.REWARDS_ALBUM_BUTTON.value)
def getIcon(self, size='big'): year = YEARS.getFullYearNumFromYearStr(self.COLLECTION_NAME) sizeStr = 'mega' if self.isMega() else self._SIZE_TO_FOLDER[size] res = R.images.gui.maps.icons.newYear.toys.num(year).dyn(sizeStr).dyn(self.getIconName()) if not res.exists(): _logger.error('Missing NY Toy icon. Toy ID: %s; icon size: %s.', self.getID(), size) return R.invalid() return res()
def _getViewFromTab(self, topTab, rewardTab, albumTab, selectedObject, previousObject=''): if topTab == NyWidgetTopMenu.GLADE: if selectedObject not in self._OBJECT_TO_VIEW: selectedObject = previousObject return self._OBJECT_TO_VIEW.get(selectedObject, Views.TREE).value if topTab == NyWidgetTopMenu.REWARDS and rewardTab in NyTabBarRewardsView.COLLECTIONS: return Views.REWARDS.value + str( YEARS.getYearNumFromYearStr(rewardTab)) if topTab == NyWidgetTopMenu.COLLECTIONS: return Views.ALBUMS.value + str( YEARS.getYearNumFromYearStr(albumTab)) return self._TOP_MENU_TAB_TO_VIEW[ topTab].value if topTab in self._TOP_MENU_TAB_TO_VIEW else ''
def __readBonus_nyToy(bonus, _name, section, eventType, year, checkLimit): if section.has_key('id'): tid = section['id'].asInt if year == YEARS_INFO.CURRENT_YEAR: cache = new_year.g_cache.toys else: cache = collectibles.g_cache[YEARS.getYearStrFromYearNum(year)].toys if tid not in cache: raise SoftException('Unknown NY{} toyID: {}'.format(year, tid)) count = section['count'].asInt if section.has_key('count') else 0 pureCount = section['pureCount'].asInt if section.has_key('pureCount') else count if pureCount > count: raise SoftException('Pure count should be less or equal than count', pureCount, count) toysCollectionKey = YEARS_INFO.getCollectionKeyForYear(year) nyToys = bonus.setdefault(toysCollectionKey, {}) nyToys[tid] = {'count': count, 'pureCount': pureCount}
class Collections(CONST_CONTAINER): NewYear22 = YEARS.getYearStrFromYearNum(22) NewYear21 = YEARS.getYearStrFromYearNum(21) NewYear20 = YEARS.getYearStrFromYearNum(20) NewYear19 = YEARS.getYearStrFromYearNum(19) NewYear18 = YEARS.getYearStrFromYearNum(18)
def __getViewNameFromYear(self, albumTab): return Views.ALBUMS.value + str(YEARS.getYearNumFromYearStr(albumTab))
def __getRewardsNameFromYear(self, albumTab): return Views.REWARDS.value + str(YEARS.getYearNumFromYearStr(albumTab))
def __getViewFromYearTab(self, view, tab): if tab in NyTabBarRewardsView.COLLECTIONS + NyTabBarAlbumsView.ALL: parentView = self._TOP_MENU_TAB_TO_VIEW[view].value return parentView + str(YEARS.getYearNumFromYearStr(tab)) return Views.REWARDS_FOR_LEVELS.value if tab == NyTabBarRewardsView.FOR_LEVELS else ''