From 49d4445c6b390f73f491981667737e04d6142de8 Mon Sep 17 00:00:00 2001 From: lufebe16 Date: Thu, 28 Dec 2023 12:11:16 +0100 Subject: [PATCH] display of license text fixed in android --- pysollib/kivy/LApp.py | 9 +++++---- pysollib/kivy/tkhtml.py | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pysollib/kivy/LApp.py b/pysollib/kivy/LApp.py index 152711e0..4ef55c74 100644 --- a/pysollib/kivy/LApp.py +++ b/pysollib/kivy/LApp.py @@ -38,6 +38,7 @@ from kivy.graphics import Color from kivy.graphics import Line from kivy.graphics import Rectangle from kivy.graphics import Triangle +from kivy.graphics import Callback from kivy.properties import NumericProperty from kivy.properties import StringProperty from kivy.uix.actionbar import ActionButton @@ -1935,13 +1936,13 @@ class LApp(App): # für hintrgrund und resume. Diese funktioneren gemäss logcat # einwandfrei. Daher versuchen wir ... um den graphik context # wieder zu aktivieren/auszurichten: - Clock.schedule_once(lambda dt: Window.update_viewport(), 2.0) - # (Es gibt auch Beispiele in den kivy issues die nahelegen, dass - # das nützlich sein könnte) + Clock.schedule_once(lambda dt: Window.update_viewport(), 3.0) + # fazit: schwarzer screen trotzdem gelegentlich wieder beobachtet. + Clock.schedule_once(lambda dt: self.mainWindow.rebuildContainer(), 4.0) # Pause modus abschalten nach resume: if app.game.pause: - Clock.schedule_once(self.makeEndPauseCmd(app), 3.0) + Clock.schedule_once(self.makeEndPauseCmd(app), 5.0) def makeEndPauseCmd(self, app): def endPauseCmd(dt): diff --git a/pysollib/kivy/tkhtml.py b/pysollib/kivy/tkhtml.py index c42f96ab..fe6a5f91 100644 --- a/pysollib/kivy/tkhtml.py +++ b/pysollib/kivy/tkhtml.py @@ -569,6 +569,14 @@ class HTMLViewer: # self.app.game._cancelDrag() # pass + # this is a workaround for android: Small devices cannot + # render the whole text into a label ... and Android does not + # allow local files be displayed in the local browser. The + # simplest way is to take it from the original web site. + if get_platform() == 'android': + if os.path.basename(url) == 'license.html': + url = 'https://www.gnu.org/licenses/gpl-3.0-standalone.html' + # ftp: and http: would work if we use urllib, but this widget is # far too limited to display anything but our documentation... for p in REMOTE_PROTOCOLS: