48 lines
954 B
ReStructuredText
48 lines
954 B
ReStructuredText
|
|
For Application
|
|
---------------
|
|
|
|
Make custom menu
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
Macro example in library ``mymacros``
|
|
|
|
.. code-block:: python
|
|
|
|
def show_info_debug():
|
|
app.msgbox(app.INFO_DEBUG)
|
|
return
|
|
|
|
|
|
Insert custom menu in menu Tools in Calc.
|
|
|
|
.. code-block:: python
|
|
|
|
def insert_menu_in_calc():
|
|
menus = app.menus['calc']
|
|
data = {
|
|
'Label': 'My Macros',
|
|
'CommandURL': 'zaz.my.macros',
|
|
'Index': 0,
|
|
'Submenu': [
|
|
{
|
|
'Label': 'Show info debug',
|
|
'CommandURL': {'library': 'mymacros', 'name': 'show_info_debug'},
|
|
'ShortCut': 'Ctrl+Shift+Alt+M'
|
|
},
|
|
],
|
|
}
|
|
menus.insert('Tools', data)
|
|
return
|
|
|
|
|
|
Delete menu
|
|
^^^^^^^^^^^
|
|
|
|
.. code-block:: python
|
|
|
|
def delete_menu():
|
|
menus = app.menus['calc']
|
|
menus.remove('Tools', 'zaz.my.macros')
|
|
return
|