globalforest/main.py

81 lines
2 KiB
Python

# Import system modules
from random import randrange
import sqlite3
# Import Kivy modules
#from kivy.app import App
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.core.window import Window
from kivy.graphics import Rectangle
# Import local modules
from forestmapview import ForestMapView
from gpshelper import GpsHelper
from settings import SampleBoxLayout
from game import GameWidget
Builder.load_string("""
<ScreenOne>:
BoxLayout:
Button:
text: "Go to Screen 2"
on_press:
root.manager.transition.direction = "left"
root.manager.transition.duration = 1
root.manager.current = "screen_two"
<ScreenTwo>:
BoxLayout:
Button:
text: "Go to Screen 1"
on_press:
root.manager.transition.direction = "right"
root.manager.transition.duration = 1
root.manager.current = "screen_one"
""")
class ScreenOne(Screen):
pass
class ScreenTwo(Screen):
pass
class GlobalForest(App):
def build(self):
#return Label(text='Hello world')
return GameWidget()
class MainApp(App):
def build(self):
pass
#Window.clearcolor = (0, 0, 0, 0)
#return SampleBoxLayout()
def on_start(self):
connection = None
cursor = None
# Initialize GPS
GpsHelper().run()
# Connect to database
self.connection = sqlite3.connect("databases/fountains.db")
self.cursor = self.connection.cursor()
# Instantiate SearchPopupMenu
if __name__ == '__main__':
#screen_manager = ScreenManager()
#screen_manager.add_widget(ScreenOne(name="screen_one"))
#screen_manager.add_widget(ScreenTwo(name="screen_two"))
#app = GlobalForest()
app = MainApp()
app.run()