comparison service/main.py @ 493:b3cedbee561d

refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 18:26:16 +0200
parents 203755bbe0fe
children
comparison
equal deleted inserted replaced
492:5114bbb5daa3 493:b3cedbee561d
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client 3 #Libervia Desktop-Kivy
4 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org) 4 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org)
5 5
6 # This program is free software: you can redistribute it and/or modify 6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by 7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or 8 # the Free Software Foundation, either version 3 of the License, or
16 # You should have received a copy of the GNU Affero General Public License 16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19 import sys 19 import sys
20 import os 20 import os
21 # we want the service to access the modules from parent dir (sat, etc.) 21 # we want the service to access the modules from parent dir (libervia.backend, etc.)
22 os.chdir('..') 22 os.chdir('..')
23 sys.path.insert(0, '') 23 sys.path.insert(0, '')
24 from sat.core.constants import Const as C 24 from libervia.backend.core.constants import Const as C
25 from sat.core import log_config 25 from libervia.backend.core import log_config
26 # SàT log conf must be done before calling Kivy 26 # SàT log conf must be done before calling Kivy
27 log_config.sat_configure(C.LOG_BACKEND_STANDARD, C) 27 log_config.libervia_configure(C.LOG_BACKEND_STANDARD, C)
28 # if this module is called, we should be on android, 28 # if this module is called, we should be on android,
29 # but just in case... 29 # but just in case...
30 from kivy import utils as kivy_utils 30 from kivy import utils as kivy_utils
31 if kivy_utils.platform == "android": 31 if kivy_utils.platform == "android":
32 # sys.platform is "linux" on android by default 32 # sys.platform is "linux" on android by default
33 # so we change it to allow backend to detect android 33 # so we change it to allow backend to detect android
34 sys.platform = "android" 34 sys.platform = "android"
35 C.PLUGIN_EXT = "pyc" 35 C.PLUGIN_EXT = "pyc"
36 from sat.core import sat_main 36 from libervia.backend.core import main
37 from twisted.internet import reactor 37 from twisted.internet import reactor
38 from twisted.application import app, service 38 from twisted.application import app, service
39 from jnius import autoclass 39 from jnius import autoclass
40 40
41 41
42 PythonService = autoclass('org.kivy.android.PythonService') 42 PythonService = autoclass('org.kivy.android.PythonService')
43 PythonService.mService.setAutoRestartService(True) 43 PythonService.mService.setAutoRestartService(True)
44 44
45 45
46 sat = sat_main.SAT() 46 libervia_backend = main.LiberviaBackend()
47 application = service.Application("SàT backend") 47 application = service.Application("Libervia backend")
48 sat.setServiceParent(application) 48 libervia_backend.setServiceParent(application)
49 app.startApplication(application, None) 49 app.startApplication(application, None)
50 reactor.run() 50 reactor.run()