Action Manager¶
Intr¶
method to add a new menu item
method 1¶
import imagect.api.actmgr
import imagect.core.actmgr
from imagect.api.actmgr import addAct, addActFun, renameAct
@addActFun("file.exampe.msg", text="&Message", index=1)
def apptest():
win = get()
win.showMessage("Test Message")
method 2¶
from imagect.api.actmgr import addActFetch, renameAct
@addActFetch("file.recent", "Recent File", index=2)
def recentMenu(qact : QAction):
return [ QAction("Recent 1", qact), QAction("Recent 2", qact)]
method 3¶
import imagect.api.actmgr
import imagect.core.actmgr
from imagect.api.actmgr import addActWdg, renameAct
@addActWdg("file.exampe.wdg", text="Show Widget", index = 3)
class ActWdg(QSpinBox) :
def __init__(self, parent):
super().__init__(parent)
API¶
-
interface
imagect.api.actmgr.IActMgr[source]¶ Action Manager
要包含所有的命令节点,每个命令节点包含一个菜单用于显示全部子命令
-
file¶ file menu
-
edit¶ edit menu
-
image¶ image menu
-
test¶ test menu
-
topActions()¶
-
addAct(act)¶ add sub action parent | child
-
remAct(id)¶ remove action by id
-
renameAct(id, title, index=0)¶ set action title
-
queryChildren(self, pid)¶ query actions by parent id
-
queryAll(self)¶ query all actions
-