Merge pull request #11503 from yorikvanhavre/draft-toolmessages
Draft: Added a preference to turn on/off tool messages
This commit is contained in:
@@ -17,7 +17,16 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -163,7 +172,16 @@
|
||||
<string>Draft tools options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -188,6 +206,23 @@ This allows to point the direction and type the distance.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_13">
|
||||
<property name="toolTip">
|
||||
<string>Force Draft Tools to create Part primitives instead of Draft objects.
|
||||
Note that this is not fully supported, and many object will be not editable with Draft Modifiers.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Part Primitives when available</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UsePartPrimitives</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Draft</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_3">
|
||||
<property name="toolTip">
|
||||
@@ -205,17 +240,18 @@ If this option is checked, the base objects will be selected instead.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_13">
|
||||
<item row="3" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBox_2">
|
||||
<property name="toolTip">
|
||||
<string>Force Draft Tools to create Part primitives instead of Draft objects.
|
||||
Note that this is not fully supported, and many object will be not editable with Draft Modifiers.</string>
|
||||
<string>If this is checked, prompt messages will be printed
|
||||
in the report view when using Draft tools, to help
|
||||
knowing which action to take next.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Part Primitives when available</string>
|
||||
<string>Show prompts in the report view</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UsePartPrimitives</cstring>
|
||||
<cstring>ToolMessages</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Draft</cstring>
|
||||
@@ -317,7 +353,7 @@ Note that this is not fully supported, and many object will be not editable with
|
||||
<property name="toolTip">
|
||||
<string>This is the default color for objects being drawn while in construction mode.</string>
|
||||
</property>
|
||||
<property name="color" stdset="0">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>44</red>
|
||||
<green>125</green>
|
||||
@@ -385,11 +421,6 @@ Note that this is not fully supported, and many object will be not editable with
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -44,7 +44,7 @@ import draftguitools.gui_trackers as trackers
|
||||
import draftutils.utils as utils
|
||||
|
||||
from FreeCAD import Units as U
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -85,7 +85,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.linetrack = trackers.lineTracker(dotted=True)
|
||||
self.arctrack = trackers.arcTracker()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick center point"))
|
||||
_toolmsg(translate("draft", "Pick center point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
@@ -251,7 +251,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.step = 1
|
||||
self.ui.setNextFocus()
|
||||
self.linetrack.on()
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
else:
|
||||
if len(self.tangents) == 1:
|
||||
self.tanpoints.append(self.point)
|
||||
@@ -267,7 +267,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.step = 1
|
||||
self.ui.setNextFocus()
|
||||
self.linetrack.on()
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
elif self.step == 1: # choose radius
|
||||
@@ -280,7 +280,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.linetrack.p1(self.center)
|
||||
self.linetrack.on()
|
||||
self.step = 2
|
||||
_msg(translate("draft", "Pick start angle"))
|
||||
_toolmsg(translate("draft", "Pick start angle"))
|
||||
elif self.step == 2: # choose first angle
|
||||
self.ui.labelRadius.setText(translate("draft", "Aperture angle"))
|
||||
self.ui.radiusValue.setToolTip(translate("draft", "Aperture angle"))
|
||||
@@ -289,7 +289,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.wp.axis)
|
||||
self.arctrack.setStartAngle(self.firstangle - ang_offset)
|
||||
self.step = 3
|
||||
_msg(translate("draft", "Pick aperture"))
|
||||
_toolmsg(translate("draft", "Pick aperture"))
|
||||
else: # choose second angle
|
||||
self.step = 4
|
||||
self.drawArc()
|
||||
@@ -404,7 +404,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.ui.radiusUi()
|
||||
self.step = 1
|
||||
self.ui.setNextFocus()
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
|
||||
def numericRadius(self, rad):
|
||||
"""Validate the entry radius in the user interface.
|
||||
@@ -445,7 +445,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.linetrack.on()
|
||||
self.ui.radiusValue.setText("")
|
||||
self.ui.radiusValue.setFocus()
|
||||
_msg(translate("draft", "Pick start angle"))
|
||||
_toolmsg(translate("draft", "Pick start angle"))
|
||||
elif self.step == 2:
|
||||
self.ui.labelRadius.setText(translate("draft", "Aperture angle"))
|
||||
self.ui.radiusValue.setToolTip(translate("draft", "Aperture angle"))
|
||||
@@ -457,7 +457,7 @@ class Arc(gui_base_original.Creator):
|
||||
self.step = 3
|
||||
self.ui.radiusValue.setText("")
|
||||
self.ui.radiusValue.setFocus()
|
||||
_msg(translate("draft", "Pick aperture angle"))
|
||||
_toolmsg(translate("draft", "Pick aperture angle"))
|
||||
else:
|
||||
self.updateAngle(rad)
|
||||
self.angle = math.radians(rad)
|
||||
|
||||
@@ -33,7 +33,7 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import draftutils.todo as todo
|
||||
|
||||
from draftutils.messages import _msg, _log
|
||||
from draftutils.messages import _toolmsg, _log
|
||||
|
||||
|
||||
class GuiCommandSimplest:
|
||||
@@ -104,8 +104,8 @@ class GuiCommandSimplest:
|
||||
self.doc = App.activeDocument()
|
||||
_log("Document: {}".format(self.doc.Label))
|
||||
_log("GuiCommand: {}".format(self.command_name))
|
||||
_msg("{}".format(16*"-"))
|
||||
_msg("GuiCommand: {}".format(self.command_name))
|
||||
_toolmsg("{}".format(16*"-"))
|
||||
_toolmsg("GuiCommand: {}".format(self.command_name))
|
||||
|
||||
|
||||
class GuiCommandNeedsSelection(GuiCommandSimplest):
|
||||
|
||||
@@ -43,7 +43,7 @@ import draftutils.todo as todo
|
||||
import draftguitools.gui_trackers as trackers
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg, _log
|
||||
from draftutils.messages import _msg, _log, _toolmsg
|
||||
|
||||
|
||||
class DraftTool:
|
||||
@@ -135,8 +135,8 @@ class DraftTool:
|
||||
if hasattr(Gui, "Snapper"):
|
||||
Gui.Snapper.setTrackers()
|
||||
|
||||
_msg("{}".format(16*"-"))
|
||||
_msg("GuiCommand: {}".format(self.featureName))
|
||||
_toolmsg("{}".format(16*"-"))
|
||||
_toolmsg("GuiCommand: {}".format(self.featureName))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Finish the current command.
|
||||
|
||||
@@ -46,7 +46,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_lines as gui_lines
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _toolmsg, _err
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
@@ -148,10 +148,10 @@ class BezCurve(gui_lines.Line):
|
||||
self.bezcurvetrack.on()
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.node[0])
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
else:
|
||||
self.obj.Shape = self.updateShape(self.node)
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
|
||||
def updateShape(self, pts):
|
||||
"""Create shape for display during creation process."""
|
||||
@@ -388,11 +388,11 @@ class CubicBezCurve(gui_lines.Line):
|
||||
self.bezcurvetrack.on()
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.node[0])
|
||||
_msg(translate("draft", "Click and drag to define next knot"))
|
||||
_toolmsg(translate("draft", "Click and drag to define next knot"))
|
||||
elif (len(self.node) - 1) % self.degree == 1 and len(self.node) > 2:
|
||||
# is a knot
|
||||
self.obj.Shape = self.updateShape(self.node[:-1])
|
||||
_msg(translate("draft", "Click and drag to define next knot"))
|
||||
_toolmsg(translate("draft", "Click and drag to define next knot"))
|
||||
|
||||
def updateShape(self, pts):
|
||||
"""Create shape for display during creation process."""
|
||||
|
||||
@@ -36,7 +36,7 @@ import Draft
|
||||
import Draft_rc # include resources, icons, ui files
|
||||
import draftutils.todo as todo
|
||||
|
||||
from draftutils.messages import _msg, _log
|
||||
from draftutils.messages import _log
|
||||
from draftutils.translate import translate
|
||||
from draftguitools import gui_base
|
||||
from drafttaskpanels import task_circulararray
|
||||
@@ -72,8 +72,6 @@ class CircularArray(gui_base.GuiCommandBase):
|
||||
the widgets of the task panel.
|
||||
"""
|
||||
_log("GuiCommand: {}".format(self.command_name))
|
||||
#_msg("{}".format(16*"-"))
|
||||
#_msg("GuiCommand: {}".format(self.command_name))
|
||||
|
||||
self.location = coin.SoLocation2Event.getClassTypeId()
|
||||
self.mouse_event = coin.SoMouseButtonEvent.getClassTypeId()
|
||||
|
||||
@@ -49,7 +49,7 @@ import draftguitools.gui_trackers as trackers
|
||||
import draftutils.gui_utils as gui_utils
|
||||
|
||||
from draftutils.translate import translate
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _toolmsg, _msg
|
||||
|
||||
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
|
||||
|
||||
@@ -120,7 +120,7 @@ class Dimension(gui_base_original.Creator):
|
||||
self.info = None
|
||||
self.selectmode = False
|
||||
self.set_selection()
|
||||
_msg(translate("draft", "Pick first point"))
|
||||
_toolmsg(translate("draft", "Pick first point"))
|
||||
|
||||
def set_selection(self):
|
||||
"""Fill the nodes according to the selected geometry."""
|
||||
|
||||
@@ -51,6 +51,7 @@ import DraftVecUtils
|
||||
|
||||
from draftutils.translate import translate
|
||||
import draftutils.utils as utils
|
||||
from draftutils.messages import _msg
|
||||
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.translate import translate
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _toolmsg, _err
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
True if Draft_rc.__name__ else False
|
||||
@@ -68,7 +68,7 @@ class Ellipse(gui_base_original.Creator):
|
||||
self.ui.extUi()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
self.rect = trackers.rectangleTracker()
|
||||
_msg(translate("draft", "Pick first point"))
|
||||
_toolmsg(translate("draft", "Pick first point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
@@ -196,7 +196,7 @@ class Ellipse(gui_base_original.Creator):
|
||||
self.rect.update(point)
|
||||
self.createObject()
|
||||
else:
|
||||
_msg(translate("draft", "Pick opposite point"))
|
||||
_toolmsg(translate("draft", "Pick opposite point"))
|
||||
self.ui.setRelative()
|
||||
self.rect.setorigin(point)
|
||||
self.rect.on()
|
||||
|
||||
@@ -43,7 +43,7 @@ import draftutils.utils as utils
|
||||
import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -104,7 +104,7 @@ class Fillet(gui_base_original.Creator):
|
||||
# self.linetrack = trackers.lineTracker(dotted=True)
|
||||
# self.arctrack = trackers.arcTracker()
|
||||
# self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft","Enter radius."))
|
||||
_toolmsg(translate("draft","Enter radius."))
|
||||
|
||||
def action(self, arg):
|
||||
"""Scene event handler. CURRENTLY NOT USED.
|
||||
@@ -123,12 +123,12 @@ class Fillet(gui_base_original.Creator):
|
||||
def set_delete(self):
|
||||
"""Execute as a callback when the delete checkbox changes."""
|
||||
self.delete = self.ui.check_delete.isChecked()
|
||||
_msg(translate("draft","Delete original objects:") + " " + str(self.delete))
|
||||
_toolmsg(translate("draft","Delete original objects:") + " " + str(self.delete))
|
||||
|
||||
def set_chamfer(self):
|
||||
"""Execute as a callback when the chamfer checkbox changes."""
|
||||
self.chamfer = self.ui.check_chamfer.isChecked()
|
||||
_msg(translate("draft","Chamfer mode:") + " " + str(self.chamfer))
|
||||
_toolmsg(translate("draft","Chamfer mode:") + " " + str(self.chamfer))
|
||||
|
||||
def numericRadius(self, rad):
|
||||
"""Validate the entry radius in the user interface.
|
||||
@@ -149,19 +149,19 @@ class Fillet(gui_base_original.Creator):
|
||||
return
|
||||
|
||||
for o in wires:
|
||||
_msg(utils.get_type(o))
|
||||
_toolmsg(utils.get_type(o))
|
||||
|
||||
_test = translate("draft", "Test object")
|
||||
_test_off = translate("draft", "Test object removed")
|
||||
_cant = translate("draft", "Fillet cannot be created")
|
||||
|
||||
_msg(4*"=" + _test)
|
||||
_toolmsg(4*"=" + _test)
|
||||
arc = Draft.make_fillet(wires, rad)
|
||||
if not arc:
|
||||
_err(_cant)
|
||||
return
|
||||
self.doc.removeObject(arc.Name)
|
||||
_msg(4*"=" + _test_off)
|
||||
_toolmsg(4*"=" + _test_off)
|
||||
|
||||
_doc = 'FreeCAD.ActiveDocument.'
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
import FreeCAD
|
||||
import os
|
||||
import re
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _msg, _toolmsg
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
@@ -114,7 +114,7 @@ class Draft_Hyperlink:
|
||||
else:
|
||||
url = QUrl(hyperlink)
|
||||
|
||||
_msg(translate("draft", "Opening hyperlink") + " " + hyperlink)
|
||||
_toolmsg(translate("draft", "Opening hyperlink") + " " + hyperlink)
|
||||
|
||||
QDesktopServices.openUrl(url) #ToDo: add management to open FCStd files in the current instance and to open web pages with the Web Workbench
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import Draft_rc
|
||||
import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _msg, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -95,7 +95,7 @@ class Join(gui_base_original.Modifier):
|
||||
labels.append(obj.Label)
|
||||
|
||||
labels = ", ".join(labels)
|
||||
_msg(translate("draft","Selection:") + " {}".format(labels))
|
||||
_toolmsg(translate("draft","Selection:") + " {}".format(labels))
|
||||
|
||||
|
||||
Gui.addCommand('Draft_Join', Join())
|
||||
|
||||
@@ -46,7 +46,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
import draftutils.utils as utils
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -77,7 +77,7 @@ class Label(gui_base_original.Creator):
|
||||
self.ui.xValue.selectAll()
|
||||
self.ghost = trackers.lineTracker()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick target point"))
|
||||
_toolmsg(translate("draft", "Pick target point"))
|
||||
self.ui.isCopy.hide()
|
||||
|
||||
def setmode(self, i):
|
||||
@@ -182,7 +182,7 @@ class Label(gui_base_original.Creator):
|
||||
# first click
|
||||
self.node.append(self.point)
|
||||
self.ui.isRelative.show()
|
||||
_msg(translate("draft",
|
||||
_toolmsg(translate("draft",
|
||||
"Pick endpoint of leader line"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
@@ -193,7 +193,7 @@ class Label(gui_base_original.Creator):
|
||||
self.ghost.p1(self.node[0])
|
||||
self.ghost.p2(self.node[1])
|
||||
self.ghost.on()
|
||||
_msg(translate("draft", "Pick text position"))
|
||||
_toolmsg(translate("draft", "Pick text position"))
|
||||
else:
|
||||
# third click
|
||||
self.node.append(self.point)
|
||||
@@ -210,7 +210,7 @@ class Label(gui_base_original.Creator):
|
||||
# first click
|
||||
self.node.append(self.point)
|
||||
self.ui.isRelative.show()
|
||||
_msg(translate("draft", "Pick endpoint of leader line"))
|
||||
_toolmsg(translate("draft", "Pick endpoint of leader line"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
elif len(self.node) == 1:
|
||||
@@ -220,7 +220,7 @@ class Label(gui_base_original.Creator):
|
||||
self.ghost.p1(self.node[0])
|
||||
self.ghost.p2(self.node[1])
|
||||
self.ghost.on()
|
||||
_msg(translate("draft", "Pick text position"))
|
||||
_toolmsg(translate("draft", "Pick text position"))
|
||||
else:
|
||||
# third click
|
||||
self.node.append(self.point)
|
||||
|
||||
@@ -44,7 +44,7 @@ import draftutils.todo as todo
|
||||
import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class Line(gui_base_original.Creator):
|
||||
gui_utils.format_object(self.obj)
|
||||
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick first point"))
|
||||
_toolmsg(translate("draft", "Pick first point"))
|
||||
|
||||
def action(self, arg):
|
||||
"""Handle the 3D scene events.
|
||||
@@ -211,8 +211,8 @@ class Line(gui_base_original.Creator):
|
||||
else:
|
||||
self.obj.ViewObject.hide()
|
||||
# DNC: report on removal
|
||||
# _msg(translate("draft", "Removing last point"))
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
# _toolmsg(translate("draft", "Removing last point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
|
||||
def drawSegment(self, point):
|
||||
"""Draws new line segment."""
|
||||
@@ -220,14 +220,14 @@ class Line(gui_base_original.Creator):
|
||||
if self.planetrack and self.node:
|
||||
self.planetrack.set(self.node[-1])
|
||||
if len(self.node) == 1:
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
elif len(self.node) == 2:
|
||||
last = self.node[len(self.node) - 2]
|
||||
newseg = Part.LineSegment(last, point).toShape()
|
||||
self.obj.Shape = newseg
|
||||
self.obj.ViewObject.Visibility = True
|
||||
if self.isWire:
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
else:
|
||||
currentshape = self.obj.Shape.copy()
|
||||
last = self.node[len(self.node) - 2]
|
||||
@@ -235,7 +235,7 @@ class Line(gui_base_original.Creator):
|
||||
newseg = Part.LineSegment(last, point).toShape()
|
||||
newshape = currentshape.fuse(newseg)
|
||||
self.obj.Shape = newshape
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
|
||||
def wipe(self):
|
||||
"""Remove all previous segments and starts from last point."""
|
||||
@@ -245,7 +245,7 @@ class Line(gui_base_original.Creator):
|
||||
self.node = [self.node[-1]]
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.node[0])
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
|
||||
def orientWP(self):
|
||||
"""Orient the working plane."""
|
||||
|
||||
@@ -46,7 +46,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_trackers as trackers
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _msg, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -89,7 +89,7 @@ class Mirror(gui_base_original.Modifier):
|
||||
self.ui.xValue.selectAll()
|
||||
self.ghost = trackers.ghostTracker(self.sel, mirror=True)
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick start point of mirror line"))
|
||||
_toolmsg(translate("draft", "Pick start point of mirror line"))
|
||||
self.ui.isCopy.hide()
|
||||
|
||||
def finish(self, cont=False):
|
||||
@@ -159,7 +159,7 @@ class Mirror(gui_base_original.Modifier):
|
||||
self.ui.isRelative.show()
|
||||
if self.ghost:
|
||||
self.ghost.on()
|
||||
_msg(translate("draft",
|
||||
_toolmsg(translate("draft",
|
||||
"Pick end point of mirror line"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
@@ -186,7 +186,7 @@ class Mirror(gui_base_original.Modifier):
|
||||
self.node.append(self.point)
|
||||
if self.ghost:
|
||||
self.ghost.on()
|
||||
_msg(translate("draft", "Pick end point of mirror line"))
|
||||
_toolmsg(translate("draft", "Pick end point of mirror line"))
|
||||
else:
|
||||
last = self.node[-1]
|
||||
if self.ui.isCopy.isChecked():
|
||||
|
||||
@@ -41,7 +41,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
from draftguitools.gui_subelements import SubelementHighlight
|
||||
|
||||
@@ -100,7 +100,7 @@ class Move(gui_base_original.Modifier):
|
||||
self.ui.xValue.setFocus()
|
||||
self.ui.xValue.selectAll()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick start point"))
|
||||
_toolmsg(translate("draft", "Pick start point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
@@ -165,7 +165,7 @@ class Move(gui_base_original.Modifier):
|
||||
self.ui.isRelative.show()
|
||||
for ghost in self.ghosts:
|
||||
ghost.on()
|
||||
_msg(translate("draft", "Pick end point"))
|
||||
_toolmsg(translate("draft", "Pick end point"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
else:
|
||||
@@ -312,7 +312,7 @@ class Move(gui_base_original.Modifier):
|
||||
self.ui.isCopy.show()
|
||||
for ghost in self.ghosts:
|
||||
ghost.on()
|
||||
_msg(translate("draft", "Pick end point"))
|
||||
_toolmsg(translate("draft", "Pick end point"))
|
||||
else:
|
||||
last = self.node[-1]
|
||||
self.vector = self.point.sub(last)
|
||||
|
||||
@@ -45,7 +45,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _wrn, _err
|
||||
from draftutils.messages import _msg, _wrn, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -143,7 +143,7 @@ class Offset(gui_base_original.Modifier):
|
||||
self.ghost = trackers.wireTracker(self.shape)
|
||||
self.mode = "Wire"
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick distance"))
|
||||
_toolmsg(translate("draft", "Pick distance"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.shape.Vertexes[0].Point)
|
||||
self.running = True
|
||||
|
||||
@@ -42,7 +42,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class Polygon(gui_base_original.Creator):
|
||||
self.ui.sourceCmd = self
|
||||
self.arctrack = trackers.arcTracker()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick center point"))
|
||||
_toolmsg(translate("draft", "Pick center point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
@@ -193,7 +193,7 @@ class Polygon(gui_base_original.Creator):
|
||||
self.arctrack.on()
|
||||
self.ui.radiusUi()
|
||||
self.step = 1
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
else:
|
||||
if len(self.tangents) == 1:
|
||||
self.tanpoints.append(self.point)
|
||||
@@ -204,7 +204,7 @@ class Polygon(gui_base_original.Creator):
|
||||
self.arctrack.on()
|
||||
self.ui.radiusUi()
|
||||
self.step = 1
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
elif self.step == 1: # choose radius
|
||||
@@ -264,7 +264,7 @@ class Polygon(gui_base_original.Creator):
|
||||
self.ui.radiusUi()
|
||||
self.step = 1
|
||||
self.ui.radiusValue.setFocus()
|
||||
_msg(translate("draft", "Pick radius"))
|
||||
_toolmsg(translate("draft", "Pick radius"))
|
||||
|
||||
def numericRadius(self, rad):
|
||||
"""Validate the entry radius in the user interface.
|
||||
|
||||
@@ -39,7 +39,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _toolmsg, _err
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class Rectangle(gui_base_original.Creator):
|
||||
self.ui.hasFill.setChecked(True)
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
self.rect = trackers.rectangleTracker()
|
||||
_msg(translate("draft", "Pick first point"))
|
||||
_toolmsg(translate("draft", "Pick first point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
@@ -198,7 +198,7 @@ class Rectangle(gui_base_original.Creator):
|
||||
self.rect.update(point)
|
||||
self.createObject()
|
||||
else:
|
||||
_msg(translate("draft", "Pick opposite point"))
|
||||
_toolmsg(translate("draft", "Pick opposite point"))
|
||||
self.ui.setRelative()
|
||||
self.rect.setorigin(point)
|
||||
self.rect.on()
|
||||
|
||||
@@ -43,7 +43,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from FreeCAD import Units as U
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -96,7 +96,7 @@ class Rotate(gui_base_original.Modifier):
|
||||
self.ui.rotateSetCenterUi()
|
||||
self.arctrack = trackers.arcTracker()
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick rotation center"))
|
||||
_toolmsg(translate("draft", "Pick rotation center"))
|
||||
|
||||
def action(self, arg):
|
||||
"""Handle the 3D scene events.
|
||||
@@ -194,7 +194,7 @@ class Rotate(gui_base_original.Modifier):
|
||||
for ghost in self.ghosts:
|
||||
ghost.center(self.center)
|
||||
self.step = 1
|
||||
_msg(translate("draft", "Pick base angle"))
|
||||
_toolmsg(translate("draft", "Pick base angle"))
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.point)
|
||||
|
||||
@@ -208,7 +208,7 @@ class Rotate(gui_base_original.Modifier):
|
||||
for ghost in self.ghosts:
|
||||
ghost.on()
|
||||
self.step = 2
|
||||
_msg(translate("draft", "Pick rotation angle"))
|
||||
_toolmsg(translate("draft", "Pick rotation angle"))
|
||||
|
||||
def set_rotation_angle(self, arg):
|
||||
"""Set the rotation angle."""
|
||||
@@ -397,7 +397,7 @@ class Rotate(gui_base_original.Modifier):
|
||||
self.ui.radiusValue.setToolTip(translate("draft", "The base angle you wish to start the rotation from"))
|
||||
self.ui.radiusValue.setText(U.Quantity(0, U.Angle).UserString)
|
||||
self.step = 1
|
||||
_msg(translate("draft", "Pick base angle"))
|
||||
_toolmsg(translate("draft", "Pick base angle"))
|
||||
|
||||
def numericRadius(self, rad):
|
||||
"""Validate the radius entry field in the user interface.
|
||||
@@ -415,7 +415,7 @@ class Rotate(gui_base_original.Modifier):
|
||||
for ghost in self.ghosts:
|
||||
ghost.on()
|
||||
self.step = 2
|
||||
_msg(translate("draft", "Pick rotation angle"))
|
||||
_toolmsg(translate("draft", "Pick rotation angle"))
|
||||
else:
|
||||
self.angle = math.radians(rad)
|
||||
self.rotate(self.ui.isCopy.isChecked())
|
||||
|
||||
@@ -50,7 +50,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
import drafttaskpanels.task_scale as task_scale
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -105,7 +105,7 @@ class Scale(gui_base_original.Modifier):
|
||||
self.pickmode = False
|
||||
self.task = None
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick base point"))
|
||||
_toolmsg(translate("draft", "Pick base point"))
|
||||
|
||||
def set_ghosts(self):
|
||||
"""Set the ghost to display."""
|
||||
@@ -133,7 +133,7 @@ class Scale(gui_base_original.Modifier):
|
||||
self.pickmode = True
|
||||
if self.node:
|
||||
self.node = self.node[:1] # remove previous picks
|
||||
_msg(translate("draft", "Pick reference distance from base point"))
|
||||
_toolmsg(translate("draft", "Pick reference distance from base point"))
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
|
||||
def action(self, arg):
|
||||
@@ -404,7 +404,7 @@ class Scale(gui_base_original.Modifier):
|
||||
for ghost in self.ghosts:
|
||||
ghost.on()
|
||||
elif len(self.node) == 2:
|
||||
_msg(translate("draft", "Pick new distance from base point"))
|
||||
_toolmsg(translate("draft", "Pick new distance from base point"))
|
||||
elif len(self.node) == 3:
|
||||
if hasattr(Gui, "Snapper"):
|
||||
Gui.Snapper.off()
|
||||
|
||||
@@ -50,7 +50,7 @@ import draftutils.todo as todo
|
||||
|
||||
from drafttaskpanels.task_shapestring import ShapeStringTaskPanelCmd
|
||||
from draftutils.translate import translate
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _toolmsg, _err
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
True if Draft_rc.__name__ else False
|
||||
@@ -74,7 +74,7 @@ class ShapeString(gui_base_original.Creator):
|
||||
self.ui.sourceCmd = self
|
||||
self.task = ShapeStringTaskPanelCmd(self)
|
||||
self.call = self.view.addEventCallback("SoEvent", self.task.action)
|
||||
_msg(translate("draft", "Pick ShapeString location point"))
|
||||
_toolmsg(translate("draft", "Pick ShapeString location point"))
|
||||
todo.ToDo.delay(Gui.Control.showDialog, self.task)
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_lines as gui_lines
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
@@ -137,12 +137,12 @@ class BSpline(gui_lines.Line):
|
||||
self.bsplinetrack.on()
|
||||
if self.planetrack:
|
||||
self.planetrack.set(self.node[0])
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
else:
|
||||
spline = Part.BSplineCurve()
|
||||
spline.interpolate(self.node, False)
|
||||
self.obj.Shape = spline.toShape()
|
||||
_msg(translate("draft", "Pick next point"))
|
||||
_toolmsg(translate("draft", "Pick next point"))
|
||||
|
||||
def finish(self, cont=False, closed=False):
|
||||
"""Terminate the operation and close the spline if asked.
|
||||
|
||||
@@ -38,7 +38,7 @@ import DraftVecUtils
|
||||
import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -61,7 +61,7 @@ class Split(gui_base_original.Modifier):
|
||||
super(Split, self).Activated(name="Split")
|
||||
if not self.ui:
|
||||
return
|
||||
_msg(translate("draft", "Click anywhere on a line to split it."))
|
||||
_toolmsg(translate("draft", "Click anywhere on a line to split it."))
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
|
||||
def action(self, arg):
|
||||
|
||||
@@ -46,7 +46,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _msg, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -124,7 +124,7 @@ class Stretch(gui_base_original.Modifier):
|
||||
swidth=2)
|
||||
self.nodetracker = []
|
||||
self.displacement = None
|
||||
_msg(translate("draft", "Pick first point of selection rectangle"))
|
||||
_toolmsg(translate("draft", "Pick first point of selection rectangle"))
|
||||
|
||||
def action(self, arg):
|
||||
"""Handle the 3D scene events.
|
||||
@@ -158,7 +158,7 @@ class Stretch(gui_base_original.Modifier):
|
||||
"""Add point to defined selection rectangle."""
|
||||
if self.step == 1:
|
||||
# first rctangle point
|
||||
_msg(translate("draft", "Pick opposite point "
|
||||
_toolmsg(translate("draft", "Pick opposite point "
|
||||
"of selection rectangle"))
|
||||
self.ui.setRelative(-1)
|
||||
self.rectracker.setorigin(point)
|
||||
@@ -168,7 +168,7 @@ class Stretch(gui_base_original.Modifier):
|
||||
self.step = 2
|
||||
elif self.step == 2:
|
||||
# second rectangle point
|
||||
_msg(translate("draft", "Pick start point of displacement"))
|
||||
_toolmsg(translate("draft", "Pick start point of displacement"))
|
||||
self.ui.setRelative(-2)
|
||||
self.rectracker.off()
|
||||
nodes = []
|
||||
@@ -232,7 +232,7 @@ class Stretch(gui_base_original.Modifier):
|
||||
self.step = 3
|
||||
elif self.step == 3:
|
||||
# first point of displacement line
|
||||
_msg(translate("draft", "Pick end point of displacement"))
|
||||
_toolmsg(translate("draft", "Pick end point of displacement"))
|
||||
self.displacement = point
|
||||
# print("first point:", point)
|
||||
self.node = [point]
|
||||
|
||||
@@ -43,7 +43,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from draftutils.translate import translate
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.messages import _toolmsg
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
True if Draft_rc.__name__ else False
|
||||
@@ -73,7 +73,7 @@ class Text(gui_base_original.Creator):
|
||||
self.active = True
|
||||
self.ui.xValue.setFocus()
|
||||
self.ui.xValue.selectAll()
|
||||
_msg(translate("draft", "Pick location point"))
|
||||
_toolmsg(translate("draft", "Pick location point"))
|
||||
|
||||
def finish(self, cont=False):
|
||||
"""Terminate the operation.
|
||||
|
||||
@@ -51,7 +51,7 @@ import draftguitools.gui_base_original as gui_base_original
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
import draftguitools.gui_trackers as trackers
|
||||
|
||||
from draftutils.messages import _msg, _err
|
||||
from draftutils.messages import _msg, _err, _toolmsg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -170,7 +170,7 @@ class Trimex(gui_base_original.Modifier):
|
||||
self.force = None
|
||||
self.cv = None
|
||||
self.call = self.view.addEventCallback("SoEvent", self.action)
|
||||
_msg(translate("draft", "Pick distance"))
|
||||
_toolmsg(translate("draft", "Pick distance"))
|
||||
|
||||
def action(self, arg):
|
||||
"""Handle the 3D scene events.
|
||||
|
||||
@@ -35,6 +35,8 @@ added manually.
|
||||
# @{
|
||||
import FreeCAD as App
|
||||
|
||||
params = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
||||
|
||||
def _msg(text, end="\n"):
|
||||
"""Write messages to the console including the line ending."""
|
||||
@@ -55,4 +57,10 @@ def _log(text, end="\n"):
|
||||
"""Write messages to the log file including the line ending."""
|
||||
App.Console.PrintLog(text + end)
|
||||
|
||||
def _toolmsg(text, end="\n"):
|
||||
"""Write messages to the console including the line ending,
|
||||
only if ToolMessages pref setting is True"""
|
||||
if params.GetBool("ToolMessages", False):
|
||||
App.Console.PrintMessage(text + end)
|
||||
|
||||
## @}
|
||||
|
||||
Reference in New Issue
Block a user