Translation cleanup. Setupsheet related files. Simple copy, simulator

This commit is contained in:
sliptonic
2022-01-04 14:45:36 -06:00
parent 3217352194
commit c7a20f2876
5 changed files with 44 additions and 58 deletions

View File

@@ -25,21 +25,21 @@ import PathScripts.PathGeom as PathGeom
import PathScripts.PathLog as PathLog
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
import PathScripts.PathUtil as PathUtil
import PySide
from PySide.QtCore import QT_TRANSLATE_NOOP
__title__ = "Setup Sheet for a Job."
__author__ = "sliptonic (Brad Collette)"
__url__ = "https://www.freecadweb.org"
__doc__ = "A container for all default values and job specific configuration values."
_RegisteredOps = {}
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# PathLog.trackModule(PathLog.thisModule())
_RegisteredOps: dict = {}
def translate(context, text, disambig=None):
return PySide.QtCore.QCoreApplication.translate(context, text, disambig)
if False:
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
PathLog.trackModule(PathLog.thisModule())
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
class Template:
@@ -114,34 +114,36 @@ class SetupSheet:
"App::PropertySpeed",
"VertRapid",
"ToolController",
translate("PathSetupSheet", "Default speed for horizontal rapid moves."),
QT_TRANSLATE_NOOP(
"App::Property", "Default speed for horizontal rapid moves."
),
)
obj.addProperty(
"App::PropertySpeed",
"HorizRapid",
"ToolController",
translate("PathSetupSheet", "Default speed for vertical rapid moves."),
QT_TRANSLATE_NOOP(
"App::Property", "Default speed for vertical rapid moves."
),
)
obj.addProperty(
"App::PropertyStringList",
"CoolantModes",
"CoolantMode",
translate("PathSetupSheet", "Coolant Modes"),
QT_TRANSLATE_NOOP("App::Property", "Coolant Modes"),
)
obj.addProperty(
"App::PropertyEnumeration",
"CoolantMode",
"CoolantMode",
translate("PathSetupSheet", "Default coolant mode."),
QT_TRANSLATE_NOOP("App::Property", "Default coolant mode."),
)
obj.addProperty(
"App::PropertyLength",
"SafeHeightOffset",
"OperationHeights",
translate(
"PathSetupSheet",
QT_TRANSLATE_NOOP(
"App::Property",
"The usage of this field depends on SafeHeightExpression - by default its value is added to StartDepth and used for SafeHeight of an operation.",
),
)
@@ -149,16 +151,16 @@ class SetupSheet:
"App::PropertyString",
"SafeHeightExpression",
"OperationHeights",
translate(
"PathSetupSheet", "Expression set for the SafeHeight of new operations."
QT_TRANSLATE_NOOP(
"App::Property", "Expression set for the SafeHeight of new operations."
),
)
obj.addProperty(
"App::PropertyLength",
"ClearanceHeightOffset",
"OperationHeights",
translate(
"PathSetupSheet",
QT_TRANSLATE_NOOP(
"App::Property",
"The usage of this field depends on ClearanceHeightExpression - by default is value is added to StartDepth and used for ClearanceHeight of an operation.",
),
)
@@ -166,34 +168,33 @@ class SetupSheet:
"App::PropertyString",
"ClearanceHeightExpression",
"OperationHeights",
translate(
"PathSetupSheet",
QT_TRANSLATE_NOOP(
"App::Property",
"Expression set for the ClearanceHeight of new operations.",
),
)
obj.addProperty(
"App::PropertyString",
"StartDepthExpression",
"OperationDepths",
translate(
"PathSetupSheet", "Expression used for StartDepth of new operations."
QT_TRANSLATE_NOOP(
"App::Property", "Expression used for StartDepth of new operations."
),
)
obj.addProperty(
"App::PropertyString",
"FinalDepthExpression",
"OperationDepths",
translate(
"PathSetupSheet", "Expression used for FinalDepth of new operations."
QT_TRANSLATE_NOOP(
"App::Property", "Expression used for FinalDepth of new operations."
),
)
obj.addProperty(
"App::PropertyString",
"StepDownExpression",
"OperationDepths",
translate(
"PathSetupSheet", "Expression used for StepDown of new operations."
QT_TRANSLATE_NOOP(
"App::Property", "Expression used for StepDown of new operations."
),
)
@@ -403,7 +404,6 @@ class SetupSheet:
setattr(obj, prop, getattr(self.obj, propName))
except Exception:
PathLog.info("SetupSheet has no support for {}".format(opName))
# traceback.print_exc()
def onDocumentRestored(self, obj):
@@ -412,7 +412,7 @@ class SetupSheet:
"App::PropertyStringList",
"CoolantModes",
"CoolantMode",
translate("PathSetupSheet", "Coolant Modes"),
QT_TRANSLATE_NOOP("App::Property", "Coolant Modes"),
)
obj.CoolantModes = self.DefaultCoolantModes
@@ -421,7 +421,7 @@ class SetupSheet:
"App::PropertyEnumeration",
"CoolantMode",
"CoolantMode",
translate("PathSetupSheet", "Default coolant mode."),
QT_TRANSLATE_NOOP("App::Property", "Default coolant mode."),
)
obj.CoolantMode = self.DefaultCoolantModes

View File

@@ -38,14 +38,8 @@ __url__ = "https://www.freecadweb.org"
__doc__ = "Task panel editor for a SetupSheet"
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
LOGLEVEL = False
if LOGLEVEL:
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
PathLog.trackModule(PathLog.thisModule())
@@ -388,9 +382,7 @@ class TaskPanel:
self.globalEditor = GlobalEditor(self.obj, self.globalForm)
self.opsEditor = OpsDefaultEditor(self.obj, None)
self.form = [op.form for op in self.opsEditor.ops] + [self.globalForm]
FreeCAD.ActiveDocument.openTransaction(
translate("Path_SetupSheet", "Edit SetupSheet")
)
FreeCAD.ActiveDocument.openTransaction("Edit SetupSheet")
def reject(self):
self.globalEditor.reject()
@@ -432,7 +424,7 @@ class TaskPanel:
def Create(name="SetupSheet"):
"""Create(name='SetupSheet') ... creates a new setup sheet"""
FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job"))
FreeCAD.ActiveDocument.openTransaction("Create Job")
ssheet = PathSetupSheet.Create(name)
PathIconViewProvider.Attach(ssheet, name)
return ssheet

View File

@@ -31,10 +31,6 @@ __author__ = "sliptonic (Brad Collette)"
__url__ = "https://www.freecadweb.org"
__doc__ = "Task panel editor for a SetupSheet"
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
LOGLEVEL = False

View File

@@ -23,22 +23,19 @@
import FreeCAD
import FreeCADGui
import PathScripts
from PySide import QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
__doc__ = """Path SimpleCopy command"""
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
translate = FreeCAD.Qt.translate
class CommandPathSimpleCopy:
def GetResources(self):
return {
"Pixmap": "Path_SimpleCopy",
"MenuText": QtCore.QT_TRANSLATE_NOOP("Path_SimpleCopy", "Simple Copy"),
"ToolTip": QtCore.QT_TRANSLATE_NOOP(
"MenuText": QT_TRANSLATE_NOOP("Path_SimpleCopy", "Simple Copy"),
"ToolTip": QT_TRANSLATE_NOOP(
"Path_SimpleCopy", "Creates a non-parametric copy of another path"
),
}
@@ -68,9 +65,7 @@ class CommandPathSimpleCopy:
)
return
FreeCAD.ActiveDocument.openTransaction(
translate("Path_SimpleCopy", "Simple Copy")
)
FreeCAD.ActiveDocument.openTransaction("Simple Copy")
FreeCADGui.doCommand(
"srcpath = FreeCADGui.Selection.getSelectionEx()[0].Object.Path\n"
)

View File

@@ -31,6 +31,7 @@ import PathScripts.PathJob as PathJob
import PathSimulator
import math
import os
from PySide.QtCore import QT_TRANSLATE_NOOP
from FreeCAD import Vector, Base
@@ -310,7 +311,9 @@ class PathSimulation:
self.stock = newStock.removeSplitter()
except Exception:
if self.debug:
print("invalid cut at cmd #{}".format(self.icmd))
FreeCAD.Console.PrintError(
"invalid cut at cmd #{}".format(self.icmd)
)
if not self.disableAnim:
self.cutTool.Placement = FreeCAD.Placement(self.curpos, self.stdrot)
self.icmd += 1
@@ -619,9 +622,9 @@ class CommandPathSimulate:
def GetResources(self):
return {
"Pixmap": "Path_Simulator",
"MenuText": QtCore.QT_TRANSLATE_NOOP("Path_Simulator", "CAM Simulator"),
"MenuText": QT_TRANSLATE_NOOP("Path_Simulator", "CAM Simulator"),
"Accel": "P, M",
"ToolTip": QtCore.QT_TRANSLATE_NOOP(
"ToolTip": QT_TRANSLATE_NOOP(
"Path_Simulator", "Simulate Path G-Code on stock"
),
}