Page MenuHome

UI: Fix Label alignment in top bar
ClosedPublic

Authored by Yevgeny Makarov (jenkm) on Dec 12 2021, 12:55 PM.
Subscribers
Tokens
"Party Time" token, awarded by pablovazquez."Love" token, awarded by martux."Like" token, awarded by lone_noel."Love" token, awarded by billreynish.

Details

Summary

Label alignment in top bar by using ui_text_icon_width_ex instead of w_hint

Old:

New:

Fixes T61558

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) requested review of this revision.Dec 12 2021, 12:55 PM
Yevgeny Makarov (jenkm) created this revision.
import bpy

class OBJECT_PT_hello(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        row = layout.row()
        row.alignment = 'RIGHT'
        row.prop(context.object, "display_type", icon='BLENDER')
        row.prop(context.object.lineart, "usage")
        row.prop(context.space_data, "search_filter", icon='VIEWZOOM', text="Test")

        layout.separator()

        row = layout.row()
        row.alignment = 'LEFT'
        row.prop(context.object.lineart, "usage")
        row.prop(context.space_data, "search_filter", icon='VIEWZOOM', text="Test")
        row.label(text="Custom:")
        row.operator("mesh.primitive_cube_add")
        row.prop(context.scene, "use_gravity")

        layout.separator()

        row = layout.column()
        row.use_property_split = True
        row.prop(context.object, "display_type", icon='BLENDER')
        row.prop(context.object.lineart, "usage")
        row.prop(context.space_data, "search_filter", icon='VIEWZOOM', text="Test")

        layout.separator()

        row = layout.row()
        row.prop(context.object, "display_type", icon='BLENDER')
        row.prop(context.object.lineart, "usage")
        row.prop(context.space_data, "search_filter", icon='VIEWZOOM', text="Test")

        layout.separator()

        col = layout.column()
        col.prop(context.object, "display_type")
        col.prop(context.object.lineart, "usage")
        col.prop(context.space_data, "search_filter", icon='VIEWZOOM', text="Test")
        col.label(text="Custom:")
        col.operator("mesh.primitive_cube_add")
        col.prop(context.scene, "use_gravity")


def register():
    bpy.utils.register_class(OBJECT_PT_hello)

def unregister():
    bpy.utils.unregister_class(OBJECT_PT_hello)

if __name__ == "__main__":
    register()

Couldn't find a case that breaks with this, it should only affect few cases. It's a nice fix if it works out, so let's try it.

This revision is now accepted and ready to land.Jan 27 2022, 7:36 PM
Aaron Carlisle (Blendify) retitled this revision from Fix T61558: Label alignment in top bar to UI: Fix Label alignment in top bar.Mar 13 2022, 10:36 PM
Aaron Carlisle (Blendify) edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.