Skip to content

Commit

Permalink
fixed #1472
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Feb 6, 2022
1 parent 91ab0db commit e20d781
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/pyRevitDevTools.extension/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,7 @@ def do_something(self, sender, args):
forms.alert("Voila!!!")


forms.register_dockable_panel(DockableExample)
if not forms.is_registered_dockable_panel(DockableExample):
forms.register_dockable_panel(DockableExample)
else:
print("Skipped registering dockable pane. Already exists.")
11 changes: 11 additions & 0 deletions pyrevitlib/pyrevit/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,17 @@ def SetupDockablePane(self, data):
data.VisibleByDefault = self._default_visible


def is_registered_dockable_panel(panel_type):
"""Check if dockable panel is already registered
Args:
panel_type (forms.WPFPanel): dockable panel type
"""
panel_uuid = coreutils.Guid.Parse(panel_type.panel_id)
dockable_panel_id = UI.DockablePaneId(panel_uuid)
return UI.DockablePane.PaneExists(dockable_panel_id)


def register_dockable_panel(panel_type, default_visible=True):
"""Register dockable panel
Expand Down

0 comments on commit e20d781

Please sign in to comment.