From 6198fac37ee57e285c2cbf348b49220f478e866c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Mar 2024 17:44:53 +1100 Subject: [PATCH] Cleanup: use UILayout.panel in extensions repo popover Replace workaround that's no longer needed since popovers now support collapsible sections. --- scripts/startup/bl_ui/space_userpref.py | 27 +++---------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index 54fd3e5d27c..a33892ace51 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -2044,28 +2044,6 @@ class USERPREF_PT_extensions_repos(Panel): # Show wider than most panels so the URL & directory aren't overly clipped. bl_ui_units_x = 16 - # NOTE: ideally `if panel := layout.panel("extensions_repo_advanced", default_closed=True):` - # would be used but it isn't supported here, use a kludge to achieve a similar UI. - _panel_layout_kludge_state = False - - @classmethod - def _panel_layout_kludge(cls, layout, *, text): - row = layout.row(align=True) - row.alignment = 'LEFT' - show_advanced = USERPREF_PT_extensions_repos._panel_layout_kludge_state - props = row.operator( - "wm.context_toggle", - text="Advanced", - icon='DOWNARROW_HLT' if show_advanced else 'RIGHTARROW', - emboss=False, - ) - props.module = "bl_ui.space_userpref" - props.data_path = "USERPREF_PT_extensions_repos._panel_layout_kludge_state" - - if show_advanced: - return layout.column() - return None - def draw(self, context): layout = self.layout layout.use_property_split = False @@ -2114,8 +2092,9 @@ class USERPREF_PT_extensions_repos(Panel): split.prop(active_repo, "remote_path", text="URL") split = row.split() - if layout_panel := self._panel_layout_kludge(layout, text="Advanced"): - + layout_header, layout_panel = layout.panel("advanced", default_closed=True) + layout_header.label(text="Advanced") + if layout_panel: layout_panel.prop(active_repo, "use_custom_directory") row = layout_panel.row()