1 This module providers a set of profile management solution
7 1. it is a base class and supports two modes "Default" and "Single"
8 if the mode is "Default", the program will load the 'json' file from 'default'
9 and 'user' , merge the input, save only the 'json' file from 'user'
10 if the mode is "Single", the program will only load and save the 'json' file
11 2. it saves a file two, one is only in memory and the other is in file
12 3. it provides two types of functions, one is like "set_" and "add_" and the
13 other is like "mset" and "madd". the functions are automatically registered.
15 4. You can overload the function _register_func to achieve the functions what you desire
16 by function "_setting_file","_adding_file","_setting_memory" and "_addting_memory"
18 5. it provides "settings" to show the result in memory
19 6. it provides "reset" to reload the file
23 1. create your-settings file and paste the contents
31 2. create your_settings file and paste the codes
33 import vstf.controller.settings.settings as sets
34 class YourSettings(sets.Settings):
35 def __init__(self, path="./", filename="your-settings", mode=sets.SETS_SINGLE):
36 super(MailSettings, self).__init__(path, filename, mode)
39 setting = YourSettings()
40 print setting.settings()
41 value1 = "test_set_items1"
42 setting.set_items1(value1)
43 print setting.settings()
44 value2 = "test_set_items2"
45 setting.mset_items2(value2)
46 print setting.settings()
48 print setting.settings()
50 if __name__ == '__main__':