diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index 8d8a07b9d..5e6f6bd18 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -31,7 +31,7 @@ __title__="FreeCAD Axis System" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeAxis(num=5,size=1,name=str(translate("Arch","Axes"))): +def makeAxis(num=5,size=1,name=translate("Arch","Axes")): '''makeAxis(num,size): makes an Axis System based on the given number of axes and interval distances''' obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",name) @@ -57,7 +57,7 @@ class _CommandAxis: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Axis","Creates an axis system.")} def Activated(self): - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Axis"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Axis")) FreeCADGui.doCommand("import Arch") sel = FreeCADGui.Selection.getSelection() st = Draft.getObjectsOfType(sel,"Structure") @@ -71,9 +71,9 @@ class _CommandAxis: class _Axis: "The Axis object" def __init__(self,obj): - obj.addProperty("App::PropertyFloatList","Distances","Arch", str(translate("Arch","The intervals between axes"))) - obj.addProperty("App::PropertyFloatList","Angles","Arch", str(translate("Arch","The angles of each axis"))) - obj.addProperty("App::PropertyFloat","Length","Arch", str(translate("Arch","The length of the axes"))) + obj.addProperty("App::PropertyFloatList","Distances","Arch", translate("Arch","The intervals between axes")) + obj.addProperty("App::PropertyFloatList","Angles","Arch", translate("Arch","The angles of each axis")) + obj.addProperty("App::PropertyFloat","Length","Arch", translate("Arch","The length of the axes")) obj.addProperty("App::PropertyPlacement","Placement","Base","") obj.addProperty("Part::PropertyPartShape","Shape","Base","") self.Type = "Axis" @@ -112,8 +112,8 @@ class _ViewProviderAxis: "A View Provider for the Axis object" def __init__(self,vobj): - vobj.addProperty("App::PropertyLength","BubbleSize","Arch", str(translate("Arch","The size of the axis bubbles"))) - vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", str(translate("Arch","The numbering style"))) + vobj.addProperty("App::PropertyLength","BubbleSize","Arch", translate("Arch","The size of the axis bubbles")) + vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", translate("Arch","The numbering style")) vobj.addProperty("App::PropertyEnumeration","DrawStyle","Base","") vobj.addProperty("App::PropertyFloat","LineWidth","Base","") vobj.addProperty("App::PropertyColor","LineColor","Base","") diff --git a/src/Mod/Arch/ArchBuilding.py b/src/Mod/Arch/ArchBuilding.py index ca625ecff..140df634f 100644 --- a/src/Mod/Arch/ArchBuilding.py +++ b/src/Mod/Arch/ArchBuilding.py @@ -29,7 +29,7 @@ __title__="FreeCAD Building" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeBuilding(objectslist=None,join=False,name=str(translate("Arch","Building"))): +def makeBuilding(objectslist=None,join=False,name=translate("Arch","Building")): '''makeBuilding(objectslist,[joinmode]): creates a building including the objects from the given list. If joinmode is True, components will be joined.''' obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name) @@ -52,7 +52,7 @@ class _CommandBuilding: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Site","Floor"]: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Type conversion")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("obj = Arch.makeBuilding()") FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") @@ -60,14 +60,14 @@ class _CommandBuilding: FreeCAD.ActiveDocument.commitTransaction() ok = True if not ok: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch"," Create Building"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch"," Create Building")) ss = "[" for o in sel: if len(ss) > 1: ss += "," ss += "FreeCAD.ActiveDocument."+o.Name ss += "]" - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Floor"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Floor")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeBuilding("+ss+")") FreeCAD.ActiveDocument.commitTransaction() diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 749e30d82..25ac1160e 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -137,16 +137,16 @@ def removeComponents(objectsList,host=None): if o.Base.Support: if isinstance(o.Base.Support,tuple): if o.Base.Support[0].Name == host.Name: - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing")) o.Base.Support = None elif o.Base.Support.Name == host.Name: - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing")) o.Base.Support = None elif o.Base.ExternalGeometry: for i in range(len(o.Base.ExternalGeometry)): if o.Base.ExternalGeometry[i][0].Name == host.Name: o.Base.delExternal(i) - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing")) break host.Subtractions = s else: @@ -189,16 +189,16 @@ def fixWindow(obj): if obj.Base.Support: if isinstance(o.Base.Support,tuple): if obj.Base.Support[0]: - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing")) obj.Base.Support = None elif obj.Base.Support: - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch support to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing")) obj.Base.Support = None if hasattr(obj.Base,"ExternalGeometry"): if obj.Base.ExternalGeometry: for i in range(len(obj.Base.ExternalGeometry)): obj.Base.delExternal(0) - FreeCAD.Console.PrintMessage(str(translate("Arch","removing sketch external references to avoid cross-referencing"))) + FreeCAD.Console.PrintMessage(translate("Arch","removing sketch external references to avoid cross-referencing")) def copyProperties(obj1,obj2): '''copyProperties(obj1,obj2): Copies properties values from obj1 to obj2, @@ -337,14 +337,14 @@ def getCutVolume(cutplane,shapes): else: p = cutplane.copy().Faces[0] except: - FreeCAD.Console.PrintMessage(str(translate("Arch","Invalid cutplane"))) + FreeCAD.Console.PrintMessage(translate("Arch","Invalid cutplane")) return None,None,None ce = p.CenterOfMass ax = p.normalAt(0,0) u = p.Vertexes[1].Point.sub(p.Vertexes[0].Point).normalize() v = u.cross(ax) if not bb.isCutPlane(ce,ax): - FreeCAD.Console.PrintMessage(str(translate("Arch","No objects are cut by the plane"))) + FreeCAD.Console.PrintMessage(translate("Arch","No objects are cut by the plane")) return None,None,None else: corners = [FreeCAD.Vector(bb.XMin,bb.YMin,bb.ZMin), @@ -567,19 +567,19 @@ def check(objectslist,includehidden=False): else: s = o.Shape if (not s.isClosed()) and (not (Draft.getType(o) == "Axis")): - bad.append([o,str(translate("Arch","is not closed"))]) + bad.append([o,translate("Arch","is not closed")]) elif not s.isValid(): - bad.append([o,str(translate("Arch","is not valid"))]) + bad.append([o,translate("Arch","is not valid")]) elif (not s.Solids) and (not (Draft.getType(o) == "Axis")): - bad.append([o,str(translate("Arch","doesn't contain any solid"))]) + bad.append([o,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,str(translate("Arch","contains a non-closed solid"))]) + bad.append([o,translate("Arch","contains a non-closed solid")]) if len(s.Faces) != f: - bad.append([o,str(translate("Arch","contains faces that are not part of any solid"))]) + bad.append([o,translate("Arch","contains faces that are not part of any solid")]) return bad @@ -593,7 +593,7 @@ def addFixture(fixture,baseobject): if baseobject.ViewObject.DisplayMode != "Detailed": fixture.ViewObject.hide() else: - FreeCAD.Console.PrintMessage(str(translate("Arch","This object has no support for fixtures"))) + FreeCAD.Console.PrintMessage(translate("Arch","This object has no support for fixtures")) def getTuples(data,scale=1,placement=None): """getTuples(data,[scale,placement]): returns a tuple or a list of tuples from a vector diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index e9a4728d1..6dc766e9d 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -490,7 +490,7 @@ class ArchSelectionObserver: del FreeCAD.ArchObserver elif object == self.watched.Name: if not element: - FreeCAD.Console.PrintMessage(str(translate("Arch","closing Sketch edit"))) + FreeCAD.Console.PrintMessage(translate("Arch","closing Sketch edit")) if self.hide: if self.origin: self.origin.ViewObject.Transparency = 0 diff --git a/src/Mod/Arch/ArchFloor.py b/src/Mod/Arch/ArchFloor.py index 93f4dab4a..9179da18b 100644 --- a/src/Mod/Arch/ArchFloor.py +++ b/src/Mod/Arch/ArchFloor.py @@ -29,7 +29,7 @@ __title__="FreeCAD Arch Floor" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeFloor(objectslist=None,join=True,name=str(translate("Arch","Floor"))): +def makeFloor(objectslist=None,join=True,name=translate("Arch","Floor")): '''makeFloor(objectslist,[joinmode]): creates a floor including the objects from the given list. If joinmode is False, components will not be joined.''' @@ -53,7 +53,7 @@ class _CommandFloor: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Site","Building"]: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Type conversion")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("obj = Arch.makeFloor()") FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") @@ -67,7 +67,7 @@ class _CommandFloor: ss += "," ss += "FreeCAD.ActiveDocument."+o.Name ss += "]" - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Floor"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Floor")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeFloor("+ss+")") FreeCAD.ActiveDocument.commitTransaction() @@ -77,9 +77,9 @@ class _Floor: "The Floor object" def __init__(self,obj): obj.addProperty("App::PropertyLength","Height","Arch", - str(translate("Arch","The height of this floor"))) + translate("Arch","The height of this floor")) obj.addProperty("App::PropertyPlacement","Placement","Arch", - str(translate("Arch","The placement of this group"))) + translate("Arch","The placement of this group")) self.Type = "Floor" obj.Proxy = self self.Object = obj diff --git a/src/Mod/Arch/ArchFrame.py b/src/Mod/Arch/ArchFrame.py index 61f00edbd..2d00043c9 100644 --- a/src/Mod/Arch/ArchFrame.py +++ b/src/Mod/Arch/ArchFrame.py @@ -31,7 +31,7 @@ __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeFrame(base,profile,name="Frame"): +def makeFrame(base,profile,name=translate("Arch","Frame")): """makeFrame(base,profile,[name]): creates a frame object from a base sketch (or any other object containing wires) and a profile object (an extrudable 2D object containing faces or closed wires)""" obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) @@ -53,7 +53,7 @@ class _CommandFrame: def Activated(self): s = FreeCADGui.Selection.getSelection() if len(s) == 2: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Frame"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Frame")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeFrame(FreeCAD.ActiveDocument."+s[0].Name+",FreeCAD.ActiveDocument."+s[1].Name+")") FreeCAD.ActiveDocument.commitTransaction() diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py index 855b058b8..91b2a9a93 100644 --- a/src/Mod/Arch/ArchRebar.py +++ b/src/Mod/Arch/ArchRebar.py @@ -31,7 +31,7 @@ __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeRebar(baseobj,sketch,diameter=None,amount=1,offset=None,name="Rebar"): +def makeRebar(baseobj,sketch,diameter=None,amount=1,offset=None,name=translate("Arch","Rebar")): """makeRebar(baseobj,sketch,[diameter,amount,offset,name]): adds a Reinforcement Bar object to the given structural object, using the given sketch as profile.""" p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") @@ -83,7 +83,7 @@ class _CommandRebar: sk = sel[1].Object if Draft.getType(sk) == "Sketch": # we have a base object and a sketch: create the rebar now - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Rebar"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Rebar")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeRebar(FreeCAD.ActiveDocument."+obj.Name+",FreeCAD.ActiveDocument."+sk.Name+")") FreeCAD.ActiveDocument.commitTransaction() @@ -104,7 +104,7 @@ class _CommandRebar: sup = obj.Support[0] else: sup = obj.Support - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Rebar"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Rebar")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeRebar(FreeCAD.ActiveDocument."+sup.Name+",FreeCAD.ActiveDocument."+obj.Name+")") FreeCAD.ActiveDocument.commitTransaction() @@ -114,7 +114,7 @@ class _CommandRebar: print "Arch: error: couldn't extract a base object" return - FreeCAD.Console.PrintMessage(str(translate("Arch","Please select a base face on a structural object\n"))) + FreeCAD.Console.PrintMessage(translate("Arch","Please select a base face on a structural object\n")) FreeCADGui.Control.showDialog(ArchComponent.SelectionTaskPanel()) FreeCAD.ArchObserver = ArchComponent.ArchSelectionObserver(nextCommand="Arch_Rebar") FreeCADGui.Selection.addObserver(FreeCAD.ArchObserver) diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index b41744bd5..d71fc6bfc 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -30,7 +30,7 @@ __title__="FreeCAD Roof" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeRoof(baseobj=None,facenr=1,angle=45,name=str(translate("Arch","Roof"))): +def makeRoof(baseobj=None,facenr=1,angle=45,name=translate("Arch","Roof")): '''makeRoof(baseobj,[facenr],[angle],[name]) : Makes a roof based on a face from an existing object. You can provide the number of the face to build the roof on (default = 1), the angle (default=45) and a name (default @@ -61,7 +61,7 @@ class _CommandRoof: if sel.HasSubObjects: if "Face" in sel.SubElementNames[0]: idx = int(sel.SubElementNames[0][4:]) - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Roof")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+","+str(idx)+")") FreeCAD.ActiveDocument.commitTransaction() @@ -69,16 +69,16 @@ class _CommandRoof: return if obj.isDerivedFrom("Part::Feature"): if obj.Shape.Wires: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Roof")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() return else: - FreeCAD.Console.PrintMessage(str(translate("Arch","Unable to create a roof"))) + FreeCAD.Console.PrintMessage(translate("Arch","Unable to create a roof")) else: - FreeCAD.Console.PrintMessage(str(translate("Arch","Please select a base object\n"))) + FreeCAD.Console.PrintMessage(translate("Arch","Please select a base object\n")) FreeCADGui.Control.showDialog(ArchComponent.SelectionTaskPanel()) FreeCAD.ArchObserver = ArchComponent.ArchSelectionObserver(nextCommand="Arch_Roof") FreeCADGui.Selection.addObserver(FreeCAD.ArchObserver) @@ -88,9 +88,9 @@ class _Roof(ArchComponent.Component): def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyAngle","Angle","Base", - str(translate("Arch","The angle of this roof"))) + translate("Arch","The angle of this roof")) obj.addProperty("App::PropertyInteger","Face","Base", - str(translate("Arch","The face number of the base object used to build this roof"))) + translate("Arch","The face number of the base object used to build this roof")) self.Type = "Roof" def execute(self,obj): diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index c39200cc7..5b9806e6f 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -27,10 +27,10 @@ from PySide import QtCore from pivy import coin from DraftTools import translate -def makeSectionPlane(objectslist=None): +def makeSectionPlane(objectslist=None,name=translate("Arch","Section")): """makeSectionPlane([objectslist]) : Creates a Section plane objects including the given objects. If no object is given, the whole document will be considered.""" - obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython","Section") + obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",name) _SectionPlane(obj) _ViewProviderSectionPlane(obj.ViewObject) if objectslist: @@ -43,7 +43,7 @@ def makeSectionPlane(objectslist=None): obj.Objects = g return obj -def makeSectionView(section): +def makeSectionView(section,name="View"): """makeSectionView(section) : Creates a Drawing view of the given Section Plane in the active Page object (a new page will be created if none exists""" page = None @@ -52,14 +52,14 @@ def makeSectionView(section): page = o break if not page: - page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage",str(translate("Arch","Page"))) + page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage",translate("Arch","Page")) page.Template = Draft.getParam("template",FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg') - view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View") + view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython",name) page.addObject(view) _ArchDrawingView(view) view.Source = section - view.Label = str(translate("Arch","View of"))+" "+section.Name + view.Label = translate("Arch","View of")+" "+section.Name return view class _CommandSectionPlane: @@ -78,7 +78,7 @@ class _CommandSectionPlane: ss += "," ss += "FreeCAD.ActiveDocument."+o.Name ss += "]" - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Section Plane"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Section Plane")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("section = Arch.makeSectionPlane("+ss+")") FreeCADGui.doCommand("Arch.makeSectionView(section)") @@ -90,10 +90,10 @@ class _SectionPlane: def __init__(self,obj): obj.Proxy = self obj.addProperty("App::PropertyPlacement","Placement","Base", - str(translate("Arch","The placement of this object"))) + translate("Arch","The placement of this object")) obj.addProperty("Part::PropertyPartShape","Shape","Base","") obj.addProperty("App::PropertyLinkList","Objects","Arch", - str(translate("Arch","The objects that must be considered by this section plane. Empty means all document"))) + translate("Arch","The objects that must be considered by this section plane. Empty means all document")) self.Type = "SectionPlane" def execute(self,obj): @@ -120,7 +120,7 @@ class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent): "A View Provider for Section Planes" def __init__(self,vobj): vobj.addProperty("App::PropertyLength","DisplaySize","Arch", - str(translate("Arch","The display size of this section plane"))) + translate("Arch","The display size of this section plane")) vobj.addProperty("App::PropertyPercent","Transparency","Base","") vobj.addProperty("App::PropertyFloat","LineWidth","Base","") vobj.addProperty("App::PropertyColor","LineColor","Base","") @@ -260,7 +260,7 @@ class _ArchDrawingView: [V0,V1,H0,H1] = Drawing.project(self.baseshape,self.direction) return V0.Edges+V1.Edges else: - FreeCAD.Console.PrintMessage(str(translate("Arch","No shape has been computed yet, select wireframe rendering and render again"))) + FreeCAD.Console.PrintMessage(translate("Arch","No shape has been computed yet, select wireframe rendering and render again")) return None def getDXF(self): @@ -271,7 +271,7 @@ class _ArchDrawingView: DxfOutput = Drawing.projectToDXF(self.baseshape,self.direction) return DxfOutput else: - FreeCAD.Console.PrintMessage(str(translate("Arch","No shape has been computed yet, select wireframe rendering and render again"))) + FreeCAD.Console.PrintMessage(translate("Arch","No shape has been computed yet, select wireframe rendering and render again")) return None def buildSVG(self, obj,join=False): @@ -315,7 +315,7 @@ class _ArchDrawingView: if o.Shape.isValid(): shapes.extend(o.Shape.Solids) else: - FreeCAD.Console.PrintWarning(str(translate("Arch","Skipping invalid object: "))+o.Name) + FreeCAD.Console.PrintWarning(translate("Arch","Skipping invalid object: ")+o.Name) cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes) if cutvolume: nsh = [] diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index d6f5489b5..9cb9c7e56 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -29,7 +29,7 @@ __title__="FreeCAD Site" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeSite(objectslist=None,name=str(translate("Arch","Site"))): +def makeSite(objectslist=None,name=translate("Arch","Site")): '''makeBuilding(objectslist): creates a site including the objects from the given list.''' obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name) @@ -52,7 +52,7 @@ class _CommandSite: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Building","Floor"]: - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Type conversion")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("obj = Arch.makeSite()") FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") @@ -70,7 +70,7 @@ class _CommandSite: ss += "," ss += "FreeCAD.ActiveDocument."+o.Name ss += "]" - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Site"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Site")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("Arch.makeSite("+ss+")") FreeCAD.ActiveDocument.commitTransaction() @@ -81,13 +81,13 @@ class _Site(ArchFloor._Floor): def __init__(self,obj): ArchFloor._Floor.__init__(self,obj) obj.addProperty("App::PropertyLink","Terrain","Arch", - str(translate("Arch","The terrain of this site"))) + translate("Arch","The terrain of this site")) obj.addProperty("App::PropertyString","Address","Arch", - str(translate("Arch","The address of this site"))) + translate("Arch","The address of this site")) obj.addProperty("App::PropertyString","Coordinates","Arch", - str(translate("Arch","The geographic coordinates of this site"))) + translate("Arch","The geographic coordinates of this site")) obj.addProperty("App::PropertyString","Url","Arch", - str(translate("Arch","An url that shows this site in a mapping website"))) + translate("Arch","An url that shows this site in a mapping website")) self.Type = "Site" obj.setEditorMode('Height',2) diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index fd87d4ede..d1979263f 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -29,7 +29,7 @@ import FreeCAD,FreeCADGui,ArchComponent,ArchCommands,math,Draft from DraftTools import translate from PySide import QtCore -def makeSpace(objects=None,name="Space"): +def makeSpace(objects=None,name=translate("Arch","Space")): """makeSpace([objects]): Creates a space object from the given objects. Objects can be one document object, in which case it becomes the base shape of the space object, or a list of selection objects as got from getSelectionEx(), or a list of tuples (object, subobjectname)""" @@ -73,7 +73,7 @@ class _CommandSpace: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a space object from selected boundary objects")} def Activated(self): - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Space"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Space")) FreeCADGui.doCommand("import Arch") sel = FreeCADGui.Selection.getSelection() if sel: @@ -85,7 +85,7 @@ class _CommandSpace: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() else: - FreeCAD.Console.PrintMessage(str(translate("Arch","Please select a base object\n"))) + FreeCAD.Console.PrintMessage(translate("Arch","Please select a base object\n")) FreeCADGui.Control.showDialog(ArchComponent.SelectionTaskPanel()) FreeCAD.ArchObserver = ArchComponent.ArchSelectionObserver(nextCommand="Arch_Space") FreeCADGui.Selection.addObserver(FreeCAD.ArchObserver) @@ -96,9 +96,9 @@ class _Space(ArchComponent.Component): def __init__(self,obj): obj.Proxy = self obj.addProperty("App::PropertyLink","Base","Arch", - str(translate("Arch","A base shape defining this space"))) + translate("Arch","A base shape defining this space")) obj.addProperty("App::PropertyLinkSubList","Boundaries","Arch", - str(translate("Arch","The objects that make the boundaries of this space object"))) + translate("Arch","The objects that make the boundaries of this space object")) self.Type = "Space" def execute(self,obj): diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 0e6392522..b80335c24 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -31,10 +31,10 @@ from DraftTools import translate from PySide import QtCore -def makeStairs(base=None,length=4.5,width=1,height=3,steps=17): +def makeStairs(base=None,length=4.5,width=1,height=3,steps=17,name=translate("Arch","Stairs")): """makeStairs([base,length,width,height,steps]): creates a Stairs objects with given attributes.""" - obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Stairs") + obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) _Stairs(obj) _ViewProviderStairs(obj.ViewObject) if base: @@ -54,7 +54,7 @@ class _CommandStairs: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a stairs objects")} def Activated(self): - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Stairs"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Stairs")) FreeCADGui.doCommand("import Arch") if len(FreeCADGui.Selection.getSelection()) == 1: n = FreeCADGui.Selection.getSelection()[0].Name @@ -74,39 +74,39 @@ class _Stairs(ArchComponent.Component): # base properties obj.addProperty("App::PropertyLength","Length","Arch", - str(translate("Arch","The length of these stairs, if no baseline is defined"))) + translate("Arch","The length of these stairs, if no baseline is defined")) obj.addProperty("App::PropertyLength","Width","Arch", - str(translate("Arch","The width of these stairs"))) + translate("Arch","The width of these stairs")) obj.addProperty("App::PropertyLength","Height","Arch", - str(translate("Arch","The total height of these stairs"))) + translate("Arch","The total height of these stairs")) obj.addProperty("App::PropertyEnumeration","Align","Arch", - str(translate("Arch","The alignment of these stairs on their baseline, if applicable"))) + translate("Arch","The alignment of these stairs on their baseline, if applicable")) # steps properties obj.addProperty("App::PropertyInteger","NumberOfSteps","Steps", - str(translate("Arch","The number of risers in these stairs"))) + translate("Arch","The number of risers in these stairs")) obj.addProperty("App::PropertyLength","TreadDepth","Steps", - str(translate("Arch","The depth of the treads of these stairs"))) + translate("Arch","The depth of the treads of these stairs")) obj.addProperty("App::PropertyLength","RiserHeight","Steps", - str(translate("Arch","The height of the risers of these stairs"))) + translate("Arch","The height of the risers of these stairs")) obj.addProperty("App::PropertyLength","Nosing","Steps", - str(translate("Arch","The size of the nosing"))) + translate("Arch","The size of the nosing")) obj.addProperty("App::PropertyLength","TreadThickness","Steps", - str(translate("Arch","The thickness of the treads"))) + translate("Arch","The thickness of the treads")) # structural properties obj.addProperty("App::PropertyEnumeration","Landings","Structure", - str(translate("Arch","The type of landings of these stairs"))) + translate("Arch","The type of landings of these stairs")) obj.addProperty("App::PropertyEnumeration","Winders","Structure", - str(translate("Arch","The type of winders in these stairs"))) + translate("Arch","The type of winders in these stairs")) obj.addProperty("App::PropertyEnumeration","Structure","Structure", - str(translate("Arch","The type of structure of these stairs"))) + translate("Arch","The type of structure of these stairs")) obj.addProperty("App::PropertyLength","StructureThickness","Structure", - str(translate("Arch","The thickness of the massive structure or of the stringers"))) + translate("Arch","The thickness of the massive structure or of the stringers")) obj.addProperty("App::PropertyLength","StringerWidth","Structure", - str(translate("Arch","The width of the stringers"))) + translate("Arch","The width of the stringers")) obj.addProperty("App::PropertyLength","StringerOffset","Structure", - str(translate("Arch","The offset between the border of the stairs and the stringers"))) + translate("Arch","The offset between the border of the stairs and the stringers")) obj.Align = ['Left','Right','Center'] obj.Landings = ["None","At center","At each corner"] diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index c734a7d8a..38b412f86 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -281,7 +281,7 @@ Presets = [None, ] -def makeStructure(baseobj=None,length=0,width=0,height=0,name=str(translate("Arch","Structure"))): +def makeStructure(baseobj=None,length=0,width=0,height=0,name=translate("Arch","Structure")): '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a structure element based on the given profile object and the given extrusion height. If no base object is given, you can also specify @@ -406,13 +406,13 @@ class _CommandStructure: "sets up a taskbox widget" d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2) w = QtGui.QWidget() - w.setWindowTitle(unicode(translate("Arch","Structure options"))) + w.setWindowTitle(translate("Arch","Structure options").decode("utf8")) lay0 = QtGui.QVBoxLayout(w) # presets box layp = QtGui.QHBoxLayout() lay0.addLayout(layp) - labelp = QtGui.QLabel(unicode(translate("Arch","Preset"))) + labelp = QtGui.QLabel(translate("Arch","Preset").decode("utf8")) layp.addWidget(labelp) valuep = QtGui.QComboBox() fpresets = [" "] @@ -424,7 +424,7 @@ class _CommandStructure: # length lay1 = QtGui.QHBoxLayout() lay0.addLayout(lay1) - label1 = QtGui.QLabel(unicode(translate("Arch","Length"))) + label1 = QtGui.QLabel(translate("Arch","Length").decode("utf8")) lay1.addWidget(label1) self.vLength = QtGui.QDoubleSpinBox() self.vLength.setDecimals(d) @@ -435,7 +435,7 @@ class _CommandStructure: # width lay2 = QtGui.QHBoxLayout() lay0.addLayout(lay2) - label2 = QtGui.QLabel(unicode(translate("Arch","Width"))) + label2 = QtGui.QLabel(translate("Arch","Width").decode("utf8")) lay2.addWidget(label2) self.vWidth = QtGui.QDoubleSpinBox() self.vWidth.setDecimals(d) @@ -446,7 +446,7 @@ class _CommandStructure: # height lay3 = QtGui.QHBoxLayout() lay0.addLayout(lay3) - label3 = QtGui.QLabel(unicode(translate("Arch","Height"))) + label3 = QtGui.QLabel(translate("Arch","Height").decode("utf8")) lay3.addWidget(label3) self.vHeight = QtGui.QDoubleSpinBox() self.vHeight.setDecimals(d) @@ -455,11 +455,11 @@ class _CommandStructure: lay3.addWidget(self.vHeight) # horizontal button - value5 = QtGui.QPushButton(unicode(translate("Arch","Rotate"))) + value5 = QtGui.QPushButton(translate("Arch","Rotate").decode("utf8")) lay0.addWidget(value5) # continue button - value4 = QtGui.QCheckBox(unicode(translate("Arch","Continue"))) + value4 = QtGui.QCheckBox(translate("Arch","Continue").decode("utf8")) lay0.addWidget(value4) QtCore.QObject.connect(valuep,QtCore.SIGNAL("currentIndexChanged(int)"),self.setPreset) @@ -515,25 +515,25 @@ class _Structure(ArchComponent.Component): def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyLink","Tool","Arch", - "An optional extrusion path for this element") + translate("Arch","An optional extrusion path for this element")) obj.addProperty("App::PropertyLength","Length","Arch", - str(translate("Arch","The length of this element, if not based on a profile"))) + translate("Arch","The length of this element, if not based on a profile")) obj.addProperty("App::PropertyLength","Width","Arch", - str(translate("Arch","The width of this element, if not based on a profile"))) + translate("Arch","The width of this element, if not based on a profile")) obj.addProperty("App::PropertyLength","Height","Arch", - str(translate("Arch","The height or extrusion depth of this element. Keep 0 for automatic"))) + translate("Arch","The height or extrusion depth of this element. Keep 0 for automatic")) obj.addProperty("App::PropertyLinkList","Axes","Arch", - str(translate("Arch","Axes systems this structure is built on"))) + translate("Arch","Axes systems this structure is built on")) obj.addProperty("App::PropertyLinkList","Armatures","Arch", - str(translate("Arch","Armatures contained in this element"))) + translate("Arch","Armatures contained in this element")) obj.addProperty("App::PropertyVector","Normal","Arch", - str(translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))) + translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")) obj.addProperty("App::PropertyIntegerList","Exclude","Arch", - str(translate("Arch","The element numbers to exclude when this structure is based on axes"))) + translate("Arch","The element numbers to exclude when this structure is based on axes")) obj.addProperty("App::PropertyEnumeration","Role","Arch", - str(translate("Arch","The role of this structural element"))) + translate("Arch","The role of this structural element")) obj.addProperty("App::PropertyVectorList","Nodes","Arch", - str(translate("Arch","The structural nodes of this element"))) + translate("Arch","The structural nodes of this element")) self.Type = "Structure" obj.Length = 1 obj.Width = 1 @@ -567,7 +567,7 @@ class _Structure(ArchComponent.Component): try: base = obj.Tool.Shape.copy().makePipe(obj.Base.Shape.copy()) except: - FreeCAD.Console.PrintError(str(translate("Arch","Error: The base shape couldn't be extruded along this tool object"))) + FreeCAD.Console.PrintError(translate("Arch","Error: The base shape couldn't be extruded along this tool object")) return if not base: if obj.Normal == Vector(0,0,0): @@ -651,7 +651,7 @@ class _Structure(ArchComponent.Component): if base.Volume < 0: base.reverse() if base.Volume < 0: - FreeCAD.Console.PrintError(str(translate("Arch","Couldn't compute a shape"))) + FreeCAD.Console.PrintError(translate("Arch","Couldn't compute a shape")) return base = base.removeSplitter() obj.Shape = base diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index a8cdf4dc1..f5bca95fd 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -30,7 +30,7 @@ __title__="FreeCAD Wall" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" -def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name=str(translate("Arch","Wall"))): +def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name=translate("Arch","Wall")): '''makeWall([obj],[length],[width],[height],[align],[face],[name]): creates a wall based on the given object, which can be a sketch, a draft object, a face or a solid, or no object at all, then you must provide length, width and height. Align can be "Center","Left" or "Right", @@ -156,7 +156,7 @@ class _CommandWall: # automatic mode import Draft if Draft.getType(sel[0].Object) != "Wall": - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Wall"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Wall")) FreeCADGui.doCommand('import Arch') for selobj in sel: if Draft.getType(selobj.Object) == "Space": @@ -200,7 +200,7 @@ class _CommandWall: import Part l = Part.Line(self.points[0],self.points[1]) self.tracker.finalize() - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Wall"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Wall")) FreeCADGui.doCommand('import Arch') FreeCADGui.doCommand('import Part') FreeCADGui.doCommand('trace=Part.Line(FreeCAD.'+str(l.StartPoint)+',FreeCAD.'+str(l.EndPoint)+')') @@ -230,7 +230,7 @@ class _CommandWall: self.Activated() def addDefault(self,l): - FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","'+str(translate('Arch','WallTrace'))+'")') + FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","'+translate('Arch','WallTrace')+'")') FreeCADGui.doCommand('base.addGeometry(trace)') FreeCADGui.doCommand('Arch.makeWall(base,width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")') @@ -255,12 +255,12 @@ class _CommandWall: "sets up a taskbox widget" d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2) w = QtGui.QWidget() - w.setWindowTitle(unicode(translate("Arch","Wall options"))) + w.setWindowTitle(translate("Arch","Wall options").decode("utf8")) lay0 = QtGui.QVBoxLayout(w) lay5 = QtGui.QHBoxLayout() lay0.addLayout(lay5) - label5 = QtGui.QLabel(unicode(translate("Arch","Length"))) + label5 = QtGui.QLabel(translate("Arch","Length").decode("utf8")) lay5.addWidget(label5) self.Length = QtGui.QDoubleSpinBox() self.Length.setDecimals(d) @@ -269,7 +269,7 @@ class _CommandWall: lay1 = QtGui.QHBoxLayout() lay0.addLayout(lay1) - label1 = QtGui.QLabel(unicode(translate("Arch","Width"))) + label1 = QtGui.QLabel(translate("Arch","Width").decode("utf8")) lay1.addWidget(label1) value1 = QtGui.QDoubleSpinBox() value1.setDecimals(d) @@ -278,7 +278,7 @@ class _CommandWall: lay2 = QtGui.QHBoxLayout() lay0.addLayout(lay2) - label2 = QtGui.QLabel(unicode(translate("Arch","Height"))) + label2 = QtGui.QLabel(translate("Arch","Height").decode("utf8")) lay2.addWidget(label2) value2 = QtGui.QDoubleSpinBox() value2.setDecimals(d) @@ -287,7 +287,7 @@ class _CommandWall: lay3 = QtGui.QHBoxLayout() lay0.addLayout(lay3) - label3 = QtGui.QLabel(unicode(translate("Arch","Alignment"))) + label3 = QtGui.QLabel(translate("Arch","Alignment").decode("utf8")) lay3.addWidget(label3) value3 = QtGui.QComboBox() items = ["Center","Left","Right"] @@ -295,7 +295,7 @@ class _CommandWall: value3.setCurrentIndex(items.index(self.Align)) lay3.addWidget(value3) - value4 = QtGui.QCheckBox(unicode(translate("Arch","Continue"))) + value4 = QtGui.QCheckBox(translate("Arch","Continue").decode("utf8")) lay0.addWidget(value4) QtCore.QObject.connect(value1,QtCore.SIGNAL("valueChanged(double)"),self.setWidth) QtCore.QObject.connect(value2,QtCore.SIGNAL("valueChanged(double)"),self.setHeight) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index feb87a17c..62d892be7 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -36,7 +36,7 @@ WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane", "Sliding 2-pane", "Simple door", "Glass door"] Roles = ["Window","Door"] -def makeWindow(baseobj=None,width=None,height=None,parts=None,name=str(translate("Arch","Window"))): +def makeWindow(baseobj=None,width=None,height=None,parts=None,name=translate("Arch","Window")): '''makeWindow(baseobj,[width,height,parts,name]): creates a window based on the given base 2D object (sketch or draft).''' @@ -397,7 +397,7 @@ class _CommandWindow: if obj.Objects[0].Inlist: host = obj.Objects[0].Inlist[0] - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Window"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Window")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("win = Arch.makeWindow(FreeCAD.ActiveDocument."+obj.Name+")") if host: @@ -417,7 +417,7 @@ class _CommandWindow: self.tracker.length(self.Width) self.tracker.width(self.Thickness) self.tracker.height(self.Height) - FreeCAD.Console.PrintMessage(str(translate("Arch","Pick a face on an existing object or select a preset"))) + FreeCAD.Console.PrintMessage(translate("Arch","Pick a face on an existing object or select a preset\n")) FreeCADGui.Snapper.getPoint(callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox()) FreeCADGui.Snapper.setSelectMode(True) @@ -439,7 +439,7 @@ class _CommandWindow: FreeCADGui.Selection.addObserver(FreeCAD.ArchObserver) else: # preset - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Window"))) + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Window")) FreeCADGui.doCommand("import math,FreeCAD,Arch,WorkingPlane") if obj and (self.baseFace != None): FreeCADGui.doCommand("pl = WorkingPlane.getPlacementFromFace(FreeCAD.ActiveDocument." + obj.Name + ".Shape.Faces[" + str(self.baseFace) + "])") @@ -484,13 +484,13 @@ class _CommandWindow: "sets up a taskbox widget" d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2) w = QtGui.QWidget() - w.setWindowTitle(unicode(translate("Arch","Window options"))) + w.setWindowTitle(translate("Arch","Window options")) lay0 = QtGui.QVBoxLayout(w) # presets box layp = QtGui.QHBoxLayout() lay0.addLayout(layp) - labelp = QtGui.QLabel(unicode(translate("Arch","Preset"))) + labelp = QtGui.QLabel(translate("Arch","Preset")) layp.addWidget(labelp) valuep = QtGui.QComboBox() valuep.addItems(["Create from scratch"]+WindowPresets) @@ -508,7 +508,7 @@ class _CommandWindow: for param in self.wparams: l = QtGui.QHBoxLayout() lay0.addLayout(l) - lab = QtGui.QLabel(unicode(translate("Arch",param))) + lab = QtGui.QLabel(translate("Arch",param).decode("utf8")) l.addWidget(lab) setattr(self,"val"+param,QtGui.QDoubleSpinBox()) wid = getattr(self,"val"+param) @@ -570,20 +570,20 @@ class _Window(ArchComponent.Component): def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyStringList","WindowParts","Arch", - str(translate("Arch","the components of this window"))) + translate("Arch","the components of this window")) obj.addProperty("App::PropertyLength","HoleDepth","Arch", - str(translate("Arch","The depth of the hole that this window makes in its host object. Keep 0 for automatic."))) + translate("Arch","The depth of the hole that this window makes in its host object. Keep 0 for automatic.")) obj.addProperty("Part::PropertyPartShape","Subvolume","Arch", - str(translate("Arch","an optional volume to be subtracted from hosts of this window"))) + translate("Arch","an optional volume to be subtracted from hosts of this window")) obj.addProperty("App::PropertyLength","Width","Arch", - str(translate("Arch","The width of this window (for preset windows only)"))) + translate("Arch","The width of this window (for preset windows only)")) obj.addProperty("App::PropertyLength","Height","Arch", - str(translate("Arch","The height of this window (for preset windows only)"))) + translate("Arch","The height of this window (for preset windows only)")) obj.addProperty("App::PropertyVector","Normal","Arch", - str(translate("Arch","The normal direction of this window"))) + translate("Arch","The normal direction of this window")) obj.addProperty("App::PropertyInteger","Preset","Arch","") obj.addProperty("App::PropertyEnumeration","Role","Arch", - str(translate("Arch","The role of this window"))) + translate("Arch","The role of this window")) obj.setEditorMode("Preset",2) self.Type = "Window" @@ -1058,7 +1058,7 @@ class _ArchWindowTaskPanel: self.obj.WindowParts = parts self.update() else: - FreeCAD.Console.PrintWarning(str(translate("Arch", "Unable to create component"))) + FreeCAD.Console.PrintWarning(translate("Arch", "Unable to create component\n")) self.newtitle.setVisible(False) self.new1.setVisible(False) diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py index 64b39b09a..15e08c8ec 100644 --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -100,16 +100,16 @@ class ArchWorkbench(Workbench): 'Draft_Snap_Extension','Draft_Snap_Near','Draft_Snap_Ortho', 'Draft_Snap_Dimensions'] - self.appendToolbar(str(translate("arch","Arch tools")),self.archtools) - self.appendToolbar(str(translate("arch","Draft tools")),self.drafttools) - self.appendToolbar(str(translate("arch","Draft mod tools")),self.draftmodtools) - self.appendMenu([str(translate("arch","&Architecture")),str(translate("arch","Conversion Tools"))],self.meshtools) - self.appendMenu([str(translate("arch","&Architecture")),str(translate("arch","Calculation Tools"))],self.calctools) - self.appendMenu(str(translate("arch","&Architecture")),self.archtools) - self.appendMenu(str(translate("arch","&Draft")),self.drafttools+self.draftmodtools+self.extramodtools) - self.appendMenu([str(translate("arch","&Draft")),str(translate("arch","Context Tools"))],self.draftcontexttools) - self.appendMenu([str(translate("arch","&Draft")),str(translate("arch","Utilities"))],self.draftutils) - self.appendMenu([str(translate("arch","&Draft")),str(translate("arch","Snapping"))],self.snapList) + self.appendToolbar(translate("arch","Arch tools"),self.archtools) + self.appendToolbar(translate("arch","Draft tools"),self.drafttools) + self.appendToolbar(translate("arch","Draft mod tools"),self.draftmodtools) + self.appendMenu([translate("arch","&Architecture"),translate("arch","Conversion Tools")],self.meshtools) + self.appendMenu([translate("arch","&Architecture"),translate("arch","Calculation Tools")],self.calctools) + self.appendMenu(translate("arch","&Architecture"),self.archtools) + self.appendMenu(translate("arch","&Draft"),self.drafttools+self.draftmodtools+self.extramodtools) + self.appendMenu([translate("arch","&Draft"),translate("arch","Context Tools")],self.draftcontexttools) + self.appendMenu([translate("arch","&Draft"),translate("arch","Utilities")],self.draftutils) + self.appendMenu([translate("arch","&Draft"),translate("arch","Snapping")],self.snapList) FreeCADGui.addIconPath(":/icons") FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addPreferencePage(":/ui/archprefs-base.ui","Arch") diff --git a/src/Mod/Arch/importDAE.py b/src/Mod/Arch/importDAE.py index dab4e0b50..d329a528e 100644 --- a/src/Mod/Arch/importDAE.py +++ b/src/Mod/Arch/importDAE.py @@ -41,7 +41,7 @@ def checkCollada(): try: import collada except: - FreeCAD.Console.PrintError(str(translate("Arch","pycollada not found, collada support is disabled.\n"))) + FreeCAD.Console.PrintError(translate("Arch","pycollada not found, collada support is disabled.\n")) return False else: return True @@ -77,7 +77,7 @@ def decode(name): try: decodedName = (name.decode("latin1")) except UnicodeDecodeError: - FreeCAD.Console.PrintError(str(translate("Arch","Error: Couldn't determine character encoding"))) + FreeCAD.Console.PrintError(translate("Arch","Error: Couldn't determine character encoding")) decodedName = name return decodedName @@ -171,4 +171,4 @@ def export(exportList,filename): colmesh.scenes.append(myscene) colmesh.scene = myscene colmesh.write(filename) - FreeCAD.Console.PrintMessage(str(translate("Arch","file %s successfully created.")) % filename) + FreeCAD.Console.PrintMessage(translate("Arch","file %s successfully created.") % filename) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 325e13dd6..b3b88cde0 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -89,7 +89,7 @@ def getIfcOpenShell(): global IfcImport import IfcImport except: - FreeCAD.Console.PrintMessage(str(translate("Arch","Couldn't locate IfcOpenShell\n"))) + FreeCAD.Console.PrintMessage(translate("Arch","Couldn't locate IfcOpenShell\n")) return False else: return True @@ -349,13 +349,13 @@ def read(filename): else: # use only the internal python parser - FreeCAD.Console.PrintWarning(str(translate("Arch","IfcOpenShell not found or disabled, falling back on internal parser.\n"))) + FreeCAD.Console.PrintWarning(translate("Arch","IfcOpenShell not found or disabled, falling back on internal parser.\n")) schema=getSchema() if schema: if DEBUG: print "opening",filename,"..." ifc = ifcReader.IfcDocument(filename,schema=schema,debug=DEBUG) else: - FreeCAD.Console.PrintWarning(str(translate("Arch","IFC Schema not found, IFC import disabled.\n"))) + FreeCAD.Console.PrintWarning(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)) @@ -761,7 +761,7 @@ def decode(name): try: decodedName = (name.decode("latin1")) except UnicodeDecodeError: - FreeCAD.Console.PrintError(str(translate("Arch", "Error: Couldn't determine character encoding\n"))) + FreeCAD.Console.PrintError(translate("Arch", "Error: Couldn't determine character encoding\n")) decodedName = name return decodedName diff --git a/src/Mod/Arch/importOBJ.py b/src/Mod/Arch/importOBJ.py index 72e824a2e..6028a6705 100644 --- a/src/Mod/Arch/importOBJ.py +++ b/src/Mod/Arch/importOBJ.py @@ -92,7 +92,7 @@ def export(exportList,filename): for f in flist: outfile.write("f" + f + "\n") outfile.close() - FreeCAD.Console.PrintMessage(str(translate("Arch","successfully written "))+filename) + FreeCAD.Console.PrintMessage(translate("Arch","successfully written ")+filename+"\n") diff --git a/src/Mod/Arch/importWebGL.py b/src/Mod/Arch/importWebGL.py index 1e5d76858..c59a6fb44 100644 --- a/src/Mod/Arch/importWebGL.py +++ b/src/Mod/Arch/importWebGL.py @@ -44,7 +44,7 @@ def export(exportList,filename): outfile = pythonopen(filename,"wb") outfile.write(html) outfile.close() - FreeCAD.Console.PrintMessage(str(translate("Arch","successfully written "))+filename) + FreeCAD.Console.PrintMessage(translate("Arch","successfully written ")+filename+"\n") def getHTML(objectsList): "returns the complete HTML code of a viewer for the given objects" diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 0338ee9d4..0d2514fb8 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2697,7 +2697,7 @@ class _ViewProviderDraft: "Draft","Defines a hatch pattern") vobj.addProperty("App::PropertyFloat","PatternSize", "Draft","Sets the size of the pattern") - vobj.Pattern = [str(translate("draft","None"))]+svgpatterns().keys() + vobj.Pattern = [translate("draft","None")]+svgpatterns().keys() vobj.PatternSize = 1 def __getstate__(self): diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 54f140cd3..0f16bd6fb 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -67,7 +67,7 @@ MODALT = MODS[Draft.getParam("modalt",2)] def translate(context,text): "convenience function for Qt translator" - return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8) + return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).encode("utf8") def msg(text=None,mode=None): "prints the given message on the FreeCAD status bar" @@ -423,7 +423,7 @@ class Line(Creator): 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_Line", "Line"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Line", "Creates a 2-point line. CTRL to snap, SHIFT to constrain")} - def Activated(self,name=str(translate("draft","Line"))): + def Activated(self,name=translate("draft","Line")): Creator.Activated(self,name) if self.doc: self.obj = None @@ -565,7 +565,7 @@ class Wire(Line): 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_Wire", "DWire"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Wire", "Creates a multiple-point DraftWire (DWire). CTRL to snap, SHIFT to constrain")} def Activated(self): - Line.Activated(self,name=str(translate("draft","DWire"))) + Line.Activated(self,name=translate("draft","DWire")) class BSpline(Line): @@ -581,7 +581,7 @@ class BSpline(Line): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_BSpline", "Creates a multiple-point b-spline. CTRL to snap, SHIFT to constrain")} def Activated(self): - Line.Activated(self,name=str(translate("draft","BSpline"))) + Line.Activated(self,name=translate("draft","BSpline")) if self.doc: self.bsplinetrack = bsplineTracker() @@ -731,7 +731,7 @@ class Rectangle(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Rectangle", "Creates a 2-point rectangle. CTRL to snap")} def Activated(self): - name = str(translate("draft","Rectangle")) + name = translate("draft","Rectangle") Creator.Activated(self,name) if self.ui: self.refpoint = None @@ -1107,14 +1107,14 @@ class Arc(Creator): else: self.step = 2 self.arctrack.setCenter(self.center) - self.ui.labelRadius.setText(str(translate("draft", "Start Angle"))) + self.ui.labelRadius.setText(translate("draft", "Start Angle")) self.linetrack.p1(self.center) self.linetrack.on() self.ui.radiusValue.setText("") self.ui.radiusValue.setFocus() msg(translate("draft", "Pick start angle:\n")) elif (self.step == 2): - self.ui.labelRadius.setText(str(translate("draft", "Aperture"))) + self.ui.labelRadius.setText(translate("draft", "Aperture")) self.firstangle = math.radians(rad) if DraftVecUtils.equals(plane.axis, Vector(1,0,0)): u = Vector(0,self.rad,0) else: u = DraftVecUtils.scaleTo(Vector(1,0,0).cross(plane.axis), self.rad) @@ -1155,7 +1155,7 @@ class Polygon(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Polygon", "Creates a regular polygon. CTRL to snap, SHIFT to constrain")} def Activated(self): - name = str(translate("draft","Polygon")) + name = translate("draft","Polygon") Creator.Activated(self,name) if self.ui: self.step = 0 @@ -1334,7 +1334,7 @@ class Ellipse(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Ellipse", "Creates an ellipse. CTRL to snap")} def Activated(self): - name = str(translate("draft","Ellipse")) + name = translate("draft","Ellipse") Creator.Activated(self,name) if self.ui: self.refpoint = None @@ -1447,7 +1447,7 @@ class Text(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Text", "Creates an annotation. CTRL to snap")} def Activated(self): - name = str(translate("draft","Text")) + name = translate("draft","Text") Creator.Activated(self,name) if self.ui: self.dialog = None @@ -1524,7 +1524,7 @@ class Dimension(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Dimension", "Creates a dimension. CTRL to snap, SHIFT to constrain, ALT to select a segment")} def Activated(self): - name = str(translate("draft","Dimension")) + name = translate("draft","Dimension") if self.cont: self.finish() elif self.hasMeasures(): @@ -1815,7 +1815,7 @@ class ShapeString(Creator): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_ShapeString", "Creates text string in shapes.")} def Activated(self): - name = str(translate("draft","ShapeString")) + name = translate("draft","ShapeString") Creator.Activated(self,name) if self.ui: self.ui.sourceCmd = self @@ -1939,7 +1939,7 @@ class Move(Modifier): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Move", "Moves the selected objects between 2 points. CTRL to snap, SHIFT to constrain, ALT to copy")} def Activated(self): - self.name = str(translate("draft","Move")) + self.name = translate("draft","Move") Modifier.Activated(self,self.name) if self.ui: if not Draft.getSelection(): @@ -2827,7 +2827,7 @@ class Scale(Modifier): 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Scale", "Scales the selected objects from a base point. CTRL to snap, SHIFT to constrain, ALT to copy")} def Activated(self): - self.name = str(translate("draft","Scale")) + self.name = translate("draft","Scale") Modifier.Activated(self,self.name) if self.ui: if not Draft.getSelection(): diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index a16ff8198..103411279 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -99,7 +99,7 @@ class DraftWorkbench (Workbench): from DraftTools import translate FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") - self.appendMenu(["&Macro",str(translate("draft","Installed Macros"))],macros.macrosList) + self.appendMenu(["&Macro",translate("draft","Installed Macros")],macros.macrosList) except: pass @@ -125,11 +125,11 @@ class DraftWorkbench (Workbench): 'Draft_Snap_Dimensions'] self.appendToolbar(QT_TRANSLATE_NOOP("Workbench","Draft creation tools"),self.cmdList) self.appendToolbar(QT_TRANSLATE_NOOP("Workbench","Draft modification tools"),self.modList) - self.appendMenu(str(translate("draft","&Draft")),self.cmdList+self.modList) - self.appendMenu([str(translate("draft","&Draft")),str(translate("draft","Context tools"))],self.treecmdList) - self.appendMenu([str(translate("draft","&Draft")),str(translate("draft","Utilities"))],self.utils) - self.appendMenu([str(translate("draft","&Draft")),str(translate("draft","Wire tools"))],self.lineList) - self.appendMenu([str(translate("draft","&Draft")),str(translate("draft","Snapping"))],self.snapList) + self.appendMenu(translate("draft","&Draft"),self.cmdList+self.modList) + self.appendMenu([translate("draft","&Draft"),translate("draft","Context tools")],self.treecmdList) + self.appendMenu([translate("draft","&Draft"),translate("draft","Utilities")],self.utils) + self.appendMenu([translate("draft","&Draft"),translate("draft","Wire tools")],self.lineList) + self.appendMenu([translate("draft","&Draft"),translate("draft","Snapping")],self.snapList) if hasattr(FreeCADGui,"draftToolBar"): if not hasattr(FreeCADGui.draftToolBar,"loadedPreferences"): FreeCADGui.addPreferencePage(":/ui/userprefs-base.ui","Draft") diff --git a/src/Mod/Draft/importDWG.py b/src/Mod/Draft/importDWG.py index 6fb019bff..0d281c907 100644 --- a/src/Mod/Draft/importDWG.py +++ b/src/Mod/Draft/importDWG.py @@ -79,7 +79,7 @@ def getTeighaConverter(): if os.path.exists(teigha): return teigha from DraftTools import translate - FreeCAD.Console.PrintMessage(str(translate("draft","Teigha File Converter not found, DWG support is disabled.\n"))) + FreeCAD.Console.PrintMessage(translate("draft","Teigha File Converter not found, DWG support is disabled.\n")) return None def convertToDxf(dwgfilename):