def _load(self):
        defaultFilters = AccountSettings.getFilterDefaults(self._sections)
        savedFilters = g_settingsCore.serverSettings.getSections(self._sections, defaultFilters)
        for key, value in defaultFilters.items():
            savedFilters[key] = type(value)(savedFilters[key])

        self._filters = savedFilters
    def _load(self):
        defaultFilters = AccountSettings.getFilterDefaults(self._sections)
        savedFilters = g_settingsCore.serverSettings.getSections(self._sections, defaultFilters)
        for key, value in defaultFilters.items():
            savedFilters[key] = type(value)(savedFilters[key])

        self._filters = savedFilters
Example #3
0
    def load(self):
        filters = AccountSettings.getFilterDefaults(self._serverSections)
        for section in self._clientSections:
            filters.update(AccountSettings.getFilterDefault(section))

        self._filters = filters
        self.update(filters, save=False)
Example #4
0
    def load(self):
        filters = AccountSettings.getFilterDefaults(self._serverSections)
        for section in self._clientSections:
            filters.update(AccountSettings.getFilterDefault(section))

        filters.update(caches.getNavInfo().getVehicleSelectorFilters())
        self._filters = filters
        self.update(filters, save=False)
    def reset(self, keys=None, exceptions=None, save=True):
        defaultFilters = AccountSettings.getFilterDefaults(self._serverSections)
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getFilterDefault(section))

        keys = keys or defaultFilters.iterkeys()
        exceptions = exceptions or []
        keys = [ key for key in keys if key not in exceptions ]
        defaultFilters = _filterDict(defaultFilters, keys)
        self.update(defaultFilters, save)
 def reset(self, keys = None, save = True):
     """ Reset filters to their default state.
     
     :param keys: if specified, resets only the filters listed in this parameter.
     :param save: flag that determines whether filters should be saved immediately.
     """
     defaultFilters = AccountSettings.getFilterDefaults(self._sections)
     if keys is not None:
         defaultFilters = _filterDict(defaultFilters, keys)
     self.update(defaultFilters, save)
     return
 def reset(self, keys = None, save = True):
     """ Reset filters to their default state.
     
     :param keys: if specified, resets only the filters listed in this parameter.
     :param save: flag that determines whether filters should be saved immediately.
     """
     defaultFilters = AccountSettings.getFilterDefaults(self._sections)
     if keys is not None:
         defaultFilters = _filterDict(defaultFilters, keys)
     self.update(defaultFilters, save)
     return
    def load(self):
        defaultFilters = AccountSettings.getFilterDefaults(self._serverSections)
        savedFilters = self.settingsCore.serverSettings.getSections(self._serverSections, defaultFilters)
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getFilterDefault(section))
            savedFilters.update(AccountSettings.getFilter(section))

        self._filters = defaultFilters
        for key, value in defaultFilters.iteritems():
            savedFilters[key] = type(value)(savedFilters[key])

        self.update(savedFilters, save=False)
    def isDefault(self, keys=None):
        defaultFilters = AccountSettings.getFilterDefaults(self._serverSections)
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getFilterDefault(section))

        if keys is None:
            keys = defaultFilters.keys()
        for key in keys:
            if self._filters[key] != defaultFilters[key]:
                return False

        return True
    def isDefault(self, keys = None):
        """ Check whether filters are in default state or not.
        
        :param keys: if specified, check only the filters listed in this parameter.
        :return: True if filters are in default state, False otherwise.
        """
        defaultFilters = AccountSettings.getFilterDefaults(self._sections)
        if keys is None:
            keys = defaultFilters.keys()
        for key in keys:
            if self._filters[key] != defaultFilters[key]:
                return False

        return True
Example #11
0
    def load(self):
        defaultFilters = AccountSettings.getFilterDefaults(
            self._serverSections)
        savedFilters = self._getFromServerStorage(defaultFilters)
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getFilterDefault(section))
            savedFilters.update(AccountSettings.getFilter(section))

        self._filters = defaultFilters
        for key, value in defaultFilters.iteritems():
            savedFilters[key] = type(value)(savedFilters.get(key, value))

        self.update(savedFilters, save=False)
        self.newYearReset()
    def isDefault(self, keys = None):
        """ Check whether filters are in default state or not.
        
        :param keys: if specified, check only the filters listed in this parameter.
        :return: True if filters are in default state, False otherwise.
        """
        defaultFilters = AccountSettings.getFilterDefaults(self._sections)
        if keys is None:
            keys = defaultFilters.keys()
        for key in keys:
            if self._filters[key] != defaultFilters[key]:
                return False

        return True
    def reset(self, keys = None, exceptions = None, save = True):
        """ Reset filters to their default state.
        
        :param keys: if specified, resets only the filters listed in this parameter.
        :param exceptions: if specified, excludes given filters from reseting.
        :param save: flag that determines whether filters should be saved immediately.
        """
        defaultFilters = AccountSettings.getFilterDefaults(self._serverSections)
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getFilterDefault(section))

        keys = keys or defaultFilters.keys()
        exceptions = exceptions or []
        keys = [ key for key in keys if key not in exceptions ]
        defaultFilters = _filterDict(defaultFilters, keys)
        self.update(defaultFilters, save)
 def _load(self):
     defaultFilters = AccountSettings.getFilterDefaults(self._sections)
     savedFilters = g_settingsCore.serverSettings.getSections(self._sections, defaultFilters)
     isNationNegative = savedFilters['nationIsNegative']
     isVehicleTypeNegative = savedFilters['vehicleTypeIsNegative']
     if isNationNegative:
         nation = -savedFilters['nation']
     else:
         nation = savedFilters['nation']
     if isVehicleTypeNegative:
         vehicleType = -savedFilters['vehicleType']
     else:
         vehicleType = savedFilters['vehicleType']
     self._filters = {'nation': nation,
      'vehicleType': vehicleType,
      'favoriteSelected': bool(savedFilters['favoriteSelected']),
      'gameModeSelected': bool(savedFilters['gameModeSelected'])}
 def _load(self):
     defaultFilters = AccountSettings.getFilterDefaults(self._sections)
     savedFilters = g_settingsCore.serverSettings.getSections(self._sections, defaultFilters)
     isNationNegative = savedFilters['nationIsNegative']
     isVehicleTypeNegative = savedFilters['vehicleTypeIsNegative']
     if isNationNegative:
         nation = -savedFilters['nation']
     else:
         nation = savedFilters['nation']
     if isVehicleTypeNegative:
         vehicleType = -savedFilters['vehicleType']
     else:
         vehicleType = savedFilters['vehicleType']
     self._filters = {'nation': nation,
      'vehicleType': vehicleType,
      'favoriteSelected': bool(savedFilters['favoriteSelected']),
      'gameModeSelected': bool(savedFilters['gameModeSelected'])}