mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-07-28 06:03:02 +02:00
feat: enable conditional loading of DeveloperView based on experimental features
This commit is contained in:
@@ -18,6 +18,7 @@ from bec_widgets.utils.screen_utils import (
|
||||
available_screen_geometry,
|
||||
main_app_size_for_screen,
|
||||
)
|
||||
from bec_widgets.widgets.containers.dock_area.profile_utils import is_experimental_features_enabled
|
||||
from bec_widgets.widgets.containers.main_window.main_window import BECMainWindow
|
||||
|
||||
|
||||
@@ -63,7 +64,7 @@ class BECMainApp(BECMainWindow):
|
||||
self.add_section("BEC Applications", "bec_apps")
|
||||
self.dock_area = DockAreaView(self)
|
||||
self.device_manager = DeviceManagerView(self)
|
||||
# self.developer_view = DeveloperView(self) #TODO temporary disable until the bugs with BECShell are resolved
|
||||
self.developer_view = None
|
||||
self.admin_view = AdminView(self)
|
||||
|
||||
self.add_view(icon="widgets", title="Dock Area", widget=self.dock_area, mini_text="Docks")
|
||||
@@ -73,14 +74,15 @@ class BECMainApp(BECMainWindow):
|
||||
widget=self.device_manager,
|
||||
mini_text="DM",
|
||||
)
|
||||
# TODO temporary disable until the bugs with BECShell are resolved
|
||||
# self.add_view(
|
||||
# icon="code_blocks",
|
||||
# title="IDE",
|
||||
# widget=self.developer_view,
|
||||
# mini_text="IDE",
|
||||
# exclusive=True,
|
||||
# )
|
||||
if is_experimental_features_enabled():
|
||||
self.developer_view = DeveloperView(self)
|
||||
self.add_view(
|
||||
icon="code_blocks",
|
||||
title="IDE",
|
||||
widget=self.developer_view,
|
||||
mini_text="IDE",
|
||||
exclusive=True,
|
||||
)
|
||||
self.add_view(
|
||||
icon="admin_panel_settings",
|
||||
title="Admin View",
|
||||
|
||||
@@ -5,6 +5,10 @@ from qtpy.QtWidgets import QWidget
|
||||
from bec_widgets.applications.main_app import BECMainApp
|
||||
from bec_widgets.applications.views.view import ViewBase
|
||||
from bec_widgets.utils.bec_widget import BECWidget
|
||||
from bec_widgets.widgets.containers.dock_area.profile_utils import (
|
||||
is_experimental_features_enabled,
|
||||
set_experimental_features_enabled,
|
||||
)
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
|
||||
@@ -136,6 +140,21 @@ def test_view_content_widget_is_hidden_from_namespace(app_with_spies):
|
||||
assert app.dock_area.content is app.dock_area.dock_area
|
||||
|
||||
|
||||
def test_developer_view_is_experimental_by_default(monkeypatch, tmp_path, qtbot, mocked_client):
|
||||
monkeypatch.setenv("BECWIDGETS_PROFILE_DIR", str(tmp_path))
|
||||
set_experimental_features_enabled(False)
|
||||
|
||||
app = BECMainApp(client=mocked_client, anim_duration=ANIM_TEST_DURATION, show_examples=False)
|
||||
qtbot.addWidget(app)
|
||||
app.show()
|
||||
qtbot.waitExposed(app)
|
||||
|
||||
assert is_experimental_features_enabled() is False
|
||||
assert (
|
||||
not hasattr(app, "developer_view") or app.sidebar.components.get("developer_view") is None
|
||||
)
|
||||
|
||||
|
||||
# def test_developer_plotting_area_parent_id_uses_view_namespace(app_with_spies): #TODO temp disabled due to disabled IDE view
|
||||
# app, _, _, _ = app_with_spies
|
||||
# plotting_area = app.developer_view.developer_widget.plotting_ads
|
||||
|
||||
Reference in New Issue
Block a user