Arch: Fixed strings to be translated

This commit is contained in:
Yorik van Havre 2012-08-15 18:39:53 -03:00
parent c295599828
commit 4386421a0b
9 changed files with 35 additions and 30 deletions

View File

@ -111,9 +111,7 @@ def removeComponents(objectsList,host=None):
if Draft.getType(host) in ["Wall","Structure"]:
if hasattr(host,"Axes"):
a = host.Axes
print a
for o in objectsList[:]:
print o.Name
if o in a:
a.remove(o)
objectsList.remove(o)
@ -127,10 +125,10 @@ def removeComponents(objectsList,host=None):
if o.Base.Support:
if isinstance(o.Base.Support,tuple):
if o.Base.Support[0].Name == host.Name:
print "removing sketch support to avoid cross-referencing"
FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing")))
o.Base.Support = None
elif o.Base.Support.Name == host.Name:
print "removing sketch support to avoid cross-referencing"
FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing")))
o.Base.Support = None
host.Subtractions = s
else:
@ -293,7 +291,7 @@ def getCutVolume(cutplane,shapes):
u = placement.Rotation.multVec(FreeCAD.Vector(1,0,0))
v = placement.Rotation.multVec(FreeCAD.Vector(0,1,0))
if not bb.isCutPlane(placement.Base,ax):
print "No objects are cut by the plane"
FreeCAD.Console.PrintMessage(str(translate("Arch","No objects are cut by the plane")))
return None,None,None
else:
corners = [FreeCAD.Vector(bb.XMin,bb.YMin,bb.ZMin),
@ -475,19 +473,19 @@ def check(objectslist,includehidden=False):
else:
s = o.Shape
if (not s.isClosed()) and (not (Draft.getType(o) == "Axis")):
bad.append([o,"is not closed"])
bad.append([o,str(translate("Arch","is not closed"))])
elif not s.isValid():
bad.append([o,"is not valid"])
bad.append([o,str(translate("Arch","is not valid"))])
elif (not s.Solids) and (not (Draft.getType(o) == "Axis")):
bad.append([o,"doesn't contain any solid"])
bad.append([o,str(translate("Arch","doesn't contain any solid"))])
else:
f = 0
for sol in s.Solids:
f += len(sol.Faces)
if not sol.isClosed():
bad.append([o,"contains a non-closed solid"])
bad.append([o,str(translate("Arch","contains a non-closed solid"))])
if len(s.Faces) != f:
bad.append([o,"contains faces that are not part of any solid"])
bad.append([o,str(translate("Arch","contains faces that are not part of any solid"))])
return bad
@ -589,7 +587,7 @@ class _CommandMeshToShape:
def GetResources(self):
return {'Pixmap' : 'Arch_MeshToShape',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_MeshToShape","Mesh to Shape"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_MeshToPart","Turns selected meshes into Part Shape objects")}
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_MeshToShape","Turns selected meshes into Part Shape objects")}
def IsActive(self):
if FreeCADGui.Selection.getSelection():
@ -694,7 +692,7 @@ class _CommandCheck:
def Activated(self):
result = check(FreeCADGui.Selection.getSelection())
if not result:
FreeCAD.Console.PrintMessage("All good! no problems found")
FreeCAD.Console.PrintMessage(str(translate("Arch","All good! no problems found")))
else:
FreeCADGui.Selection.clearSelection()
for i in result:

View File

@ -27,6 +27,7 @@ __url__ = "http://free-cad.sourceforge.net"
import FreeCAD,FreeCADGui
from PyQt4 import QtGui,QtCore
from DraftTools import translate
def addToComponent(compobject,addobject,mod=None):
'''addToComponent(compobject,addobject,mod): adds addobject
@ -317,7 +318,7 @@ class ArchSelectionObserver:
def addSelection(self,document, object, element, position):
if object == self.watched.Name:
if not element:
print "closing Sketch edit"
FreeCAD.Console.PrintMessage(str(translate("Arch","closing Sketch edit")))
if self.hide:
self.origin.ViewObject.Transparency = 0
self.origin.ViewObject.Selectable = True

View File

@ -222,7 +222,7 @@ class _ArchDrawingView:
[V0,V1,H0,H1] = Drawing.project(self.baseshape,self.direction)
return V0.Edges+V1.Edges
else:
print "No shape has been computed yet, use wireframe rendering and re-render"
FreeCAD.Console.PrintMessage(str(translate("Arch","No shape has been computed yet, select wireframe rendering and render again")))
return None
def getDXF(self):
@ -233,7 +233,7 @@ class _ArchDrawingView:
DxfOutput = Drawing.projectToDXF(self.baseshape,self.direction)
return DxfOutput
else:
print "No shape has been computed yet, use wireframe rendering and re-render"
FreeCAD.Console.PrintMessage(str(translate("Arch","No shape has been computed yet, select wireframe rendering and render again")))
return None
def buildSVG(self, obj,join=False):
@ -273,7 +273,7 @@ class _ArchDrawingView:
if o.Shape.isValid():
shapes.extend(o.Shape.Solids)
else:
FreeCAD.Console.PrintWarning("Skipping invalid object: "+o.Name)
FreeCAD.Console.PrintWarning(str(translate("Arch","Skipping invalid object: "))+o.Name)
cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes)
if cutvolume:
nsh = []

View File

@ -390,7 +390,7 @@ class _Wall(ArchComponent.Component):
if sh.isClosed() and sh.isValid() and sh.Solids and (not sh.isNull()):
base = sh
else:
FreeCAD.Console.PrintWarning("This mesh is an invalid solid")
FreeCAD.Console.PrintWarning(str(translate("Arch","This mesh is an invalid solid")))
obj.Base.ViewObject.show()
if base:

View File

@ -161,7 +161,6 @@ class _Window(ArchComponent.Component):
if zof:
zov = DraftVecUtils.scaleTo(norm,zof)
shape.translate(zov)
print shape
shapes.append(shape)
if shapes:
obj.Shape = Part.makeCompound(shapes)
@ -440,10 +439,7 @@ class _ArchWindowTaskPanel:
self.obj.WindowParts = parts
self.update()
else:
FreeCAD.Console.PrintWarning(str(
QtGui.QApplication.translate(
"Arch", "Unable to create component",
None, QtGui.QApplication.UnicodeUTF8)))
FreeCAD.Console.PrintWarning(str(translate("Arch", "Unable to create component")))
self.newtitle.setVisible(False)
self.new1.setVisible(False)

View File

@ -22,6 +22,7 @@
#***************************************************************************
import FreeCAD, Mesh, os, numpy
from DraftTools import translate
__title__="FreeCAD Collada importer"
__author__ = "Yorik van Havre"
@ -36,7 +37,7 @@ def checkCollada():
try:
import collada
except:
FreeCAD.Console.PrintError("pycollada not found, no collada support.\n")
FreeCAD.Console.PrintError(str(translate("Arch","pycollada not found, no collada support.\n")))
return False
else:
return True
@ -70,7 +71,7 @@ def decode(name):
try:
decodedName = (name.decode("latin1"))
except UnicodeDecodeError:
print "ifc: error: couldn't determine character encoding"
FreeCAD.Console.PrintError(str(translate("Arch","Error: Couldn't determine character encoding")))
decodedName = name
return decodedName
@ -148,4 +149,4 @@ def export(exportList,filename):
colmesh.scenes.append(myscene)
colmesh.scene = myscene
colmesh.write(filename)
print "file ",filename," successfully created."
FreeCAD.Console.PrintMessage(str(translate("Arch","file %s successfully created.")) % filename)

View File

@ -22,6 +22,7 @@
#***************************************************************************
import ifcReader, FreeCAD, Arch, Draft, os, sys, time, Part, DraftVecUtils
from DraftTools import translate
__title__="FreeCAD IFC importer"
__author__ = "Yorik van Havre"
@ -79,7 +80,7 @@ def decode(name):
try:
decodedName = (name.decode("latin1"))
except UnicodeDecodeError:
print "ifc: error: couldn't determine character encoding"
FreeCAD.Console.PrintError(str(translate("Arch", "Error: Couldn't determine character encoding\n")))
decodedName = name
return decodedName
@ -101,7 +102,7 @@ def getIfcOpenShell():
global IfcImport
import IfcImport
except:
print "Couldn't import IfcOpenShell"
FreeCAD.Console.PrintMessage(str(translate("Arch","Couldn't locate IfcOpenShell\n")))
return False
else:
return True
@ -117,7 +118,7 @@ def read(filename):
if DEBUG: print "opening",filename,"..."
ifc = ifcReader.IfcDocument(filename,schema=schema,debug=DEBUG)
else:
FreeCAD.Console.PrintWarning("IFC Schema not found, IFC import disabled.\n")
FreeCAD.Console.PrintWarning(str(translate("Arch","IFC Schema not found, IFC import disabled.\n")))
return None
t2 = time.time()
if DEBUG: print "Successfully loaded",ifc,"in %s s" % ((t2-t1))

View File

@ -22,6 +22,7 @@
#***************************************************************************
import FreeCAD, DraftGeomUtils, Part, Draft
from DraftTools import translate
p = Draft.precision()
@ -91,7 +92,7 @@ def export(exportList,filename):
for f in flist:
outfile.write("f" + f + "\n")
outfile.close()
FreeCAD.Console.PrintMessage("successfully written "+filename)
FreeCAD.Console.PrintMessage(str(translate("Arch","successfully written "))+filename)

View File

@ -74,7 +74,6 @@ How it works / how to extend:
# import FreeCAD modules
import FreeCAD, math, sys, os, DraftVecUtils, Draft_rc
from FreeCAD import Vector
from pivy import coin
if FreeCAD.GuiUp:
import FreeCADGui, WorkingPlane
@ -220,6 +219,7 @@ def ungroup(obj):
def dimSymbol():
"returns the current dim symbol from the preferences as a pivy SoMarkerSet"
s = getParam("dimsymbol")
from pivy import coin
marker = coin.SoMarkerSet()
if s == 0: marker.markerIndex = coin.SoMarkerSet.CIRCLE_FILLED_5_5
elif s == 1: marker.markerIndex = coin.SoMarkerSet.CIRCLE_FILLED_7_7
@ -1816,6 +1816,7 @@ class _ViewProviderDimension:
def calcGeom(self,obj):
import Part, DraftGeomUtils
from pivy import coin
p1 = obj.Start
p4 = obj.End
base = Part.Line(p1,p4).toShape()
@ -1866,6 +1867,7 @@ class _ViewProviderDimension:
return p1,p2,p3,p4,tbase,norm,rot
def attach(self, obj):
from pivy import coin
self.Object = obj.Object
p1,p2,p3,p4,tbase,norm,rot = self.calcGeom(obj.Object)
self.color = coin.SoBaseColor()
@ -1932,6 +1934,7 @@ class _ViewProviderDimension:
self.onChanged(obj,"FontName")
def updateData(self, obj, prop):
from pivy import coin
try:
dm = obj.ViewObject.DisplayMode
except:
@ -2122,6 +2125,7 @@ class _ViewProviderAngularDimension:
obj.Override = ''
def attach(self, vobj):
from pivy import coin
self.Object = vobj.Object
self.arc = None
c,tbase,trot,p2,p3 = self.calcGeom(vobj.Object)
@ -2202,6 +2206,7 @@ class _ViewProviderAngularDimension:
return cir, tbase, trot, cir.Vertexes[0].Point, cir.Vertexes[-1].Point
def updateData(self, obj, prop):
from pivy import coin
text = None
ivob = None
c,tbase,trot,p2,p3 = self.calcGeom(obj)
@ -2492,6 +2497,7 @@ class _ViewProviderWire(_ViewProviderDraft):
"Displays a dim symbol at the end of the wire")
def attach(self, obj):
from pivy import coin
self.Object = obj.Object
col = coin.SoBaseColor()
col.rgb.setValue(obj.LineColor[0],
@ -2646,6 +2652,7 @@ class _BSpline:
class _ViewProviderBSpline(_ViewProviderDraft):
"A View Provider for the BSPline object"
def __init__(self, obj):
from pivy import coin
_ViewProviderDraft.__init__(self,obj)
obj.addProperty("App::PropertyBool","EndArrow",
"Base","Displays a dim symbol at the end of the wire")