changeset 302:f55b60659ec1

core (about): improved "about" popup: - added some style - backend version and Cagou version are shown - host.version is now Cagou version, while host.backend_version is the one of the backend fix 312
author Goffi <goffi@goffi.org>
date Fri, 28 Jun 2019 13:02:11 +0200
parents 86292cc41e81
children fe8639e64c69
files cagou/core/cagou_main.py cagou/core/constants.py cagou/core/menu.py
diffstat 3 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Fri Jun 28 12:30:18 2019 +0200
+++ b/cagou/core/cagou_main.py	Fri Jun 28 13:02:11 2019 +0200
@@ -33,6 +33,7 @@
 from sat_frontends.quick_frontend import quick_chat
 from sat_frontends.quick_frontend import quick_utils
 from sat_frontends.tools import jid
+from sat.tools import utils as sat_utils
 from sat.tools import config
 from sat.tools.common import dynamic_import
 import kivy
@@ -69,6 +70,8 @@
 from . import menu
 from . import dialog
 from importlib import import_module
+import sat
+import cagou
 import cagou.plugins
 import cagou.kv
 try:
@@ -437,7 +440,14 @@
         self._plg_wids_transfer = []  # transfer widgets plugins
         self._import_plugins()
         self._visible_widgets = {}  # visible widgets by classes
-        self.version = C.APP_VERSION  # will be replaced by getVersion()
+        self.backend_version = sat.__version__  # will be replaced by getVersion()
+        if C.APP_VERSION.endswith('D'):
+            self.version = "{} {}".format(
+                C.APP_VERSION,
+                sat_utils.getRepositoryData(cagou)
+            )
+        else:
+            self.version = C.APP_VERSION
 
         self.tls_validation =  not C.bool(config.getConfig(main_config,
                                                            C.CONFIG_SECTION,
@@ -502,7 +512,7 @@
             sat_instance.stopService()
 
     def _getVersionCb(self, version):
-        self.version = version
+        self.backend_version = version
 
     def onBackendReady(self):
         self.app.showWidget()
--- a/cagou/core/constants.py	Fri Jun 28 12:30:18 2019 +0200
+++ b/cagou/core/constants.py	Fri Jun 28 13:02:11 2019 +0200
@@ -18,10 +18,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat_frontends.quick_frontend import constants
+import cagou
 
 
 class Const(constants.Const):
     APP_NAME = u"Cagou"
+    APP_VERSION = cagou.__version__
     LOG_OPT_SECTION = APP_NAME.lower()
     CONFIG_SECTION = APP_NAME.lower()
     WID_SELECTOR = u'selector'
--- a/cagou/core/menu.py	Fri Jun 28 12:30:18 2019 +0200
+++ b/cagou/core/menu.py	Fri Jun 28 13:02:11 2019 +0200
@@ -20,7 +20,6 @@
 
 from sat.core.i18n import _
 from sat.core import log as logging
-log = logging.getLogger(__name__)
 from cagou.core.constants import Const as C
 from cagou.core.common import JidToggle
 from kivy.uix.boxlayout import BoxLayout
@@ -38,12 +37,20 @@
 from functools import partial
 import webbrowser
 
+log = logging.getLogger(__name__)
+
 ABOUT_TITLE = _(u"About {}".format(C.APP_NAME))
-ABOUT_CONTENT = _(u"""Cagou (Salut à Toi) v{version}
+ABOUT_CONTENT = _(u"""[b]Cagou (Salut à Toi)[/b]
+
+[u]cagou version[/u]:
+{version}
+
+[u]backend version[/u]:
+{backend_version}
 
 Cagou is a libre communication tool based on libre standard XMPP.
 
-Cagou is part of the "Salut à Toi" project
+Cagou is part of the "Salut à Toi" project (desktop/mobile frontend)
 more informations at [color=5500ff][ref=website]salut-a-toi.org[/ref][/color]
 """)
 
@@ -164,8 +171,11 @@
     def onAbout(self):
         about = AboutPopup()
         about.title = ABOUT_TITLE
-        about.content = AboutContent(text=ABOUT_CONTENT.format(version=G.host.version),
-                                     markup=True)
+        about.content = AboutContent(
+            text=ABOUT_CONTENT.format(
+                backend_version = G.host.backend_version,
+                version=G.host.version),
+            markup=True)
         about.open()