back button goes to map screen on other two
This commit is contained in:
parent
5c0f0d22c9
commit
ef0d71855f
23
main.py
23
main.py
@ -1,6 +1,7 @@
|
||||
from plyer import gps
|
||||
from kivy.app import App
|
||||
from kivy.clock import Clock
|
||||
from kivy.core.window import Window
|
||||
from kivy.properties import DictProperty, NumericProperty, StringProperty
|
||||
from kivy.clock import mainthread
|
||||
from kivy.utils import platform
|
||||
@ -24,11 +25,28 @@ class MapScreen(Screen):
|
||||
|
||||
|
||||
class CompassScreen(Screen):
|
||||
pass
|
||||
def __init__(self, **kwargs):
|
||||
super(CompassScreen, self).__init__(**kwargs)
|
||||
Window.bind(on_keyboard=self.android_back_click)
|
||||
|
||||
def android_back_click(self, window, key, *largs):
|
||||
if key == 27 and self.parent is not None:
|
||||
self.parent.current='map'
|
||||
return True
|
||||
|
||||
|
||||
|
||||
class SettingsScreen(Screen):
|
||||
pass
|
||||
def __init__(self, **kwargs):
|
||||
super(SettingsScreen, self).__init__(**kwargs)
|
||||
Window.bind(on_keyboard=self.android_back_click)
|
||||
|
||||
def android_back_click(self, window, key, *largs):
|
||||
|
||||
if key == 27 and self.parent is not None:
|
||||
self.parent.current='map'
|
||||
return True
|
||||
|
||||
|
||||
|
||||
class FlockompassApp(App):
|
||||
@ -199,7 +217,6 @@ class FlockompassApp(App):
|
||||
|
||||
screen_manager.add_widget(self.cs)
|
||||
|
||||
|
||||
self.ss = SettingsScreen(name='settings')
|
||||
screen_manager.add_widget(self.ss)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user