unimenu icon indicating copy to clipboard operation
unimenu copied to clipboard

add separator support unreal

Open hannesdelbeke opened this issue 1 year ago • 2 comments

a section needs to first be added then we set section name in the labels/command entries

# create section named test
return parent_app_node.add_section(section_name="test", label=self.label + "_label", insert_name="test_insert_name")
# assign entry to section test
parent_app_node.add_menu_entry("test", entry)

hannesdelbeke avatar Apr 06 '23 20:04 hannesdelbeke

With our latest changes to be able set section_name from kwarg we can then set the section_name for the separator, but have to define it for each subsequent item that you want to be under that separator in the config.

I have found another solution which can still use the above. but also can do this in the background without needing to setup some additional flags for the config. https://github.com/JLHayde/unimenu/blob/2fa3c54a2a7f534781482fc264ed44daeaffe9aa/unimenu/apps/unreal.py#L136-L151

image

MainToolbar = {
    'label': f'Studio: 11111',

    'items':

        [
            {
                'label': 'UV Tools',
                'separator': True,
                "tooltip": "tooltip separator",
            },
            {
                'command': 'remote.send_message_to_server(host_port, "Hello from unimenu")',
                'label': 'Tool 1',
                "icon": "MessageLog.TabIcon",
                "tooltip": "tooltip",


            },

            {
                'command': 'remote.send_message_to_server(host_port, "Hello from unimenu")',
                'label': 'Tool 2',
                "icon": "MessageLog.TabIcon",
                "tooltip": "tooltip",


            },
            {
                'label': 'Mesh Tools',
                'separator': True,
                "tooltip": "tooltip separator",
            },
            {
                'command': 'remote.send_message_to_server(host_port, "Hello from unimenu")',
                'label': 'Tool 3',
                "icon": "MessageLog.TabIcon",
                "tooltip": "tooltip",

            },

            {
                'command': 'remote.send_message_to_server(host_port, "Hello from unimenu")',
                'label': 'Tool 4',
                "icon": "MessageLog.TabIcon",
                "tooltip": "tooltip",

            },
            {
                'label': 'Tools',
                'items':
                    [
                        {
                            'label': 'Faces',
                            'separator': True,
                            "tooltip": "tooltip separator",
                        },
                        {
                            'command': 'print("hello 1")',
                            'label': 'tool8',
                            'icon': "MessageLog.TabIcon"
                        },
                        {
                            'command': 'print("hello 2")',
                            'label': 'tool9',
                            'icon': "MessageLog.TabIcon"
                        }
                    ]
            }
        ]
}

JLHayde avatar Jul 25 '23 10:07 JLHayde

that looks good, can you get a PR for that?

hannesdelbeke avatar Aug 02 '23 17:08 hannesdelbeke