globalforest/main.py

81 lines
2 KiB
Python
Raw Normal View History

# Import system modules
2020-09-25 10:20:37 -04:00
from random import randrange
2020-09-28 23:18:26 -04:00
import sqlite3
2020-09-25 10:20:37 -04:00
# Import Kivy modules
#from kivy.app import App
2020-10-14 00:19:43 -04:00
from kivymd.app import MDApp
2020-09-28 18:38:35 -04:00
from kivy.lang import Builder
2020-09-25 10:20:37 -04:00
2020-09-28 18:38:35 -04:00
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.boxlayout import BoxLayout
2020-09-20 10:51:02 -04:00
from kivy.uix.label import Label
2020-09-25 10:20:37 -04:00
2020-09-28 18:38:35 -04:00
from kivy.core.window import Window
2020-09-21 17:13:51 -04:00
from kivy.graphics import Rectangle
2020-09-20 10:51:02 -04:00
# Import local modules
from forestmapview import ForestMapView
from gpshelper import GpsHelper
from settings import SampleBoxLayout
from game import GameWidget
2020-09-28 18:38:35 -04:00
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
2020-10-14 00:19:43 -04:00
class GlobalForest(MDApp):
2020-09-20 10:51:02 -04:00
def build(self):
2020-09-21 17:13:51 -04:00
#return Label(text='Hello world')
return GameWidget()
2020-09-20 10:51:02 -04:00
2020-10-14 00:19:43 -04:00
class MainApp(MDApp):
2020-09-28 18:38:35 -04:00
def build(self):
pass
#Window.clearcolor = (0, 0, 0, 0)
#return SampleBoxLayout()
2020-09-28 18:38:35 -04:00
def on_start(self):
2020-09-28 23:18:26 -04:00
connection = None
cursor = None
# Initialize GPS
GpsHelper().run()
2020-09-28 23:18:26 -04:00
# Connect to database
self.connection = sqlite3.connect("databases/fountains.db")
2020-09-28 23:18:26 -04:00
self.cursor = self.connection.cursor()
# Instantiate SearchPopupMenu
2020-09-28 18:38:35 -04:00
2020-09-20 10:51:02 -04:00
if __name__ == '__main__':
#screen_manager = ScreenManager()
#screen_manager.add_widget(ScreenOne(name="screen_one"))
#screen_manager.add_widget(ScreenTwo(name="screen_two"))
2020-09-28 18:38:35 -04:00
#app = GlobalForest()
app = MainApp()
2020-09-21 17:13:51 -04:00
app.run()