Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register_dockable_panel() to return panel instance #1323

Merged
merged 1 commit into from Sep 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyrevitlib/pyrevit/forms/__init__.py
Expand Up @@ -459,12 +459,13 @@ class _WPFPanelProvider(UI.IDockablePaneProvider):
def __init__(self, panel_type, default_visible=True):
self._panel_type = panel_type
self._default_visible = default_visible
self.panel = self._panel_type()

def SetupDockablePane(self, data):
"""Setup forms.WPFPanel set on this instance"""
# TODO: need to implement panel data
# https://apidocs.co/apps/revit/2021.1/98157ec2-ab26-6ab7-2933-d1b4160ba2b8.htm
data.FrameworkElement = self._panel_type()
data.FrameworkElement = self.panel
data.VisibleByDefault = self._default_visible


Expand All @@ -483,12 +484,15 @@ def register_dockable_panel(panel_type, default_visible=True):

panel_uuid = coreutils.Guid.Parse(panel_type.panel_id)
dockable_panel_id = UI.DockablePaneId(panel_uuid)
panel_provider = _WPFPanelProvider(panel_type, default_visible)
HOST_APP.uiapp.RegisterDockablePane(
dockable_panel_id,
panel_type.panel_title,
_WPFPanelProvider(panel_type, default_visible)
panel_provider
)

return panel_provider.panel


def open_dockable_panel(panel_type_or_id):
"""Open previously registered dockable panel
Expand Down