-
Notifications
You must be signed in to change notification settings - Fork 1
/
openeqms.py
318 lines (240 loc) · 8.32 KB
/
openeqms.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
import sys, os, pathlib
from typing import Union
import socket
from time import time
from datetime import datetime
from os.path import dirname, join
import cv2
import numpy as np
import glob
#from root.ModelPrep import validate_params, change_koatuu, prep_params, load_regression
#IMPORT PANDAS
#import pandas as pd
#import sqlite3
#IMPORT SCIKITLEARN FOR MACHINE LEARNING
#import scikitlearn as sct
#IMPORT KIVY FOR GUI
import kivy
#from kivy.app import App
from kivymd.app import MDApp
from kivy.uix.widget import Widget
from kivymd.uix.widget import MDWidget
from kivymd.uix import *
from kivy.properties import ObjectProperty, NumericProperty, StringProperty, BooleanProperty,\
ListProperty
from kivy.metrics import dp
from kivy.lang import Builder
#from kivymd.app import Builder
from kivy.core.window import Window
from kivy.uix.slider import Slider
from kivymd.uix.list import IRightBodyTouch, OneLineAvatarIconListItem
from kivymd.uix.boxlayout import MDBoxLayout
#from kivy.uix.screenmanager import Screen, ScreenManager
from kivymd.uix.screen import MDScreen
from kivymd.uix.screenmanager import MDScreenManager
from kivymd.uix.screenmanager import ScreenManager
from kivymd.uix.pickers import MDColorPicker
from kivymd.uix.toolbar import MDTopAppBar
from kivymd.uix.menu import MDDropdownMenu
from kivymd.uix.button import MDRaisedButton
from kivymd.uix.button import MDIconButton
from kivy.uix.button import Button
from kivymd.uix.snackbar import Snackbar
from kivymd.uix.label import MDLabel
from kivymd.uix.fitimage import FitImage
from kivy.clock import Clock
from kivymd.uix.textfield import MDTextField
from kivymd.uix.pickers import MDColorPicker, MDDatePicker, MDTimePicker
from kivy.uix.carousel import Carousel
#DATABASE SETUP AND DEFINITION
"""
class DBE():
conn = sqlite3.connect('dbl_container.sql')
def submit(self):
conn = sqlite3.connect('dbl_container.sql')
#create cursor
c = conn.cursor()
#add a record
c.execute("INSERT INTO customers VALUES (:first)",
{
'first': self.root.ids.word_input.text,
})
#add message
self.root.ids.word_label.text = f'{self.root.ids.word_input.text} Added'
#clear input texts
self.root.ids.word_input.text = ''
#commit cnages
conn.commit()
#close connection
conn.close()
def show_records(self):
conn = sqlite3.connect('dbl_container.sql')
#create cursor
c = conn.cursor()
#add record
c.execute("SELECT * FROM customers")
records = c.fetchall()
word = ''
#loop for records
for record in records:
word = f'{word}\n{record[0]}'
self.root.ids.word_label.text = f'{word}'
#clear input texts
self.root.ids.word_input.text = ''
#commit cnages
conn.commit()
#close connection
conn.close()
"""
#STATUS WORK
#define working status: by online with team, offline by yourself
#main execution is to connect and update team packages by online status
"""
class Status(self):
container = None
comms = sct.
db_container =
def __init__(self):
#connection to DB
def connect(self):
def online(self):
def offline(self):
primary_palette = ['Red', 'Pink', 'Purple', 'DeepPurple',
'Indigo', 'Blue', 'LightBlue', 'Cyan',
'Teal', 'Green', 'LightGreen', 'Lime',
'Yellow', 'Amber', 'Orange', 'DeepOrange',
'Brown', 'Gray', 'BlueGray']
"""
class calendars(MDDatePicker):
def on_release1(self, instance):
print(instance)
def app_calendar(self):
pass
def show_app_date(self):
date_dialog = MDDatePicker()
date_dialog.bind(on_save=self.date_save, on_cancel=self.date_cancel)
date_dialog.open()
def date_save(self, instance, value):
print(instance, value)
def date_cancel(self, instance):
if instance is True: pass
elif instance is True: print(instance)
class timers(MDTimePicker):
def time_cancel(self, instance):
print(instance)
def show_app_time(self, *args):
previous_time = datetime.strptime("", '').time()
time_dialog = MDTimePicker()
time_dialog.bind(
time = self.get_time,
on_save=self.time_save,
on_cancel=self.time_cancel)
#time_dialog.set_time(previous_time)
time_dialog.open()
def get_time(self, time):
time = datetime.time
'''
The method returns the set time.
:type instance: <kivymd.uix.picker.MDTimePicker object>
:type time: <class 'datetime.time'>
'''
return time
def time_save(self, instance):
print(instance)
class generator():
pass
class mlearn():
pass
class HOME(MDScreen):
pass
class APPLICATIONS(MDScreen):
pass
class Product(MDScreen):
pass
class Drawing(MDScreen):
def build(self):
menu_items = [
{
"viewclass": "OneLineListItem",
"text": f"Item {i}",
"height": dp(56),
"on_release": lambda x=f"Item {i}": self.menu_callback(x),
} for i in range(5)
]
self.menu = MDDropdownMenu(
items=menu_items,
width_mult=4,
)
def callback(self, menu_button):
menu_button = self.root.ids.menu_button
self.menu.caller = menu_button
self.menu.open()
def menu_callback(self, text_item):
self.menu.dismiss()
Snackbar(text=text_item).open()
class Casecheck(MDScreen):
pass
class INFO(MDScreen):
pass
class ProdcaseApp(MDApp):
title = 'OPEN SOURCE ENTERPRISE QUALITY MANAGEMENT SYSTEM'
sm = ScreenManager()
apps = APPLICATIONS()
def build(self):
menu_items = [
{
"viewclass": "OneLineListItem",
"text": f"Item {i}",
"height": dp(56),
"on_release": lambda x=f"Item {i}": self.menu_callback(x),
} for i in range(5)
]
self.menu = MDDropdownMenu(
items=menu_items,
width_mult=4,
)
self.theme_cls.theme_style = "Light"
self.theme_cls.primary_palette = "LightBlue"
self.theme_cls.material_style = "M3"
return Builder.load_file('openeqms.kv')
def on_save(self, instance, value):
print(instance, value)
def on_cancel(self, instance, value):
print(instance, value)
def callback(self, menu_button):
menu_button = self.root.ids.menu_button
self.menu.caller = menu_button
self.menu.open()
def menu_callback(self, text_item):
self.menu.dismiss()
Snackbar(text=text_item).open()
def on_pause(self):
return True
def on_resume(self):
pass
def app_calendar(self): return calendars.show_app_date(calendars)
def app_timer(self): return timers.show_app_time(timers)
def open_color_picker(self):
color_picker = MDColorPicker(size_hint=(0.45, 0.85))
color_picker.open()
color_picker.bind(
on_select_color=self.on_select_color,
on_release=self.get_selected_color,
)
def update_color(self, color: list) -> None:
self.root.ids.menubar.md_bg_color = color
def get_selected_color(
self,
instance_color_picker: MDColorPicker,
type_color: str,
selected_color: Union[list, str],
):
'''Return selected color.'''
print(f"Selected color is {selected_color}")
self.update_color(selected_color[:-1] + [1])
def on_select_color(self, instance_gradient_tab, color: list) -> None:
'''Called when a gradient image is clicked.'''
def presser(self): self.root.ids.drawings.text = "Your DRAWING is missing!"
def koko_open(self): print("koko")
if __name__ == '__main__':
ProdcaseApp().run()