diff --git a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui b/src/Mod/Path/Gui/Resources/panels/PathEdit.ui
index fbcba83956..2f5d02dbf2 100644
--- a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PathEdit.ui
@@ -31,8 +31,8 @@
0
0
- 146
- 378
+ 561
+ 675
@@ -112,8 +112,8 @@
0
0
- 96
- 26
+ 98
+ 28
@@ -205,21 +205,6 @@
<html><head/><body><p>Ordering by Fixture, will cause all operations to be performed in the first coordinate system before switching to the second. Then all operations will be performed there in the same order.</p><p>This is useful if the operator can safely load work into one coordinate system while the machine is doing work in another.</p><p>Ordering by Tool, will minimize the Tool Changes. A tool change will be done, then all operations in all coordinate systems before changing tools.</p><p>Ordering by operation will do each operation in all coordinate systems before moving to the next operation. This is especially useful in conjunction with the 'split output' even with only a single work coordinate system since it will put each operation into a separate file</p></body></html>
- -
-
- Fixture
-
-
- -
-
- Tool
-
-
- -
-
- Operation
-
-
-
@@ -251,7 +236,7 @@
- <html><head/><body><p><span style=" font-style:italic;">Work Coordinate Systems</span> also called <span style=" font-style:italic;">Work Offsets</span>, <span style=" font-style:italic;">Fixture Offsets</span>, or <span style=" font-style:italic;">Fixtures </span>are useful for building efficient production jobs where the same part is done many times on the machine.</p><p>FreeCAD has no knowledge of where a particular coordinate system exists within the machine coordinate system so adding additional coordinate systems to your job will have no visual change within your job. It will, however, change your gcode output. The exact way in which the output is affected is controlled by the 'order by' setting.</p></body></html>
+ <html><head/><body><p><span style=" font-style:italic;">Work Coordinate Systems</span> also called <span style=" font-style:italic;">Work Offsets</span>, <span style=" font-style:italic;">Fixture Offsets</span>, or <span style=" font-style:italic;">Fixtures </span>are useful for building efficient production jobs where the same part is done many times on the machine.</p><p>FreeCAD has no knowledge of where a particular coordinate system exists within the machine coordinate system so adding additional coordinate systems to your job will have no visual change within your job. It will, however, change your gcode output. The exact way in which the output is affected is controlled by the 'order by' setting.</p></body></html>
QListView::Adjust
@@ -404,7 +389,7 @@
<html><head/><body><p>If multiple coordinate systems are in use, setting this to TRUE will cause the gcode to be written to multiple output files as controlled by the 'order by' property. For example, if ordering by Fixture, the first output file will be for the first fixture and separate file for the second.</p><p><br/></p><p><br/></p></body></html>
- <html><head/><body><p>If True, post-processing will create multiple output files based on the <span style=" font-style:italic;">order by</span> setting.</p><p><br/></p><p>For example, if <span style=" font-style:italic;">order by</span> is set to Tool, the first output file will contain the first tool change and all operations, in all coordinate systems, that can be done with that tool before the next tool change is called.</p><p><br/></p><p>If <span style=" font-style:italic;">order by</span> is set to <span style=" font-style:italic;">operation</span> and <span style=" font-style:italic;">split output</span> is true, each operation will be written to a separate file.</p></body></html>
+ <html><head/><body><p>If True, post-processing will create multiple output files based on the <span style=" font-style:italic;">order by</span> setting.</p><p><br/></p><p>For example, if <span style=" font-style:italic;">order by</span> is set to Tool, the first output file will contain the first tool change and all operations, in all coordinate systems, that can be done with that tool before the next tool change is called.</p><p><br/></p><p>If <span style=" font-style:italic;">order by</span> is set to <span style=" font-style:italic;">operation</span> and <span style=" font-style:italic;">split output</span> is true, each operation will be written to a separate file.</p></body></html>
Split Output
@@ -424,15 +409,15 @@
-
- 0
+ 1
0
0
- 545
- 896
+ 548
+ 941
@@ -1002,8 +987,8 @@
0
0
- 213
- 321
+ 561
+ 675
@@ -1185,8 +1170,8 @@
0
0
- 317
- 173
+ 561
+ 675
@@ -1285,8 +1270,8 @@
0
0
- 138
- 112
+ 151
+ 119
diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py
index 5f21da0c40..72d1085c9d 100644
--- a/src/Mod/Path/PathScripts/PathJob.py
+++ b/src/Mod/Path/PathScripts/PathJob.py
@@ -20,6 +20,9 @@
# * *
# ***************************************************************************
+from PathScripts.PathPostProcessor import PostProcessor
+from PySide import QtCore
+from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import PathScripts.PathLog as PathLog
import PathScripts.PathPreferences as PathPreferences
@@ -29,8 +32,7 @@ import PathScripts.PathToolController as PathToolController
import PathScripts.PathUtil as PathUtil
import json
import time
-from PathScripts.PathPostProcessor import PostProcessor
-from PySide import QtCore
+
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
@@ -38,12 +40,13 @@ from lazy_loader.lazy_loader import LazyLoader
Draft = LazyLoader("Draft", globals(), "Draft")
-PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
+if False:
+ PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
+ PathLog.trackModule(PathLog.thisModule())
+else:
+ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
-
-# Qt translation handling
-def translate(context, text, disambig=None):
- return QtCore.QCoreApplication.translate(context, text, disambig)
+translate = FreeCAD.Qt.translate
class JobTemplate:
@@ -111,34 +114,35 @@ class ObjectJob:
"App::PropertyFile",
"PostProcessorOutputFile",
"Output",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "The NC output file for this project"),
+ QT_TRANSLATE_NOOP("App::Property", "The NC output file for this project"),
)
obj.addProperty(
"App::PropertyEnumeration",
"PostProcessor",
"Output",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Select the Post Processor"),
+ QT_TRANSLATE_NOOP("App::Property", "Select the Post Processor"),
)
obj.addProperty(
"App::PropertyString",
"PostProcessorArgs",
"Output",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "Arguments for the Post Processor (specific to the script)"
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "Arguments for the Post Processor (specific to the script)",
),
)
obj.addProperty(
"App::PropertyString",
"LastPostProcessDate",
"Output",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Last Time the Job was post-processed"),
+ QT_TRANSLATE_NOOP("App::Property", "Last Time the Job was post-processed"),
)
obj.setEditorMode("LastPostProcessDate", 2) # Hide
obj.addProperty(
"App::PropertyString",
"LastPostProcessOutput",
"Output",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Last Time the Job was post-processed"),
+ QT_TRANSLATE_NOOP("App::Property", "Last Time the Job was post-processed"),
)
obj.setEditorMode("LastPostProcessOutput", 2) # Hide
@@ -146,21 +150,21 @@ class ObjectJob:
"App::PropertyString",
"Description",
"Path",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "An optional description for this job"),
+ QT_TRANSLATE_NOOP("App::Property", "An optional description for this job"),
)
obj.addProperty(
"App::PropertyString",
"CycleTime",
"Path",
- QtCore.QT_TRANSLATE_NOOP("PathOp", "Job Cycle Time Estimation"),
+ QT_TRANSLATE_NOOP("App::Property", "Job Cycle Time Estimation"),
)
obj.setEditorMode("CycleTime", 1) # read-only
obj.addProperty(
"App::PropertyDistance",
"GeometryTolerance",
"Geometry",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
"For computing Paths; smaller increases accuracy, but slows down computation",
),
)
@@ -169,14 +173,14 @@ class ObjectJob:
"App::PropertyLink",
"Stock",
"Base",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Solid object to be used as stock."),
+ QT_TRANSLATE_NOOP("App::Property", "Solid object to be used as stock."),
)
obj.addProperty(
"App::PropertyLink",
"Operations",
"Base",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
"Compound path of all operations in the order they are processed.",
),
)
@@ -185,7 +189,7 @@ class ObjectJob:
"App::PropertyEnumeration",
"JobType",
"Base",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Select the Type of Job"),
+ QT_TRANSLATE_NOOP("App::Property", "Select the Type of Job"),
)
obj.setEditorMode("JobType", 2) # Hide
@@ -193,30 +197,31 @@ class ObjectJob:
"App::PropertyBool",
"SplitOutput",
"Output",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "Split output into multiple gcode files"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Split output into multiple gcode files"
),
)
obj.addProperty(
"App::PropertyEnumeration",
"OrderOutputBy",
"WCS",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "If multiple WCS, order the output this way"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "If multiple WCS, order the output this way"
),
)
obj.addProperty(
"App::PropertyStringList",
"Fixtures",
"WCS",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "The Work Coordinate Systems for the Job"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "The Work Coordinate Systems for the Job"
),
)
- obj.OrderOutputBy = ["Fixture", "Tool", "Operation"]
+
obj.Fixtures = ["G54"]
- obj.JobType = ["2D", "2.5D", "Lathe", "Multiaxis"]
+ for n in self.propertyEnumerations():
+ setattr(obj, n[0], n[1])
obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile()
obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors()
@@ -236,6 +241,45 @@ class ObjectJob:
self.setFromTemplateFile(obj, templateFile)
self.setupStock(obj)
+ @classmethod
+ def propertyEnumerations(self, dataType="data"):
+ """propertyEnumerations(dataType="data")... return property enumeration lists of specified dataType.
+ Args:
+ dataType = 'data', 'raw', 'translated'
+ Notes:
+ 'data' is list of internal string literals used in code
+ 'raw' is list of (translated_text, data_string) tuples
+ 'translated' is list of translated string literals
+ """
+
+ enums = {
+ "OrderOutputBy": [
+ (translate("Path_Job", "Fixture"), "Fixture"),
+ (translate("Path_Job", "Tool"), "Tool"),
+ (translate("Path_Job", "Operation"), "Operation"),
+ ],
+ "JobType": [
+ (translate("Path_Job", "2D"), "2D"),
+ (translate("Path_Job", "2.5D"), "2.5D"),
+ (translate("Path_Job", "Lathe"), "Lathe"),
+ (translate("Path_Job", "Multiaxis"), "Multiaxis"),
+ ],
+ }
+
+ if dataType == "raw":
+ return enums
+
+ data = list()
+ idx = 0 if dataType == "translated" else 1
+
+ PathLog.debug(enums)
+
+ for k, v in enumerate(enums):
+ data.append((v, [tup[idx] for tup in enums[v]]))
+ PathLog.debug(data)
+
+ return data
+
def setupOperations(self, obj):
"""setupOperations(obj)... setup the Operations group for the Job object."""
ops = FreeCAD.ActiveDocument.addObject(
@@ -255,8 +299,8 @@ class ObjectJob:
"App::PropertyLink",
"SetupSheet",
"Base",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "SetupSheet holding the settings for this job"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "SetupSheet holding the settings for this job"
),
)
obj.SetupSheet = PathSetupSheet.Create()
@@ -278,8 +322,8 @@ class ObjectJob:
"App::PropertyLink",
"Model",
"Base",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "The base objects for all operations"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "The base objects for all operations"
),
)
addModels = True
@@ -314,8 +358,8 @@ class ObjectJob:
"App::PropertyLink",
"Tools",
"Base",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "Collection of all tool controllers for the job"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Collection of all tool controllers for the job"
),
)
addTable = True
@@ -451,7 +495,7 @@ class ObjectJob:
"App::PropertyString",
"CycleTime",
"Path",
- QtCore.QT_TRANSLATE_NOOP("PathOp", "Operations Cycle Time Estimation"),
+ QT_TRANSLATE_NOOP("App::Property", "Operations Cycle Time Estimation"),
)
obj.setEditorMode("CycleTime", 1) # read-only
@@ -460,8 +504,8 @@ class ObjectJob:
"App::PropertyStringList",
"Fixtures",
"WCS",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "The Work Coordinate Systems for the Job"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "The Work Coordinate Systems for the Job"
),
)
obj.Fixtures = ["G54"]
@@ -471,8 +515,8 @@ class ObjectJob:
"App::PropertyEnumeration",
"OrderOutputBy",
"WCS",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "If multiple WCS, order the output this way"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "If multiple WCS, order the output this way"
),
)
obj.OrderOutputBy = ["Fixture", "Tool", "Operation"]
@@ -482,8 +526,8 @@ class ObjectJob:
"App::PropertyBool",
"SplitOutput",
"Output",
- QtCore.QT_TRANSLATE_NOOP(
- "PathJob", "Split output into multiple gcode files"
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Split output into multiple gcode files"
),
)
obj.SplitOutput = False
@@ -493,11 +537,12 @@ class ObjectJob:
"App::PropertyEnumeration",
"JobType",
"Base",
- QtCore.QT_TRANSLATE_NOOP("PathJob", "Select the Type of Job"),
+ QT_TRANSLATE_NOOP("App::Property", "Select the Type of Job"),
)
obj.setEditorMode("JobType", 2) # Hide
- obj.JobType = ["2D", "2.5D", "Lathe", "Multiaxis"]
+ for n in self.propertyEnumerations():
+ setattr(obj, n[0], n[1])
def onChanged(self, obj, prop):
if prop == "PostProcessor" and obj.PostProcessor:
@@ -577,9 +622,11 @@ class ObjectJob:
obj.Tools.Group = tcs
else:
PathLog.error(
- translate("PathJob", "Unsupported PathJob template version %s")
- % attrs.get(JobTemplate.Version)
+ "Unsupported PathJob template version {}".format(
+ attrs.get(JobTemplate.Version)
+ )
)
+
if not tcs:
self.addToolController(PathToolController.Create())
@@ -733,9 +780,7 @@ class ObjectJob:
suffix = job.Name[3:]
def errorMessage(grp, job):
- PathLog.error(
- translate("PathJobGui", "{} corrupt in {} job.".format(grp, job.Name))
- )
+ PathLog.error("{} corrupt in {} job.".format(grp, job.Name))
if not job.Operations:
self.setupOperations(job)
diff --git a/src/Mod/Path/PathScripts/PathJobCmd.py b/src/Mod/Path/PathScripts/PathJobCmd.py
index 0e4ea2607c..9f20533619 100644
--- a/src/Mod/Path/PathScripts/PathJobCmd.py
+++ b/src/Mod/Path/PathScripts/PathJobCmd.py
@@ -20,6 +20,8 @@
# * *
# ***************************************************************************
+from PySide import QtCore, QtGui
+from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import PathScripts.PathJob as PathJob
@@ -31,16 +33,14 @@ import PathScripts.PathUtil as PathUtil
import json
import os
-from PySide import QtCore, QtGui
+translate = FreeCAD.Qt.translate
-# Qt translation handling
-def translate(context, text, disambig=None):
- return QtCore.QCoreApplication.translate(context, text, disambig)
-
-
-PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
-# PathLog.trackModule(PathLog.thisModule())
+if False:
+ PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
+ PathLog.trackModule(PathLog.thisModule())
+else:
+ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
class CommandJobCreate:
@@ -56,9 +56,9 @@ class CommandJobCreate:
def GetResources(self):
return {
"Pixmap": "Path_Job",
- "MenuText": QtCore.QT_TRANSLATE_NOOP("Path_Job", "Job"),
+ "MenuText": QT_TRANSLATE_NOOP("Path_Job", "Job"),
"Accel": "P, J",
- "ToolTip": QtCore.QT_TRANSLATE_NOOP(
+ "ToolTip": QT_TRANSLATE_NOOP(
"Path_Job", "Creates a Path Job object"
),
}
@@ -102,9 +102,9 @@ class CommandJobTemplateExport:
def GetResources(self):
return {
"Pixmap": "Path_ExportTemplate",
- "MenuText": QtCore.QT_TRANSLATE_NOOP("Path_Job", "Export Template"),
- "ToolTip": QtCore.QT_TRANSLATE_NOOP(
- "Path_Job", "Exports Path Job as a template to be used for other jobs"
+ "MenuText": QT_TRANSLATE_NOOP("Path_ExportTemplate", "Export Template"),
+ "ToolTip": QT_TRANSLATE_NOOP(
+ "Path_ExportTemplate", "Exports Path Job as a template to be used for other jobs"
),
}
diff --git a/src/Mod/Path/PathScripts/PathJobDlg.py b/src/Mod/Path/PathScripts/PathJobDlg.py
index cd15adf863..10c025b1c6 100644
--- a/src/Mod/Path/PathScripts/PathJobDlg.py
+++ b/src/Mod/Path/PathScripts/PathJobDlg.py
@@ -20,6 +20,9 @@
# * *
# ***************************************************************************
+from PySide import QtCore, QtGui
+from collections import Counter
+import FreeCAD
import FreeCADGui
import PathScripts.PathJob as PathJob
import PathScripts.PathLog as PathLog
@@ -29,17 +32,14 @@ import PathScripts.PathUtil as PathUtil
import glob
import os
-from PySide import QtCore, QtGui
-from collections import Counter
+translate = FreeCAD.Qt.translate
-# Qt translation handling
-def translate(context, text, disambig=None):
- return QtCore.QCoreApplication.translate(context, text, disambig)
-
-
-PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
-# PathLog.trackModule(PathLog.thisModule())
+if False:
+ PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
+ PathLog.trackModule(PathLog.thisModule())
+else:
+ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
class _ItemDelegate(QtGui.QStyledItemDelegate):
@@ -60,9 +60,9 @@ class JobCreate:
def __init__(self, parent=None, sel=None):
# pylint: disable=unused-argument
self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobCreate.ui")
- self.itemsSolid = QtGui.QStandardItem(translate("PathJob", "Solids"))
- self.items2D = QtGui.QStandardItem(translate("PathJob", "2D"))
- self.itemsJob = QtGui.QStandardItem(translate("PathJob", "Jobs"))
+ self.itemsSolid = QtGui.QStandardItem(translate("Path_Job", "Solids"))
+ self.items2D = QtGui.QStandardItem(translate("Path_Job", "2D"))
+ self.itemsJob = QtGui.QStandardItem(translate("Path_Job", "Jobs"))
self.dialog.templateGroup.hide()
self.dialog.modelGroup.hide()
# debugging support
@@ -331,7 +331,7 @@ class JobTemplateExport:
stockType = PathStock.StockType.FromStock(job.Stock)
if stockType == PathStock.StockType.FromBase:
seHint = translate(
- "PathJob", "Base -/+ %.2f/%.2f %.2f/%.2f %.2f/%.2f"
+ "Path_Job", "Base -/+ %.2f/%.2f %.2f/%.2f %.2f/%.2f"
) % (
job.Stock.ExtXneg,
job.Stock.ExtXpos,
@@ -342,19 +342,19 @@ class JobTemplateExport:
)
self.dialog.stockPlacement.setChecked(False)
elif stockType == PathStock.StockType.CreateBox:
- seHint = translate("PathJob", "Box: %.2f x %.2f x %.2f") % (
+ seHint = translate("Path_Job", "Box: %.2f x %.2f x %.2f") % (
job.Stock.Length,
job.Stock.Width,
job.Stock.Height,
)
elif stockType == PathStock.StockType.CreateCylinder:
- seHint = translate("PathJob", "Cylinder: %.2f x %.2f") % (
+ seHint = translate("Path_Job", "Cylinder: %.2f x %.2f") % (
job.Stock.Radius,
job.Stock.Height,
)
else:
seHint = "-"
- PathLog.error(translate("PathJob", "Unsupported stock type"))
+ PathLog.error(translate("Path_Job", "Unsupported stock type"))
self.dialog.stockExtentHint.setText(seHint)
spHint = "%s" % job.Stock.Placement
self.dialog.stockPlacementHint.setText(spHint)
diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py
index ff040ce98a..1f3eb6a1e3 100644
--- a/src/Mod/Path/PathScripts/PathJobGui.py
+++ b/src/Mod/Path/PathScripts/PathJobGui.py
@@ -25,27 +25,25 @@ from PySide import QtCore, QtGui
from collections import Counter
from contextlib import contextmanager
from pivy import coin
-import json
-import math
-import traceback
-
import FreeCAD
import FreeCADGui
-
+import PathScripts.PathGeom as PathGeom
+import PathScripts.PathGuiInit as PathGuiInit
import PathScripts.PathJob as PathJob
import PathScripts.PathJobCmd as PathJobCmd
import PathScripts.PathJobDlg as PathJobDlg
-import PathScripts.PathGeom as PathGeom
-import PathScripts.PathGuiInit as PathGuiInit
import PathScripts.PathLog as PathLog
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathSetupSheetGui as PathSetupSheetGui
import PathScripts.PathStock as PathStock
+import PathScripts.PathToolBitGui as PathToolBitGui
import PathScripts.PathToolControllerGui as PathToolControllerGui
import PathScripts.PathToolLibraryEditor as PathToolLibraryEditor
import PathScripts.PathUtil as PathUtil
import PathScripts.PathUtils as PathUtils
-import PathScripts.PathToolBitGui as PathToolBitGui
+import json
+import math
+import traceback
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
@@ -54,14 +52,13 @@ Draft = LazyLoader("Draft", globals(), "Draft")
Part = LazyLoader("Part", globals(), "Part")
DraftVecUtils = LazyLoader("DraftVecUtils", globals(), "DraftVecUtils")
+translate = FreeCAD.Qt.translate
-# Qt translation handling
-def translate(context, text, disambig=None):
- return QtCore.QCoreApplication.translate(context, text, disambig)
-
-
-PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
-# PathLog.trackModule(PathLog.thisModule())
+if False:
+ PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
+ PathLog.trackModule(PathLog.thisModule())
+else:
+ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
def _OpenCloseResourceEditor(obj, vobj, edit):
@@ -282,7 +279,7 @@ class ViewProvider:
PathLog.track()
for action in menu.actions():
menu.removeAction(action)
- action = QtGui.QAction(translate("Path", "Edit"), menu)
+ action = QtGui.QAction(translate("Path_Job", "Edit"), menu)
action.triggered.connect(self.setEdit)
menu.addAction(action)
@@ -387,7 +384,7 @@ class StockFromBaseBoundBoxEdit(StockEdit):
if self.IsStock(obj):
self.getFieldsStock(obj.Stock, fields)
else:
- PathLog.error(translate("PathJob", "Stock not from Base bound box!"))
+ PathLog.error("Stock not from Base bound box!")
def setFields(self, obj):
PathLog.track()
@@ -479,7 +476,7 @@ class StockCreateBoxEdit(StockEdit):
self.form.stockBoxHeight.text()
)
else:
- PathLog.error(translate("PathJob", "Stock not a box!"))
+ PathLog.error("Stock not a box!")
except Exception:
pass
@@ -525,7 +522,7 @@ class StockCreateCylinderEdit(StockEdit):
self.form.stockCylinderHeight.text()
)
else:
- PathLog.error(translate("PathJob", "Stock not a cylinder!"))
+ PathLog.error(translate("Path_Job", "Stock not a cylinder!"))
except Exception:
pass
@@ -609,7 +606,7 @@ class TaskPanel:
DataProperty = QtCore.Qt.ItemDataRole.UserRole + 1
def __init__(self, vobj, deleteOnReject):
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job"))
+ FreeCAD.ActiveDocument.openTransaction("Edit Job")
self.vobj = vobj
self.vproxy = vobj.Proxy
self.obj = vobj.Object
@@ -644,6 +641,11 @@ class TaskPanel:
self.form.postProcessorArguments.toolTip()
)
+ # Populate the other comboboxes with enums from the job class
+ comboToPropertyMap = [("orderBy", "OrderOutputBy")]
+ enumTups = PathJob.ObjectJob.propertyEnumerations(dataType="raw")
+ self.populateCombobox(self.form, enumTups, comboToPropertyMap)
+
self.vproxy.setupEditVisibility(self.obj)
self.stockFromBase = None
@@ -659,6 +661,21 @@ class TaskPanel:
self.obj.SetupSheet, self.form
)
+ def populateCombobox(self, form, enumTups, comboBoxesPropertyMap):
+ """fillComboboxes(form, comboBoxesPropertyMap) ... populate comboboxes with translated enumerations
+ ** comboBoxesPropertyMap will be unnecessary if UI files use strict combobox naming protocol.
+ Args:
+ form = UI form
+ enumTups = list of (translated_text, data_string) tuples
+ comboBoxesPropertyMap = list of (translated_text, data_string) tuples
+ """
+ # Load appropriate enumerations in each combobox
+ for cb, prop in comboBoxesPropertyMap:
+ box = getattr(form, cb) # Get the combobox
+ box.clear() # clear the combobox
+ for text, data in enumTups[prop]: # load enumerations
+ box.addItem(text, data)
+
def preCleanup(self):
PathLog.track()
FreeCADGui.Selection.removeObserver(self)
@@ -682,9 +699,7 @@ class TaskPanel:
FreeCAD.ActiveDocument.abortTransaction()
if self.deleteOnReject and FreeCAD.ActiveDocument.getObject(self.name):
PathLog.info("Uncreate Job")
- FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Job", "Uncreate Job")
- )
+ FreeCAD.ActiveDocument.openTransaction("Uncreate Job")
if self.obj.ViewObject.Proxy.onDelete(self.obj.ViewObject, None):
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
FreeCAD.ActiveDocument.commitTransaction()
@@ -1257,7 +1272,7 @@ class TaskPanel:
setupFromExisting()
else:
PathLog.error(
- translate("PathJob", "Unsupported stock object %s")
+ translate("Path_Job", "Unsupported stock object %s")
% self.obj.Stock.Label
)
else:
@@ -1273,7 +1288,7 @@ class TaskPanel:
index = -1
else:
PathLog.error(
- translate("PathJob", "Unsupported stock type %s (%d)")
+ translate("Path_Job", "Unsupported stock type %s (%d)")
% (self.form.stock.currentText(), index)
)
self.stockEdit.activate(self.obj, index == -1)
@@ -1562,7 +1577,7 @@ def Create(base, template=None):
"""Create(base, template) ... creates a job instance for the given base object
using template to configure it."""
FreeCADGui.addModule("PathScripts.PathJob")
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job"))
+ FreeCAD.ActiveDocument.openTransaction("Create Job")
try:
obj = PathJob.Create("Job", base, template)
obj.ViewObject.Proxy = ViewProvider(obj.ViewObject)