Mercurial > libervia-web
changeset 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 (2015-03-19) |
parents | e6bb64bd6b4d |
children | e876f493dccc |
files | src/browser/libervia_main.py src/browser/sat_browser/json.py src/browser/sat_browser/menu.py |
diffstat | 3 files changed, 53 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/libervia_main.py Thu Mar 19 20:41:14 2015 +0100 +++ b/src/browser/libervia_main.py Thu Mar 19 20:41:46 2015 +0100 @@ -106,6 +106,8 @@ #FIXME: microblog cache should be managed directly in blog module self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel + self._versions={} # SàT and Libervia versions cache + # self._selected_listeners = set() # FIXME: to be done with new listeners mechanism @property @@ -133,6 +135,39 @@ url = url[:-1] return url + @property + def sat_version(self): + return self._versions["sat"] + + @property + def libervia_version(self): + return self._versions["libervia"] + + def getVersions(self, callback=None): + """Ask libervia server for SàT and Libervia version and fill local cache + + @param callback: method to call when both versions have been received + """ + def gotVersion(): + if len(self._versions) == 2 and callback is not None: + callback() + + if len(self._versions) == 2: + # we already have versions in cache + gotVersion() + return + + def gotSat(version): + self._versions["sat"] = version + gotVersion() + + def gotLibervia(version): + self._versions["libervia"] = version + gotVersion() + + self.bridge.getVersion(callback=gotSat) + self.bridge.getLiberviaVersion(callback=gotLibervia, profile=None) # XXX: bridge direct call expect a profile, even for method with no profile needed + def registerSignal(self, functionName, handler=None, iface="core", with_profile=True): if handler is None: callback = getattr(self, "{}{}".format(functionName, "Handler"))
--- a/src/browser/sat_browser/json.py Thu Mar 19 20:41:14 2015 +0100 +++ b/src/browser/sat_browser/json.py Thu Mar 19 20:41:46 2015 +0100 @@ -186,6 +186,7 @@ "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction", "disconnect", "chatStateComposing", "getNewAccountDomain", "confirmationAnswer", "syntaxConvert", "getAccountDialogUI", "getMainResource", "getWaitingConf", "getEntitiesData", + "getVersion", "getLiberviaVersion", ]) def __call__(self, *args, **kwargs): return LiberviaJsonProxy.__call__(self, *args, **kwargs)
--- a/src/browser/sat_browser/menu.py Thu Mar 19 20:41:14 2015 +0100 +++ b/src/browser/sat_browser/menu.py Thu Mar 19 20:41:46 2015 +0100 @@ -101,17 +101,23 @@ _dialog.show() def onAbout(self): - _about = HTML("""<b>Libervia</b>, a Salut à Toi project<br /> -<br /> -You can contact the authors at <a href="mailto:contact@salut-a-toi.org">contact@salut-a-toi.org</a><br /> -Blog available (mainly in french) at <a href="http://www.goffi.org" target="_blank">http://www.goffi.org</a><br /> -Project page: <a href="http://salut-a-toi.org"target="_blank">http://salut-a-toi.org</a><br /> -<br /> -Any help welcome :) -<p style='font-size:small;text-align:center'>This project is dedicated to Roger Poisson</p> -""") - _dialog = dialog.GenericDialog("About", _about) - _dialog.show() + def gotVersions(): + _about = HTML("""<b>Libervia</b>, a Salut à Toi project<br /> + <br /> + Libervia is a web frontend for Salut à Toi<br /> + <span style='font-style: italic;'>SàT version:</span> {sat_version}<br/> + <span style='font-style: italic;'>Libervia version:</span> {libervia_version}<br/> + <br /> + You can contact the authors at <a href="mailto:contact@salut-a-toi.org">contact@salut-a-toi.org</a><br /> + Blog available (mainly in french) at <a href="http://www.goffi.org" target="_blank">http://www.goffi.org</a><br /> + Project page: <a href="http://salut-a-toi.org"target="_blank">http://salut-a-toi.org</a><br /> + <br /> + Any help welcome :) + <p style='font-size:small;text-align:center'>This project is dedicated to Roger Poisson</p> + """.format(sat_version=self.host.sat_version, libervia_version=self.host.libervia_version)) + _dialog = dialog.GenericDialog("About", _about) + _dialog.show() + self.host.getVersions(gotVersions) #Settings menu