test
This commit is contained in:
Binary file not shown.
+12
-2
@@ -7,7 +7,7 @@
|
|||||||
"description": "Machine Learning on Processed fNIRS Data.",
|
"description": "Machine Learning on Processed fNIRS Data.",
|
||||||
"platforms": ["win_x64"],
|
"platforms": ["win_x64"],
|
||||||
"min_app_version": "1.7.0",
|
"min_app_version": "1.7.0",
|
||||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/machine-learning-pack/machine_learning_pack_win_x64.zip"
|
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/machine_learning_pack_win_x64.zip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "theme-pack",
|
"id": "theme-pack",
|
||||||
@@ -17,6 +17,16 @@
|
|||||||
"description": "Pure Python themes (cross-platform).",
|
"description": "Pure Python themes (cross-platform).",
|
||||||
"min_app_version": "1.7.0",
|
"min_app_version": "1.7.0",
|
||||||
"platforms": ["darwin_arm64", "darwin_x64", "linux_x64"],
|
"platforms": ["darwin_arm64", "darwin_x64", "linux_x64"],
|
||||||
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/theme-pack/theme_pack_multi.zip"
|
"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",
|
||||||
|
"author": "Tyler de Zeeuw",
|
||||||
|
"description": "Test Plugin.",
|
||||||
|
"min_app_version": "1.7.0",
|
||||||
|
"platforms": ["win_x64"],
|
||||||
|
"download_url": "https://git.research.dezeeuw.ca/tyler/flares-plugins/raw/branch/main/packages/test-plugin.zip"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
"""
|
||||||
|
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.",
|
||||||
|
)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"id": "test_plugin",
|
||||||
|
"name": "Test Plugin",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A basic test plugin demonstrating menu registration and custom widgets.",
|
||||||
|
"author": "Your Name",
|
||||||
|
"min_app_version": "1.0.0",
|
||||||
|
"platforms": ["win_x64", "darwin_arm64", "darwin_x64", "linux_x64"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user