diff cagou/core/platform_/base.py @ 342:89799148f894

core: use classes and factory to handle platform specific behaviours in a generic way
author Goffi <goffi@goffi.org>
date Sat, 04 Jan 2020 16:24:57 +0100
parents
children 83697218b9b2
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cagou/core/platform_/base.py	Sat Jan 04 16:24:57 2020 +0100
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+# Cagou: desktop/mobile frontend for Salut à Toi XMPP client
+# Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from kivy.config import Config as KivyConfig
+
+
+class Platform:
+    """Base class to handle platform specific behaviours"""
+
+    def init_platform(self):
+        # we don't want multi-touch emulation with mouse
+
+        # this option doesn't make sense on Android and cause troubles, so we only activate
+        # it for other platforms (cf. https://github.com/kivy/kivy/issues/6229)
+        KivyConfig.set('input', 'mouse', 'mouse,disable_multitouch')
+
+    def on_app_build(self, wid):
+        pass
+
+    def on_host_init(self, host):
+        pass
+
+    def on_initFrontendState(self):
+        pass
+
+    def on_pause(self):
+        pass
+
+    def on_resume(self):
+        pass
+
+    def on_stop(self):
+        pass