-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisual.py
760 lines (637 loc) · 26.9 KB
/
visual.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
from kivymd.app import MDApp
from kivymd.uix.pickers import MDDatePicker, MDTimePicker
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen
#from kivy.uix.checkbox import CheckBox
from kivymd.uix.button import MDIconButton
from kivymd.uix.selectioncontrol import MDCheckbox
from kivymd.uix.label import MDLabel
from kivy.properties import BooleanProperty, StringProperty
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivymd.uix.button import MDFlatButton, MDRaisedButton
from kivymd.uix.dialog import MDDialog
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivymd.uix.list import TwoLineListItem
from kivy.metrics import dp
from kivymd.uix.list import TwoLineListItem, OneLineListItem
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import ObjectProperty, NumericProperty
from kivymd.uix.menu import MDDropdownMenu
from kivymd.uix.datatables import MDDataTable
from kivymd.uix.card import (
MDCardSwipe, MDCardSwipeLayerBox, MDCardSwipeFrontBox
)
from datetime import datetime, date
import ast,webbrowser,csv, requests
from functools import partial
import pandas as pd
import subprocess
import json
from src.scheduler import AppointmentScheduler
from src.predictor import Prediction, Detail
import src.file as fi
from src.display import draw
today = datetime.today()
formatted_date = today.strftime("%Y/%m/%d")
class BackgroundLayout(FloatLayout):
pass
class HomeWindow(Screen):
pass
class BMIWindow(Screen):
drop_down_menu = ObjectProperty(None)
bmi_weight = ObjectProperty(None)
bmi_height = ObjectProperty(None)
bmi_label = ObjectProperty(None)
data_tables = ObjectProperty(None)
selected_row_index = NumericProperty(None) # To store the highlighted row index
def __init__(self, **kw):
super().__init__(**kw)
self.menu = MDDropdownMenu(
caller=self.ids.drop_down_menu,
items=[
{"text": "Metric", "viewclass": "OneLineListItem", "on_release": lambda x="Metric": self.set_units(x)},
{"text": "Imperial", "viewclass": "OneLineListItem", "on_release": lambda x="Imperial": self.set_units(x)}
],
width_mult=4,
)
self.data_tables = MDDataTable(
size_hint=(0.7, 0.4),
use_pagination=False,
column_data=[
("BMI", dp(30)),
("Status", dp(30)),
],
row_data=[
("≤ 18.4", "Underweight"),
("18.5 - 24.9", "Normal Weight"),
("25 - 29.9", "Overweight"),
("≥ 30", "Obesity"),
]
)
self.ids.layout.add_widget(self.data_tables)
def on_enter(self):
# self.data_tables.clear_widgets()
pass
# Set initial selected row index (assuming first row is default)
def set_units(self, unit):
self.ids.drop_down_menu.text = unit
if unit == "Metric":
self.ids.bmi_weight.hint_text = "Weight (kg)"
self.ids.bmi_height.hint_text = "Height (cm)"
else:
self.ids.bmi_weight.hint_text = "Weight (lbs)"
self.ids.bmi_height.hint_text = "Height (inches)"
self.menu.dismiss()
def calculate(self):
weight = self.ids.bmi_weight.text
height = self.ids.bmi_height.text
if weight and height:
weight = float(weight)
height = float(height)
if self.ids.drop_down_menu.text == "Metric":
bmi = weight / ((height / 100) ** 2)
else:
bmi = (weight / (height ** 2)) * 703
text=""
if(bmi<=18.4):
text="Underweight"
if bmi >=18.5 and bmi <= 24.9 :
text="Normal Weight"
if(bmi>=25 and bmi<= 29.9):
text="Overweight"
if bmi >=30:
text="Obesity"
self.ids.bmi_label.text = f"BMI: {bmi:.1f}"+f"\n{text}"
else:
self.ids.bmi_label.text = "Please enter both weight and height."
class PredictorWindow(Screen):
selected_symptoms = []
def predict_disease(self):
pr = Prediction()
if self.selected_symptoms:
result = pr.predict_dis(self.selected_symptoms)
self.ids.disease_label.text = result
else:
self.ids.disease_label.text = "Please select at least one symptom."
self.selected_symptoms = []
self.ids.symptom_list.clear_widgets()
def on_enter(self):
self.selected_symptoms = []
self.ids.symptom_list.clear_widgets()
def show_add_symptom_dropdown(self):
if not hasattr(self, 'dropdown_open') or not self.dropdown_open:
self.dropdown_open = True
if hasattr(self, 'dropdown_menu') and isinstance(self.dropdown_menu, MDDropdownMenu):
self.dropdown_menu.dismiss()
if self.ids.diseaseTextField.on_focus == False:
self.dropdown_menu.dismiss()
searchText = self.ids.diseaseTextField.text
symptoms_list = MDApp.get_running_app().symptoms_list
search_items = [
{
"text": symptom,
"on_release": lambda symptom=symptom: self.addSymptom(symptom),
}for symptom in symptoms_list if searchText.lower() in symptom.lower()
]
self.dropdown_menu = MDDropdownMenu(
caller=self.ids.diseaseTextField, items=search_items
)
self.dropdown_menu.open()
def addSymptom(self, symptom):
self.selected_symptoms.append(symptom)
symptomText = str(len(self.selected_symptoms)) + ". " + symptom
list_item = OneLineListItem(text=symptomText)
self.ids.symptom_list.add_widget(list_item)
self.ids.diseaseTextField.text = ""
self.dropdown_menu.dismiss()
class SymptomOptionField(ButtonBehavior, BoxLayout):
selected = BooleanProperty(False)
symptom = StringProperty("")
def __init__(self, symptom, **kwargs):
super(SymptomOptionField, self).__init__(**kwargs)
self.symptom = symptom
self.orientation = 'horizontal'
self.size_hint_y = None
self.height = dp(50)
self.label = MDLabel(text=symptom, size_hint_x=None, width=dp(150))
self.add_widget(self.label)
self.toggle_selection_color()
def toggle_selection_color(self):
if self.selected:
self.label.color = (0, 0, 0, 1) # Change text color when selected
self.background_color = (0.3, 0.3, 0.3, 1) # Change background color when selected
else:
self.label.color = (1, 1, 1, 1) # Restore text color when deselected
self.background_color = (1, 1, 1, 1) # Restore background color when deselected
def on_release(self):
self.selected = not self.selected
self.toggle_selection_color()
class SymptomsWindow(Screen):
disease_label = None
def find_info(self, disease):
dtl = Detail()
self.ids.all_info.clear_widgets()
disease_label = disease
result = dtl.dis_description(disease)
if result:
self.ids.all_info.text = result
symptoms, prevention, cure = dtl.dis_detail()
self.ids.all_info.text += symptoms
self.ids.all_info.text += prevention
self.ids.all_info.text += cure
else:
self.ids.all_info.text = f"Sorry, unable to find any disease named {disease} in dataset."
class Content(BoxLayout):
pass
class SchedulerWindow(Screen):
schedulers = {'kabita': AppointmentScheduler(), 'shekhar': AppointmentScheduler()}
doctor = StringProperty(None)
scheduler = AppointmentScheduler()
def __init__(self, **kwargs):
super(SchedulerWindow, self).__init__(**kwargs)
if self.doctor=="kabita":
self.scheduler = self.doc1_scheduler
if self.doctor=="shekhar":
self.scheduler = self.doc2_scheduler
self.load_appointments_from_file()
self.update_appointments_label()
def on_doctor(self, instance, value):
if value in self.schedulers:
self.scheduler = self.schedulers[value]
self.scheduler.appointments.traverse()
self.load_appointments_from_file()
self.update_appointments_label()
def scheduled(self,time, name):
temp_node = self.scheduler.appointments.front
while temp_node:
if temp_node.data[0] == time and temp_node.data[1] == name:
return True
temp_node = temp_node.next
return False
def save_appointment(self):
date_str = self.ids.date_input.text
time_str = self.ids.time_input.text
name = self.ids.name_input.text
try:
appointment_time = datetime.strptime(date_str + ' ' + time_str, '%Y-%m-%d %H:%M')
if not self.scheduled(appointment_time, name):
self.scheduler.schedule_appointment(appointment_time, name)
self.scheduler.appointments.traverse()
self.update_appointments_label()
self.save_appointments_to_file()
else:
self.show_error_popup('Appointment already scheduled')
except ValueError:
self.show_error_popup('Invalid Date/Time Format')
def save_appointments_to_file(self):
filename = f"dataset/appointments/{self.doctor}.json"
appointments = self.scheduler.appointments
data = []
temp_node = appointments.front
while temp_node:
data.append({str(temp_node.data[1]): str(temp_node.data[0])})
temp_node = temp_node.next
with open(filename, "w") as file:
json.dump(data, file, indent=4)
def delete_appointment_from_file(self, time, name):
filename = f"dataset/appointments/{self.doctor}.json"
try:
with open(filename, "r") as file:
data = json.load(file)
print(time, name)
self.scheduler.appointments.traverse()
for appointment in data:
if (name in appointment and str(time) == appointment[name]):
data.remove(appointment)
with open(filename, "w") as file:
json.dump(data, file, indent=4)
except (FileNotFoundError, json.JSONDecodeError):
pass
def load_appointments_from_file(self):
filename = f"dataset/appointments/{self.doctor}.json"
try:
with open(filename, "r") as file:
data = json.load(file)
self.scheduler.appointments.clear()
for appointment in data:
name = list(appointment.keys())[0]
time_str = appointment[name]
appointment_time = datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S")
self.scheduler.schedule_appointment(appointment_time, name)
except (FileNotFoundError, json.JSONDecodeError):
pass
def update_appointments_label(self):
appointments = self.scheduler.appointments
self.ids.container.clear_widgets()
if not appointments.isEmpty():
self.ids.container.clear_widgets()
temp_node = appointments.front
while temp_node:
appointment_layout = BoxLayout(orientation='horizontal', size_hint=(1, None))
appointment_time = temp_node.data[0]
appointment_name = temp_node.data[1]
appointment_layout.add_widget(MDCardSwipe(
MDCardSwipeLayerBox(
MDIconButton(
icon="trash-can",
pos_hint={"center_y":0.5},
on_release=lambda x, widget=appointment_layout, time=appointment_time, name=appointment_name: self.delete_appointment(widget, time, name)
)
,
radius = [20, 20, 20, 20],
padding = dp(20),
md_bg_color=(0, 0, 0, 1)
),
MDCardSwipeFrontBox(
TwoLineListItem(
text=f'{temp_node.data[1]}',
secondary_text=f'{temp_node.data[0]}'
),
radius = [20, 20, 20, 20],
line_color=(0, 0, 1, 0.2),
)
)
)
self.ids.container.add_widget(appointment_layout)
temp_node = temp_node.next
def delete_appointment(self,widget, time, name):
self.delete_appointment_from_file(time, name)
self.ids.container.remove_widget(widget)
self.scheduler.cancel_appointment(time, name)
def show_error_popup(self, message):
content = Label(text=message)
error_popup = Popup(title='Error', content=content,
size_hint=(None, None), size=(300, 200))
error_popup.open()
def on_cancel_date(self, *args):
self.date_picker_open = False
def on_save_date(self, instance, value, date_range):
self.ids.date_input.text = value.strftime("%Y-%m-%d")
self.date_picker_open = False
def on_cancel_time(self, *args):
self.time_picker_open = False
def on_save_time(self, instance, time):
self.ids.time_input.text = time.strftime("%H:%M")
self.time_picker_open = False
def show_date_picker(self):
if not hasattr(self, 'date_picker_open') or not self.date_picker_open:
self.date_picker_open = True
date_dialog = MDDatePicker(min_date=date.today(), max_date=date(
date.today().year,
date.today().month+6,
date.today().day,
),
)
date_dialog.bind(on_save=self.on_save_date,
on_cancel=self.on_cancel_date)
date_dialog.open()
def show_time_picker(self):
if not hasattr(self, 'time_picker_open') or not self.time_picker_open:
self.time_picker_open = True
time_dialog = MDTimePicker()
time_dialog.bind(on_save=self.on_save_time,
on_cancel=self.on_cancel_time)
time_dialog.open()
class DoctorWindow(Screen):
def on_click(self, doctor):
self.manager.get_screen('scheduler').doctor = doctor
self.manager.current = 'scheduler'
class HospitalWindow(Screen):
dropdown_menus = {}
def on_enter(self):
self.ids.hospitalList.clear_widgets()
nameList = self.readData("dataset/hospitals_data/hospitals.csv")
for name, address in zip(nameList[0], nameList[1]):
item = TwoLineListItem(
text=name,
secondary_text = address
)
button = MDFlatButton(text = "[color=#0000ff]view in map[/color]", pos_hint = {"top": 0.6, 'x': 0.95},
on_release= partial(self.view_in_map, name))
item.add_widget(button)
self.ids.hospitalList.add_widget(item)
def view_in_map(self, name, *args):
nameList = self.readData("dataset/hospitals_data/hospitals.csv")
for names in nameList[0]:
if name == names:
nameIndex = nameList[0].index(names)
latlon = nameList[-1][nameIndex]
latlon = ast.literal_eval(latlon)
lat = latlon[0]
lon = latlon[1]
url = f"https://www.google.com/maps/search/?api=1&query={lat},{lon}"
webbrowser.open(url)
def show_sort_popup(self):
sort_items = [
{
"text": "sort by name",
"on_release": lambda: self.sort_by_name(),
},
{
"text": "sort by distance",
"on_release": lambda: self.sort_by_distance(),
}
]
MDDropdownMenu(
caller=self.ids.sort, items=sort_items
).open()
def sort_by_name(self):
self.ids.hospitalList.clear_widgets()
nameList = self.read_csv("dataset/hospitals_data/hospitals.csv")
self.merge_sort(nameList, key='Name')
self.write_csv("dataset/hospitals_data/hospitalstd.csv",nameList)
nameList = self.readData("dataset/hospitals_data/hospitalstd.csv")
for name, address in zip(nameList[0], nameList[1]):
item = TwoLineListItem(
text=name,
secondary_text = address
)
button = MDFlatButton(text = "[color=#0000ff]view in map[/color]", pos_hint = {"top": 0.6, 'x': 0.95},
on_release= partial(self.view_in_map, name))
item.add_widget(button)
self.ids.hospitalList.add_widget(item)
def sort_by_distance(self):
# add = requests.get("https://api.ipify.org").text
# url = "https://get.geojs.io/v1/ip/geo/" + add + ".json"
# geo_request = requests.get(url)
# geo_data = geo_request.json()
# g=[float(geo_data['latitude']), float(geo_data['longitude'])]
g=[27.681908, 85.319193]
df = pd.read_csv("dataset/hospitals_data/hospitals.csv", encoding="ISO-8859-1")
nameList = self.readData("dataset/hospitals_data/hospitals.csv")
distanceList = []
for coordinates in nameList[3]:
coordinates = ast.literal_eval(coordinates)
distance = ((g[0]- coordinates[0])**2 + (g[1]- coordinates[1])**2)**(1/2)
distanceList.append(distance)
df['distance'] = distanceList
df.to_csv("dataset/hospitals_data/hospitalstd.csv", index=False)
self.ids.hospitalList.clear_widgets()
nameList = self.read_csv("dataset/hospitals_data/hospitalstd.csv")
self.merge_sort(nameList, key='distance')
self.write_csv("dataset/hospitals_data/hospitalstd.csv",nameList)
nameList = self.readData("dataset/hospitals_data/hospitalstd.csv")
for name, address in zip(nameList[0], nameList[1]):
item = TwoLineListItem(
text=name,
secondary_text = address
)
button = MDFlatButton(text = "[color=#0000ff]view in map[/color]", pos_hint = {"top": 0.6, 'x': 0.95},
on_release= partial(self.view_in_map, name))
item.add_widget(button)
self.ids.hospitalList.add_widget(item)
def searchHospital(self, searchIndex):
searchText = self.ids.search_hospital.text
self.ids.hospitalList.clear_widgets()
nameList = self.readData("dataset/hospitals_data/hospitals.csv")
for name, address in zip(nameList[0], nameList[1]):
searchWhat = name if searchIndex == 0 else address
if searchText.lower() in searchWhat.lower():
item = TwoLineListItem(
text=name,
secondary_text = address
)
button = MDFlatButton(text = "[color=#0000ff]view in map[/color]", pos_hint = {"top": 0.6, 'x': 0.95},
on_release= partial(self.view_in_map, name))
item.add_widget(button)
self.ids.hospitalList.add_widget(item)
def toggleSearch(self):
if self.ids.search_hospital.hint_text == "Search by Address":
self.ids.search_hospital.hint_text = "Search by Name"
else:
self.ids.search_hospital.hint_text= "Search by Address"
def readData(self, filename):
df = pd.read_csv(filename, encoding="ISO-8859-1")
data_list = df.T.values.tolist()
return data_list
def on_start(self):
pass
def merge_sort(self, arr, key):
if len(arr) > 1:
mid = len(arr) // 2
left_half = arr[:mid]
right_half = arr[mid:]
self.merge_sort(left_half, key)
self.merge_sort(right_half, key)
i = j = k = 0
while i < len(left_half) and j < len(right_half):
if left_half[i][key] < right_half[j][key]:
arr[k] = left_half[i]
i += 1
else:
arr[k] = right_half[j]
j += 1
k += 1
while i < len(left_half):
arr[k] = left_half[i]
i += 1
k += 1
while j < len(right_half):
arr[k] = right_half[j]
j += 1
k += 1
def read_csv(self,filename):
data = []
with open(filename, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
data.append(row)
return data
def write_csv(self,filename, data):
with open(filename, 'w', newline='') as file:
writer = csv.DictWriter(file, fieldnames=data[0].keys())
writer.writeheader()
writer.writerows(data)
class ContentDialog(Popup):
def __init__(self, title='', content_cls=None, buttons=[], **kwargs):
super(ContentDialog, self).__init__(**kwargs)
self.title = title
self.content_cls = content_cls
self.buttons = buttons
class ContentDialog(Popup):
def __init__(self, title='', content_cls=None, buttons=[], **kwargs):
super(ContentDialog, self).__init__(**kwargs)
self.title = title
self.content_cls = content_cls
self.buttons = buttons
class WindowManager(ScreenManager):
pass
class DataWindow(Screen):
def on_enter(self):
pass
def __init__(self, **kw):
super().__init__(**kw)
layout=AnchorLayout()
table = MDDataTable(
pos_hint={'center_x': 0.6, 'top': 0.2},
size_hint=(1, 1),
column_data=[
("SN.", dp(30)),
("NAME", dp(30)),
("RANGE", dp(30)),
("UNIT", dp(30))
],
row_data=[
["1", "Pressure", "120/80","mm/HG"],
["2", "Weight", "50","kg"],
["3", "Screen tiime","2-4", "hour"],
["4", "Water intake","2-4", "litre"]
]
)
layout.add_widget(table)
def click(self):
if(self.ids.pressure.text!= ''):
string=formatted_date+":"+self.ids.pressure.text+" mmHg"+"\n"
fi.update_last_line("dependencies/txt_files/Pressure.txt", string)
if(self.ids.weight.text!= ''):
string=formatted_date+":"+self.ids.weight.text+"\n"
fi.update_last_line("dependencies/txt_files/Weight.txt", string)
if(self.ids.screen.text!= ''):
string=formatted_date+":"+self.ids.screen.text+"\n"
fi.update_last_line("dependencies/txt_files/Screen.txt", string)
if(self.ids.water.text!= ''):
string=formatted_date+":"+self.ids.water.text+"\n"
fi.update_last_line("dependencies/txt_files/Water.txt", string)
class BloodWindow(Screen):
def on_enter(self):
pass
def __init__(self, **kw):
super().__init__(**kw)
def clickk(self):
if(self.ids.RBC.text!= ''):
string=formatted_date+":"+self.ids.RBC.text+"\n"
fi.update_last_line("dependencies/txt_files/RBC.txt", string)
if(self.ids.WBC.text!= ''):
string=formatted_date+":"+self.ids.WBC.text+"\n"
fi.update_last_line("dependencies/txt_files/WBC.txt", string)
if(self.ids.Platelets.text!= ''):
string=formatted_date+":"+self.ids.Platelets.text+"\n"
fi.update_last_line("dependencies/txt_files/Platelets.txt", string)
if(self.ids.Haemoglobin.text!= ''):
string=formatted_date+":"+self.ids.Haemoglobin.text+"\n"
fi.update_last_line("dependencies/txt_files/Haemoglobin.txt", string)
return
class GraphWindow(Screen):
def on_enter(self):
pass
def __init__(self, **kwargs):
super().__init__(**kwargs)
def click(self,button_name):
if(button_name=="Platelets"):
MonthWindow.what="Platelets"
self.manager.current = "month"
if(button_name=="Haemoglobin"):
MonthWindow.what="Haemoglobin"
self.manager.current = "month"
if(button_name=="WBC"):
MonthWindow.what="WBC"
self.manager.current = "month"
if(button_name=="RBC"):
MonthWindow.what="RBC"
self.manager.current = "month"
if(button_name=="Weight"):
MonthWindow.what="Weight"
self.manager.current = "month"
if(button_name=="Pressure"):
MonthWindow.what="Pressure"
self.manager.current = "month"
if(button_name=="Screen"):
MonthWindow.what="Screen"
self.manager.current = "month"
if(button_name=="Water"):
MonthWindow.what="Water"
self.manager.current = "month"
class MonthWindow(Screen):
what= None
def on_enter(self):
pass
def __init__(self, **kwargs):
super().__init__(**kwargs)
def click(self,button_name):
if(button_name=="January"):
draw(self.what,button_name)
if(button_name=="February"):
draw(self.what,button_name)
if(button_name=="March"):
draw(self.what,button_name)
if(button_name=="April"):
draw(self.what,button_name)
if(button_name=="May"):
draw(self.what,button_name)
if(button_name=="June"):
draw(self.what,button_name)
if(button_name=="July"):
draw(self.what,button_name)
if(button_name=="August"):
draw(self.what,button_name)
if(button_name=="September"):
draw(self.what,button_name)
if(button_name=="October"):
draw(self.what,button_name)
if(button_name=="November"):
draw(self.what,button_name)
if(button_name=="December"):
draw(self.what,button_name)
class AboutWindow(Screen):
def on_start(self):
pass
def openGithub(self,index):
if index == 1:
url = f"https://github.com/sandipkatel"
webbrowser.open(url)
if index ==2 :
url = f"https://github.com/saphalr"
webbrowser.open(url)
if index == 3:
url = f"https://github.com/sharadpokharel108"
webbrowser.open(url)
if index == 4:
url = f"https://github.com/SijanJ"
webbrowser.open(url)
# Load the kv file
kv = Builder.load_file("style.kv")