Skip to content

Commit

Permalink
Move printMessage in ArchCommands.
Browse files Browse the repository at this point in the history
Messages are translatable.
  • Loading branch information
j-wiedemann authored and yorikvanhavre committed Jul 24, 2016
1 parent 15b70be commit 41307ef
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
19 changes: 8 additions & 11 deletions src/Mod/Arch/ArchBuilding.py
@@ -1,3 +1,5 @@
# -*- coding: utf8 -*-

#***************************************************************************
#* *
#* Copyright (c) 2011 *
Expand Down Expand Up @@ -214,15 +216,15 @@ def Activated(self):
else:
warning = True
if warning :
message = "You can put anything but Site and Building object in a Building object.\n\
message = translate( "Arch" , "You can put anything but Site and Building object in a Building object.\n\
Building object are not allowed to accept Site and Building object.\n\
Site and Building objects will be removed from the selection.\n\
You can change that in the preferences.\n"
self.printMessage( message )
You can change that in the preferences.\n" )
ArchCommands.printMessage( message )
if sel and len(buildingobj) == 0:
message = "There is no valid object in the selection.\n\
Building creation aborted.\n"
self.printMessage( message )
message = translate( "Arch" , "There is no valid object in the selection.\n\
Building creation aborted.\n" )
ArchCommands.printMessage( message )
else :
ss = "[ "
for o in buildingobj:
Expand All @@ -234,11 +236,6 @@ def Activated(self):
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()

def printMessage(self, message):
FreeCAD.Console.PrintMessage(translate("Arch", message))
if FreeCAD.GuiUp :
reply = QtGui.QMessageBox.information(None,"", message)

class _Building(ArchFloor._Floor):
"The Building object"
def __init__(self,obj):
Expand Down
10 changes: 10 additions & 0 deletions src/Mod/Arch/ArchCommands.py
Expand Up @@ -937,6 +937,16 @@ def getExtrusionData(shape):
return [faces[p[0]][0],faces[p[1]][0].CenterOfMass.sub(faces[p[0]][0].CenterOfMass)]
return None

def printMessage( message ):
FreeCAD.Console.PrintMessage( message )
if FreeCAD.GuiUp :
reply = QtGui.QMessageBox.information( None , "" , message.decode('utf8') )

def printWarning( message ):
FreeCAD.Console.PrintMessage( message )
if FreeCAD.GuiUp :
reply = QtGui.QMessageBox.warning( None , "" , message.decode('utf8') )


# command definitions ###############################################

Expand Down
19 changes: 8 additions & 11 deletions src/Mod/Arch/ArchFloor.py
@@ -1,3 +1,5 @@
# -*- coding: utf8 -*-

#***************************************************************************
#* *
#* Copyright (c) 2011 *
Expand Down Expand Up @@ -72,15 +74,15 @@ def Activated(self):
else:
warning = True
if warning :
message = "You can put anything but Site, Building, Floor object in a Floor object.\n\
message = translate( "Arch" , "You can put anything but Site, Building, Floor object in a Floor object.\n\
Floor object are not allowed to accept Site or Building object.\n\
Site, Building and Floor objects will be removed from the selection.\n\
You can change that in the preferences.\n"
self.printMessage( message )
You can change that in the preferences.\n" )
ArchCommands.printMessage( message )
if sel and len(floorobj) == 0:
message = "There is no valid object in the selection.\n\
Floor creation aborted.\n"
self.printMessage( message )
message = translate( "Arch" , "There is no valid object in the selection.\n\
Floor creation aborted.\n" )
ArchCommands.printMessage( message )
else :
ss = "[ "
for o in floorobj:
Expand All @@ -92,11 +94,6 @@ def Activated(self):
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()

def printMessage(self, message):
FreeCAD.Console.PrintMessage(translate("Arch", message))
if FreeCAD.GuiUp :
reply = QtGui.QMessageBox.information(None,"", message)

class _Floor:
"The Floor object"
def __init__(self,obj):
Expand Down
19 changes: 8 additions & 11 deletions src/Mod/Arch/ArchSite.py
@@ -1,3 +1,5 @@
# -*- coding: utf8 -*-

#***************************************************************************
#* *
#* Copyright (c) 2011 *
Expand Down Expand Up @@ -74,15 +76,15 @@ def Activated(self):
else:
warning = True
if warning :
message = "Please select only Building objects or nothing!\n\
message = translate( "Arch" , "Please select only Building objects or nothing!\n\
Site are not allowed to accept other object than Building.\n\
Other objects will be removed from the selection.\n\
You can change that in the preferences."
self.printMessage( message )
You can change that in the preferences." )
ArchCommands.printMessage( message )
if sel and len(siteobj) == 0:
message = "There is no valid object in the selection.\n\
Site creation aborted."
self.printMessage( message )
message = translate( "Arch" , "There is no valid object in the selection.\n\
Site creation aborted." )
ArchCommands.printMessage( message )
else :
ss = "[ "
for o in siteobj:
Expand All @@ -94,11 +96,6 @@ def Activated(self):
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()

def printMessage(self, message):
FreeCAD.Console.PrintMessage(translate("Arch", message))
if FreeCAD.GuiUp :
reply = QtGui.QMessageBox.information(None,"", message)

class _Site(ArchFloor._Floor):
"The Site object"
def __init__(self,obj):
Expand Down

0 comments on commit 41307ef

Please sign in to comment.