2020-10-18 19:16:32 -04:00
|
|
|
__author__ = "afx"
|
|
|
|
__version__ = "0.2"
|
|
|
|
|
2020-09-28 22:10:13 -04:00
|
|
|
# Import system modules
|
2020-10-18 13:53:02 -04:00
|
|
|
import multiprocessing
|
2020-10-17 12:22:22 -04:00
|
|
|
import random
|
2020-09-28 23:18:26 -04:00
|
|
|
import sqlite3
|
2020-09-25 10:20:37 -04:00
|
|
|
|
2020-09-28 22:10:13 -04:00
|
|
|
# Import Kivy modules
|
|
|
|
#from kivy.app import App
|
2020-10-17 12:22:22 -04:00
|
|
|
#from kivy.app import async_runTouchApp
|
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
|
|
|
|
2020-09-28 22:10:13 -04:00
|
|
|
# Import local modules
|
|
|
|
from forestmapview import ForestMapView
|
2020-10-15 20:12:15 -04:00
|
|
|
#from searchpopupmenu import SearchPopupMenu
|
2020-09-28 22:10:13 -04:00
|
|
|
from gpshelper import GpsHelper
|
|
|
|
from settings import SampleBoxLayout
|
|
|
|
from game import GameWidget
|
2020-10-18 13:53:02 -04:00
|
|
|
from cncbot import CnCApp
|
2020-09-28 22:10:13 -04:00
|
|
|
|
2020-10-17 12:22:22 -04:00
|
|
|
# Welcome message
|
|
|
|
MOTD = """]
|
2020-10-18 19:16:32 -04:00
|
|
|
] GlobalForest {} by afx""".format(__version__)
|
2020-10-14 08:29:53 -04:00
|
|
|
|
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 MainApp(MDApp):
|
2020-10-14 15:52:03 -04:00
|
|
|
connection = None
|
|
|
|
cursor = None
|
|
|
|
search_menu = None
|
|
|
|
|
2020-09-28 18:38:35 -04:00
|
|
|
def build(self):
|
2020-09-28 22:10:13 -04:00
|
|
|
pass
|
|
|
|
#Window.clearcolor = (0, 0, 0, 0)
|
|
|
|
#return SampleBoxLayout()
|
2020-09-28 18:38:35 -04:00
|
|
|
|
2020-09-28 22:10:13 -04:00
|
|
|
def on_start(self):
|
2020-10-14 15:52:03 -04:00
|
|
|
# Welcome
|
2020-10-17 12:22:22 -04:00
|
|
|
print(MOTD)
|
2020-10-14 15:52:03 -04:00
|
|
|
|
|
|
|
self.theme_cls.primary_palette = 'BlueGray'
|
2020-09-28 23:18:26 -04:00
|
|
|
|
|
|
|
# Initialize GPS
|
2020-09-28 22:10:13 -04:00
|
|
|
GpsHelper().run()
|
2020-09-28 23:18:26 -04:00
|
|
|
|
|
|
|
# Connect to database
|
2020-09-29 11:45:44 -04:00
|
|
|
self.connection = sqlite3.connect("databases/fountains.db")
|
2020-09-28 23:18:26 -04:00
|
|
|
self.cursor = self.connection.cursor()
|
|
|
|
|
|
|
|
# Instantiate SearchPopupMenu
|
2020-10-15 20:12:15 -04:00
|
|
|
#self.search_menu = SearchPopupMenu()
|
2020-10-18 13:53:02 -04:00
|
|
|
|
2020-09-20 10:51:02 -04:00
|
|
|
if __name__ == '__main__':
|
2020-10-18 13:53:02 -04:00
|
|
|
# Start the Command and Control bot. Mainly for reporting.
|
|
|
|
cnc = multiprocessing.Process(target=CnCApp)
|
|
|
|
cnc.start()
|
2020-10-17 12:22:22 -04:00
|
|
|
|
2020-10-18 13:53:02 -04:00
|
|
|
# Start the Kivy Framework main loop
|
2020-10-17 12:22:22 -04:00
|
|
|
kivyapp = MainApp()
|
|
|
|
kivyapp.run()
|
|
|
|
|
2020-10-18 13:53:02 -04:00
|
|
|
# Cleanup subprocesses
|
2020-10-18 19:16:32 -04:00
|
|
|
print('] Terminating subprocesses.')
|
|
|
|
cnc.kill()
|