more plugin things
This commit is contained in:
@@ -9,6 +9,7 @@ License: GPL-3.0
|
||||
# Built-in imports
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Optional, Any
|
||||
|
||||
# External library imports
|
||||
@@ -502,12 +503,43 @@ class Plugin:
|
||||
self.widget_instance.activateWindow()
|
||||
|
||||
def show_about(self) -> None:
|
||||
"""Displays plugin information."""
|
||||
"""Displays plugin information dynamically from plugin.json if available."""
|
||||
# Fallback default values
|
||||
title = "ROI Channel Builder"
|
||||
version = "Unknown"
|
||||
author = "Unknown"
|
||||
description = (
|
||||
"This plugin loads SNIRF binary files using h5py, extracts source-detector "
|
||||
"channel pairs, and exports custom ROI channel group JSON files."
|
||||
)
|
||||
|
||||
# Look for plugin.json in the same directory as this file
|
||||
json_path = Path(__file__).resolve().parent / "plugin.json"
|
||||
|
||||
if json_path.is_file():
|
||||
try:
|
||||
with open(json_path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
if isinstance(data, dict):
|
||||
title = data.get("name", title)
|
||||
version = data.get("version", version)
|
||||
author = data.get("author", author)
|
||||
description = data.get("description", description)
|
||||
except Exception:
|
||||
# Silently catch file read/parse errors to prevent crashing
|
||||
pass
|
||||
|
||||
# Build formatted display message
|
||||
message = (
|
||||
f"<b>{title}</b><br>"
|
||||
f"<b>Version:</b> {version} | <b>Author:</b> {author}<br><br>"
|
||||
f"{description}"
|
||||
)
|
||||
|
||||
QMessageBox.about(
|
||||
self.main_window,
|
||||
"About ROI Channel Builder",
|
||||
"This plugin loads SNIRF binary files using h5py, extracts source-detector channel pairs, "
|
||||
"and exports custom ROI channel group JSON files.",
|
||||
f"About {title}",
|
||||
message,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "roi-builder-pack",
|
||||
"name": "ROI Channel Builder Pack",
|
||||
"version": "1.0.0",
|
||||
"version": "0.1.0",
|
||||
"description": "Extracts channel labels from SNIRF files and generates custom ROI grouping JSON files.",
|
||||
"author": "Tyler de Zeeuw",
|
||||
"min_app_version": "1.7.0",
|
||||
|
||||
Reference in New Issue
Block a user