def testTupleValue(self): self._setUpTestFiles() value = (1, "item2", False) config.set(self._filenames[1], "Test_5", "test5_2", value) self.failUnlessEqual(["1", "item2", "False"], config.getList(self._filenames[1], "Test_5", "test5_2"))
def getList(self): ''' Gets a value of the settings option converted to list. If the option does not exist the 'None' is returned. :return: A value of the option :rtype: list ''' return config.getList(self._name, self._section, self._option, self._default)
def loadState(self): ''' Restores paths from configuration. ''' enabled = config.getList(self._CONFIG_NAME, self._CONFIG_SECTION_LOCATIONS, "enabled", []) disabled = config.getList(self._CONFIG_NAME, self._CONFIG_SECTION_LOCATIONS, "disabled", []) for path in disabled: message = self._addLocation(path) if message: log.warning(message) for path in enabled: message = self._addLocation(path) if message: log.warning(message) else: self._locItems[path].setCheckState(0, QtCore.Qt.Checked) self._loaded = True
def __init__(self, conf, section, option, max=10): ''' Synchronizes the internal list of values with configuration. ''' self._values = config.getList(conf, section, option, []) if len(self._values) > max: self._values = self._values[:max] config.set(conf, section, option, self._values) self._conf = conf self._section = section self._option = option self._max = max
def testListValue(self): self._setUpTestFiles() value = ["item1", "item2", "item3"] config.set(self._filenames[1], "Test_5", "test5_1", value) self.failUnlessEqual( value, config.getList(self._filenames[1], "Test_5", "test5_1"))
def testListValue(self): self._setUpTestFiles() value = ["item1", "item2", "item3"] config.set(self._filenames[1], "Test_5", "test5_1", value) self.failUnlessEqual(value, config.getList(self._filenames[1], "Test_5", "test5_1"))