annotate src/service/main.py @ 70:46b5f3ecf6a1

settings: settings widget plugin, first draft
author Goffi <goffi@goffi.org>
date Sun, 18 Dec 2016 10:27:34 +0100
parents 8e16abcadbb8
children 17094a075fd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
64
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr//bin/env python2
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
3
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # Copyright (C) 2016 Jérôme Poisson (goffi@goffi.org)
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
6
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
11
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
16
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
19
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
20 import sys
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
21 import os
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
22 # we want the service to access the modules from parent dir (sat, etc.)
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
23 os.chdir('..')
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
24 sys.path.insert(0, '')
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from sat.core.constants import Const as C
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from sat.core import log_config
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
27 # SàT log conf must be done before calling Kivy
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
28 log_config.satConfigure(C.LOG_BACKEND_STANDARD, C)
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
29 # if this module is called, we should be on android,
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
30 # but just in case...
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from kivy import utils as kivy_utils
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
32 if kivy_utils.platform == "android":
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
33 # sys.platform is "linux" on android by default
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
34 # so we change it to allow backend to detect android
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
35 sys.platform = "android"
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
36 from sat.core import sat_main
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
37 from twisted.internet import reactor
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
38
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
39 sat = sat_main.SAT()
8e16abcadbb8 core: launch SàT backend as a service on Android and wait for it on pb bridge connection.
Goffi <goffi@goffi.org>
parents:
diff changeset
40 reactor.run()