Draft: change 'Filled' to 'Make face' in UI

Fixes #19715.

The related parameter has been renamed as well and other references to 'fill mode' have been updated.
This commit is contained in:
Roy-043
2025-02-20 17:15:54 +01:00
committed by Chris Hennes
parent 826ec0d104
commit af20bf003f
16 changed files with 54 additions and 81 deletions

View File

@@ -54,28 +54,6 @@ from draftutils.todo import todo
from draftutils.translate import translate
from draftutils.units import display_external
translate("draft", "Relative")
translate("draft", "Global")
translate("draft", "Continue")
translate("draft", "Close")
translate("draft", "Copy")
translate("draft", "Subelement mode")
translate("draft", "Fill")
translate("draft", "Exit")
translate("draft", "Snap On/Off")
translate("draft", "Increase snap radius")
translate("draft", "Decrease snap radius")
translate("draft", "Restrict X")
translate("draft", "Restrict Y")
translate("draft", "Restrict Z")
translate("draft", "Select edge")
translate("draft", "Add custom snap point")
translate("draft", "Length mode")
translate("draft", "Wipe")
translate("draft", "Set Working Plane")
translate("draft", "Cycle snap object")
translate("draft", "Undo last segment")
def _get_incmd_shortcut(itm):
return params.get_param("inCommandShortcut" + itm).upper()
@@ -184,7 +162,7 @@ class DraftToolBar:
self.textbuffer = []
self.crossedViews = []
self.isTaskOn = False
self.fillmode = True
self.makeFaceMode = True
self.mask = None
self.alock = False
self.x = 0 # coord of the point as displayed in the task panel (global/local and relative/absolute)
@@ -411,7 +389,7 @@ class DraftToolBar:
# update modes from parameters:
self.relativeMode = params.get_param("RelativeMode")
self.globalMode = params.get_param("GlobalMode")
self.fillmode = params.get_param("fillmode")
self.makeFaceMode = params.get_param("MakeFaceMode")
self.continueMode = params.get_param("ContinueMode")
# Note: The order of the calls to self._checkbox() below controls
@@ -420,7 +398,7 @@ class DraftToolBar:
# update checkboxes with parameters and internal modes:
self.isRelative = self._checkbox("isRelative", self.layout, checked=self.relativeMode)
self.isGlobal = self._checkbox("isGlobal", self.layout, checked=self.globalMode)
self.hasFill = self._checkbox("hasFill", self.layout, checked=self.fillmode)
self.makeFace = self._checkbox("makeFace", self.layout, checked=self.makeFaceMode)
self.continueCmd = self._checkbox("continueCmd", self.layout, checked=self.continueMode)
# update checkboxes without parameters and without internal modes:
@@ -477,7 +455,7 @@ class DraftToolBar:
QtCore.QObject.connect(self.isRelative,QtCore.SIGNAL("stateChanged(int)"),self.setRelative)
QtCore.QObject.connect(self.isGlobal,QtCore.SIGNAL("stateChanged(int)"),self.setGlobal)
QtCore.QObject.connect(self.hasFill,QtCore.SIGNAL("stateChanged(int)"),self.setFill)
QtCore.QObject.connect(self.makeFace,QtCore.SIGNAL("stateChanged(int)"),self.setMakeFace)
QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("resized()"),self.relocate)
QtCore.QObject.connect(self.baseWidget,QtCore.SIGNAL("retranslate()"),self.retranslateUi)
@@ -557,12 +535,11 @@ class DraftToolBar:
self.isGlobal.setToolTip(translate(
"draft", "Coordinates relative to global coordinate system."
+ "\nUncheck to use working plane coordinate system"))
self.hasFill.setText(translate(
"draft", "Filled") + " (" + _get_incmd_shortcut("Fill") + ")")
self.hasFill.setToolTip(translate(
"draft", "Check this if the object should appear as filled, "
+ "otherwise it will appear as wireframe.\nNot available if "
+ "Draft preference option 'Use Part Primitives' is enabled"))
self.makeFace.setText(translate(
"draft", "Make face") + " (" + _get_incmd_shortcut("MakeFace") + ")")
self.makeFace.setToolTip(translate(
"draft", "If checked, the object will be filled with a face."
+ "\nNot available if the 'Use Part Primitives' preference is enabled"))
self.finishButton.setText(translate(
"draft", "Finish") + " (" + _get_incmd_shortcut("Exit") + ")")
self.finishButton.setToolTip(translate(
@@ -710,10 +687,10 @@ class DraftToolBar:
self.xValue.setEnabled(True)
self.yValue.setEnabled(True)
if params.get_param("UsePartPrimitives"):
self.hasFill.setEnabled(False)
self.makeFace.setEnabled(False)
else:
self.hasFill.setEnabled(True)
self.hasFill.show()
self.makeFace.setEnabled(True)
self.makeFace.show()
self.finishButton.show()
self.closeButton.show()
self.wipeButton.show()
@@ -863,10 +840,10 @@ class DraftToolBar:
def extUi(self):
if params.get_param("UsePartPrimitives"):
self.hasFill.setEnabled(False)
self.makeFace.setEnabled(False)
else:
self.hasFill.setEnabled(True)
self.hasFill.show()
self.makeFace.setEnabled(True)
self.makeFace.show()
self.continueCmd.show()
def modUi(self):
@@ -981,9 +958,9 @@ class DraftToolBar:
self.displayPoint(self.new_point, self.get_last_point())
self.updateSnapper()
def setFill(self, val):
params.set_param("fillmode", bool(val))
self.fillmode = bool(val)
def setMakeFace(self, val):
params.set_param("MakeFaceMode", bool(val))
self.makeFaceMode = bool(val)
def setCopymode(self, val):
# special value for offset command
@@ -1154,9 +1131,9 @@ class DraftToolBar:
elif txt == _get_incmd_shortcut("Snap"):
self.togglesnap()
spec = True
elif txt == _get_incmd_shortcut("Fill"):
if self.hasFill.isVisible():
self.hasFill.setChecked(not self.hasFill.isChecked())
elif txt == _get_incmd_shortcut("MakeFace"):
if self.makeFace.isVisible():
self.makeFace.setChecked(not self.makeFace.isChecked())
spec = True
elif txt == _get_incmd_shortcut("Continue"):
if self.continueCmd.isVisible():

View File

@@ -165,14 +165,14 @@
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_inCommandShortcutFill">
<widget class="QLabel" name="label_inCommandShortcutMakeFace">
<property name="text">
<string>Fill</string>
<string>Make face</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefLineEdit" name="lineEdit_inCommandShortcutFill">
<widget class="Gui::PrefLineEdit" name="lineEdit_inCommandShortcutMakeFace">
<property name="maximumSize">
<size>
<width>25</width>
@@ -189,7 +189,7 @@
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>inCommandShortcutFill</cstring>
<cstring>inCommandShortcutMakeFace</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>

View File

@@ -212,8 +212,8 @@ class DraftTool:
* the current working plane rotation quaternion as a string
* the support object if available as a string
* the list of nodes inside the `node` attribute as a string
* the string `'True'` or `'False'` depending on the fill mode
of the current tool
* the string `'True'` or `'False'` depending on the make face
setting
"""
# Current plane rotation as a string
qr = self.wp.get_placement().Rotation.Q
@@ -234,13 +234,13 @@ class DraftTool:
points += DraftVecUtils.toString(n)
points += ']'
# Fill mode
# Make face
if self.ui:
fil = str(bool(self.ui.fillmode))
make_face = str(bool(self.ui.makeFace))
else:
fil = "True"
make_face = "True"
return qr, sup, points, fil
return qr, sup, points, make_face
class Creator(DraftTool):

View File

@@ -75,7 +75,7 @@ class Line(gui_base_original.Creator):
elif self.mode == "leader":
self.ui.wireUi(title=title, icon=icon)
self.ui.closeButton.hide()
self.ui.hasFill.hide()
self.ui.makeFace.hide()
else:
self.ui.lineUi(title=title, icon=icon)

View File

@@ -176,7 +176,7 @@ class Rotate(gui_base_original.Modifier):
self.node = [self.point]
self.ui.radiusUi()
self.ui.radiusValue.setText(U.Quantity(0, U.Angle).UserString)
self.ui.hasFill.hide()
self.ui.makeFace.hide()
self.ui.labelRadius.setText(translate("draft", "Base angle"))
self.ui.radiusValue.setToolTip(translate("draft", "The base angle you wish to start the rotation from"))
self.arctrack.setCenter(self.center)
@@ -291,7 +291,7 @@ class Rotate(gui_base_original.Modifier):
for ghost in self.ghosts:
ghost.center(self.center)
self.ui.radiusUi()
self.ui.hasFill.hide()
self.ui.makeFace.hide()
self.ui.labelRadius.setText(translate("draft", "Base angle"))
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)

View File

@@ -69,7 +69,7 @@ class BezCurve(DraftObject):
"The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False
obj.Degree = 3
obj.Continuity = []

View File

@@ -56,7 +56,7 @@ class BSpline(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object")
obj.addProperty("App::PropertyArea","Area", "Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False
obj.Points = []
self.assureProperties(obj)

View File

@@ -62,7 +62,7 @@ class Circle(DraftObject):
obj.addProperty("App::PropertyArea", "Area",
"Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
def onDocumentRestored(self, obj):
super().onDocumentRestored(obj)

View File

@@ -60,7 +60,7 @@ class Ellipse(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property","Area of this object")
obj.addProperty("App::PropertyArea", "Area","Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
def onDocumentRestored(self, obj):
super().onDocumentRestored(obj)

View File

@@ -71,7 +71,7 @@ class Polygon(DraftObject):
"The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
obj.DrawMode = ['inscribed','circumscribed']
obj.FacesNumber = 0
obj.Radius = 1

View File

@@ -66,7 +66,7 @@ class Rectangle(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Length=1
obj.Height=1
obj.Rows=1

View File

@@ -92,7 +92,7 @@ class Wire(DraftObject):
"The area of this object")
obj.addProperty("App::PropertyArea","Area", "Draft",_tip)
obj.MakeFace = params.get_param("fillmode")
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False
def onDocumentRestored(self, obj):

View File

@@ -293,7 +293,7 @@ class DraftModification(test_base.DraftTestCaseDoc):
Draft.upgrade(obj3[0], delete=True)
# when draftifying, upgrade doesn't return a new object
wire = self.doc.ActiveObject
wire.MakeFace = True # make test independent of fillmode parameter
wire.MakeFace = True # make test independent of MakeFaceMode parameter
self.doc.recompute()
_msg(" 4: Result '{0}' ({1})".format(wire.Proxy.Type, wire.TypeId))
self.assertTrue(bool(wire), "'{}' failed".format(operation))
@@ -315,7 +315,7 @@ class DraftModification(test_base.DraftTestCaseDoc):
_msg(" a={0}, b={1}".format(a, b))
_msg(" c={0}, a={1}".format(c, a))
wire = Draft.make_wire([a, b, c, a])
wire.MakeFace = True # make test independent of fillmode parameter
wire.MakeFace = True # make test independent of MakeFaceMode parameter
self.doc.recompute()
# downgrade to face

View File

@@ -393,7 +393,6 @@ def _get_param_dictionary():
"FilletRadius": ("float", 100.0),
"FilletChamferMode": ("bool", False),
"FilletDeleteMode": ("bool", False),
"fillmode": ("bool", True),
"GlobalMode": ("bool", False),
"GridHideInOtherWorkbenches": ("bool", True),
"HatchPatternFile": ("string", hatch_pattern_file),
@@ -404,6 +403,7 @@ def _get_param_dictionary():
"labeltype": ("string", "Custom"),
"LayersManagerHeight": ("int", 320),
"LayersManagerWidth": ("int", 640),
"MakeFaceMode": ("bool", True),
"maxSnapEdges": ("int", 0),
"OffsetCopyMode": ("bool", False),
"Offset_OCC": ("bool", False),

View File

@@ -216,7 +216,7 @@ def get_param_type(param):
"LineSpacing", "DefaultAnnoScaleMultiplier"):
return "float"
elif param in ("selectBaseObjects", "alwaysSnap", "grid",
"fillmode", "DimShowLine",
"MakeFaceMode", "DimShowLine",
"SvgLinesBlack", "dxfStdSize", "SnapBarShowOnlyDuringCommands",
"alwaysShowGrid", "renderPolylineWidth",
"showPlaneTracker", "UsePartPrimitives",

View File

@@ -859,7 +859,7 @@ def drawPolyline(polyline, forceShape=False, num=None):
`dxfCreateDraft` or `dxfCreateSketch` are set, and `forceShape` is `False`
it creates a straight `Draft Wire`.
If the polyline is closed, and the global variable `dxfFillMode`
If the polyline is closed, and the global variable `dxfMakeFaceMode`
is set, it will return a `Part.Face`, otherwise it will return
a `Part.Wire`.
@@ -940,7 +940,7 @@ def drawPolyline(polyline, forceShape=False, num=None):
ob.Placement = placementFromDXFOCS(polyline)
return ob
else:
if polyline.closed and dxfFillMode:
if polyline.closed and dxfMakeFaceMode:
w = Part.Wire(edges)
w.Placement = placementFromDXFOCS(polyline)
return Part.Face(w)
@@ -1116,11 +1116,7 @@ def drawEllipse(ellipse, forceShape=False):
def drawFace(face):
"""Return a Part face (filled) from a list of points.
It takes the points in a `face` and places them in a list,
then appends the first point again to the end.
Only in this way the shape returned appears filled.
"""Return a Part face from a list of points.
Parameters
----------
@@ -1282,7 +1278,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False,
closed : bool, optional
It defaults to `False`. If it is `True` it will create a closed
Wire, closed BSpline, or a filled Face.
Wire, closed BSpline, or a Face.
forceShape : bool, optional
It defaults to `False`. If it is `True` it will try to produce
@@ -1307,7 +1303,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False,
Otherwise it tries producing a `Part.Edge`
(`dxfDiscretizeCurves` or `alwaysDiscretize` are `True`)
or `Part.Face`
if `closed` and the global variable `dxfFillMode` are `True`.
if `closed` and the global variable `dxfMakeFaceMode` are `True`.
To do
-----
@@ -1328,7 +1324,7 @@ def drawSplineIterpolation(verts, closed=False, forceShape=False,
# print(knots)
sp.interpolate(verts)
sh = Part.Wire(sp.toShape())
if closed and dxfFillMode:
if closed and dxfMakeFaceMode:
return Part.Face(sh)
else:
return sh
@@ -4157,7 +4153,7 @@ def readPreferences():
`dxfDiscretizeCurves`, `dxfStarBlocks`, `dxfMakeBlocks`, `dxfJoin`,
`dxfRenderPolylineWidth`, `dxfImportTexts`, `dxfImportLayouts`,
`dxfImportPoints`, `dxfImportHatches`, `dxfUseStandardSize`,
`dxfGetColors`, `dxfUseDraftVisGroups`, `dxfFillMode`,
`dxfGetColors`, `dxfUseDraftVisGroups`, `dxfMakeFaceMode`,
`dxfBrightBackground`, `dxfDefaultColor`, `dxfUseLegacyImporter`,
`dxfExportBlocks`, `dxfScaling`, `dxfUseLegacyExporter`
@@ -4176,7 +4172,7 @@ def readPreferences():
global dxfImportTexts, dxfImportLayouts
global dxfImportPoints, dxfImportHatches, dxfUseStandardSize
global dxfGetColors, dxfUseDraftVisGroups
global dxfFillMode, dxfBrightBackground, dxfDefaultColor
global dxfMakeFaceMode, dxfBrightBackground, dxfDefaultColor
global dxfUseLegacyImporter, dxfExportBlocks, dxfScaling
global dxfUseLegacyExporter
dxfCreatePart = params.get_param("dxfCreatePart")
@@ -4194,7 +4190,7 @@ def readPreferences():
dxfUseStandardSize = params.get_param("dxfStdSize")
dxfGetColors = params.get_param("dxfGetOriginalColors")
dxfUseDraftVisGroups = params.get_param("dxfUseDraftVisGroups")
dxfFillMode = params.get_param("fillmode")
dxfMakeFaceMode = params.get_param("MakeFaceMode")
dxfUseLegacyImporter = params.get_param("dxfUseLegacyImporter")
dxfUseLegacyExporter = params.get_param("dxfUseLegacyExporter")
dxfBrightBackground = isBrightBackground()