Esempio n. 1
0
 def __prepareNewData(self):
     isCollectionFull = self.currentCollectionPresenter.isFull()
     self.viewModel.setIsCollectionFull(isCollectionFull)
     settingID = YEARS_INFO.CURRENT_SETTING_IDS_BY_NAME[
         self._collectionType]
     settingStrID = new_year.g_cache.collectionStrIDs[settingID]
     _, stamp, _ = self._itemsCache.items.festivity.getAlbums().get(
         settingStrID, (0, 0, 0))
     isStampShow = stamp != isCollectionFull
     if isStampShow:
         self._nyController.sendViewAlbum(
             settingID,
             YEARS_INFO.getMaxToyRankByYear(YEARS_INFO.CURRENT_YEAR))
Esempio n. 2
0
def _readToy(section, collectionName=None):
    cfg = {intern('collection'): collectionName} if collectionName else {}
    toyData = {
        intern(name):
        (section.readInt(name) if name in ('id', 'rank') else intern(
            section.readString(name)))
        for name, subsection in section.items()
    }
    if collectionName and collectionName != 'defaultToys':
        if not MIN_TOY_RANK <= toyData[
                'rank'] <= YEARS_INFO.getMaxToyRankByYear(collectionName):
            raise NYSoftException(
                'Invalid toy rank, toy collection:{}, toy id: {}'.format(
                    collectionName, toyData['id']))
        if toyData['setting'] not in YEARS_INFO.getCollectionTypesByYear(
                collectionName):
            raise NYSoftException(
                'Invalid setting, toy collection:{}, toy id: {}'.format(
                    collectionName, toyData['id']))
    cfg.update(toyData)
    return cfg
Esempio n. 3
0
 def __buildRegularToyGroups(self):
     for toyID, toyDescr in new_year.g_cache.toys.iteritems():
         if toyDescr.setting in ToySettings.MEGA:
             continue
         if toyDescr.setting not in ToySettings.NEW:
             _logger.error('Wrong toy setting: "%s"', toyDescr.setting)
             continue
         if toyDescr.type not in TOY_TYPES:
             _logger.error('Wrong toy type: "%s"', toyDescr.type)
             continue
         rank = toyDescr.rank
         if rank not in xrange(
                 1,
                 YEARS_INFO.getMaxToyRankByYear(YEARS_INFO.CURRENT_YEAR) +
                 1):
             _logger.error('Wrong toy rank: "%d"', rank)
             continue
         toyTypeID = TOY_TYPE_IDS_BY_NAME[toyDescr.type]
         toySettingID = YEARS_INFO.CURRENT_SETTING_IDS_BY_NAME[
             toyDescr.setting]
         self.__regularToyGroups.setdefault((toyTypeID, toySettingID, rank),
                                            []).append(toyID)
Esempio n. 4
0
 def getDesc(self):
     return R.strings.dyn(self.PREFIX).decorations.dyn(self.getLocalKey()).description() if self.getRank() == YEARS_INFO.getMaxToyRankByYear(self.COLLECTION_NAME) or self.isMega() else R.invalid()