Skip to content

Commit

Permalink
Made Arch objects properties translatable - issue #2524
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Oct 8, 2016
1 parent 11bbb9e commit dabccc4
Show file tree
Hide file tree
Showing 22 changed files with 343 additions and 269 deletions.
17 changes: 10 additions & 7 deletions src/Mod/Arch/ArchAxis.py
Expand Up @@ -28,9 +28,12 @@
from PySide import QtCore, QtGui
from DraftTools import translate
from pivy import coin
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

__title__="FreeCAD Axis System"
__author__ = "Yorik van Havre"
Expand Down Expand Up @@ -59,9 +62,9 @@ class _CommandAxis:
"the Arch Axis command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_Axis',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Axis","Axis"),
'MenuText': QT_TRANSLATE_NOOP("Arch_Axis","Axis"),
'Accel': "A, X",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Axis","Creates an axis system.")}
'ToolTip': QT_TRANSLATE_NOOP("Arch_Axis","Creates an axis system.")}

def Activated(self):
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Axis"))
Expand All @@ -81,9 +84,9 @@ def IsActive(self):
class _Axis:
"The Axis object"
def __init__(self,obj):
obj.addProperty("App::PropertyFloatList","Distances","Arch", "The intervals between axes")
obj.addProperty("App::PropertyFloatList","Angles","Arch", "The angles of each axis")
obj.addProperty("App::PropertyLength","Length","Arch", "The length of the axes")
obj.addProperty("App::PropertyFloatList","Distances","Arch", QT_TRANSLATE_NOOP("App::Property","The intervals between axes"))
obj.addProperty("App::PropertyFloatList","Angles","Arch", QT_TRANSLATE_NOOP("App::Property","The angles of each axis"))
obj.addProperty("App::PropertyLength","Length","Arch", QT_TRANSLATE_NOOP("App::Property","The length of the axes"))
obj.addProperty("App::PropertyPlacement","Placement","Base","")
obj.addProperty("Part::PropertyPartShape","Shape","Base","")
self.Type = "Axis"
Expand Down Expand Up @@ -126,8 +129,8 @@ class _ViewProviderAxis:
"A View Provider for the Axis object"

def __init__(self,vobj):
vobj.addProperty("App::PropertyLength","BubbleSize","Arch", "The size of the axis bubbles")
vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", "The numbering style")
vobj.addProperty("App::PropertyLength","BubbleSize","Arch", QT_TRANSLATE_NOOP("App::Property","The size of the axis bubbles"))
vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", QT_TRANSLATE_NOOP("App::Property","The numbering style"))
vobj.addProperty("App::PropertyEnumeration","DrawStyle","Base","")
vobj.addProperty("App::PropertyEnumeration","BubblePosition","Base","")
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Arch/ArchBuilding.py
Expand Up @@ -28,9 +28,12 @@
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

__title__="FreeCAD Building"
__author__ = "Yorik van Havre"
Expand Down Expand Up @@ -240,7 +243,7 @@ class _Building(ArchFloor._Floor):
"The Building object"
def __init__(self,obj):
ArchFloor._Floor.__init__(self,obj)
obj.addProperty("App::PropertyEnumeration","BuildingType","Arch","The type of this building")
obj.addProperty("App::PropertyEnumeration","BuildingType","Arch",QT_TRANSLATE_NOOP("App::Property","The type of this building"))
self.Type = "Building"
obj.setEditorMode('Height',2)
obj.BuildingType = BuildingTypes
Expand Down
31 changes: 17 additions & 14 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -37,9 +37,12 @@
import FreeCADGui
from PySide import QtGui,QtCore
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt


def addToComponent(compobject,addobject,mod=None):
Expand Down Expand Up @@ -289,20 +292,20 @@ def retranslateUi(self, TaskPanel):
class Component:
"The default Arch Component object"
def __init__(self,obj):
obj.addProperty("App::PropertyLink","Base","Arch","The base object this component is built upon")
obj.addProperty("App::PropertyLink","CloneOf","Arch","The object this component is cloning")
obj.addProperty("App::PropertyLinkList","Additions","Arch","Other shapes that are appended to this object")
obj.addProperty("App::PropertyLinkList","Subtractions","Arch","Other shapes that are subtracted from this object")
obj.addProperty("App::PropertyString","Description","Arch","An optional description for this component")
obj.addProperty("App::PropertyString","Tag","Arch","An optional tag for this component")
obj.addProperty("App::PropertyMap","IfcAttributes","Arch","Custom IFC properties and attributes")
obj.addProperty("App::PropertyLink","BaseMaterial","Material","A material for this object")
obj.addProperty("App::PropertyEnumeration","Role","Arch","The role of this object")
obj.addProperty("App::PropertyBool","MoveWithHost","Arch","Specifies if this object must move together when its host is moved")
obj.addProperty("App::PropertyLink","IfcProperties","Arch","Custom IFC properties and attributes")
obj.addProperty("App::PropertyArea","VerticalArea","Arch","The area of all vertical faces of this object")
obj.addProperty("App::PropertyArea","HorizontalArea","Arch","The area of the projection of this object onto the XY plane")
obj.addProperty("App::PropertyLength","PerimeterLength","Arch","The perimeter length of the horizontal area")
obj.addProperty("App::PropertyLink","Base","Arch",QT_TRANSLATE_NOOP("App::Property","The base object this component is built upon"))
obj.addProperty("App::PropertyLink","CloneOf","Arch",QT_TRANSLATE_NOOP("App::Property","The object this component is cloning"))
obj.addProperty("App::PropertyLinkList","Additions","Arch",QT_TRANSLATE_NOOP("App::Property","Other shapes that are appended to this object"))
obj.addProperty("App::PropertyLinkList","Subtractions","Arch",QT_TRANSLATE_NOOP("App::Property","Other shapes that are subtracted from this object"))
obj.addProperty("App::PropertyString","Description","Arch",QT_TRANSLATE_NOOP("App::Property","An optional description for this component"))
obj.addProperty("App::PropertyString","Tag","Arch",QT_TRANSLATE_NOOP("App::Property","An optional tag for this component"))
obj.addProperty("App::PropertyMap","IfcAttributes","Arch",QT_TRANSLATE_NOOP("App::Property","Custom IFC properties and attributes"))
obj.addProperty("App::PropertyLink","BaseMaterial","Material",QT_TRANSLATE_NOOP("App::Property","A material for this object"))
obj.addProperty("App::PropertyEnumeration","Role","Arch",QT_TRANSLATE_NOOP("App::Property","The role of this object"))
obj.addProperty("App::PropertyBool","MoveWithHost","Arch",QT_TRANSLATE_NOOP("App::Property","Specifies if this object must move together when its host is moved"))
obj.addProperty("App::PropertyLink","IfcProperties","Arch",QT_TRANSLATE_NOOP("App::Property","Custom IFC properties and attributes"))
obj.addProperty("App::PropertyArea","VerticalArea","Arch",QT_TRANSLATE_NOOP("App::Property","The area of all vertical faces of this object"))
obj.addProperty("App::PropertyArea","HorizontalArea","Arch",QT_TRANSLATE_NOOP("App::Property","The area of the projection of this object onto the XY plane"))
obj.addProperty("App::PropertyLength","PerimeterLength","Arch",QT_TRANSLATE_NOOP("App::Property","The perimeter length of the horizontal area"))
obj.Proxy = self
self.Type = "Component"
self.Subvolume = None
Expand Down
22 changes: 11 additions & 11 deletions src/Mod/Arch/ArchEquipment.py
Expand Up @@ -33,9 +33,12 @@
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

# presets
Roles = ["Furniture", "Hydro Equipment", "Electric Equipment"]
Expand Down Expand Up @@ -163,9 +166,9 @@ class _CommandEquipment:
"the Arch Equipment command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_Equipment',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Equipment","Equipment"),
'MenuText': QT_TRANSLATE_NOOP("Arch_Equipment","Equipment"),
'Accel': "E, Q",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Equipment","Creates an equipment object from a selected object (Part or Mesh)")}
'ToolTip': QT_TRANSLATE_NOOP("Arch_Equipment","Creates an equipment object from a selected object (Part or Mesh)")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand All @@ -191,8 +194,8 @@ class _Command3Views:
"the Arch 3Views command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_3Views',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_3Views","3 views from mesh"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_3Views","Creates 3 views (top, front, side) from a mesh-based object")}
'MenuText': QT_TRANSLATE_NOOP("Arch_3Views","3 views from mesh"),
'ToolTip': QT_TRANSLATE_NOOP("Arch_3Views","Creates 3 views (top, front, side) from a mesh-based object")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand Down Expand Up @@ -235,13 +238,10 @@ class _Equipment(ArchComponent.Component):
"The Equipment object"
def __init__(self,obj):
ArchComponent.Component.__init__(self,obj)
#obj.addProperty("Part::PropertyPartShape","TopView","Arch","an optional 2D shape representing a top view of this equipment")
#obj.addProperty("Part::PropertyPartShape","FrontView","Arch","an optional 2D shape representing a front view of this equipment")
#obj.addProperty("Part::PropertyPartShape","SideView","Arch","an optional 2D shape representing a side view of this equipment")
obj.addProperty("App::PropertyString","Model","Arch","The model description of this equipment")
obj.addProperty("App::PropertyString","Url","Arch","The url of the product page of this equipment")
obj.addProperty("App::PropertyVectorList","SnapPoints","Arch","Additional snap points for this equipment")
obj.addProperty("App::PropertyFloat","EquipmentPower","Arch","The electric power needed by this equipment in Watts")
obj.addProperty("App::PropertyString","Model","Arch",QT_TRANSLATE_NOOP("App::Property","The model description of this equipment"))
obj.addProperty("App::PropertyString","Url","Arch",QT_TRANSLATE_NOOP("App::Property","The url of the product page of this equipment"))
obj.addProperty("App::PropertyVectorList","SnapPoints","Arch",QT_TRANSLATE_NOOP("App::Property","Additional snap points for this equipment"))
obj.addProperty("App::PropertyFloat","EquipmentPower","Arch",QT_TRANSLATE_NOOP("App::Property","The electric power needed by this equipment in Watts"))
self.Type = "Equipment"
obj.Role = Roles
obj.Proxy = self
Expand Down
13 changes: 8 additions & 5 deletions src/Mod/Arch/ArchFloor.py
Expand Up @@ -28,9 +28,12 @@
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

__title__="FreeCAD Arch Floor"
__author__ = "Yorik van Havre"
Expand All @@ -52,9 +55,9 @@ class _CommandFloor:
"the Arch Cell command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_Floor',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Floor"),
'MenuText': QT_TRANSLATE_NOOP("Arch_Floor","Floor"),
'Accel': "F, L",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Creates a floor object including selected objects")}
'ToolTip': QT_TRANSLATE_NOOP("Arch_Floor","Creates a floor object including selected objects")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand Down Expand Up @@ -97,11 +100,11 @@ def Activated(self):
class _Floor:
"The Floor object"
def __init__(self,obj):
obj.addProperty("App::PropertyLength","Height","Arch","The height of this object")
obj.addProperty("App::PropertyArea","Area", "Arch","The computed floor area of this floor")
obj.addProperty("App::PropertyLength","Height","Arch",QT_TRANSLATE_NOOP("App::Property","The height of this object"))
obj.addProperty("App::PropertyArea","Area", "Arch",QT_TRANSLATE_NOOP("App::Property","The computed floor area of this floor"))
if not hasattr(obj,"Placement"):
# obj can be a Part Feature and already has a placement
obj.addProperty("App::PropertyPlacement","Placement","Arch","The placement of this object")
obj.addProperty("App::PropertyPlacement","Placement","Arch",QT_TRANSLATE_NOOP("App::Property","The placement of this object"))
self.Type = "Floor"
obj.Proxy = self
self.Object = obj
Expand Down
17 changes: 10 additions & 7 deletions src/Mod/Arch/ArchFrame.py
Expand Up @@ -27,9 +27,12 @@
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

__title__="FreeCAD Arch Frame"
__author__ = "Yorik van Havre"
Expand Down Expand Up @@ -59,9 +62,9 @@ class _CommandFrame:

def GetResources(self):
return {'Pixmap' : 'Arch_Frame',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Frame","Frame"),
'MenuText': QT_TRANSLATE_NOOP("Arch_Frame","Frame"),
'Accel': "F, R",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Frame","Creates a frame object from a planar 2D object and a profile")}
'ToolTip': QT_TRANSLATE_NOOP("Arch_Frame","Creates a frame object from a planar 2D object and a profile")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand All @@ -81,11 +84,11 @@ class _Frame(ArchComponent.Component):

def __init__(self,obj):
ArchComponent.Component.__init__(self,obj)
obj.addProperty("App::PropertyLink","Profile","Arch","The profile used to build this frame")
obj.addProperty("App::PropertyBool","Align","Arch","Specifies if the profile must be aligned with the extrusion wires")
obj.addProperty("App::PropertyVectorDistance","Offset","Arch","An offset vector between the base sketch and the frame")
obj.addProperty("App::PropertyInteger","BasePoint","Arch","Crossing point of the path on the profile.")
obj.addProperty("App::PropertyAngle","Rotation","Arch","The rotation of the profile around its extrusion axis")
obj.addProperty("App::PropertyLink","Profile","Arch",QT_TRANSLATE_NOOP("App::Property","The profile used to build this frame"))
obj.addProperty("App::PropertyBool","Align","Arch",QT_TRANSLATE_NOOP("App::Property","Specifies if the profile must be aligned with the extrusion wires"))
obj.addProperty("App::PropertyVectorDistance","Offset","Arch",QT_TRANSLATE_NOOP("App::Property","An offset vector between the base sketch and the frame"))
obj.addProperty("App::PropertyInteger","BasePoint","Arch",QT_TRANSLATE_NOOP("App::Property","Crossing point of the path on the profile."))
obj.addProperty("App::PropertyAngle","Rotation","Arch",QT_TRANSLATE_NOOP("App::Property","The rotation of the profile around its extrusion axis"))
self.Type = "Frame"
obj.Role = Roles

Expand Down
33 changes: 18 additions & 15 deletions src/Mod/Arch/ArchPanel.py
Expand Up @@ -27,9 +27,12 @@
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt

__title__="FreeCAD Panel"
__author__ = "Yorik van Havre"
Expand Down Expand Up @@ -89,9 +92,9 @@ class _CommandPanel:
"the Arch Panel command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_Panel',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Panel","Panel"),
'MenuText': QT_TRANSLATE_NOOP("Arch_Panel","Panel"),
'Accel': "P, A",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Panel","Creates a panel object from scratch or from a selected object (sketch, wire, face or solid)")}
'ToolTip': QT_TRANSLATE_NOOP("Arch_Panel","Creates a panel object from scratch or from a selected object (sketch, wire, face or solid)")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand Down Expand Up @@ -254,11 +257,11 @@ class _Panel(ArchComponent.Component):
"The Panel object"
def __init__(self,obj):
ArchComponent.Component.__init__(self,obj)
obj.addProperty("App::PropertyLength","Length","Arch", "The length of this element, if not based on a profile")
obj.addProperty("App::PropertyLength","Width","Arch", "The width of this element, if not based on a profile")
obj.addProperty("App::PropertyLength","Thickness","Arch","The thickness or extrusion depth of this element")
obj.addProperty("App::PropertyInteger","Sheets","Arch", "The number of sheets to use")
obj.addProperty("App::PropertyLength","Offset","Arch", "The offset between this panel and its baseline")
obj.addProperty("App::PropertyLength","Length","Arch", QT_TRANSLATE_NOOP("App::Property","The length of this element, if not based on a profile"))
obj.addProperty("App::PropertyLength","Width","Arch", QT_TRANSLATE_NOOP("App::Property","The width of this element, if not based on a profile"))
obj.addProperty("App::PropertyLength","Thickness","Arch",QT_TRANSLATE_NOOP("App::Property","The thickness or extrusion depth of this element"))
obj.addProperty("App::PropertyInteger","Sheets","Arch", QT_TRANSLATE_NOOP("App::Property","The number of sheets to use"))
obj.addProperty("App::PropertyLength","Offset","Arch", QT_TRANSLATE_NOOP("App::Property","The offset between this panel and its baseline"))
obj.Sheets = 1
self.Type = "Panel"

Expand Down Expand Up @@ -388,14 +391,14 @@ class _PanelView:
"A Drawing view for Arch Panels"

def __init__(self, obj):
obj.addProperty("App::PropertyLink","Source","Base","The linked object")
obj.addProperty("App::PropertyFloat","LineWidth","Drawing view","The line width of the rendered objects")
obj.addProperty("App::PropertyColor","LineColor","Drawing view","The color of the panel outline")
obj.addProperty("App::PropertyLength","FontSize","Tag view","The size of the tag text")
obj.addProperty("App::PropertyColor","TextColor","Tag view","The color of the tag text")
obj.addProperty("App::PropertyFloat","TextX","Tag view","The X offset of the tag text")
obj.addProperty("App::PropertyFloat","TextY","Tag view","The Y offset of the tag text")
obj.addProperty("App::PropertyString","FontName","Tag view","The font of the tag text")
obj.addProperty("App::PropertyLink","Source","Base",QT_TRANSLATE_NOOP("App::Property","The linked object"))
obj.addProperty("App::PropertyFloat","LineWidth","Drawing view",QT_TRANSLATE_NOOP("App::Property","The line width of the rendered objects"))
obj.addProperty("App::PropertyColor","LineColor","Drawing view",QT_TRANSLATE_NOOP("App::Property","The color of the panel outline"))
obj.addProperty("App::PropertyLength","FontSize","Tag view",QT_TRANSLATE_NOOP("App::Property","The size of the tag text"))
obj.addProperty("App::PropertyColor","TextColor","Tag view",QT_TRANSLATE_NOOP("App::Property","The color of the tag text"))
obj.addProperty("App::PropertyFloat","TextX","Tag view",QT_TRANSLATE_NOOP("App::Property","The X offset of the tag text"))
obj.addProperty("App::PropertyFloat","TextY","Tag view",QT_TRANSLATE_NOOP("App::Property","The Y offset of the tag text"))
obj.addProperty("App::PropertyString","FontName","Tag view",QT_TRANSLATE_NOOP("App::Property","The font of the tag text"))
obj.Proxy = self
self.Type = "PanelView"
obj.LineWidth = 0.35
Expand Down

0 comments on commit dabccc4

Please sign in to comment.