Commit dfb5ac22 authored by Sivananthan.S's avatar Sivananthan.S

50% done waste prediction

parent 11d62d0f
.vscode
__pycache__
*.pyc
.buildozer
bin
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Nosetests" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="pandas" />
<item index="1" class="java.lang.String" itemvalue="selenium" />
<item index="2" class="java.lang.String" itemvalue="lxml" />
<item index="3" class="java.lang.String" itemvalue="nose" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/App.iml" filepath="$PROJECT_DIR$/.idea/App.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
month,SeedType,Seeds,DailyWater,chemicalsType,production,wastage
2017-06,KeeriSamba,17000,1000,organic,70000,2
2017-12,KeeriSamba,17000,1000,organic,70000,2
2018-06,KeeriSamba,17000,1000,organic,70000,2
2018-12,KeeriSamba,17000,1000,organic,70000,2
2019-06,KeeriSamba,17000,1000,organic,70000,2
2019-12,KeeriSamba,17000,1000,organic,70000,2
2020-06,KeeriSamba,17000,1000,organic,70000,2
2020-12,KeeriSamba,17000,1000,organic,70000,2
2021-06,KeeriSamba,17000,1000,organic,70000,2
2022-12,KeeriSamba,17000,1000,organic,70000,2
2017-06,Nadu,18000,1000,organic,80000,3
2017-12,Nadu,18000,1000,organic,80000,3
2018-06,Nadu,18000,1000,organic,80000,3
2018-12,Nadu,18000,1000,organic,80000,3
2019-06,Nadu,18000,1000,organic,80000,3
2019-12,Nadu,18000,1000,organic,80000,3
2020-06,Nadu,18000,1000,organic,80000,3
2020-12,Nadu,18000,1000,organic,80000,3
2021-06,Nadu,18000,1000,organic,80000,3
2022-12,Nadu,18000,1000,organic,80000,3
import pandas as pd
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.tree import export_graphviz
from six import StringIO
import pydotplus
from sklearn.tree import DecisionTreeClassifier
dataset = pd.read_csv('FarmingData/DataCollected.csv')
dataset.shape
dataset['chemicalsType'].replace({'organic': 1}, inplace=True)
tableData = dataset[(dataset["SeedType"] == 'Nadu')]
dataset['WasteAmount'] = (dataset['wastage'] / 100) * dataset['production']
tableData = dataset.head()
print(tableData)
# Preparing the Data
feature_cols = ['Seeds', 'DailyWater', 'chemicalsType']
X = dataset[['Seeds', 'DailyWater', 'chemicalsType']]
y = dataset['WasteAmount']
# Training and Making Predictions 0.80 tranning
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20)
# set DecisionTreeClassifier algorithm
classifier = DecisionTreeClassifier()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
dot_data = StringIO()
export_graphviz(classifier, out_file=dot_data,
filled=True, rounded=True,
special_characters=True,feature_names = feature_cols,class_names=['0','1'])
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
# used Seeds Kg , DailyWater , chemicalsType Used
new_input = [[18000,1000,2]]
pred = classifier.predict(new_input)
print(pred)
# measure Accuracy
print("Accuracy:",metrics.accuracy_score(y_test, y_pred) * 100 )
\ No newline at end of file
Add Your Custom Modules Here.
If you have a module named module_name.py in
libs/applibs dir. You can call it directly in your
uix dir via:
`import module_name` instead of `from libs.applibs import module`
\ No newline at end of file
import os
from main_imports import Builder
def load_kv(file_name, file_path=os.path.join("ProjectFiles", "uix", "kv")):
"""
`load_kv` func is used to load a .kv file.
args that you can pass:
* `file_name`: Name of the kv file.
* `file_path`: Path to the kv file, it defaults
to `project_name/libs/kv`.
Q: Why a custom `load_kv`?
A: To avoid some encoding errors.
"""
with open(os.path.join(file_path, file_name), encoding="utf-8") as kv:
Builder.load_string(kv.read())
from main_imports import MDScreen
from ProjectFiles.applibs import utils
from kivy.properties import StringProperty
import numpy as np
import pandas as pd
import os
import warnings
from sklearn.model_selection import train_test_split
warnings.filterwarnings('ignore')
utils.load_kv("Instruction.kv")
class Instruction_Screen(MDScreen):
def btnA(self):
dataset = pd.read_csv("heartDs/heart.csv")
dataset["target"].describe()
unique = dataset["target"].unique()
predictors = dataset.drop("target", axis=1)
target = dataset["target"]
X_train, X_test, Y_train, Y_test = train_test_split(predictors, target, test_size=0.20, random_state=0)
# V. Model Fitting
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
rf = RandomForestClassifier()
rf.fit(X_train, Y_train)
Y_pred_rf = rf.predict(X_test)
current_accuracy = round(accuracy_score(Y_pred_rf, Y_test) * 100, 2)
rf = RandomForestClassifier()
rf.fit(X_train, Y_train)
Y_pred_rf = rf.predict(X_test)
Y_pred_rf.shape
score_rf = round(accuracy_score(Y_pred_rf, Y_test) * 100, 2)
# print("The accuracy: " + str(score_rf) + " %")
cp = dataset["cp"].mean()
restecg = dataset["restecg"].mean()
thalach = dataset["thalach"].mean()
exang = dataset["exang"].mean()
oldpeak = dataset["oldpeak"].mean()
slope = dataset["slope"].mean()
ca = dataset["ca"].mean()
thal = dataset["thal"].mean()
age = self.txt2.text
gender = StringProperty("")
gender = format(self.gender)
trestbps = self.txt3.text
chol = self.txt4.text
fbs = self.txt5.text
new_input = [[age, gender, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]]
pred = rf.predict(new_input)
if (pred == 1):
self.l1.text = "Prediction: Positive"
else:
self.l1.text = "Prediction: Negative"
pass
from main_imports import MDScreen
from ProjectFiles.applibs import utils
import warnings
import pandas as pd
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.tree import export_graphviz
from six import StringIO
import pydotplus
from sklearn.tree import DecisionTreeClassifier
warnings.filterwarnings('ignore')
utils.load_kv("Paddy_Waste.kv")
class Paddy_Waste_Screen(MDScreen):
def selectbtn1(self):
self.l3.text = "KeeriSamba"
pass
def selectbtn2(self):
self.l3.text = "Nadu"
pass
def selectbtn3(self):
# organic = 1
self.l2.text = "1"
def btnA(self):
SeedType = self.l3.text
dataset = pd.read_csv('FarmingData/DataCollected.csv')
dataset.shape
dataset['chemicalsType'].replace({'organic': 1}, inplace=True)
dataset = dataset[(dataset["SeedType"] == SeedType)]
dataset['WasteAmount'] = (dataset['wastage'] / 100) * dataset['production']
tableData = dataset.head()
print(tableData)
# Preparing the Data
feature_cols = ['Seeds', 'DailyWater', 'chemicalsType']
X = dataset[['Seeds', 'DailyWater', 'chemicalsType']]
y = dataset['WasteAmount']
# Training and Making Predictions
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20)
# set DecisionTreeClassifier algorithm
classifier = DecisionTreeClassifier()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
dot_data = StringIO()
export_graphviz(classifier, out_file=dot_data,
filled=True, rounded=True,
special_characters=True, feature_names=feature_cols, class_names=['0', '1'])
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
# used Seeds Kg , DailyWater , chemicalsType Used
Seeds = self.txt3.text
DailyWater = self.txt4.text
chemicalsType = self.l2.text
new_input = [[Seeds, DailyWater, chemicalsType]]
pred = classifier.predict(new_input)
print(pred)
self.l1.text = str(pred[0])
pass
from main_imports import ImageLeftWidget, MDScreen, TwoLineAvatarListItem
from ProjectFiles.applibs import utils
import warnings
from kivymd.uix.list import OneLineListItem
import os
import psutil
import time
import subprocess
import fnmatch
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import ImageFilter,Image
from tkinter import filedialog, messagebox
from sklearn.cluster import KMeans
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
utils.load_kv("homeList.kv")
warnings.filterwarnings('ignore')
class HomeList_Screen(MDScreen):
pass
from main_imports import MDScreen
from ProjectFiles.applibs import utils
utils.load_kv("login.kv")
import mysql.connector
class Login_Screen(MDScreen):
def LoginButton(self):
email = format(self.txt1.text)
password = format(self.txt2.text)
try:
connection = mysql.connector.connect(host='localhost',
database='SystemUser',
user='root',
password='')
cursor = connection.cursor()
sql_select_query = "SELECT * FROM People WHERE email = '" + email + "' AND password = '" + password + "'"
cursor.execute(sql_select_query)
cursor.fetchall()
rowcount = cursor.rowcount
if rowcount > 0:
self.parent.current = "Paddy_Waste"
else:
self.l1.text = "Login Invalid"
finally:
if connection.is_connected():
connection.close()
def ClearButton(self):
self.txt1.text = ""
self.txt2.text = ""
self.l1.text = ""
pass
from kivy.core.window import Window
from main_imports import ScreenManager
from ProjectFiles.applibs import utils
utils.load_kv("root.kv")
class Root(ScreenManager):
def __init__(self, **kwargs):
super(Root, self).__init__(**kwargs)
Window.bind(on_keyboard=self._key_handler)
self.screen_list = list() #this list have all screen that user switched
def _key_handler(self, instance, key, *args):
if key is 27:
#in Desktop this key 27 is Esc and in Phone it's Back btn
self.previous_screen()
return True
def previous_screen(self):
"""
Switch to previous screen last screen in screen_list
"""
last_screen=self.screen_list.pop()
if last_screen == "home" or last_screen == "login":
exit()
print(self.screen_list)
self.transition.direction = "left"
self.current = self.screen_list[len(self.screen_list)-1]
def change_screen(self,name):
"""
Switch Screen using screen name and
"""
self.current = name
if name not in self.screen_list:
self.screen_list.append(self.current)
else:
self.screen_list.remove(name)
self.screen_list.append(self.current)
print(self.screen_list)
# if name == "home":
# MDBottomNavigation not resize there tabs when app stat in android
# to resize when switch to home screen
# self.get_screen(name).ids.android_tabs.on_resize()
\ No newline at end of file
from main_imports import BoxLayout
from ProjectFiles.applibs import utils
utils.load_kv("ui_class.kv")
class OneLineTextDialog(BoxLayout):
def input_text(self):
return self.ids.dialog_text.text
from main_imports import MDScreen
from ProjectFiles.applibs import utils
utils.load_kv("verification.kv")
class Verification_Screen(MDScreen):
pass
\ No newline at end of file
<Instruction_Screen>:
name: "Instruction"
MDToolbar:
title: app.APP_NAME
size_hint: 1,.08
elevation: 5
pos_hint: {"center_y": .95}
MDToolbar:
size_hint: 1,.08
elevation: 5
MDIconButton:
icon: "home"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.50}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("Diabetes2022")
MDIconButton:
icon: "menu"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.90}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("Instruction")
MDIconButton:
icon: "account"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.1}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("login")
MDLabel:
text: "INSTRUCTION FOR POSITIVE HEART PERSON"
halign: "center"
pos_hint: {"center_y":.88}
color: 255,255,178
MDLabel:
text: "AAAAAAAA AAAAAAAA AAAAAA AAAAAAAA AAAAAA"
halign: "center"
pos_hint: {"center_y":.80}
MDLabel:
text: "AAAAA AAAAAA AAAAAAAAAAAA AAAAAAAA AAAA AAAAAAAA"
halign: "center"
pos_hint: {"center_y":.70}
MDLabel:
text: "AAAAA AAAAAA AAAAAAAAAAAA AAAAAAAA AAAA AAAAAAAA"
halign: "center"
pos_hint: {"center_y":.60}
MDLabel:
text: "AAAAA AAAAAA AAAAAAAAAAAA AAAAAAAA AAAA AAAAAAAA"
halign: "center"
pos_hint: {"center_y":.50}
\ No newline at end of file
<Paddy_Waste_Screen>:
name: "Paddy_Waste"
txt3:txt3
txt4:txt4
l1:l1
l2:l2
l3:l3
MDToolbar:
title: "PREDICT PADDY WASTE"
size_hint: 1,.08
elevation: 5
pos_hint: {"center_y": .95}
MDToolbar:
title: app.APP_NAME
size_hint: 1,.08
elevation: 5
font_size: 20
color: 0,100,0
pos_hint: {"center_y": .95}
MDToolbar:
size_hint: 1,.08
elevation: 5
canvas.before:
Color:
rgba: (1, 1, 1, 1)
Rectangle:
source:'assets//img//bk.jpg'
size: 500, 500
pos: self.pos
Image:
source: "assets//img//2022.png"
id: avatar_image
size_hint: 1, 1
pos_hint: {"center_x":0.5, "center_y":0.78}
MDIconButton:
icon: "home"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.50}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("login")
GridLayout:
cols: 2
padding : 30,30
spacing: 20, 20
row_default_height: '30dp'
MDTextField:
hint_text: "Enter Seeds Kg"
id: txt3
pos_hint: {"center_x":0.5, "center_y":0.50}
size_hint: .75,0.08
# mode: "rectangle"
MDTextField:
hint_text: "Enter Daily Water L"
id: txt4
pos_hint: {"center_x":0.5, "center_y":0.41}
size_hint: .75,0.08
# mode: "rectangle"
MDFillRoundFlatButton:
text: "PREDICT WASTE"
pos_hint: {"center_x": 0.5, "center_y":0.18}
size_hint: .7,0.05
on_release:
root.btnA()
MDLabel:
text: ""
halign: "center"
pos_hint: {"center_y":.26}
font_style: "Subtitle2"
id: l1
color: 223, 55, 19
background_color: (1.0, 0.0, 0.0, 1.0)
MDLabel:
text: ""
halign: "center"
pos_hint: {"center_y":.0}
font_style: "Subtitle2"
id: l2
color: 223, 55, 19
background_color: (1.0, 0.0, 0.0, 1.0)
MDLabel:
text: ""
halign: "center"
pos_hint: {"center_y":.0}
font_style: "Subtitle2"
id: l3
color: 223, 55, 19
background_color: (1.0, 0.0, 0.0, 1.0)
GridLayout:
cols: 1
padding: 38, 10
size_hint: 0.5, 0.5
pos_hint: {"center_x":0.25, "center_y":0.38}
Button:
id: btn
text: "-- Select Paddy Type--"
size_hint: None, None
pos_hint: {"center_x":0.5, "center_y":0.30}
height: 35
width:280
color: 0,0,0
background_color: (255,255,255)
on_parent: drop_content.dismiss()
on_release: drop_content.open(self)
DropDown:
id: drop_content
on_select: btn.text = f'{args[1]}' # see note below
Button:
id: selectbtn1
text: 'KeeriSamba'
size_hint: None, None
height: 35
width:280
color: 0,0,0
background_color: (255,255,255)
on_release: drop_content.select('KeeriSamba')
on_release:
root.selectbtn1()
Button:
id: selectbt2
text: 'Nadu'
size_hint: None, None
height: 35
width:280
color: 0,0,0
background_color: (255,255,255)
on_release: drop_content.select('Nadu')
on_release:
root.selectbtn2()
GridLayout:
cols: 1
padding: 38, 10
size_hint: 0.5, 0.5
pos_hint: {"center_x":0.25, "center_y":0.10}
Button:
id: btn2
text: "-- Select Chemicals Type --"
size_hint: None, None
pos_hint: {"center_x":0.5, "center_y":0.30}
height: 35
width:280
color: 0,0,0
background_color: (255,255,255)
on_parent: drop_content2.dismiss()
on_release: drop_content2.open(self)
DropDown:
id: drop_content2
on_select: btn2.text = f'{args[1]}' # see note below
Button:
id: selectbtn3
text: 'organic'
size_hint: None, None
height: 35
width:280
color: 0,0,0
background_color: (255,255,255)
on_release: drop_content2.select('organic')
on_release:
root.selectbtn3()
<homeList_Screen>:
name: "HomeList"
list_one:list_one
list_two:list_two
list_three:list_three
list_BMI:list_BMI
MDToolbar:
title: "FOOD RECOMMENDATION"
size_hint: 1,.08
elevation: 5
pos_hint: {"center_y": .95}
MDToolbar:
size_hint: 1,.08
elevation: 5
MDIconButton:
icon: "home"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.50}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("Diabetes2022")
MDIconButton:
icon: "menu"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.90}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("Instruction")
MDIconButton:
icon: "account"
text_color: "white"
theme_text_color: "Custom"
pos_hint: {"center_x": 0.1}
pos_hint: {"center_x": 0.1}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("login")
MDLabel:
text: "FOOD RECOMMENDATION"
halign: "center"
pos_hint: {"center_y":.88}
color: 255,255,178
MDList:
do_scroll_x: True
id: list_BMI
halign: "center"
pos_hint: {"center_y":.80}
MDLabel:
text: "BREAKFAST Foods Recommendation"
halign: "center"
pos_hint: {"center_y":.78}
MDList:
do_scroll_x: True
id: list_one
halign: "center"
pos_hint: {"center_y":.73}
MDLabel:
text: "LUNCH Foods Recommendation"
halign: "center"
pos_hint: {"center_y":.63}
MDList:
do_scroll_x: True
id: list_two
halign: "center"
pos_hint: {"center_y":.58}
MDLabel:
text: "DINNER Foods Recommendation"
halign: "center"
pos_hint: {"center_y":.48}
MDList:
do_scroll_x: True
id: list_three
halign: "center"
pos_hint: {"center_y":.43}
MDFillRoundFlatButton:
text: "BACK"
pos_hint: {"center_x": 0.5, "center_y":0.18}
size_hint: .7,0.05
on_release: app.screen_manager.change_screen("Food")
<HomeList_Screen>:
name: "HomeList"
list_one:list_one
MDToolbar:
size_hint: 1,.08
elevation: 5
pos_hint: {"center_y": .95}
right_action_items: [ ["arrow-left", lambda x:app.screen_manager.change_screen("home")]]
MDIconButton:
icon: "home-circle-outline"
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
pos_hint: {"center_x": 0.50}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("home")
MDIconButton:
icon: "send-circle-outline"
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
pos_hint: {"center_x": 0.88}
user_font_size: "35sp"
on_release: app.screen_manager.change_screen("login")
MDList:
do_scroll_x: True
id: list_one
<Login_Screen>:
name: "login"
txt1:txt1
txt2:txt2
l1:l1
l2:l2
MDToolbar:
title: app.APP_NAME
size_hint: 1,.08
elevation: 5
font_size: 20
color: 0,100,0
pos_hint: {"center_y": .95}
MDToolbar:
size_hint: 1,.08
elevation: 5
canvas.before:
Color:
rgba: (1, 1, 1, 1)
Rectangle:
source:'assets//img//bk.jpg'
size: 500, 500
pos: self.pos
Image:
source: "assets//img//2022.png"
id: avatar_image
size_hint: 1, 1
pos_hint: {"center_x":0.5, "center_y":0.78}
MDLabel:
text: "USER LOGIN"
halign: "center"
pos_hint: {"center_y":.55}
font_style: "Subtitle2"
font_size: 20
color: 0,100,0
MDTextField:
hint_text: "Username"
id: txt1
pos_hint: {"center_x": 0.5, "center_y": 0.46}
size_hint: .75,0.085
# mode: "rectangle"
MDTextField:
hint_text: "Password"
id: txt2
pos_hint: {"center_x":0.5, "center_y":0.38}
size_hint: .75,0.085
password: True
# mode: "rectangle"
MDLabel:
text: ""
halign: "center"
pos_hint: {"center_y":.30}
font_style: "Subtitle2"
id: l1
color: 1,0,1,1
MDLabel:
text: ""
halign: "center"
pos_hint: {"center_y":.35}
font_style: "Subtitle2"
id: l2
color: 1,0,1,1
MDFillRoundFlatButton:
text: "LOGIN"
pos_hint: {"center_x": 0.2, "center_y":0.24}
size_hint: .11,0.05
on_release:
root.LoginButton()
MDFillRoundFlatButton:
text: "Clear"
pos_hint: {"center_x": 0.8, "center_y":0.24}
size_hint: .11,0.05
on_release:
root.ClearButton()
<Root>:
\ No newline at end of file
<OneLineTextDialog>
orientation: "vertical"
spacing: "6dp"
size_hint_y: None
height: "60dp"
MDTextField:
id:dialog_text
# Enter text in textfiled
\ No newline at end of file
<Verification_Screen>:
name: "verification"
MDLabel:
text: app.APP_NAME
halign: "center"
pos_hint: {"center_y": .8}
font_style: "H3"
MDLabel:
text: "Account verification"
halign: "center"
pos_hint: {"center_y":.73}
font_style: "Subtitle2"
MDLabel:
text: "We've sent a verification code to your email."
halign: "center"
pos_hint: {"center_y":.67}
font_style: "Body2"
MDTextField:
hint_text: "Enter your verification Code"
pos_hint: {"center_x": 0.5, "center_y": 0.6}
size_hint: .75,0.08
max_text_length: 6
# mode: "rectangle"
MDRaisedButton:
text: "Submit"
pos_hint: {"center_x": 0.5, "center_y":0.52}
size_hint: .7,0.05
MDTextButton:
text: "Resend code"
pos_hint: {"center_x": 0.5, "center_y":0.45}
on_release: app.screen_manager.change_screen("verification")
MDLabel:
text: "Never share your verification code to anyone."
halign: "center"
pos_hint: {"center_y":.4}
font_style: "Caption"
MDLabel:
text: f"[font=Icons] {md_icons['copyright']}[/font] [font=Roboto]{app.COMPANY_NAME} [/font]"
markup: True
halign: "center"
pos_hint: {"center_y":0.05}
\ No newline at end of file
Temperature,Humidity,Rainfall_Forcasting,Water_level,Light,Filling_Time_Minutes
28,29,27,0.5,26,60
28,29,27,0.5,26,60
28,29,27,0.5,26,60
32,28,29,0.7,31,45
32,28,29,0.7,31,45
32,28,29,0.7,31,45
32,28,29,0.7,31,45
33,28,28,0.9,32,15
33,28,28,0.9,32,15
33,28,28,0.9,32,15
This diff is collapsed.
#--[Start platform specific code]
"""This code to detect it's Android or not
if it's not android than app window size change in android phone size"""
from kivy.utils import platform
if platform != 'android':
from kivy.config import Config
Config.set("graphics","width",360)
Config.set("graphics","height",740)
Config.set('graphics', 'borderless', 'True')
#--[End platform specific code]
#
#--[Start Soft_Keyboard code ]Config
"""code for android keyboard. when in android keyboard show textbox
automatic go to top of keyboard so user can see when he type msg"""
from kivy.core.window import Window
Window.keyboard_anim_args = {"d":.2,"t":"linear"}
Window.softinput_mode = "below_target"
#--[End Soft_Keyboard code ]
from ProjectFiles.uix.baseclass.login import Login_Screen
from ProjectFiles.uix.baseclass.Instruction import Instruction_Screen
from ProjectFiles.uix.baseclass.root import Root
from ProjectFiles.uix.baseclass.Paddy_Waste import Paddy_Waste_Screen
from ProjectFiles.uix.baseclass.homeList import HomeList_Screen
from ProjectFiles.uix.baseclass.verification import Verification_Screen
from main_imports import ImageLeftWidget, MDApp, TwoLineAvatarListItem
class HamsterApp(MDApp):
"""
Hamster App start from here this class is root of app.
in kivy (.kv) file when use app.method_name app is start from here
"""
def __init__(self, **kwargs):
super(HamsterApp, self).__init__(**kwargs)
self.APP_NAME = "SMART FARMING"
self.COMPANY_NAME = "2022"
def all_chats(self):
# self.change_screen("profile")
twolineW= TwoLineAvatarListItem(text=f"DIABETES IDENTIFICATION WITH ML",
secondary_text="@username",
on_touch_up=self.chat_room)
twolineW.add_widget(ImageLeftWidget(source="assets//img//hamster_icon.png"))
self.screen_manager.get_screen("login").ids.chat_tab.add_widget(twolineW)
def build(self):
self.theme_cls.primary_palette = "LightGreen"
self.theme_cls.primary_hue = "500"
self.theme_cls.accent_palette = "LightGreen"
self.theme_cls.accent_hue = "500"
self.theme_cls.theme_style = "Light"
self.screen_manager = Root()
self.screen_manager.add_widget(Login_Screen())
self.screen_manager.add_widget(Instruction_Screen())
self.screen_manager.add_widget(Paddy_Waste_Screen())
self.screen_manager.add_widget(HomeList_Screen())
self.screen_manager.add_widget(Verification_Screen())
return self.screen_manager
def on_start(self):
self.screen_manager.change_screen("Paddy_Waste")
if __name__ == "__main__":
HamsterApp().run()
"""
IMPORT all modules here that use in this app.
"""
#--[Start UI Imports]
"""All imports for UI here Kivy,KivyMD or etc that help in UI"""
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import ScreenManager
from kivymd.app import MDApp
from kivymd.uix.bottomsheet import MDGridBottomSheet
from kivymd.uix.button import MDFlatButton
from kivymd.uix.card import MDCard, MDSeparator
from kivymd.uix.dialog import MDDialog
from kivymd.uix.label import MDLabel
from kivymd.uix.list import ImageLeftWidget, TwoLineAvatarListItem
from kivymd.uix.screen import MDScreen
from kivymd.uix.tab import MDTabsBase
from kivymd.uix.textfield import MDTextField
from ProjectFiles.uix.baseclass.ui_class import OneLineTextDialog
#--[End UI Imports]
#--[Start Non UI Imports]
"""All imports that use in application """
#--[End Non UI Imports]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment