Draft: Add example tool hints
This commit is contained in:
@@ -291,6 +291,36 @@ class Arc(gui_base_original.Creator):
|
||||
self.step = 4
|
||||
self.drawArc()
|
||||
|
||||
self.updateHints()
|
||||
|
||||
def getHints(self):
|
||||
hint_global = Gui.InputHint(translate("draft", "%1 toggle global"), Gui.UserInput.KeyG)
|
||||
hint_continue = Gui.InputHint(translate("draft", "%1 toggle continue"), Gui.UserInput.KeyN)
|
||||
|
||||
if self.step == 0:
|
||||
return [
|
||||
Gui.InputHint(translate("draft", "%1 pick center"), Gui.UserInput.MouseLeft),
|
||||
hint_global,
|
||||
hint_continue,
|
||||
]
|
||||
elif self.step == 1:
|
||||
return [
|
||||
Gui.InputHint(translate("draft", "%1 pick radius"), Gui.UserInput.MouseLeft),
|
||||
hint_continue,
|
||||
]
|
||||
elif self.step == 2:
|
||||
return [
|
||||
Gui.InputHint(translate("draft", "%1 pick staring angle"), Gui.UserInput.MouseLeft),
|
||||
hint_continue,
|
||||
]
|
||||
elif self.step == 3:
|
||||
return [
|
||||
Gui.InputHint(translate("draft", "%1 pick aperture"), Gui.UserInput.MouseLeft),
|
||||
hint_continue,
|
||||
]
|
||||
else:
|
||||
return []
|
||||
|
||||
def drawArc(self):
|
||||
"""Actually draw the arc object."""
|
||||
rot, sup, pts, fil = self.getStrings()
|
||||
|
||||
@@ -136,6 +136,17 @@ class DraftTool:
|
||||
_toolmsg("{}".format(16*"-"))
|
||||
_toolmsg("GuiCommand: {}".format(self.featureName))
|
||||
|
||||
# update hints after the tool is fully initialized
|
||||
QtCore.QTimer.singleShot(0, self.updateHints)
|
||||
|
||||
def updateHints(self):
|
||||
Gui.HintManager.show(*self.getHints())
|
||||
|
||||
def getHints(self):
|
||||
return [
|
||||
Gui.InputHint("%1 constrain", Gui.UserInput.KeyShift)
|
||||
]
|
||||
|
||||
def end_callbacks(self, call):
|
||||
try:
|
||||
self.view.removeEventCallback("SoEvent", call)
|
||||
@@ -184,6 +195,8 @@ class DraftTool:
|
||||
todo.ToDo.delayCommit(self.commitList)
|
||||
self.commitList = []
|
||||
|
||||
Gui.HintManager.hide()
|
||||
|
||||
def commit(self, name, func):
|
||||
"""Store actions in the commit list to be run later.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user