Exemplo n.º 1
0
def packVehiclesBlock(uniqueListID,
                      header,
                      vehs=None,
                      showFilters=True,
                      showInHangarCB=False,
                      showNotInHangarCB=False,
                      isShowInHangarCBChecked=False,
                      disableChecker=None):
    props = caches.addVehiclesData(uniqueListID,
                                   vehs,
                                   disableChecker=disableChecker,
                                   checkbox=isShowInHangarCBChecked)
    if props.checkbox is not None:
        isShowInHangarCBChecked = props.checkbox
    return UiElement({
        'linkage': 'VehiclesSortingBlock_UI',
        'hasHeader': showFilters,
        'showNotInHangarCB': showNotInHangarCB,
        'showInHangarCB': showInHangarCB,
        'cbSelected': isShowInHangarCBChecked,
        'vehicles': packVehiclesList(vehs or [], disableChecker),
        'tableHeader': header,
        'nationFilterData': packNationsFilter(),
        'tankFilterData': packIntVehicleTypesFilter(),
        'levelFilterData': packVehicleLevelsFilter(),
        'selectedNation': props.nationIdx,
        'selectedVehType': props.vehTypeIdx,
        'selectedLvl': props.levelIdx,
        'selectedBtnID': props.selectedBtn,
        'sortDirection': props.sortDirect,
        'tableID': uniqueListID
    })
Exemplo n.º 2
0
 def _initFilter(self, nation=-1, vehicleType='none', isMain=False, level=-1, compatibleOnly=False):
     filtersData = {'vehicleTypesDP': packVehicleTypesFilter(defaultVehType='none'),
      'levelsDP': packVehicleLevelsFilter(self._levelsRange),
      'nation': nation,
      'nationDP': packNationsFilter(),
      'vehicleType': vehicleType,
      'isMain': isMain,
      'level': level,
      'compatibleOnly': compatibleOnly,
      'compatibleOnlyLabel': VEH_COMPARE.ADDVEHPOPOVER_SHOWONLYMYVAHICLES}
     return filtersData
Exemplo n.º 3
0
 def _initFilter(self, nation=-1, vehicleType='none', isMain=False, level=-1, compatibleOnly=False):
     levelsDP = packVehicleLevelsFilter(self._levelsRange)
     if len(levelsDP) <= 2:
         self._filterVisibility ^= VEHICLE_SELECTOR_CONSTANTS.VISIBLE_LEVEL
     filtersData = {'vehicleTypesDP': packVehicleTypesFilter(defaultVehType='none'),
      'levelsDP': levelsDP,
      'nation': nation,
      'nationDP': packNationsFilter(),
      'vehicleType': vehicleType,
      'isMain': isMain,
      'level': level,
      'compatibleOnly': compatibleOnly,
      'visibility': self._filterVisibility,
      'compatibleOnlyLabel': self._compatibleOnlyLabel}
     return filtersData
 def _initFilter(self, nation, vehicleType):
     vehicles = self.__getVehicles()
     nations = set(
         (AVAILABLE_NAMES[vehicle['nationID']] for vehicle in vehicles))
     types = set((vehicle['type'] for vehicle in vehicles))
     if vehicles:
         self.__infoText = ''
     filtersData = {
         'vehicleTypesDP':
         packVehicleTypesFilter(defaultVehType='none', types=types),
         'nationDP':
         packNationsFilter(nations=nations),
         'nation':
         nation,
         'vehicleType':
         vehicleType
     }
     return filtersData
Exemplo n.º 5
0
 def setOpener(self, view):
     self.__opener = view
     eventData = self.__opener.eventData
     if eventData.getType() == EVENT_TYPE.VEHICLE:
         filtersVO = self.__filters.copy()
         filtersVO['vehicleTypesDP'] = packVehicleTypesFilter(
             defaultVehType='none')
         filtersVO['levelsDP'] = packVehicleLevelsFilter(LEVELS_RANGE)
         filtersVO['nationDP'] = packNationsFilter()
         self.as_setFiltersS(filtersVO)
         self.applyFilters(**self.__filters)
     else:
         leaderboards = eventData.getLeaderboards()
         leaderboardID = leaderboards[0][0]
         header = {
             'filters':
             makeFiltersVO(eventData.getType(),
                           leaderboards,
                           leaderboardID,
                           category='vehicles')
         }
         self.as_setHeaderS(header)
         self.changeFilter(leaderboardID)