# HG changeset patch # User Goffi # Date 1426794106 -3600 # Node ID 801eb94aa869384a4ac8faad5a0b5510281791fe # Parent e6bb64bd6b4d971f02482b79044c8ab8b7da1b6d browser side: versions management + version is shown in about dialog diff -r e6bb64bd6b4d -r 801eb94aa869 src/browser/libervia_main.py --- 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")) diff -r e6bb64bd6b4d -r 801eb94aa869 src/browser/sat_browser/json.py --- 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) diff -r e6bb64bd6b4d -r 801eb94aa869 src/browser/sat_browser/menu.py --- 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("""Libervia, a Salut à Toi project
-
-You can contact the authors at contact@salut-a-toi.org
-Blog available (mainly in french) at http://www.goffi.org
-Project page: http://salut-a-toi.org
-
-Any help welcome :) -

This project is dedicated to Roger Poisson

-""") - _dialog = dialog.GenericDialog("About", _about) - _dialog.show() + def gotVersions(): + _about = HTML("""Libervia, a Salut à Toi project
+
+ Libervia is a web frontend for Salut à Toi
+ SàT version: {sat_version}
+ Libervia version: {libervia_version}
+
+ You can contact the authors at contact@salut-a-toi.org
+ Blog available (mainly in french) at http://www.goffi.org
+ Project page: http://salut-a-toi.org
+
+ Any help welcome :) +

This project is dedicated to Roger Poisson

+ """.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