1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-05-05 06:16:32 +02:00

wip TODO for fixing, implement after import refactoring

This commit is contained in:
2026-04-30 11:18:08 +02:00
parent 86181c8b37
commit 943853b6de
2 changed files with 9 additions and 15 deletions
@@ -400,12 +400,10 @@ class BECDockArea(DockAreaWidget):
_build_menu("menu_utils", "Add Utils ", util_actions)
# Build plugin widget menu (only shown when plugin widgets are available)
try:
try: # TODO move this check to bec_plugin_helper.ser_widget_plugin method to fix globally
plugin_widgets_dict = get_all_plugin_widgets().as_dict()
except (ImportError, AttributeError, RuntimeError):
logger.warning(
"Failed to discover plugin widgets for toolbar menu.", exc_info=True
)
logger.warning("Failed to discover plugin widgets for toolbar menu.", exc_info=True)
plugin_widgets_dict = {}
plugin_actions: dict[str, tuple[str, str, str]] = {
widget_name: (
@@ -417,6 +415,9 @@ class BECDockArea(DockAreaWidget):
}
if plugin_actions:
_build_menu("menu_plugins", "Add Plugins ", plugin_actions)
logger.success(
"Plugin widgets added to toolbar menu: " + ", ".join(plugin_actions.keys())
)
# Create flat toolbar bundles for each widget type
def _build_flat_bundles(category: str, mapping: dict[str, tuple[str, str, str]]):
@@ -1129,18 +1130,10 @@ class BECDockArea(DockAreaWidget):
if mode_key == "user":
bundles = ["spacer_bundle", "workspace", "dock_actions"]
elif mode_key == "creator":
bundles = [
"menu_plots",
"menu_devices",
"menu_utils",
]
bundles = ["menu_plots", "menu_devices", "menu_utils"]
if "menu_plugins" in getattr(self, "_ACTION_MAPPINGS", {}):
bundles.append("menu_plugins")
bundles += [
"spacer_bundle",
"workspace",
"dock_actions",
]
bundles += ["spacer_bundle", "workspace", "dock_actions"]
elif mode_key == "plot":
bundles = ["flat_plots", "spacer_bundle", "workspace", "dock_actions"]
elif mode_key == "device":
+2 -1
View File
@@ -47,9 +47,10 @@ from .client_mocks import mocked_client
@pytest.fixture
def fake_plugin_widget_cls():
"""Return a fake plugin widget class for use in toolbar plugin menu tests."""
from bec_widgets.utils.bec_widget import BECWidget
from qtpy.QtWidgets import QWidget as _QWidget
from bec_widgets.utils.bec_widget import BECWidget
class FakePluginWidget(BECWidget, _QWidget):
ICON_NAME = "star"
PLUGIN = True