remove stale code
This commit is contained in:
@@ -11,7 +11,7 @@ from typing import Callable
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from backend.runtime_paths import demo_dir, input_dir, output_dir
|
from backend.runtime_paths import demo_dir
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Scalar payload helpers (from display.py)
|
# Scalar payload helpers (from display.py)
|
||||||
@@ -522,8 +522,6 @@ def _rasterize_mask(width, height, strokes, default_pen_size):
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
DEMO_DIR = demo_dir()
|
DEMO_DIR = demo_dir()
|
||||||
INPUT_DIR = input_dir()
|
|
||||||
OUTPUT_DIR = output_dir()
|
|
||||||
|
|
||||||
_MAX_SAVE_FIELDS = 8
|
_MAX_SAVE_FIELDS = 8
|
||||||
|
|
||||||
@@ -532,21 +530,8 @@ from backend.importers import all_extensions, get_importer
|
|||||||
_PATH_COMPATIBLE_EXTENSIONS = all_extensions()
|
_PATH_COMPATIBLE_EXTENSIONS = all_extensions()
|
||||||
|
|
||||||
|
|
||||||
def _resolve_path(filepath: str):
|
|
||||||
path = Path(filepath)
|
|
||||||
if path.is_absolute():
|
|
||||||
return path
|
|
||||||
candidate = INPUT_DIR / filepath
|
|
||||||
if candidate.exists():
|
|
||||||
return candidate
|
|
||||||
candidate = DEMO_DIR / filepath
|
|
||||||
if candidate.exists():
|
|
||||||
return candidate
|
|
||||||
return INPUT_DIR / filepath
|
|
||||||
|
|
||||||
|
|
||||||
def list_channels(filepath: str) -> list[dict]:
|
def list_channels(filepath: str) -> list[dict]:
|
||||||
path = _resolve_path(filepath)
|
path = Path(filepath)
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
return [{"name": "field", "type": "DATA_FIELD"}]
|
return [{"name": "field", "type": "DATA_FIELD"}]
|
||||||
|
|
||||||
@@ -564,7 +549,7 @@ def list_channels(filepath: str) -> list[dict]:
|
|||||||
|
|
||||||
|
|
||||||
def list_folder_paths(folderpath: str) -> list[dict]:
|
def list_folder_paths(folderpath: str) -> list[dict]:
|
||||||
path = _resolve_path(folderpath)
|
path = Path(folderpath)
|
||||||
if not path.exists() or not path.is_dir():
|
if not path.exists() or not path.is_dir():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
|||||||
from backend.node_registry import register_node
|
from backend.node_registry import register_node
|
||||||
from backend.execution_context import emit_warning
|
from backend.execution_context import emit_warning
|
||||||
from backend.data_types import COLORMAPS, DataField, resolve_colormap_input
|
from backend.data_types import COLORMAPS, DataField, resolve_colormap_input
|
||||||
from backend.nodes.helpers import _resolve_path
|
|
||||||
from backend.importers import get_importer, calibrated_extensions
|
from backend.importers import get_importer, calibrated_extensions
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ class Image:
|
|||||||
selected_path = str(path).strip() if path is not None else str(filename).strip()
|
selected_path = str(path).strip() if path is not None else str(filename).strip()
|
||||||
if not selected_path:
|
if not selected_path:
|
||||||
raise ValueError("No file selected — use Browse to pick a file.")
|
raise ValueError("No file selected — use Browse to pick a file.")
|
||||||
path_obj = _resolve_path(selected_path)
|
path_obj = Path(selected_path)
|
||||||
if not path_obj.exists():
|
if not path_obj.exists():
|
||||||
raise FileNotFoundError(f"File not found: {path_obj}")
|
raise FileNotFoundError(f"File not found: {path_obj}")
|
||||||
if path_obj.is_dir():
|
if path_obj.is_dir():
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from backend.node_registry import register_node
|
from backend.node_registry import register_node
|
||||||
from backend.data_types import DataTable
|
from backend.data_types import DataTable
|
||||||
from backend.nodes.helpers import _resolve_path, _import_ibw_loader
|
from backend.nodes.helpers import _import_ibw_loader
|
||||||
|
|
||||||
|
|
||||||
def _parse_ibw_note(note_bytes: bytes) -> list[dict]:
|
def _parse_ibw_note(note_bytes: bytes) -> list[dict]:
|
||||||
@@ -57,7 +59,7 @@ class Note:
|
|||||||
selected = str(path).strip() if path is not None else str(filename).strip()
|
selected = str(path).strip() if path is not None else str(filename).strip()
|
||||||
if not selected:
|
if not selected:
|
||||||
raise ValueError("No file selected.")
|
raise ValueError("No file selected.")
|
||||||
path_obj = _resolve_path(selected)
|
path_obj = Path(selected)
|
||||||
if not path_obj.exists():
|
if not path_obj.exists():
|
||||||
raise FileNotFoundError(f"File not found: {path_obj}")
|
raise FileNotFoundError(f"File not found: {path_obj}")
|
||||||
if path_obj.suffix.lower() != ".ibw":
|
if path_obj.suffix.lower() != ".ibw":
|
||||||
|
|||||||
@@ -54,14 +54,6 @@ def demo_dir() -> Path:
|
|||||||
return project_root() / "demo"
|
return project_root() / "demo"
|
||||||
|
|
||||||
|
|
||||||
def input_dir() -> Path:
|
|
||||||
return app_data_dir() / "input"
|
|
||||||
|
|
||||||
|
|
||||||
def output_dir() -> Path:
|
|
||||||
return app_data_dir() / "output"
|
|
||||||
|
|
||||||
|
|
||||||
def plugins_dir() -> Path:
|
def plugins_dir() -> Path:
|
||||||
return app_data_dir() / "plugins"
|
return app_data_dir() / "plugins"
|
||||||
|
|
||||||
@@ -84,7 +76,5 @@ def plugins_enabled(*, native: bool) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def ensure_runtime_dirs(*, with_plugins: bool = False) -> None:
|
def ensure_runtime_dirs(*, with_plugins: bool = False) -> None:
|
||||||
input_dir().mkdir(parents=True, exist_ok=True)
|
|
||||||
output_dir().mkdir(parents=True, exist_ok=True)
|
|
||||||
if with_plugins:
|
if with_plugins:
|
||||||
plugins_dir().mkdir(parents=True, exist_ok=True)
|
plugins_dir().mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 MiB After Width: | Height: | Size: 11 MiB |
Reference in New Issue
Block a user