more plugin things
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "machine-learning-pack",
|
||||
"name": "Machine Learning Pack",
|
||||
"version": "0.1.0",
|
||||
"author": "Tyler de Zeeuw",
|
||||
"description": "Machine Learning on Processed fNIRS Data.",
|
||||
"min_app_version": "1.7.0",
|
||||
"platforms": ["win_x64"],
|
||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/machine-learning-pack-win-x64.zip"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-21
@@ -9,30 +9,10 @@
|
||||
"platforms": ["win_x64"],
|
||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/machine-learning-pack-win-x64.zip"
|
||||
},
|
||||
{
|
||||
"id": "theme-pack",
|
||||
"name": "Dark Theme Pack",
|
||||
"version": "1.0.0",
|
||||
"author": "Tyler de Zeeuw",
|
||||
"description": "Pure Python themes (cross-platform).",
|
||||
"min_app_version": "1.8.0",
|
||||
"platforms": ["darwin_arm64", "darwin_x64", "linux_x64"],
|
||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/theme-pack-multi.zip"
|
||||
},
|
||||
{
|
||||
"id": "test-plugin",
|
||||
"name": "Test Plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "A basic test plugin demonstrating menu registration and custom widgets.",
|
||||
"author": "Tyler de Zeeuw",
|
||||
"min_app_version": "1.8.0",
|
||||
"platforms": ["win_x64", "darwin_arm64", "darwin_x64", "linux_x64"],
|
||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/test-plugin.zip"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
"""
|
||||
Basic Test Plugin
|
||||
Creates a widget window and registers submenu items under the Plugins menu.
|
||||
"""
|
||||
|
||||
from PySide6.QtGui import QAction
|
||||
from PySide6.QtWidgets import QLabel, QMenu, QMessageBox, QPushButton, QVBoxLayout, QWidget
|
||||
|
||||
|
||||
class PluginWidget(QWidget):
|
||||
"""Custom widget UI owned by the plugin."""
|
||||
|
||||
def __init__(self, parent: QWidget | None = None) -> None:
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Test Plugin Window")
|
||||
self.resize(350, 200)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
label = QLabel("Hello from the Test Plugin!", self)
|
||||
btn_action = QPushButton("Click Me", self)
|
||||
btn_action.clicked.connect(self._on_button_clicked)
|
||||
|
||||
layout.addWidget(label)
|
||||
layout.addWidget(btn_action)
|
||||
|
||||
def _on_button_clicked(self) -> None:
|
||||
QMessageBox.information(self, "Plugin Interactive", "Button inside the plugin QWidget was clicked!")
|
||||
|
||||
|
||||
class Plugin:
|
||||
"""Plugin entry point contract loaded by the main application."""
|
||||
|
||||
def __init__(self, main_window: QWidget) -> None:
|
||||
self.main_window = main_window
|
||||
self.name = "Test Plugin"
|
||||
self.widget_instance: PluginWidget | None = None
|
||||
|
||||
def register_menu(self, plugin_menu: QMenu) -> None:
|
||||
"""
|
||||
Populates the plugin's dedicated submenu in the main menubar.
|
||||
Called by the main app after creating the submenu header.
|
||||
"""
|
||||
open_action = QAction("Open Tool Window", self.main_window)
|
||||
open_action.triggered.connect(self.show_widget)
|
||||
|
||||
about_action = QAction("About Test Plugin", self.main_window)
|
||||
about_action.triggered.connect(self.show_about)
|
||||
|
||||
plugin_menu.addAction(open_action)
|
||||
plugin_menu.addAction(about_action)
|
||||
|
||||
def show_widget(self) -> None:
|
||||
"""Instantiates and displays the plugin's QWidget window."""
|
||||
if self.widget_instance is None or not self.widget_instance.isVisible():
|
||||
self.widget_instance = PluginWidget()
|
||||
self.widget_instance.show()
|
||||
else:
|
||||
self.widget_instance.raise_()
|
||||
self.widget_instance.activateWindow()
|
||||
|
||||
def show_about(self) -> None:
|
||||
"""Secondary menu action example."""
|
||||
QMessageBox.about(
|
||||
self.main_window,
|
||||
"About Test Plugin",
|
||||
"This is a basic test plugin demonstrating submenu registration and custom QWidget window spawning.",
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"id": "test_plugin",
|
||||
"name": "Test Plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "A basic test plugin demonstrating menu registration and custom widgets.",
|
||||
"author": "Tyler de Zeeuw",
|
||||
"min_app_version": "1.7.0",
|
||||
"platforms": ["win_x64", "darwin_arm64", "darwin_x64", "linux_x64"],
|
||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/test-plugin.zip"
|
||||
}
|
||||
Reference in New Issue
Block a user