Mercurial > libervia-backend
comparison src/core/sat_main.py @ 364:312ca6f9d84a
core: configuration file
SàT's main options can now be put in a configuration file which can be in different locations
Bridge: new getConfig option
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 18 Jun 2011 16:22:50 +0200 |
parents | f147b778511a |
children | efbfccfed623 |
comparison
equal
deleted
inserted
replaced
363:54c77a56b22f | 364:312ca6f9d84a |
---|---|
95 CONST[name] = value | 95 CONST[name] = value |
96 | 96 |
97 def __init__(self): | 97 def __init__(self): |
98 #TODO: standardize callback system | 98 #TODO: standardize callback system |
99 | 99 |
100 local_dir = os.path.expanduser(self.get_const('local_dir')) | |
101 if not os.path.exists(local_dir): | |
102 os.makedirs(local_dir) | |
103 | |
104 self.__waiting_conf = {} #callback called when a confirmation is received | 100 self.__waiting_conf = {} #callback called when a confirmation is received |
105 self.__progress_cb_map = {} #callback called when a progress is requested (key = progress id) | 101 self.__progress_cb_map = {} #callback called when a progress is requested (key = progress id) |
106 self.__general_cb_map = {} #callback called for general reasons (key = name) | 102 self.__general_cb_map = {} #callback called for general reasons (key = name) |
107 self.__private_data = {} #used for internal callbacks (key = id) | 103 self.__private_data = {} #used for internal callbacks (key = id) |
108 self.trigger = TriggerManager() #trigger are used to change SàT behaviour | |
109 self.profiles = {} | 104 self.profiles = {} |
110 self.plugins = {} | 105 self.plugins = {} |
111 self.menus = {} #used to know which new menus are wanted by plugins | 106 self.menus = {} #used to know which new menus are wanted by plugins |
112 | 107 |
113 self.memory=Memory(self) | 108 self.memory=Memory(self) |
109 | |
110 local_dir = os.path.expanduser(self.get_const('local_dir')) | |
111 if not os.path.exists(local_dir): | |
112 os.makedirs(local_dir) | |
113 | |
114 self.trigger = TriggerManager() #trigger are used to change SàT behaviour | |
115 | |
114 | 116 |
115 self.bridge=DBusBridge() | 117 self.bridge=DBusBridge() |
116 self.bridge.register("getVersion", lambda: self.get_const('client_version')) | 118 self.bridge.register("getVersion", lambda: self.get_const('client_version')) |
117 self.bridge.register("getProfileName", self.memory.getProfileName) | 119 self.bridge.register("getProfileName", self.memory.getProfileName) |
118 self.bridge.register("getProfilesList", self.memory.getProfilesList) | 120 self.bridge.register("getProfilesList", self.memory.getProfilesList) |
124 self.bridge.register("disconnect", self.disconnect) | 126 self.bridge.register("disconnect", self.disconnect) |
125 self.bridge.register("getContacts", self.memory.getContacts) | 127 self.bridge.register("getContacts", self.memory.getContacts) |
126 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) | 128 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) |
127 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) | 129 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) |
128 self.bridge.register("sendMessage", self.sendMessage) | 130 self.bridge.register("sendMessage", self.sendMessage) |
131 self.bridge.register("getConfig", self.memory.getConfig) | |
129 self.bridge.register("setParam", self.setParam) | 132 self.bridge.register("setParam", self.setParam) |
130 self.bridge.register("getParamA", self.memory.getParamA) | 133 self.bridge.register("getParamA", self.memory.getParamA) |
131 self.bridge.register("getParamsUI", self.memory.getParamsUI) | 134 self.bridge.register("getParamsUI", self.memory.getParamsUI) |
132 self.bridge.register("getParams", self.memory.getParams) | 135 self.bridge.register("getParams", self.memory.getParams) |
133 self.bridge.register("getParamsForCategory", self.memory.getParamsForCategory) | 136 self.bridge.register("getParamsForCategory", self.memory.getParamsForCategory) |