mirror of
https://github.com/Cian-H/Melter.git
synced 2025-12-22 14:11:59 +00:00
New main branch for flutter/flet rewrite
This commit is contained in:
3
.envrc
Normal file
3
.envrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="
|
||||||
|
|
||||||
|
use devenv
|
||||||
134
.gitignore
vendored
134
.gitignore
vendored
@@ -1,129 +1,9 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
# Devenv
|
||||||
__pycache__/
|
.devenv*
|
||||||
*.py[cod]
|
devenv.local.nix
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
# direnv
|
||||||
*.so
|
.direnv
|
||||||
|
|
||||||
# Distribution / packaging
|
# pre-commit
|
||||||
.Python
|
.pre-commit-config.yaml
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
pip-wheel-metadata/
|
|
||||||
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/
|
|
||||||
|
|
||||||
# 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
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
.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
|
|
||||||
|
|
||||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
||||||
__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/
|
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
# Melter
|
Experimental MTPy GUI written in flutter/flet
|
||||||
Generates meltpool tomographs and layer maps from SLM printing pyrometry data
|
|
||||||
|
|||||||
152
devenv.lock
Normal file
152
devenv.lock
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"devenv": {
|
||||||
|
"locked": {
|
||||||
|
"dir": "src/modules",
|
||||||
|
"lastModified": 1730745597,
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "devenv",
|
||||||
|
"rev": "7cfc04e544e67adf803c3634b53a911c670e046e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"dir": "src/modules",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "devenv",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716977621,
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "devenv-nixpkgs",
|
||||||
|
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"ref": "rolling",
|
||||||
|
"repo": "devenv-nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-python": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730716553,
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "nixpkgs-python",
|
||||||
|
"rev": "8fcdb8ec34a1c2bae3f5326873a41b310e948ccc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "nixpkgs-python",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730741070,
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730797577,
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "1864030ed24a2b8b4e4d386a5eeaf0c5369e50a9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"devenv": "devenv",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-python": "nixpkgs-python",
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
50
devenv.nix
Normal file
50
devenv.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
pkgs-unstable = import inputs.nixpkgs-unstable {system = pkgs.stdenv.system;};
|
||||||
|
in {
|
||||||
|
packages = with pkgs; [
|
||||||
|
at-spi2-core
|
||||||
|
cairo
|
||||||
|
fontconfig
|
||||||
|
git
|
||||||
|
gdk-pixbuf
|
||||||
|
glib
|
||||||
|
gnome.zenity
|
||||||
|
gtk3
|
||||||
|
gst_all_1.gstreamer
|
||||||
|
gst_all_1.gst-plugins-base
|
||||||
|
harfbuzz
|
||||||
|
libepoxy
|
||||||
|
pango
|
||||||
|
];
|
||||||
|
|
||||||
|
env.NIX_LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [
|
||||||
|
at-spi2-core
|
||||||
|
cairo
|
||||||
|
fontconfig
|
||||||
|
gdk-pixbuf
|
||||||
|
glib
|
||||||
|
gtk3
|
||||||
|
gst_all_1.gstreamer
|
||||||
|
gst_all_1.gst-plugins-base
|
||||||
|
harfbuzz
|
||||||
|
libepoxy
|
||||||
|
pango
|
||||||
|
]);
|
||||||
|
env.NIX_LD = lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker";
|
||||||
|
|
||||||
|
languages = {
|
||||||
|
python = {
|
||||||
|
version = "3.12";
|
||||||
|
enable = true;
|
||||||
|
poetry = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
11
devenv.yaml
Normal file
11
devenv.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
|
||||||
|
inputs:
|
||||||
|
nixpkgs:
|
||||||
|
url: github:cachix/devenv-nixpkgs/rolling
|
||||||
|
nixpkgs-python:
|
||||||
|
url: github:cachix/nixpkgs-python
|
||||||
|
inputs:
|
||||||
|
nixpkgs:
|
||||||
|
follows: nixpkgs
|
||||||
|
|
||||||
|
impure: true
|
||||||
0
melter/__init__.py
Normal file
0
melter/__init__.py
Normal file
13
melter/__main__.py
Normal file
13
melter/__main__.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import flet as ft
|
||||||
|
from loguru import logger
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from melter.gui import main
|
||||||
|
|
||||||
|
|
||||||
|
logger.remove()
|
||||||
|
logger.add(sys.stderr, level="ERROR")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
ft.app(main)
|
||||||
BIN
melter/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
melter/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
melter/__pycache__/gui.cpython-312.pyc
Normal file
BIN
melter/__pycache__/gui.cpython-312.pyc
Normal file
Binary file not shown.
97
melter/gui.py
Normal file
97
melter/gui.py
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import flet as ft
|
||||||
|
from functools import lru_cache
|
||||||
|
from mtpy.meltpool_tomography import MeltpoolTomography
|
||||||
|
import panel as pn
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
URL = "localhost"
|
||||||
|
PORT = 1234
|
||||||
|
PBAR_WIDTH = 256
|
||||||
|
|
||||||
|
|
||||||
|
def main(page: ft.Page):
|
||||||
|
page.title = "Minimal GUI Test"
|
||||||
|
|
||||||
|
page.window_height = 100.0
|
||||||
|
page.window_width = 512.0
|
||||||
|
page.max_height = 100.0
|
||||||
|
page.max_width = 512.0
|
||||||
|
page.max_window_height = 100.0
|
||||||
|
page.max_window_width = 512.0
|
||||||
|
page.update()
|
||||||
|
placeholder = ft.Row(
|
||||||
|
[ft.ProgressRing()],
|
||||||
|
alignment=ft.MainAxisAlignment.CENTER,
|
||||||
|
height=100,
|
||||||
|
width=512,
|
||||||
|
)
|
||||||
|
page.add(placeholder)
|
||||||
|
page.window_height = 100.0
|
||||||
|
page.window_width = 512.0
|
||||||
|
sleep(0.1)
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
# webview = ft.WebView(f"http://{URL}:{PORT}")
|
||||||
|
pbar = ft.ProgressBar(width=PBAR_WIDTH)
|
||||||
|
pbar.value = 0
|
||||||
|
|
||||||
|
def pbar_wrapper(iterator, length=None, *args, **kwargs):
|
||||||
|
l = length if length is not None else len(iterator)
|
||||||
|
increment = PBAR_WIDTH // l
|
||||||
|
pbar.value = 0
|
||||||
|
for i in iterator:
|
||||||
|
page.update()
|
||||||
|
yield i
|
||||||
|
pbar.value += increment
|
||||||
|
page.update()
|
||||||
|
pbar.value = PBAR_WIDTH
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
@lru_cache(maxsize=1)
|
||||||
|
def get_engine():
|
||||||
|
mt = MeltpoolTomography()
|
||||||
|
mt.loader.progressbar = pbar_wrapper
|
||||||
|
return mt
|
||||||
|
|
||||||
|
mt = get_engine()
|
||||||
|
|
||||||
|
def open_filepicker(_):
|
||||||
|
return file_picker.get_directory_path()
|
||||||
|
|
||||||
|
def on_dialog_result(e: ft.FilePickerResultEvent):
|
||||||
|
mt.read_layers(e.path)
|
||||||
|
plot = mt.scatter2d()
|
||||||
|
scatter_pane = pn.pane.HoloViews(plot)
|
||||||
|
pn.serve(scatter_pane, PORT, URL, show=True)
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
|
||||||
|
file_picker = ft.FilePicker(on_result=on_dialog_result)
|
||||||
|
page.overlay.append(file_picker)
|
||||||
|
file_picker_button = ft.ElevatedButton(
|
||||||
|
"Choose files...",
|
||||||
|
on_click=open_filepicker,
|
||||||
|
)
|
||||||
|
|
||||||
|
page.remove(placeholder)
|
||||||
|
page.add(
|
||||||
|
ft.Column(
|
||||||
|
[
|
||||||
|
ft.Row(
|
||||||
|
[
|
||||||
|
file_picker_button,
|
||||||
|
pbar,
|
||||||
|
],
|
||||||
|
alignment=ft.MainAxisAlignment.CENTER,
|
||||||
|
),
|
||||||
|
# webview,
|
||||||
|
],
|
||||||
|
alignment=ft.MainAxisAlignment.CENTER,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
sleep(0.1)
|
||||||
|
|
||||||
|
page.window_height = 100.0
|
||||||
|
page.window_width = 512.0
|
||||||
|
page.update()
|
||||||
3122
poetry.lock
generated
Normal file
3122
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
pyproject.toml
Normal file
32
pyproject.toml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "melter"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "A GUI wrapper around MTPy"
|
||||||
|
authors = ["Cian Hughes <chughes000@gmail.com>"]
|
||||||
|
readme = "README.md"
|
||||||
|
license = "MIT"
|
||||||
|
packages = [{ include = "melter", from = "." }]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = ">=3.11,<3.13"
|
||||||
|
mtpy = {git = "https://github.com/Cian-H/MTPy"}
|
||||||
|
flet = "0.19.0" # "^0.24.1"
|
||||||
|
dask-expr = "^1.1.16"
|
||||||
|
panel = "^1.5.3"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 100
|
||||||
|
target-version = "py312"
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = "double"
|
||||||
|
indent-style = "space"
|
||||||
|
line-ending = "auto"
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
force-sort-within-sections = true
|
||||||
|
lines-after-imports = -1
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
Reference in New Issue
Block a user