Skip to content

features overview

hannes edited this page Jul 20, 2023 · 36 revisions

Features

App feature overview

  • ❌ Not easily supported ( with current UniMenu implementation )
  • ✅ Implemented
  • 🛠️ To implement

Qt based apps

App native icons custom icons Separator Labeled separator callback command ¹ tooltip teardown native UI
Qt ⚠️ any Qt
Maya Qt PySide2
Max Qt ⚠️ PySide2
Substance Painter PySide2
Krita ³ ❌ ❔ ⚠️ PyQt5
CryEngine ³ PySide6

Other supported UI frameworks

App native icons custom icons Separator Labeled separator callback command ¹ tooltip teardown native UI
Blender 🛠️ 🛠️ GHOST Menu Operator
Unreal 🛠️ 🛠️ 🛠️ 🛠️ 🛠️ Slate ToolMenuEntry
Marmoset 🛠️ UIWindow

Dropped (in favor of Qt)

App native icons custom icons Separator Labeled separator callback command ¹ tooltip teardown native UI
Maya native native menu
Max native² 🛠️ 🛠️ 🛠️ native menu
Additional info ¹²³⁴⁵⁶⁷⁸⁹⁰

¹ some apps only support string commands, some support passing functions & callbacks.

² ⚠️ Max maintains it's created menu on restart, inconsistent with other apps.

³ Some Krita features should be doable with PyQt5 but don't work by default. They likely are disabled in the parent QT window. Not yet figured out how to enable e.g. tooltips or icons, and the default menu entries don't use them either.

⁴ Support for labeled separators, depends on the stylesheet used. The default Qt one wont show this. But without any additional code, this works in e.g. Krita. ⁵ labeled separators work but don't look great.

other features TODO 🛠️

  • checkbox, e.g. Krita
  • shortcuts - Krita, Blender, Unreal
  • option button, e.g. maya
  • disabled hints, e.g. Blender disabled hints every menu item can have several attributes. The core attributes are label and command

other apps TODO 🛠️

  • ROBLOX studio (Lua, no python)
  • GODOT (no python on latest version)
  • Unity (mostly c#, but some form of python)
  • Photoshop, after effects, illustrator, … (python for COM, but JavaScript preferred)
  • Houdini
  • substance designer (should just work, python & qt, test)
  • Scribus , open source app to make pdfs, qt & python, book on python in scribus

Attributes

attribute description
command the action to run when clicking the item
label the label displayed in the menu for this item. (Don't confuse label with name)
id the name used in the code or by the app for this item. Often required to be unique so be carefull !
icon name of the icon, or path to the icon, an icon next to the menu entry TODO do we support QIcons?
separator if set to a non False value, this item will be treated as a separator. Some apps support labeled separators
items = children the child nodes of a menu or submenu.
parent_path Only set in config for the root node. Controls where & how your menu is parented too. Behaviour can differ between apps, depending on implementation!
tooltip text shown when hovering over the menu
kwargs custom kwargs passed to the app menu node. e.g. unreal menu section or qt widget kwargs
data custom data stored in the unimenu menu node instance. to support custom solutions. not used by unimenu

Config

This sample shows of all attributes in use. Checkout the samples in the UniMenu repo for more configs.

parent_path: MainWindow
label: UniMenu
items:
  - label: Item 1
    command: print('Item 1')
    icon: QUESTION.png
    tooltip: you can read this when you hover over me
  - separator: 1
    label: labeled separator

MenuNode

The attributes can also be accessed on the MenuNode, if we load the above config in unimenu.

node = unimenu.load(config)
node.parent_path # "MainWindow"
node.label       # "UniMenu"

nodes = node.children
node1 = nodes[0]
node2 = nodes[1]

node1.label      # "Item 1"
node1.tooltip    # "you can read this when you hover over me"
node1.command    # "print('Item 1')"
node1.icon       # "QUESTION.png"


node2.separator  # 1, could also be set to True, or "--"
node2.label      # "labeled separator"

# =========== Helper functions ===========
# run the command, return value depends on the application integration
node1.run()
# find out if a node is a separator
node2.is_separator()
# get a node's parent. When you ask the parent of a non-root-menuNode, 
# it'll return the parent MenuNode. 
# This attribute isn't explicitly saved back to the config.
parent_node = node2.parent