commit 03dae671b540847a0efe6bc18c96274a03ec51a0 Author: Максим Юрьевич Кузин <21200660@live.preco.ru> Date: Tue May 13 15:08:46 2025 +0500 start diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b0c602a --- /dev/null +++ b/.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 +*.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/README.md b/README.md new file mode 100644 index 0000000..d8f7d26 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# Test app + +## Run the app + +### uv + +Run as a desktop app: + +``` +uv run flet run +``` + +Run as a web app: + +``` +uv run flet run --web +``` + +### Poetry + +Install dependencies from `pyproject.toml`: + +``` +poetry install +``` + +Run as a desktop app: + +``` +poetry run flet run +``` + +Run as a web app: + +``` +poetry run flet run --web +``` + +For more details on running the app, refer to the [Getting Started Guide](https://flet.dev/docs/getting-started/). + +## Build the app + +### Android + +``` +flet build apk -v +``` + +For more details on building and signing `.apk` or `.aab`, refer to the [Android Packaging Guide](https://flet.dev/docs/publish/android/). + +### iOS + +``` +flet build ipa -v +``` + +For more details on building and signing `.ipa`, refer to the [iOS Packaging Guide](https://flet.dev/docs/publish/ios/). + +### macOS + +``` +flet build macos -v +``` + +For more details on building macOS package, refer to the [macOS Packaging Guide](https://flet.dev/docs/publish/macos/). + +### Linux + +``` +flet build linux -v +``` + +For more details on building Linux package, refer to the [Linux Packaging Guide](https://flet.dev/docs/publish/linux/). + +### Windows + +``` +flet build windows -v +``` + +For more details on building Windows package, refer to the [Windows Packaging Guide](https://flet.dev/docs/publish/windows/). \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..51ea6fb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,41 @@ +[project] +name = "test" +version = "0.1.0" +description = "" +readme = "README.md" +requires-python = ">=3.9" +authors = [ + { name = "Flet developer", email = "you@example.com" } +] +dependencies = [ + "flet==0.28.2" +] + +[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 = "test" + +# company name to display in about app dialogs +company = "Flet" + +# copyright text to display in about app dialogs +copyright = "Copyright (C) 2025 by Flet" + +[tool.flet.app] +path = "src" + +[tool.uv] +dev-dependencies = [ + "flet[all]==0.28.2", +] + +[tool.poetry] +package-mode = false + +[tool.poetry.group.dev.dependencies] +flet = {extras = ["all"], version = "0.28.2"} \ No newline at end of file diff --git a/src/assets/icon.png b/src/assets/icon.png new file mode 100644 index 0000000..bebc6d5 Binary files /dev/null and b/src/assets/icon.png differ diff --git a/src/assets/splash_android.png b/src/assets/splash_android.png new file mode 100644 index 0000000..8772f3f Binary files /dev/null and b/src/assets/splash_android.png differ diff --git a/src/assets/test.jpg b/src/assets/test.jpg new file mode 100644 index 0000000..dccca8f Binary files /dev/null and b/src/assets/test.jpg differ diff --git a/src/config.py b/src/config.py new file mode 100644 index 0000000..7cce05b --- /dev/null +++ b/src/config.py @@ -0,0 +1,14 @@ +import pyodbc + +url = "ILABSQLW19S1" +port = "49172" + +def new_mssql_connection(MSSQL_PORT:str,MSSQL_HOST:str, ) -> pyodbc.Connection: + connection = pyodbc.connect( + f"DRIVER={{ODBC Driver 17 for SQL Server}};SERVER={MSSQL_HOST}," + f"{MSSQL_PORT};DATABASE=test_may;Trusted_Connection=yes;", + autocommit=True, + ) + return connection + +new_mssql_connection(MSSQL_HOST=url, MSSQL_PORT=port) diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..6199738 --- /dev/null +++ b/src/main.py @@ -0,0 +1,17 @@ +import flet as ft +from views import return_views + +def main(page: ft.Page): + def load_route(route): + page.views.clear() + page.views.append(return_views(page=page)[page.route]) + print(page.route) + page.update() + + page.on_route_change = load_route + page.go("/") + + + + +ft.app(main) diff --git a/src/views.py b/src/views.py new file mode 100644 index 0000000..3bb0a06 --- /dev/null +++ b/src/views.py @@ -0,0 +1,8 @@ +import flet as ft + +def return_views(page:ft.Page): + return{ + "/":ft.View( + bgcolor="#000000" + ) + } \ No newline at end of file