mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Proposed improvement on API naming
This commit is contained in:
parent
a1bc2f3ebf
commit
6d237b09e8
2 changed files with 8 additions and 8 deletions
|
@ -9,26 +9,26 @@ from cura.CuraApplication import CuraApplication
|
||||||
# Usage:
|
# Usage:
|
||||||
# ``from cura.API import CuraAPI
|
# ``from cura.API import CuraAPI
|
||||||
# api = CuraAPI()
|
# api = CuraAPI()
|
||||||
# api.sidebar_context_menu.getSidebarMenuItems()
|
# api.sidebar.getContextMenuItems()
|
||||||
# menu_actions = []
|
# menu_actions = []
|
||||||
# menu_actions.append("sidebarMenuItemOnClickHander")
|
# menu_actions.append("sidebarMenuItemOnClickHandler")
|
||||||
# data = {
|
# data = {
|
||||||
# "name": "My Plugin Action",
|
# "name": "My Plugin Action",
|
||||||
# "iconName": "my-plugin-icon",
|
# "iconName": "my-plugin-icon",
|
||||||
# "actions": menu_actions,
|
# "actions": menu_actions,
|
||||||
# "menu_item": MyPluginAction(self)
|
# "menu_item": MyPluginAction(self)
|
||||||
# }
|
# }
|
||||||
# api.sidebar_context_menu.addSidebarMenuItems([])``
|
# api.sidebar.addContextMenuItem(data)``
|
||||||
class SidebarContextMenu:
|
class Sidebar:
|
||||||
|
|
||||||
_application = CuraApplication.getInstance() # type: CuraApplication
|
_application = CuraApplication.getInstance() # type: CuraApplication
|
||||||
|
|
||||||
## Add items to the sidebar context menu.
|
## Add items to the sidebar context menu.
|
||||||
# \param menu_item dict containing the menu item to add.
|
# \param menu_item dict containing the menu item to add.
|
||||||
def addSidebarMenuItem(self, menu_item: dict) -> None:
|
def addContextMenuItem(self, menu_item: dict) -> None:
|
||||||
self._application.addSidebarCustomMenuItem(menu_item)
|
self._application.addSidebarCustomMenuItem(menu_item)
|
||||||
|
|
||||||
## Get all custom items currently added to the sidebar context menu.
|
## Get all custom items currently added to the sidebar context menu.
|
||||||
# \return List containing all custom context menu items.
|
# \return List containing all custom context menu items.
|
||||||
def getSidebarMenuItems(self) -> list:
|
def getContextMenuItems(self) -> list:
|
||||||
return self._application.getSidebarCustomMenuItems()
|
return self._application.getSidebarCustomMenuItems()
|
|
@ -2,7 +2,7 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
from UM.PluginRegistry import PluginRegistry
|
from UM.PluginRegistry import PluginRegistry
|
||||||
from cura.API.Backups import Backups
|
from cura.API.Backups import Backups
|
||||||
from cura.API.SidebarContextMenu import SidebarContextMenu
|
from cura.API.Sidebar import Sidebar
|
||||||
|
|
||||||
## The official Cura API that plug-ins can use to interact with Cura.
|
## The official Cura API that plug-ins can use to interact with Cura.
|
||||||
#
|
#
|
||||||
|
@ -19,4 +19,4 @@ class CuraAPI:
|
||||||
backups = Backups()
|
backups = Backups()
|
||||||
|
|
||||||
# Sidebar Context Menu API
|
# Sidebar Context Menu API
|
||||||
sidebar_context_menu = SidebarContextMenu()
|
sidebar = Sidebar()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue