Mercurial > libervia-backend
comparison src/core/sat_main.py @ 2113:9c861d07b5b6
core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 05 Jan 2017 22:22:13 +0100 |
parents | c96fe007ca41 |
children | 2f264f3df280 |
comparison
equal
deleted
inserted
replaced
2112:877d0a2d0d86 | 2113:9c861d07b5b6 |
---|---|
116 self.bridge.register_method("getMenuHelp", self.getMenuHelp) | 116 self.bridge.register_method("getMenuHelp", self.getMenuHelp) |
117 self.bridge.register_method("discoInfos", self.memory.disco._discoInfos) | 117 self.bridge.register_method("discoInfos", self.memory.disco._discoInfos) |
118 self.bridge.register_method("discoItems", self.memory.disco._discoItems) | 118 self.bridge.register_method("discoItems", self.memory.disco._discoItems) |
119 self.bridge.register_method("saveParamsTemplate", self.memory.save_xml) | 119 self.bridge.register_method("saveParamsTemplate", self.memory.save_xml) |
120 self.bridge.register_method("loadParamsTemplate", self.memory.load_xml) | 120 self.bridge.register_method("loadParamsTemplate", self.memory.load_xml) |
121 self.bridge.register_method("sessionInfosGet", self.getSessionInfos) | |
121 | 122 |
122 self.memory.initialized.addCallback(self._postMemoryInit) | 123 self.memory.initialized.addCallback(self._postMemoryInit) |
123 | 124 |
124 @property | 125 @property |
125 def version(self): | 126 def version(self): |
1075 ret.append((menu_id, type_, path, path_i18n, extra)) | 1076 ret.append((menu_id, type_, path, path_i18n, extra)) |
1076 | 1077 |
1077 return ret | 1078 return ret |
1078 | 1079 |
1079 def getMenuHelp(self, menu_id, language=''): | 1080 def getMenuHelp(self, menu_id, language=''): |
1080 """ | 1081 """return the help string of the menu |
1081 return the help string of the menu | 1082 |
1082 @param menu_id: id of the menu (same as callback_id) | 1083 @param menu_id: id of the menu (same as callback_id) |
1083 @param language: language used for translation, or empty string for default | 1084 @param language: language used for translation, or empty string for default |
1084 @param return: translated help | 1085 @param return: translated help |
1085 | 1086 |
1086 """ | 1087 """ |
1090 raise exceptions.DataError("Trying to access an unknown menu") | 1091 raise exceptions.DataError("Trying to access an unknown menu") |
1091 languageSwitch(language) | 1092 languageSwitch(language) |
1092 help_string = _(menu_data['help_string']) | 1093 help_string = _(menu_data['help_string']) |
1093 languageSwitch() | 1094 languageSwitch() |
1094 return help_string | 1095 return help_string |
1096 | |
1097 def getSessionInfos(self, profile_key): | |
1098 """compile interesting data on current profile session""" | |
1099 client = self.getClient(profile_key) | |
1100 data = { | |
1101 "jid": client.jid.full(), | |
1102 "started": unicode(int(client.started)), | |
1103 } | |
1104 return defer.succeed(data) |