UI: tweaks to extension & addon items
- Use line separator over box instead of separate boxes. - Format web-links with a label, then the button instead of positioning the buttons side-by-side. Changes by Brecht with minor edits (see !123420). Co-authored-by: Brecht Van Lommel <brecht@blender.org>
This commit is contained in:
parent
72ef03d5a1
commit
38e25d7838
@ -195,7 +195,7 @@ def addon_draw_item_expanded(
|
|||||||
|
|
||||||
if item_description:
|
if item_description:
|
||||||
col_a.label(
|
col_a.label(
|
||||||
text="{:s}.".format(item_description),
|
text=" {:s}.".format(item_description),
|
||||||
translate=False,
|
translate=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -209,42 +209,40 @@ def addon_draw_item_expanded(
|
|||||||
rowsub.operator("preferences.addon_remove", text="Uninstall").module = mod.__name__
|
rowsub.operator("preferences.addon_remove", text="Uninstall").module = mod.__name__
|
||||||
del rowsub
|
del rowsub
|
||||||
|
|
||||||
if item_doc_url or item_tracker_url:
|
layout.separator(type='LINE')
|
||||||
sub = layout.split(factor=0.5)
|
|
||||||
if item_doc_url:
|
|
||||||
sub.operator(
|
|
||||||
"wm.url_open", text="Website", icon='HELP',
|
|
||||||
).url = item_doc_url
|
|
||||||
else:
|
|
||||||
sub.separator()
|
|
||||||
|
|
||||||
# Only add "Report a Bug" button if tracker_url is set
|
sub = layout.column()
|
||||||
# or the add-on is bundled (use official tracker then).
|
|
||||||
if item_tracker_url:
|
|
||||||
sub.operator(
|
|
||||||
"wm.url_open", text="Report a Bug", icon='URL',
|
|
||||||
).url = item_tracker_url
|
|
||||||
elif addon_type == ADDON_TYPE_LEGACY_CORE:
|
|
||||||
addon_info = (
|
|
||||||
"Name: {:s} {:s}\n"
|
|
||||||
"Author: {:s}\n"
|
|
||||||
).format(item_name, item_version, item_maintainer)
|
|
||||||
props = sub.operator(
|
|
||||||
"wm.url_open_preset", text="Report a Bug", icon='URL',
|
|
||||||
)
|
|
||||||
props.type = 'BUG_ADDON'
|
|
||||||
props.id = addon_info
|
|
||||||
else:
|
|
||||||
sub.separator()
|
|
||||||
|
|
||||||
sub = layout.box()
|
|
||||||
sub.active = is_enabled
|
sub.active = is_enabled
|
||||||
split = sub.split(factor=0.125)
|
split = sub.split(factor=0.15)
|
||||||
col_a = split.column()
|
col_a = split.column()
|
||||||
col_b = split.column()
|
col_b = split.column()
|
||||||
|
|
||||||
col_a.alignment = 'RIGHT'
|
col_a.alignment = 'RIGHT'
|
||||||
|
|
||||||
|
if item_doc_url:
|
||||||
|
col_a.label(text="Website")
|
||||||
|
col_b.split(factor=0.5).operator(
|
||||||
|
"wm.url_open", text=domain_extract_from_url(item_doc_url), icon='HELP',
|
||||||
|
).url = item_doc_url
|
||||||
|
# Only add "Report a Bug" button if tracker_url is set
|
||||||
|
# or the add-on is bundled (use official tracker then).
|
||||||
|
if item_tracker_url or (addon_type == ADDON_TYPE_LEGACY_CORE):
|
||||||
|
col_a.label(text="Feedback")
|
||||||
|
if item_tracker_url:
|
||||||
|
col_b.split(factor=0.5).operator(
|
||||||
|
"wm.url_open", text="Report a Bug", icon='URL',
|
||||||
|
).url = item_tracker_url
|
||||||
|
else:
|
||||||
|
addon_info = (
|
||||||
|
"Name: {:s} {:s}\n"
|
||||||
|
"Author: {:s}\n"
|
||||||
|
).format(item_name, item_version, item_maintainer)
|
||||||
|
props = col_b.split(factor=0.5).operator(
|
||||||
|
"wm.url_open_preset", text="Report a Bug", icon='URL',
|
||||||
|
)
|
||||||
|
props.type = 'BUG_ADDON'
|
||||||
|
props.id = addon_info
|
||||||
|
|
||||||
if USE_SHOW_ADDON_TYPE_AS_TEXT:
|
if USE_SHOW_ADDON_TYPE_AS_TEXT:
|
||||||
col_a.label(text="Type")
|
col_a.label(text="Type")
|
||||||
col_b.label(text=addon_type_name[addon_type])
|
col_b.label(text=addon_type_name[addon_type])
|
||||||
@ -259,8 +257,9 @@ def addon_draw_item_expanded(
|
|||||||
col_a.label(text="Warning")
|
col_a.label(text="Warning")
|
||||||
col_b.label(text=" " + item_warning_legacy, icon='ERROR', translate=False)
|
col_b.label(text=" " + item_warning_legacy, icon='ERROR', translate=False)
|
||||||
|
|
||||||
col_a.label(text="File")
|
if addon_type != ADDON_TYPE_LEGACY_CORE:
|
||||||
col_b.label(text=mod.__file__, translate=False)
|
col_a.label(text="File")
|
||||||
|
col_b.label(text=mod.__file__, translate=False)
|
||||||
|
|
||||||
|
|
||||||
# NOTE: this can be removed once upgrading from 4.1 is no longer relevant.
|
# NOTE: this can be removed once upgrading from 4.1 is no longer relevant.
|
||||||
@ -485,7 +484,7 @@ def addons_panel_draw_items(
|
|||||||
|
|
||||||
if is_enabled:
|
if is_enabled:
|
||||||
if (addon_preferences := used_addon_module_name_map[module_name].preferences) is not None:
|
if (addon_preferences := used_addon_module_name_map[module_name].preferences) is not None:
|
||||||
box = layout.box()
|
box.separator(type='LINE')
|
||||||
USERPREF_PT_addons.draw_addon_preferences(box, context, addon_preferences)
|
USERPREF_PT_addons.draw_addon_preferences(box, context, addon_preferences)
|
||||||
|
|
||||||
|
|
||||||
@ -616,7 +615,7 @@ def addons_panel_draw(panel, context):
|
|||||||
row_a = split.row()
|
row_a = split.row()
|
||||||
row_b = split.row()
|
row_b = split.row()
|
||||||
row_a.prop(wm, "addon_search", text="", icon='VIEWZOOM')
|
row_a.prop(wm, "addon_search", text="", icon='VIEWZOOM')
|
||||||
row_b.prop(view, "show_addons_enabled_only")
|
row_b.prop(view, "show_addons_enabled_only", text="Enabled Only")
|
||||||
rowsub = row_b.row(align=True)
|
rowsub = row_b.row(align=True)
|
||||||
|
|
||||||
rowsub.popover("USERPREF_PT_addons_tags", text="", icon='TAG')
|
rowsub.popover("USERPREF_PT_addons_tags", text="", icon='TAG')
|
||||||
@ -1090,28 +1089,17 @@ def extensions_panel_draw_impl(
|
|||||||
row_right.active = False
|
row_right.active = False
|
||||||
|
|
||||||
if show:
|
if show:
|
||||||
split = box.split(factor=0.8)
|
col = box.column()
|
||||||
col_a = split.column()
|
|
||||||
col_b = split.column()
|
row = col.row()
|
||||||
|
|
||||||
# The full tagline may be multiple lines (not yet supported by Blender's UI).
|
# The full tagline may be multiple lines (not yet supported by Blender's UI).
|
||||||
col_a.label(text="{:s}.".format(item.tagline), translate=False)
|
row.label(text=" {:s}.".format(item.tagline), translate=False)
|
||||||
|
|
||||||
if value := item.website:
|
|
||||||
# Use half size button, for legacy add-ons there are two, here there is one
|
|
||||||
# however one large button looks silly, so use a half size still.
|
|
||||||
col_a.split(factor=0.5).operator(
|
|
||||||
"wm.url_open",
|
|
||||||
text=domain_extract_from_url(value),
|
|
||||||
translate=False,
|
|
||||||
icon='URL',
|
|
||||||
).url = value
|
|
||||||
del value
|
|
||||||
|
|
||||||
# Note that we could allow removing extensions from non-remote extension repos
|
# Note that we could allow removing extensions from non-remote extension repos
|
||||||
# although this is destructive, so don't enable this right now.
|
# although this is destructive, so don't enable this right now.
|
||||||
if is_installed:
|
if is_installed:
|
||||||
rowsub = col_b.row()
|
rowsub = row.row()
|
||||||
rowsub.alignment = 'RIGHT'
|
rowsub.alignment = 'RIGHT'
|
||||||
if is_system_repo:
|
if is_system_repo:
|
||||||
rowsub.operator("extensions.package_uninstall_system", text="Uninstall")
|
rowsub.operator("extensions.package_uninstall_system", text="Uninstall")
|
||||||
@ -1119,17 +1107,32 @@ def extensions_panel_draw_impl(
|
|||||||
props = rowsub.operator("extensions.package_uninstall", text="Uninstall")
|
props = rowsub.operator("extensions.package_uninstall", text="Uninstall")
|
||||||
props.repo_index = repo_index
|
props.repo_index = repo_index
|
||||||
props.pkg_id = pkg_id
|
props.pkg_id = pkg_id
|
||||||
del props, rowsub
|
del props
|
||||||
|
del rowsub
|
||||||
|
|
||||||
del split, col_a, col_b
|
col.separator(type='LINE')
|
||||||
|
del col
|
||||||
|
|
||||||
boxsub = box.box()
|
col_info = box.column()
|
||||||
boxsub.active = is_enabled
|
col_info.active = is_enabled
|
||||||
split = boxsub.split(factor=0.125)
|
split = col_info.split(factor=0.15)
|
||||||
col_a = split.column()
|
col_a = split.column()
|
||||||
col_b = split.column()
|
col_b = split.column()
|
||||||
col_a.alignment = "RIGHT"
|
col_a.alignment = "RIGHT"
|
||||||
|
|
||||||
|
if value := item.website:
|
||||||
|
col_a.label(text="Website")
|
||||||
|
# Use half size button the full width button looks silly.
|
||||||
|
col_b.split(factor=0.5).operator(
|
||||||
|
"wm.url_open",
|
||||||
|
text=domain_extract_from_url(value),
|
||||||
|
translate=False,
|
||||||
|
icon='URL',
|
||||||
|
).url = value
|
||||||
|
del value
|
||||||
|
|
||||||
|
col_a.alignment = "RIGHT"
|
||||||
|
|
||||||
if is_addon:
|
if is_addon:
|
||||||
col_a.label(text="Permissions")
|
col_a.label(text="Permissions")
|
||||||
# WARNING: while this is documented to be a dict, old packages may contain a list of strings.
|
# WARNING: while this is documented to be a dict, old packages may contain a list of strings.
|
||||||
|
@ -2332,9 +2332,8 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
addon_preferences_class = type(addon_preferences)
|
addon_preferences_class = type(addon_preferences)
|
||||||
|
layout.label(text=" Preferences")
|
||||||
box_prefs = layout.box()
|
box_prefs = layout.box()
|
||||||
box_prefs.label(text="Preferences")
|
|
||||||
box_prefs.separator(type='LINE')
|
|
||||||
addon_preferences_class.layout = box_prefs
|
addon_preferences_class.layout = box_prefs
|
||||||
try:
|
try:
|
||||||
draw(context)
|
draw(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user