This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
62 lines (53 loc) · 2.07 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#<stdio>
import sqlite3
import sys
import traceback
### Kivy
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.widget import Widget
from kivymd.app import MDApp
### Import page to work with ScreenManager.
# Factory class will automatically go to each page and grab Screen class.
# From individual files.
# This is for future scaling and readability purpose. Though i don't know if this
# is even remotely Pythonic.
from Pages.scannerapp import ScanningScreen
from Pages.signaturepage import SignatureScreen
from Pages.welcome import WelcomeScreen
##TODO : reduce scanning speed
##TODO : record value from scanning into database
##TODO : making signature screen after receiving shipment
##TODO : making signature screen before sending shipment
##TODO : record signature into database
##DOLATER : login page
##DOLATER : specific page for user login
class RootWidget(ScreenManager):
Builder.load_file('design.kv')
class LogistecApp(MDApp):
path_to_kv = 'design.kv'
def connectAppDatabase(self):
try:
con = sqlite3.connect('data\database.db')
return con
except sqlite3.Error as er:
print('SQLite error: %s' % (' '.join(er.args)))
print("Exception class is: ", er.__class__)
print('SQLite traceback: ')
exc_type, exc_value, exc_tb = sys.exc_info()
print(traceback.format_exception(exc_type, exc_value, exc_tb))
### FPS MONITORING FOR DEBUGGING AND PERFORMANCE TESTING PURPOSE ###
# PLEASE DELETE IT BEFORE COMPLILING #
def on_start(self):
self.fps_monitor_start()
def build(self):
con = self.connectAppDatabase()
cursorObj = con.cursor()
cursorObj.execute("CREATE TABLE IF NOT EXISTS scanning_data (ID INTEGER PRIMARY KEY, PHY_ID TEXT, PHY_NUMBER INTEGER, BRANCH_NUMBER INTEGER, BRANCH_NAME INTEGER)")
con.commit()
sm = RootWidget()
self.theme_cls.theme_style = "Dark"
self.theme_cls.material_style = "M3"
return sm
if __name__ in "__main__":
LogistecApp().run()