remove translation from property descriptions.

This commit is contained in:
sliptonic
2016-05-18 20:42:55 -05:00
committed by Yorik van Havre
parent 30f3e93349
commit 04a0f82fb8
10 changed files with 281 additions and 295 deletions

View File

@@ -1,29 +1,30 @@
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD,Path
from PySide import QtCore,QtGui
import FreeCAD
import Path
from PySide import QtCore, QtGui
FreeCADGui = None
if FreeCAD.GuiUp:
@@ -34,6 +35,7 @@ if FreeCAD.GuiUp:
# Qt tanslation handling
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
@@ -42,27 +44,26 @@ except AttributeError:
class ObjectPathProject:
def __init__(self,obj):
# obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project")
obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", "The NC output file for this project")
obj.setEditorMode("OutputFile",0) #set to default mode
# obj.addProperty("App::PropertyBool","Editor","CodeOutput","Show G-Code in simple editor after posting code")
# obj.addProperty("Path::PropertyTooltable","Tooltable", "Path","The tooltable of this feature")
obj.addProperty("App::PropertyString", "Description","Path","An optional description for this project")
def __init__(self, obj):
# obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project")
obj.addProperty("App::PropertyFile", "OutputFile",
"CodeOutput", "The NC output file for this project")
obj.setEditorMode("OutputFile", 0) # set to default mode
obj.addProperty("App::PropertyString", "Description",
"Path", "An optional description for this project")
obj.Proxy = self
def __getstate__(self):
return None
def __setstate__(self,state):
def __setstate__(self, state):
return None
def onChanged(self,obj,prop):
def onChanged(self, obj, prop):
pass
def execute(self,obj):
def execute(self, obj):
cmds = []
for child in obj.Group:
if child.isDerivedFrom("Path::Feature"):
@@ -75,78 +76,71 @@ class ObjectPathProject:
path = Path.Path(cmds)
obj.Path = path
class ViewProviderProject:
def __init__(self,vobj):
def __init__(self, vobj):
vobj.Proxy = self
mode = 2
# vobj.setEditorMode('LineWidth',mode)
# vobj.setEditorMode('MarkerColor',mode)
# vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('ShowFirstRapid',mode)
vobj.setEditorMode('BoundingBox',mode)
vobj.setEditorMode('DisplayMode',mode)
vobj.setEditorMode('Selectable',mode)
vobj.setEditorMode('ShapeColor',mode)
vobj.setEditorMode('Transparency',mode)
# vobj.setEditorMode('Visibility',mode)
vobj.setEditorMode('BoundingBox', mode)
vobj.setEditorMode('DisplayMode', mode)
vobj.setEditorMode('Selectable', mode)
vobj.setEditorMode('ShapeColor', mode)
vobj.setEditorMode('Transparency', mode)
def __getstate__(self): #mandatory
def __getstate__(self): # mandatory
return None
def __setstate__(self,state): #mandatory
def __setstate__(self, state): # mandatory
return None
def getIcon(self):
return ":/icons/Path-Project.svg"
def onChanged(self,vobj,prop):
def onChanged(self, vobj, prop):
mode = 2
# vobj.setEditorMode('LineWidth',mode)
# vobj.setEditorMode('MarkerColor',mode)
# vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('ShowFirstRapid',mode)
vobj.setEditorMode('BoundingBox',mode)
vobj.setEditorMode('DisplayMode',mode)
vobj.setEditorMode('Selectable',mode)
vobj.setEditorMode('ShapeColor',mode)
vobj.setEditorMode('Transparency',mode)
# vobj.setEditorMode('Visibility',mode)
vobj.setEditorMode('BoundingBox', mode)
vobj.setEditorMode('DisplayMode', mode)
vobj.setEditorMode('Selectable', mode)
vobj.setEditorMode('ShapeColor', mode)
vobj.setEditorMode('Transparency', mode)
class CommandProject:
def GetResources(self):
return {'Pixmap' : 'Path-Project',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project","Project"),
return {'Pixmap': 'Path-Project',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project", "Project"),
'Accel': "P, P",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Project","Creates a Path Project object")}
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Project", "Creates a Path Project object")}
def IsActive(self):
return not FreeCAD.ActiveDocument is None
return FreeCAD.ActiveDocument is not None
def Activated(self):
incl = []
sel = FreeCADGui.Selection.getSelection()
for obj in sel:
if obj.isDerivedFrom("Path::Feature"):
incl.append(obj)
FreeCAD.ActiveDocument.openTransaction(translate("Path_Project","Create Project"))
FreeCAD.ActiveDocument.openTransaction(
translate("Path_Project", "Create Project"))
CommandProject.Create(incl)
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
@staticmethod
def Create(pathChildren = []):
def Create(pathChildren=[]):
"""Code to create a project"""
#FreeCADGui.addModule("PathScripts.PathProject")
# FreeCADGui.addModule("PathScripts.PathProject")
import PathScripts.PathUtils as PU
if not PU.findProj() == None:
FreeCAD.Console.PrintError("A Path project already exists in this document\n")
if not PU.findProj() is None:
FreeCAD.Console.PrintError(
"A Path project already exists in this document\n")
return
obj = FreeCAD.ActiveDocument.addObject("Path::FeatureCompoundPython","Project")
obj = FreeCAD.ActiveDocument.addObject(
"Path::FeatureCompoundPython", "Project")
ObjectPathProject(obj)
if pathChildren:
for child in pathChildren:
@@ -154,7 +148,7 @@ class CommandProject:
obj.Group = pathChildren
ViewProviderProject(obj.ViewObject)
#create a machine obj
# create a machine obj
import PathScripts
PathScripts.PathMachine.CommandPathMachine.Create()
PathScripts.PathLoadTool.CommandPathLoadTool.Create()
@@ -162,8 +156,8 @@ class CommandProject:
return obj
if FreeCAD.GuiUp:
if FreeCAD.GuiUp:
# register the FreeCAD command
FreeCADGui.addCommand('Path_Project',CommandProject())
FreeCADGui.addCommand('Path_Project', CommandProject())
FreeCAD.Console.PrintLog("Loading PathProject... done\n")