diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..1cca7e2 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://serafimdev.com:6000/postgres + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/gadasin.iml b/.idea/gadasin.iml new file mode 100644 index 0000000..4d82f76 --- /dev/null +++ b/.idea/gadasin.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..db8786c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a4b7c04 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..30a4d95 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/UI/.gitignore b/UI/.gitignore new file mode 100644 index 0000000..14f79e2 --- /dev/null +++ b/UI/.gitignore @@ -0,0 +1,163 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# Flet +storage/ \ No newline at end of file diff --git a/UI/README.md b/UI/README.md new file mode 100644 index 0000000..925a1f6 --- /dev/null +++ b/UI/README.md @@ -0,0 +1,9 @@ +# Flet app + +A simple Flet app. + +To run the app: + +``` +flet run [app_directory] +``` \ No newline at end of file diff --git a/UI/pyproject.toml b/UI/pyproject.toml new file mode 100644 index 0000000..8a6be94 --- /dev/null +++ b/UI/pyproject.toml @@ -0,0 +1,29 @@ +[project] +name = "ui" +version = "0.1.0" +description = "" +readme = "README.md" +requires-python = ">=3.8" +dependencies = [ + "flet==0.25.2", + "psycopg2==2.9.10" +] + + +[tool.flet] +# org name in reverse domain name notation, e.g. "com.mycompany". +# Combined with project.name to build bundle ID for iOS and Android apps +org = "com.mycompany" + +# project display name that is used as an app title on Android and iOS home screens, +# shown in window titles and about app dialogs on desktop. +product = "ui" + +# company name to display in about app dialogs +company = "Flet" + +# copyright text to display in about app dialogs +copyright = "Copyright (C) 2024 by Flet" + +[tool.flet.app] +path = "src" \ No newline at end of file diff --git a/UI/src/assets/icon.png b/UI/src/assets/icon.png new file mode 100644 index 0000000..bebc6d5 Binary files /dev/null and b/UI/src/assets/icon.png differ diff --git a/UI/src/main.py b/UI/src/main.py new file mode 100644 index 0000000..dcb1f62 --- /dev/null +++ b/UI/src/main.py @@ -0,0 +1,23 @@ +import flet as ft + +from requests.board_games import get_sections + + +def main(page: ft.Page): + print("Rerender!") + + sections = get_sections() + + sections_buttons = [ft.Button(section) for section in sections] + + page.add( + ft.SafeArea( + ft.Column ( + [ft.Row(sections_buttons, alignment=ft.MainAxisAlignment.CENTER)], + alignment=ft.MainAxisAlignment.START + ) + ) + ) + + +ft.app(main) diff --git a/UI/src/requests/__init__.py b/UI/src/requests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/UI/src/requests/board_games.py b/UI/src/requests/board_games.py new file mode 100644 index 0000000..12f07fe --- /dev/null +++ b/UI/src/requests/board_games.py @@ -0,0 +1,9 @@ +from requests.connection import get_cursor + + +def get_sections(): + cursor = get_cursor() + + cursor.execute("select name from sections") + + return [elem[0] for elem in cursor.fetchall()] diff --git a/UI/src/requests/connection.py b/UI/src/requests/connection.py new file mode 100644 index 0000000..601367d --- /dev/null +++ b/UI/src/requests/connection.py @@ -0,0 +1,11 @@ +import psycopg2 + +connection = None + +def get_cursor(): + global connection + + if connection is None: + connection = psycopg2.connect(database="postgres", user="postgres", password="not_admin", host="serafimdev.com", port=6000) + + return connection.cursor()