Mercurial > libervia-web
comparison src/browser/libervia_main.py @ 683:801eb94aa869
browser side: versions management + version is shown in about dialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 19 Mar 2015 20:41:46 +0100 |
parents | a90cc8fc9605 |
children | 9877607c719a |
comparison
equal
deleted
inserted
replaced
682:e6bb64bd6b4d | 683:801eb94aa869 |
---|---|
104 self.next_rsm_index = 0 | 104 self.next_rsm_index = 0 |
105 | 105 |
106 #FIXME: microblog cache should be managed directly in blog module | 106 #FIXME: microblog cache should be managed directly in blog module |
107 self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel | 107 self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel |
108 | 108 |
109 self._versions={} # SàT and Libervia versions cache | |
110 | |
109 # self._selected_listeners = set() # FIXME: to be done with new listeners mechanism | 111 # self._selected_listeners = set() # FIXME: to be done with new listeners mechanism |
110 | 112 |
111 @property | 113 @property |
112 def whoami(self): | 114 def whoami(self): |
113 # XXX: works because Libervia is mono-profile | 115 # XXX: works because Libervia is mono-profile |
130 if url.endswith(C.LIBERVIA_MAIN_PAGE): | 132 if url.endswith(C.LIBERVIA_MAIN_PAGE): |
131 url = url[:-len(C.LIBERVIA_MAIN_PAGE)] | 133 url = url[:-len(C.LIBERVIA_MAIN_PAGE)] |
132 if url.endswith("/"): | 134 if url.endswith("/"): |
133 url = url[:-1] | 135 url = url[:-1] |
134 return url | 136 return url |
137 | |
138 @property | |
139 def sat_version(self): | |
140 return self._versions["sat"] | |
141 | |
142 @property | |
143 def libervia_version(self): | |
144 return self._versions["libervia"] | |
145 | |
146 def getVersions(self, callback=None): | |
147 """Ask libervia server for SàT and Libervia version and fill local cache | |
148 | |
149 @param callback: method to call when both versions have been received | |
150 """ | |
151 def gotVersion(): | |
152 if len(self._versions) == 2 and callback is not None: | |
153 callback() | |
154 | |
155 if len(self._versions) == 2: | |
156 # we already have versions in cache | |
157 gotVersion() | |
158 return | |
159 | |
160 def gotSat(version): | |
161 self._versions["sat"] = version | |
162 gotVersion() | |
163 | |
164 def gotLibervia(version): | |
165 self._versions["libervia"] = version | |
166 gotVersion() | |
167 | |
168 self.bridge.getVersion(callback=gotSat) | |
169 self.bridge.getLiberviaVersion(callback=gotLibervia, profile=None) # XXX: bridge direct call expect a profile, even for method with no profile needed | |
135 | 170 |
136 def registerSignal(self, functionName, handler=None, iface="core", with_profile=True): | 171 def registerSignal(self, functionName, handler=None, iface="core", with_profile=True): |
137 if handler is None: | 172 if handler is None: |
138 callback = getattr(self, "{}{}".format(functionName, "Handler")) | 173 callback = getattr(self, "{}{}".format(functionName, "Handler")) |
139 else: | 174 else: |