translation cleanup (postprocessing files)
This commit is contained in:
@@ -37,17 +37,13 @@ import os
|
||||
from PathScripts.PathPostProcessor import PostProcessor
|
||||
from PySide import QtCore, QtGui
|
||||
from datetime import datetime
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
LOG_MODULE = PathLog.thisModule()
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
|
||||
|
||||
|
||||
# Qt translation handling
|
||||
def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class _TempObject:
|
||||
# pylint: disable=no-init
|
||||
Path = None
|
||||
@@ -183,11 +179,9 @@ class CommandPathPost:
|
||||
def GetResources(self):
|
||||
return {
|
||||
"Pixmap": "Path_Post",
|
||||
"MenuText": QtCore.QT_TRANSLATE_NOOP("Path_Post", "Post Process"),
|
||||
"MenuText": QT_TRANSLATE_NOOP("Path_Post", "Post Process"),
|
||||
"Accel": "P, P",
|
||||
"ToolTip": QtCore.QT_TRANSLATE_NOOP(
|
||||
"Path_Post", "Post Process the selected Job"
|
||||
),
|
||||
"ToolTip": QT_TRANSLATE_NOOP("Path_Post", "Post Process the selected Job"),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
@@ -224,9 +218,7 @@ class CommandPathPost:
|
||||
|
||||
def Activated(self):
|
||||
PathLog.track()
|
||||
FreeCAD.ActiveDocument.openTransaction(
|
||||
translate("Path_Post", "Post Process the Selected path(s)")
|
||||
)
|
||||
FreeCAD.ActiveDocument.openTransaction("Post Process the Selected path(s)")
|
||||
FreeCADGui.addModule("PathScripts.PathPost")
|
||||
|
||||
# Attempt to figure out what the user wants to post-process
|
||||
|
||||
@@ -29,6 +29,8 @@ These are a common functions and classes for creating custom post processors.
|
||||
from PySide import QtCore, QtGui
|
||||
import FreeCAD
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
FreeCADGui = None
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
|
||||
@@ -50,14 +50,14 @@ import re
|
||||
import PathScripts.PathCustom as PathCustom
|
||||
import PathScripts.PathCustomGui as PathCustomGui
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
# LEVEL = PathLog.Level.DEBUG
|
||||
LEVEL = PathLog.Level.INFO
|
||||
PathLog.setLevel(LEVEL, PathLog.thisModule())
|
||||
|
||||
if LEVEL == PathLog.Level.DEBUG:
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
|
||||
# to distinguish python built-in open function from the one declared below
|
||||
@@ -66,7 +66,7 @@ if open.__module__ in ["__builtin__", "io"]:
|
||||
|
||||
|
||||
def open(filename):
|
||||
"called when freecad opens a file."
|
||||
"""called when freecad opens a file."""
|
||||
PathLog.track(filename)
|
||||
docname = os.path.splitext(os.path.basename(filename))[0]
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
@@ -83,7 +83,7 @@ def matchToolController(op, toolnumber):
|
||||
|
||||
|
||||
def insert(filename, docname):
|
||||
"called when freecad imports a file"
|
||||
"""called when freecad imports a file"""
|
||||
PathLog.track(filename)
|
||||
gfile = pythonopen(filename)
|
||||
gcode = gfile.read()
|
||||
@@ -118,7 +118,7 @@ def insert(filename, docname):
|
||||
PathCustom.Create,
|
||||
PathCustomGui.TaskPanelOpPage,
|
||||
"Path_Custom",
|
||||
QtCore.QT_TRANSLATE_NOOP("Path_Custom", "Custom"),
|
||||
QT_TRANSLATE_NOOP("Path_Custom", "Custom"),
|
||||
"",
|
||||
"",
|
||||
)
|
||||
@@ -153,7 +153,7 @@ def parse(inputstring):
|
||||
|
||||
axis = ["X", "Y", "Z", "A", "B", "C", "U", "V", "W"]
|
||||
|
||||
print("preprocessing...")
|
||||
FreeCAD.Console.PrintMessage("preprocessing...")
|
||||
PathLog.track(inputstring)
|
||||
# split the input by line
|
||||
lines = inputstring.splitlines()
|
||||
@@ -191,7 +191,7 @@ def parse(inputstring):
|
||||
elif currcommand[0] in axis and lastcommand:
|
||||
output.append(lastcommand + " " + lin)
|
||||
|
||||
print("done preprocessing.")
|
||||
FreeCAD.Console.PrintMessage("done preprocessing.")
|
||||
return output
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user