📦 feat(app.py, requirements.txt): add new app.py file and requirements.txt for Kivy app
👍 app.py: Implement Kivy app with word pair generation and liking functionality 📝 requirements.txt: Add dependencies required for the Kivy app
This commit is contained in:
commit
0299b9efa4
161
app.py
Normal file
161
app.py
Normal file
@ -0,0 +1,161 @@
|
||||
from kivy.lang import Builder
|
||||
from kivy.properties import StringProperty, ListProperty
|
||||
from kivymd.app import MDApp
|
||||
from kivymd.uix.label import MDLabel
|
||||
from kivymd.uix.navigationbar import MDNavigationBar, MDNavigationItem
|
||||
from kivymd.uix.navigationbar.navigationbar import MDBoxLayout
|
||||
from kivymd.uix.screen import MDScreen
|
||||
from wonderwords import RandomWord
|
||||
from kivymd.uix.card import MDCard
|
||||
from kivy.event import EventDispatcher
|
||||
from kivy.uix.scrollview import ScrollView
|
||||
|
||||
KV = '''
|
||||
<BaseMDNavigationItem>
|
||||
|
||||
MDNavigationItemIcon:
|
||||
icon: root.icon
|
||||
|
||||
MDNavigationItemLabel:
|
||||
text: root.text
|
||||
|
||||
<MainScreen>
|
||||
name: "main_screen"
|
||||
MDBoxLayout:
|
||||
orientation: "vertical"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
||||
MDCard:
|
||||
padding: "4dp"
|
||||
size_hint: None, None
|
||||
size: "240dp", "100dp"
|
||||
|
||||
MDRelativeLayout:
|
||||
|
||||
MDLabel:
|
||||
text : root.currentWordPair
|
||||
adaptive_size: True
|
||||
color: "black"
|
||||
pos: "12dp", "12dp"
|
||||
bold: True
|
||||
|
||||
MDBoxLayout:
|
||||
|
||||
MDButton:
|
||||
style: "elevated"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
on_press: root.new_word_pair(*args)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "plus"
|
||||
|
||||
MDButtonText:
|
||||
text: "Suivant"
|
||||
|
||||
MDButton:
|
||||
style: "elevated"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
on_press: root.like_word_pair(*args)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "plus"
|
||||
|
||||
MDButtonText:
|
||||
text: "Like"
|
||||
|
||||
<FavoriteScreen>
|
||||
ScrollView:
|
||||
MDBoxLayout:
|
||||
id: favorite_layout
|
||||
orientation: "vertical"
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "vertical"
|
||||
md_bg_color: self.theme_cls.backgroundColor
|
||||
|
||||
MDScreenManager:
|
||||
id: screen_manager
|
||||
|
||||
MainScreen:
|
||||
name: "Word Pair"
|
||||
image_size: "1024"
|
||||
|
||||
FavoriteScreen:
|
||||
name: "Favorites"
|
||||
image_size: "800"
|
||||
|
||||
MDNavigationBar:
|
||||
on_switch_tabs: app.on_switch_tabs(*args)
|
||||
|
||||
BaseMDNavigationItem
|
||||
icon: "gmail"
|
||||
text: "Word Pair"
|
||||
active: True
|
||||
|
||||
BaseMDNavigationItem
|
||||
icon: "twitter"
|
||||
text: "Favorites"
|
||||
'''
|
||||
|
||||
r = RandomWord()
|
||||
|
||||
class WordList():
|
||||
words = []
|
||||
|
||||
class BaseMDNavigationItem(MDNavigationItem):
|
||||
icon = StringProperty()
|
||||
text = StringProperty()
|
||||
|
||||
class LikedEventDispatcher(EventDispatcher):
|
||||
def __init__(self, **kwargs):
|
||||
self.register_event_type('on_like')
|
||||
super(LikedEventDispatcher, self).__init__(**kwargs)
|
||||
|
||||
def on_like(self, *args):
|
||||
print("a word pair has been liked", args)
|
||||
|
||||
class MainScreen(MDScreen):
|
||||
currentWordPair = StringProperty("TidalWave")
|
||||
|
||||
def new_word_pair(self,instance):
|
||||
print(MDApp.get_running_app().liked)
|
||||
self.currentWordPair = r.word().capitalize() + r.word().capitalize()
|
||||
|
||||
def like_word_pair(self,instance):
|
||||
MDApp.get_running_app().liked.append(self.currentWordPair)
|
||||
layout = self.manager.get_screen("Favorites").ids.favorite_layout
|
||||
layout.clear_widgets()
|
||||
for word in MDApp.get_running_app().liked:
|
||||
print(word)
|
||||
card = MDCard()
|
||||
label = MDLabel(
|
||||
text=word,
|
||||
color="black",
|
||||
)
|
||||
card.add_widget(label)
|
||||
layout.add_widget(card)
|
||||
|
||||
class FavoriteScreen(MDScreen):
|
||||
image_size = StringProperty()
|
||||
|
||||
class Example(MDApp):
|
||||
|
||||
liked = ListProperty([])
|
||||
|
||||
def add_to_liked(self):
|
||||
self.liked.append()
|
||||
pass
|
||||
|
||||
def on_switch_tabs(
|
||||
self,
|
||||
bar: MDNavigationBar,
|
||||
item: MDNavigationItem,
|
||||
item_icon: str,
|
||||
item_text: str,
|
||||
):
|
||||
self.root.ids.screen_manager.current = item_text
|
||||
|
||||
def build(self):
|
||||
return Builder.load_string(KV)
|
||||
|
||||
Example().run()
|
395
requirements.txt
Normal file
395
requirements.txt
Normal file
@ -0,0 +1,395 @@
|
||||
absolutely-proprietary==1.0.0
|
||||
aiohttp==3.9.3
|
||||
aiosignal==1.3.1
|
||||
altgraph==0.17.3
|
||||
annotated-types==0.6.0
|
||||
anyascii==0.3.2
|
||||
anyio==4.3.0
|
||||
appdirs==1.4.4
|
||||
arandr==0.1.11
|
||||
argcomplete==3.1.1
|
||||
argon2-cffi==23.1.0
|
||||
argon2-cffi-bindings==21.2.0
|
||||
arrow==1.3.0
|
||||
asttokens==2.4.1
|
||||
async-lru==2.0.4
|
||||
async-timeout==4.0.3
|
||||
asyncio-dgram==1.2.0
|
||||
attrs==23.2.0
|
||||
auto-cpufreq==1
|
||||
auto-py-to-exe==2.36.0
|
||||
autobahn==23.6.2
|
||||
autocommand==2.2.2
|
||||
Automat==22.10.0
|
||||
avalon_framework==1.8.2
|
||||
Babel==2.14.0
|
||||
beautifulsoup4==4.12.3
|
||||
bidict==0.23.1
|
||||
binaryornot==0.4.4
|
||||
bleach==6.1.0
|
||||
blinker==1.6.3
|
||||
borgbackup==1.2.8
|
||||
bottle==0.12.25
|
||||
bottle-websocket==0.2.9
|
||||
Brotli==1.1.0
|
||||
bt-dualboot==1.0.1
|
||||
btrfs==13
|
||||
btrfsutil==6.8
|
||||
build==1.2.1
|
||||
CacheControl==0.14.0
|
||||
cached-property==1.5.2
|
||||
cachy==0.3.0
|
||||
cairocffi==1.6.1
|
||||
CairoSVG==2.7.1
|
||||
cattrs==23.2.3
|
||||
certifi==2024.2.2
|
||||
cffi==1.16.0
|
||||
chardet==5.2.0
|
||||
charset-normalizer==3.3.2
|
||||
cleo==2.1.0
|
||||
click==8.1.7
|
||||
clickable-ut==8.0.1
|
||||
cloudscraper==1.2.71
|
||||
colorama==0.4.6
|
||||
coloredlogs==15.0.1
|
||||
comm==0.2.2
|
||||
constantly==23.10.0
|
||||
construct==2.10.70
|
||||
contourpy==1.1.0
|
||||
cookiecutter==2.6.0
|
||||
coverage==7.4.1
|
||||
crashtest==0.4.1
|
||||
cryptography==42.0.5
|
||||
cssselect==1.2.0
|
||||
cssselect2==0.7.0
|
||||
cssutils==2.9.0
|
||||
cycler==0.11.0
|
||||
dbus-python==1.3.2
|
||||
debugpy==1.8.1
|
||||
decorator==5.1.1
|
||||
defusedxml==0.7.1
|
||||
DisplayCAL==3.9.12
|
||||
distlib==0.3.8
|
||||
distro==1.9.0
|
||||
dnspython==2.5.0
|
||||
docopt==0.6.2
|
||||
docstring-to-markdown==0.15
|
||||
docutils==0.20.1
|
||||
dulwich==0.21.7
|
||||
dunamai==1.18.0
|
||||
Eel==0.16.0
|
||||
et-xmlfile==1.1.0
|
||||
evdev==1.7.0
|
||||
eventlet==0.35.1
|
||||
exceptiongroup==1.2.0
|
||||
executing==2.0.0
|
||||
fastjsonschema==2.19.1
|
||||
filelock==3.13.3
|
||||
Flask==2.3.3
|
||||
Flask-Cors==4.0.0
|
||||
Flask-SocketIO==5.3.6
|
||||
fonttools==4.40.0
|
||||
fqdn==1.5.1
|
||||
freetype-py==2.4.0
|
||||
frozenlist==1.4.1
|
||||
fsspec==2023.9.2
|
||||
gallery_dl==1.26.8
|
||||
gbinder-python==1.1.2
|
||||
gevent==22.10.2
|
||||
gevent-websocket==0.10.1
|
||||
googletrans-py==4.0.0
|
||||
greenlet==3.0.3
|
||||
guiscrcpy==2023.1.1
|
||||
h11==0.14.0
|
||||
h2==4.1.0
|
||||
hkdf==0.0.3
|
||||
hpack==4.0.0
|
||||
hsluv==5.0.3
|
||||
html5lib==1.1
|
||||
httpcore==1.0.2
|
||||
httpx==0.26.0
|
||||
humanfriendly==10.0
|
||||
humanize==4.9.0
|
||||
hyperframe==6.0.1
|
||||
hyperlink==21.0.0
|
||||
hypothesis==6.100.0
|
||||
idna==3.6
|
||||
ifaddr==0.2.0
|
||||
importlib_metadata==5.1.0
|
||||
incremental==22.10.0
|
||||
inflect==7.2.0
|
||||
iniconfig==2.0.0
|
||||
InquirerPy==0.3.4
|
||||
installer==0.7.0
|
||||
ipykernel==6.29.4
|
||||
ipython==8.22.2
|
||||
ipython-genutils==0.2.0
|
||||
isoduration==20.11.0
|
||||
iterable-io==1.0.0
|
||||
itsdangerous==2.1.2
|
||||
jaraco.classes==3.3.1
|
||||
jaraco.context==4.3.0
|
||||
jaraco.functools==4.0.0
|
||||
jaraco.text==3.12.0
|
||||
jedi==0.19.1
|
||||
jedi-language-server==0.41.3
|
||||
jeepney==0.8.0
|
||||
Jinja2==3.1.3
|
||||
joblib==1.3.2
|
||||
Js2Py==0.72
|
||||
json5==0.9.24
|
||||
jsonpointer==2.4
|
||||
jsonschema==4.21.1
|
||||
jsonschema-specifications==2023.12.1
|
||||
jupyter-console==6.6.3
|
||||
jupyter-events==0.10.0
|
||||
jupyter-lsp==2.2.5
|
||||
jupyter_client==8.6.1
|
||||
jupyter_core==5.7.2
|
||||
jupyter_server==2.13.0
|
||||
jupyter_server_terminals==0.5.3
|
||||
jupyterlab==4.1.6
|
||||
jupyterlab_pygments==0.3.0
|
||||
jupyterlab_server==2.26.0
|
||||
keyring==25.0.0
|
||||
KindleComicConverter==5.6.5
|
||||
kiwisolver==1.4.4
|
||||
lark==1.1.9
|
||||
libfdt==1.7.0
|
||||
libvirt-python==10.2.0
|
||||
lit==17.0.6.dev0
|
||||
lockfile==0.12.2
|
||||
lsplug==4
|
||||
lsprotocol==2023.0.1
|
||||
lxml==5.1.0
|
||||
magic-wormhole==0.14.0
|
||||
Mako==1.3.2
|
||||
mariadb==1.1.10
|
||||
Markdown==3.6
|
||||
markdown-it-py==3.0.0
|
||||
MarkupSafe==2.1.5
|
||||
material-color-utilities-python==0.1.5
|
||||
matplotlib==3.7.1
|
||||
matplotlib-inline==0.1.6
|
||||
mdurl==0.1.2
|
||||
meson==1.4.0
|
||||
mistune==3.0.2
|
||||
more-itertools==10.2.0
|
||||
mouse==0.7.1
|
||||
MouseInfo==0.1.3
|
||||
mozjpeg-lossless-optimization==1.1.3
|
||||
msgpack==1.0.5
|
||||
multidict==6.0.5
|
||||
natsort==8.4.0
|
||||
nbclassic==1.0.0
|
||||
nbclient==0.10.0
|
||||
nbconvert==7.16.3
|
||||
nbformat==5.10.4
|
||||
nest_asyncio==1.6.0
|
||||
netaddr==0.8.0
|
||||
netifaces==0.11.0
|
||||
netsnmp-python==1.0a1
|
||||
nftables==0.1
|
||||
noiseprotocol==0.3.1
|
||||
normcap==0.5.4
|
||||
nose==1.3.7
|
||||
notebook==7.1.2
|
||||
notebook_shim==0.2.4
|
||||
npyscreen==4.10.5
|
||||
numpy==1.24.2
|
||||
openai==1.16.2
|
||||
openpyxl==3.1.2
|
||||
ordered-set==4.1.0
|
||||
outcome==1.3.0.post0
|
||||
overrides==7.7.0
|
||||
packaging==23.2
|
||||
pandas==1.5.3
|
||||
pandocfilters==1.5.1
|
||||
parso==0.8.4
|
||||
patool==2.2.0
|
||||
patsy==0.5.4
|
||||
pexpect==4.9.0
|
||||
pfzy==0.3.4
|
||||
pickleshare==0.7.5
|
||||
pillow==10.2.0
|
||||
pipreqs==0.4.13
|
||||
pipx==1.5.0
|
||||
pkginfo==1.9.6
|
||||
platformdirs==4.2.0
|
||||
pluggy==1.4.0
|
||||
ply==3.11
|
||||
poetry==1.8.2
|
||||
poetry-core==1.9.0
|
||||
poetry-dynamic-versioning==1.2.0
|
||||
poetry-plugin-export==1.5.0
|
||||
pooch==1.8.1
|
||||
prometheus_client==0.20.0
|
||||
prompt-toolkit==3.0.43
|
||||
protontricks==1.11.1
|
||||
psutil==5.9.8
|
||||
ptyprocess==0.7.0
|
||||
pure-eval==0.2.2
|
||||
pwquality==1.4.5
|
||||
py-cord==0.0.0
|
||||
pyaml==23.12.0
|
||||
pyasn1==0.5.0
|
||||
pyasn1_modules==0.3.0
|
||||
PyAutoGUI==0.9.54
|
||||
pybind11==2.12.0
|
||||
pycairo==1.26.0
|
||||
pyclip==0.7.0
|
||||
pycparser==2.22
|
||||
pycryptodomex==3.12.0
|
||||
pydantic==2.6.4
|
||||
pydantic_core==2.16.3
|
||||
pyfuse3==3.3.0
|
||||
pygls==1.3.1
|
||||
Pygments==2.17.2
|
||||
PyGObject==3.48.1
|
||||
pyinotify==0.9.6
|
||||
pyinstaller==5.12.0
|
||||
pyinstaller-hooks-contrib==2023.3
|
||||
pyjsparser==2.7.1
|
||||
pykeepass==4.0.7
|
||||
pymongo==4.6.1
|
||||
PyMsgBox==1.0.9
|
||||
PyNaCl==1.4.0
|
||||
PyOpenGL==3.1.6
|
||||
pyOpenSSL==24.0.0
|
||||
pyotp==2.9.0
|
||||
pyparsing==3.1.0
|
||||
pyperclip==1.8.2
|
||||
pypng==0.20231004.0
|
||||
pyproject_hooks==1.0.0
|
||||
PyQt5==5.15.9
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.12.1
|
||||
PyQtWebEngine==5.15.6
|
||||
pyrsistent==0.19.3
|
||||
PyScreeze==0.1.30
|
||||
pyserial==3.5
|
||||
PySide2==5.15.13
|
||||
PySide6==6.6.2
|
||||
PySocks==1.7.1
|
||||
pyte==0.8.2
|
||||
pytesseract==0.3.13
|
||||
pytest==8.1.1
|
||||
python-dateutil==2.9.0
|
||||
python-engineio==4.8.2
|
||||
python-json-logger==2.0.7
|
||||
python-magic==0.4.27
|
||||
python-slugify==8.0.4
|
||||
python-socketio==5.8.0
|
||||
python-xlib==0.33
|
||||
pytweening==1.2.0
|
||||
pytz==2024.1
|
||||
PyYAML==6.0
|
||||
pyzfs==2.2.99
|
||||
pyzmq==25.1.2
|
||||
qrcode==7.4.2
|
||||
QtPy==2.4.1
|
||||
ranger-fm==1.9.3
|
||||
rapidfuzz==3.6.2
|
||||
raven==6.10.0
|
||||
redis==5.0.1
|
||||
referencing==0.33.0
|
||||
regex==2023.12.25
|
||||
reportlab==4.1.0
|
||||
requests==2.31.0
|
||||
requests-futures==1.0.1
|
||||
requests-toolbelt==1.0.0
|
||||
rfc3339-validator==0.1.4
|
||||
rfc3986-validator==0.1.1
|
||||
rich==13.7.1
|
||||
rich-cli @ file:///home/djalim/.cache/yay/python-rich-cli-git/src/python-rich-cli/dist/rich_cli-1.8.0-py3-none-any.whl#sha256=aa8a908a3ad288d1eeb9de7373387c0d726e77b2302ef71d48b94064a37483ae
|
||||
rich-rst==1.1.7
|
||||
rpds-py==0.17.1
|
||||
ruamel.yaml==0.18.6
|
||||
ruamel.yaml.clib==0.2.8
|
||||
s-tui==1.1.6
|
||||
scikit-learn==1.4.1.post1
|
||||
scipy==1.13.0
|
||||
scour==0.38.2
|
||||
screenkey==1.5
|
||||
SecretStorage==3.3.3
|
||||
Send2Trash==1.8.2
|
||||
service-identity==23.1.0
|
||||
setproctitle==1.3.3
|
||||
shellingham==1.5.4
|
||||
shiboken2==5.15.13
|
||||
shiboken6==6.6.2
|
||||
shiboken6-generator==6.6.2
|
||||
shtab==1.6.5
|
||||
six==1.16.0
|
||||
smbus==1.1
|
||||
sniffio==1.3.1
|
||||
sortedcontainers==2.4.0
|
||||
soupsieve==2.5
|
||||
spake2==0.8
|
||||
SQLAlchemy==2.1.0b1.dev0
|
||||
srt==3.5.3
|
||||
stack-data==0.6.3
|
||||
statsmodels==0.14.1
|
||||
stem==1.8.3
|
||||
stopit==1.1.2
|
||||
svglib==1.5.1
|
||||
TBB==0.2
|
||||
termcolor==2.4.0
|
||||
terminado==0.18.1
|
||||
text-unidecode==1.3
|
||||
textual==0.56.3
|
||||
thefuck==3.32
|
||||
threadpoolctl==3.4.0
|
||||
tinycss2==1.2.1
|
||||
tldr==3.2.0
|
||||
toml==0.10.2
|
||||
tomli==2.0.1
|
||||
tomli_w==1.0.0
|
||||
tomlkit==0.12.4
|
||||
tornado==6.3.2
|
||||
torrequest==0.1.0
|
||||
tqdm==4.66.2
|
||||
traitlets==5.14.2
|
||||
tree-sitter==0.21.0
|
||||
tree-sitter-languages==1.10.2
|
||||
trio==0.25.0
|
||||
trove-classifiers==2024.3.29
|
||||
Twisted==24.3.0
|
||||
txaio==23.1.1
|
||||
txtorcon==23.11.0
|
||||
typeguard==4.2.1
|
||||
types-python-dateutil==2.9.0.20240316
|
||||
typing_extensions==4.10.0
|
||||
uc-micro-py==1.0.3
|
||||
ueberzug==18.2.1
|
||||
uri-template==1.3.0
|
||||
urllib3==1.26.18
|
||||
urwid==2.6.10
|
||||
userpath==1.9.2
|
||||
validate-pyproject==0.13.post1.dev0+gb752273.d20230520
|
||||
validators==0.20.0
|
||||
vdf==3.4
|
||||
virtualenv==20.25.0
|
||||
vispy==0.12.2
|
||||
wcwidth==0.2.13
|
||||
webcolors==1.13
|
||||
webencodings==0.5.1
|
||||
websocket-client==1.7.0
|
||||
websockets==12.0
|
||||
Werkzeug==2.3.8
|
||||
wg_tool==6.6.0
|
||||
whichcraft==0.6.1
|
||||
wsaccel==0.6.6
|
||||
wxPython==4.2.1
|
||||
xcffib==1.4.0
|
||||
Yapsy==1.12.2
|
||||
yarg==0.1.9
|
||||
yarl==1.9.4
|
||||
yt-dlp==2024.4.9
|
||||
zeroconf==0.63.0
|
||||
zipp==3.17.0
|
||||
zipstream-ng==1.7.1
|
||||
zope.event==5.0
|
||||
zope.interface==6.2
|
||||
zstandard==0.22.0
|
||||
zxcvbn==4.4.28
|
Loading…
Reference in New Issue
Block a user