From 83876a09e4ed12e2a31f3e7b51333cc8263e3522 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Mon, 18 Dec 2023 14:54:55 +0000 Subject: [PATCH] Partial (so far unsuccessful) implementation of installer --- pyproject.toml | 10 ++++++++-- scripts/build.py | 2 ++ src/main.py | 3 ++- src/node_deployer_gui/__init__.py | 5 ++++- src/node_deployer_gui/gui.py | 7 +++---- 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 scripts/build.py diff --git a/pyproject.toml b/pyproject.toml index 33a30f3..201063e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,8 @@ name = "i-form-server-node-deployer" version = "0.1.0" description = "A tool for automatically deploying nodes in a cluster server for research environments." -urls={github = "https://github.com/Cian-H/I-Form_Server_Node_Deployer"} +repository = "https://github.com/Cian-H/I-Form_Server_Node_Deployer" +documentation = "https://i-form-node-deployer.netlify.app" authors = ["Cian Hughes "] readme = "README.md" license = "MIT" @@ -12,7 +13,7 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.12" +python = ">=3.12,<3.13" typer = {extras = ["all"], version = "^0.9.0"} selenium = "^4.14.0" mechanicalsoup = "^1.3.0" @@ -42,10 +43,15 @@ flet = "^0.11.0" psutil = "^5.9.6" types-psutil = "^5.9.5.17" + +[tool.poetry.group.build.dependencies] +pyinstaller = "^6.2.0" + [tool.poetry.scripts] node_deployer = "node_deployer.__main__:main" debug_node_deployer = "node_deployer.__main__:debug" build_docs = "scripts.docs:main" +build = "scripts.build:main" [build-system] requires = ["poetry-core"] diff --git a/scripts/build.py b/scripts/build.py new file mode 100644 index 0000000..4f023ea --- /dev/null +++ b/scripts/build.py @@ -0,0 +1,2 @@ +def main(): + pass \ No newline at end of file diff --git a/src/main.py b/src/main.py index 2752c49..69307fd 100644 --- a/src/main.py +++ b/src/main.py @@ -5,6 +5,7 @@ from typing import Dict, Any from node_deployer.config import config from node_deployer import app as _cli_app from node_deployer_gui import main as gui_main +from node_deployer_gui import assets_dir cmd_params: Dict[Any, Any] = config.typer @@ -18,7 +19,7 @@ app = typer.Typer( @app.command(name="gui", help="The GUI interface for the node deployer", **cmd_params) @app.callback(invoke_without_command=True) def gui_app(): - ft.app(target=gui_main) + ft.app(target=gui_main, assets_dir=assets_dir) @app.command(name="cli", help="The CLI interface for the node deployer", **cmd_params) diff --git a/src/node_deployer_gui/__init__.py b/src/node_deployer_gui/__init__.py index a6e7ff3..086c722 100644 --- a/src/node_deployer_gui/__init__.py +++ b/src/node_deployer_gui/__init__.py @@ -1,3 +1,6 @@ +from pathlib import Path from .gui import main -__all__ = ["main"] \ No newline at end of file +assets_dir = str(Path(__file__).parent.absolute() / "assets") + +__all__ = ["main", "assets_dir"] diff --git a/src/node_deployer_gui/gui.py b/src/node_deployer_gui/gui.py index fe2d8d8..6089aa9 100644 --- a/src/node_deployer_gui/gui.py +++ b/src/node_deployer_gui/gui.py @@ -1,6 +1,5 @@ from collections import defaultdict from functools import wraps -from pathlib import Path from typing import Callable, DefaultDict, Optional, Tuple import flet as ft @@ -40,9 +39,9 @@ def main(page: ft.Page) -> None: # Lets start with the easiest part: a logo in the top left if page.platform_brightness == ft.ThemeMode.DARK: - logo = ft.Image(str(Path(__file__).parent / "assets/logo_dark.png"), width=210) + logo = ft.Image(src="logo_dark.png", width=210) else: - logo = ft.Image(str(Path(__file__).parent / "assets/logo_light.png"), width=210) + logo = ft.Image(src="logo_light.png", width=210) logo_container = ft.Container( content=logo, @@ -313,4 +312,4 @@ def main(page: ft.Page) -> None: page.on_keyboard_event = on_key_press - page.update() # This shouldn't be necessary, but ensures the UI is rendered correctly + page.update() # This shouldn't be necessary, but ensures the UI is rendered correctly \ No newline at end of file