From 5e5ea4f112a1c9ece24c637ad439b707dd4a9445 Mon Sep 17 00:00:00 2001 From: megamichi Date: Fri, 21 Jun 2024 15:18:21 +0200 Subject: [PATCH] v1.0 --- README.md | 18 ++++++++++++------ assets/icon.png | Bin 5693 -> 5889 bytes main.py | 14 ++++++-------- requirements.txt | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e609991..1598e46 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ -# Nahrung Analysierung +# Nahrungstracker -An example of a minimal Flet app. - -To run the app: +Tracke deine verbrauchte kcal pro Tag! +![Preview](preview.jpg) +## Build ``` -flet run [app_directory] -``` \ No newline at end of file +flet build apk +``` +_use flet 0.21.2!_ + +## Todo +[x] History +[ ] Eigene Tags für Essen +[ ] Settings und Tag Tab \ No newline at end of file diff --git a/assets/icon.png b/assets/icon.png index 6c1142e0cebb6dace3281dd6bb3c3d37f237aef5..4e91dfe8cbda69078918715a7f55f0fedc880b6a 100644 GIT binary patch delta 1980 zcmZ`(X;hPE7XCgGHlYwm*c78|ffiGe5FkOo1SwlsrVNS!tO*2ywv;7+Y?3qsh=noA zhae0~0R>tSRLn4Ohl-NRAOWRI~6=<-gDl2p8Mn8^W6J9?xCu3JjanaexgP=U*n_qpxQsUF zvJc0N{U!OAS^rVltw2+z72V3s8f`zz?-YcGxMWR+C(&i4diGGI#c4#o*zw@V`E!1M zPc0<6UeVArM+IN~hVWHq%&^bZGj+;r z0k?aJHWkz@1U*lu1%F3PQOdXrH^VOB@XxtcIY`P({$yqWP<{Bj&pGAukzGg2feyCJ zH}17PmJ zr()s6#1U`=CoCREh{O`3abzrs#lmBq$V@zuaz-nBee(yLAS1cbv86aah|xbGk%d^8YkDuUe< zKCO684{fH&_bO_U=!*~PLl84P5Pgmp>5i$*n1! zq*>G`WvgpI2t$;)>4*SBjlQw}))HM!6v(lH{`Fx^JO&q*1^{vjKQdnM?P51)L(u_L8^kPruU?edBp;vz@cg&xsM8I*0|N z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~)J(5L1^1U1}_v+X<#aQBNedwo0QE zmVN#Yy`Y3Ku16h1T84@5cpCfAZ^+wnB4xXpokBL1*_9HbCgKwMs$lqwdDuz2*$&n1 zpSnSNM}9wu0}y@gIf5y-uQUzfSiqru`wk))*FkD{MyI_YVfYdIt3G;oL`i;-96KA(EZ$7`nnh>?(ULZvElWoG%CAp4;DVtC< zcpkkH>1=uU?d&HvC6(06Tdd@3?EwU1^Mp3<00d)lKLnA Cfi?L6 diff --git a/main.py b/main.py index 4a5015c..15128ac 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ from random import choice def get_time(): t = datetime.now() return [t.year, t.month, t.day, t.hour, t.minute, t.second] + def random_emoji(): return choice("🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🍍🥝🥭🥑🍅🍆🥒🥕🥬🌽🥔🍠🌰🥜🍯🥐🍞🥖🥨🥯🧀🥚🍳🥓🧄🧅🥞🧇🍤🍗🍖🍕🌭🍔🍟🥙🌮🌯🥗🥘🍝🍜🦪🍲🍥🍣🍱🍛🍚🧆🍙🍘🍢🍡🍧🍨🍦🍰🎂🍮🍭🍬🍫🍿🍩🍪🥮🧁🥛🧈🍼☕🍵🍶🍺🍻🥂🍷🥃🍸🍹🍾🧉🧃🧊🧂🥄🍴") @@ -16,8 +17,7 @@ class Nahrung(ft.UserControl): self.kjtext = ft.Text("0", size=25) self.kcaltext = ft.Text("0", size=30) - self.kcaltextfield = ft.TextField(keyboard_type="NUMBER",expand=True,autofocus=True,on_change=self.reseterrorinkcaltextfield,on_submit=self.editkcal) - + self.kcaltextfield = ft.TextField(keyboard_type="NUMBER", expand=True, autofocus=True, on_change=self.reseterrorinkcaltextfield, on_submit=self.editkcal) # Initialize history list self.historylist = [] @@ -63,7 +63,8 @@ class Nahrung(ft.UserControl): self.controls = [self.main_container, self.history_container] self.load_todays_kcal() - def reseterrorinkcaltextfield(self): + + def reseterrorinkcaltextfield(self, e=None): self.kcaltextfield.error_text = "" def build(self): @@ -73,21 +74,18 @@ class Nahrung(ft.UserControl): def editkcal(self, e): try: emoji = random_emoji() - print(emoji,ord(emoji)) new_kcal = int(self.kcaltext.value) + int(self.kcaltextfield.value) self.kcaltext.value = str(new_kcal) self.kjtext.value = str(round(new_kcal * 4.184, 0)) self.history.append([emoji, self.kcaltextfield.value, get_time()]) - file_handler.save(self.settings, self.history) # Save the updated kcal value + file_handler.save(self.settings, self.history) self.update_history() self.reseterrorinkcaltextfield() self.kcaltextfield.value = "" - self.update() # Update the controls to reflect changes + self.update() except ValueError: - print("error") self.kcaltextfield.error_text = "\\(*O*)/ nicht verschreiben!!" self.update() - #pass # Handle invalid input gracefully def create_appbar(self): return ft.AppBar( diff --git a/requirements.txt b/requirements.txt index d54c7ec..7a82fda 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -flet==0.22.* \ No newline at end of file +flet==0.21.* \ No newline at end of file