remove UnicodeUTF8

This commit is contained in:
wmayer 2016-12-27 18:56:30 +01:00
parent 0f53d8224b
commit b6c28688fe
23 changed files with 139 additions and 268 deletions

View File

@ -41,8 +41,7 @@ class ShipWorkbench(Workbench):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Plot module is disabled, tools cannot graph output curves", "Plot module is disabled, tools cannot graph output curves",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintMessage(msg + '\n') FreeCAD.Console.PrintMessage(msg + '\n')
# ToolBar # ToolBar
shiplist = ["Ship_LoadExample", shiplist = ["Ship_LoadExample",

View File

@ -44,8 +44,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"True if it is a valid ship instance, False otherwise", "True if it is a valid ship instance, False otherwise",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyBool", obj.addProperty("App::PropertyBool",
"IsShip", "IsShip",
"Ship", "Ship",
@ -54,8 +53,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Ship length [m]", "Ship length [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyLength", obj.addProperty("App::PropertyLength",
"Length", "Length",
"Ship", "Ship",
@ -63,8 +61,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Ship breadth [m]", "Ship breadth [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyLength", obj.addProperty("App::PropertyLength",
"Breadth", "Breadth",
"Ship", "Ship",
@ -72,8 +69,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Ship draft [m]", "Ship draft [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyLength", obj.addProperty("App::PropertyLength",
"Draft", "Draft",
"Ship", "Ship",
@ -83,8 +79,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Set of external faces of the ship hull", "Set of external faces of the ship hull",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("Part::PropertyPartShape", obj.addProperty("Part::PropertyPartShape",
"ExternalFaces", "ExternalFaces",
"Ship", "Ship",
@ -92,8 +87,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Set of weight instances", "Set of weight instances",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList", obj.addProperty("App::PropertyStringList",
"Weights", "Weights",
"Ship", "Ship",
@ -101,8 +95,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Set of tank instances", "Set of tank instances",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList", obj.addProperty("App::PropertyStringList",
"Tanks", "Tanks",
"Ship", "Ship",
@ -110,8 +103,7 @@ class Ship:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"Ship", "Ship",
"Set of load conditions", "Set of load conditions",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList", obj.addProperty("App::PropertyStringList",
"LoadConditions", "LoadConditions",
"Ship", "Ship",

View File

@ -50,8 +50,7 @@ class Tank:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_tank", "ship_tank",
"True if it is a valid tank instance, False otherwise", "True if it is a valid tank instance, False otherwise",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyBool", obj.addProperty("App::PropertyBool",
"IsTank", "IsTank",
"Tank", "Tank",
@ -130,8 +129,7 @@ class Tank:
"ship_console", "ship_console",
"Tank volume operation failed. The tool is retrying that" "Tank volume operation failed. The tool is retrying that"
" slightly moving the free surface position", " slightly moving the free surface position",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
rand_bounds = 0.01 * dz rand_bounds = 0.01 * dz
i = 0 i = 0

View File

@ -46,8 +46,7 @@ class Weight:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"True if it is a valid weight instance, False otherwise", "True if it is a valid weight instance, False otherwise",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyBool", obj.addProperty("App::PropertyBool",
"IsWeight", "IsWeight",
"Weight", "Weight",
@ -56,8 +55,7 @@ class Weight:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Mass [kg]", "Mass [kg]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat", obj.addProperty("App::PropertyFloat",
"Mass", "Mass",
"Weight", "Weight",
@ -66,8 +64,7 @@ class Weight:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Linear density [kg / m]", "Linear density [kg / m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat", obj.addProperty("App::PropertyFloat",
"LineDens", "LineDens",
"Weight", "Weight",
@ -76,8 +73,7 @@ class Weight:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Area density [kg / m^2]", "Area density [kg / m^2]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat", obj.addProperty("App::PropertyFloat",
"AreaDens", "AreaDens",
"Weight", "Weight",
@ -86,8 +82,7 @@ class Weight:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Density [kg / m^3]", "Density [kg / m^3]",
None, None))
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat", obj.addProperty("App::PropertyFloat",
"Dens", "Dens",
"Weight", "Weight",

View File

@ -56,8 +56,7 @@ class Plot(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Plot module is disabled, so I cannot perform the plot", "Plot module is disabled, so I cannot perform the plot",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n') FreeCAD.Console.PrintWarning(msg + '\n')
return True return True
# Plot areas curve # Plot areas curve

View File

@ -145,8 +145,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" objects selected)", " objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for i in range(0, len(selObjs)): for i in range(0, len(selObjs)):
@ -162,8 +161,7 @@ class TaskPanel:
"ship_console", "ship_console",
"More than one ship have been selected (the extra" "More than one ship have been selected (the extra"
" ships will be ignored)", " ships will be ignored)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
self.ship = obj self.ship = obj
@ -172,8 +170,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" valid ship found at the selected objects)", " valid ship found at the selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -223,26 +220,22 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate( form.setWindowTitle(QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Plot the transversal areas curve", "Plot the transversal areas curve",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "DraftLabel").setText( self.widget(QtGui.QLabel, "DraftLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Draft", "Draft",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "TrimLabel").setText( self.widget(QtGui.QLabel, "TrimLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Trim angle", "Trim angle",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "NumLabel").setText( self.widget(QtGui.QLabel, "NumLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Number of points", "Number of points",
None, None))
QtGui.QApplication.UnicodeUTF8))
def clampValue(self, widget, val_min, val_max, val): def clampValue(self, widget, val_min, val_max, val):
if val_min <= val <= val_max: if val_min <= val <= val_max:
@ -326,8 +319,7 @@ class TaskPanel:
dispText = QtGui.QApplication.translate( dispText = QtGui.QApplication.translate(
"ship_areas", "ship_areas",
'Displacement', 'Displacement',
None, None)
QtGui.QApplication.UnicodeUTF8)
string += dispText + u' = {0}<BR>'.format(disp.UserString) string += dispText + u' = {0}<BR>'.format(disp.UserString)
string += u'XCB = {0}'.format(xcb.UserString) string += u'XCB = {0}'.format(xcb.UserString)
form.output.setHtml(string) form.output.setHtml(string)
@ -352,8 +344,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Areas curve tool draft selected [m]", "Areas curve tool draft selected [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "Areas curve tool draft selected [m]" tooltip = "Areas curve tool draft selected [m]"
self.ship.addProperty("App::PropertyLength", self.ship.addProperty("App::PropertyLength",
@ -368,8 +359,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Areas curve tool trim selected [deg]", "Areas curve tool trim selected [deg]",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "Areas curve tool trim selected [deg]" tooltip = "Areas curve tool trim selected [deg]"
self.ship.addProperty("App::PropertyAngle", self.ship.addProperty("App::PropertyAngle",
@ -384,8 +374,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_areas", "ship_areas",
"Areas curve tool number of points", "Areas curve tool number of points",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "Areas curve tool number of points" tooltip = "Areas curve tool number of points"
self.ship.addProperty("App::PropertyInteger", self.ship.addProperty("App::PropertyInteger",

View File

@ -56,8 +56,7 @@ class Plot(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Plot module is disabled, so I cannot perform the plot", "Plot module is disabled, so I cannot perform the plot",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n') FreeCAD.Console.PrintWarning(msg + '\n')
return True return True

View File

@ -119,8 +119,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A tank instance must be selected before using this tool (no" "A tank instance must be selected before using this tool (no"
" objects selected)", " objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for i in range(0, len(selObjs)): for i in range(0, len(selObjs)):
@ -136,8 +135,7 @@ class TaskPanel:
"ship_console", "ship_console",
"More than one tank have been selected (the extra" "More than one tank have been selected (the extra"
" tanks will be ignored)", " tanks will be ignored)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
self.tank = obj self.tank = obj
@ -146,8 +144,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A tank instance must be selected before using this tool (no" "A tank instance must be selected before using this tool (no"
" valid tank found at the selected objects)", " valid tank found at the selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
return False return False
@ -159,14 +156,12 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate( form.setWindowTitle(QtGui.QApplication.translate(
"ship_capacity", "ship_capacity",
"Plot the tank capacity curve", "Plot the tank capacity curve",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "PointsLabel").setText( self.widget(QtGui.QLabel, "PointsLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_capacity", "ship_capacity",
"Number of points", "Number of points",
None, None))
QtGui.QApplication.UnicodeUTF8))
def createTask(): def createTask():
panel = TaskPanel() panel = TaskPanel()

View File

@ -49,8 +49,7 @@ def tankCapacityCurve(tank, n):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Computing capacity curves", "Computing capacity curves",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintMessage(msg + '...\n') App.Console.PrintMessage(msg + '...\n')
for i in range(1, n): for i in range(1, n):
App.Console.PrintMessage("\t{} / {}\n".format(i + 1, n)) App.Console.PrintMessage("\t{} / {}\n".format(i + 1, n))

View File

@ -41,8 +41,7 @@ def load():
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" objects selected)", " objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return return
for i in range(len(selObjs)): for i in range(len(selObjs)):
@ -58,8 +57,7 @@ def load():
"ship_console", "ship_console",
"More than one ship have been selected (the extra" "More than one ship have been selected (the extra"
" ships will be ignored)", " ships will be ignored)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
ship = obj ship = obj
@ -69,8 +67,7 @@ def load():
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" valid ship found at the selected objects)", " valid ship found at the selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return return

View File

@ -66,8 +66,7 @@ class Preview(object):
text = str(QtGui.QApplication.translate( text = str(QtGui.QApplication.translate(
"ship_create", "ship_create",
"Base line", "Base line",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
text = "Base line" text = "Base line"
self.baseLineLabel = DrawText('BaseLineText', self.baseLineLabel = DrawText('BaseLineText',
@ -83,8 +82,7 @@ class Preview(object):
text = str(QtGui.QApplication.translate( text = str(QtGui.QApplication.translate(
"ship_create", "ship_create",
"Free surface", "Free surface",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
text = "Free surface" text = "Free surface"
self.fsLineLabel = DrawText('FSText', text, Base.Vector(xEnd, 0, T)) self.fsLineLabel = DrawText('FSText', text, Base.Vector(xEnd, 0, T))
@ -100,8 +98,7 @@ class Preview(object):
text = str(QtGui.QApplication.translate( text = str(QtGui.QApplication.translate(
"ship_create", "ship_create",
"Forward perpendicular", "Forward perpendicular",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
text = "Forward perpendicular" text = "Forward perpendicular"
self.fpLineLabel = DrawText('FPText', self.fpLineLabel = DrawText('FPText',
@ -117,8 +114,7 @@ class Preview(object):
text = str(QtGui.QApplication.translate( text = str(QtGui.QApplication.translate(
"ship_create", "ship_create",
"After perpendicular", "After perpendicular",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
text = "After perpendicular" text = "After perpendicular"
self.apLineLabel = DrawText('APText', self.apLineLabel = DrawText('APText',
@ -134,8 +130,7 @@ class Preview(object):
text = str(QtGui.QApplication.translate( text = str(QtGui.QApplication.translate(
"ship_create", "ship_create",
"Main frame", "Main frame",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
text = "Main frame" text = "Main frame"
self.amLineLabel = DrawText('AMText', self.amLineLabel = DrawText('AMText',

View File

@ -133,15 +133,13 @@ class TaskPanel:
"ship_console", "ship_console",
"Ship objects can only be created on top of hull geometry" "Ship objects can only be created on top of hull geometry"
" (no objects selected)", " (no objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Please create or load a ship hull geometry before using" "Please create or load a ship hull geometry before using"
" this tool", " this tool",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
self.solids = [] self.solids = []
@ -154,15 +152,13 @@ class TaskPanel:
"ship_console", "ship_console",
"Ship objects can only be created on top of hull geometry" "Ship objects can only be created on top of hull geometry"
" (no solid found at selected objects)", " (no solid found at selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Please create or load a ship hull geometry before using" "Please create or load a ship hull geometry before using"
" this tool", " this tool",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
# Get the ship bounds. The ship instance can not have dimensions # Get the ship bounds. The ship instance can not have dimensions
@ -220,26 +216,22 @@ class TaskPanel:
self.form.setWindowTitle(QtGui.QApplication.translate( self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_create", "ship_create",
"Create a new ship", "Create a new ship",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "LengthLabel").setText( self.widget(QtGui.QLabel, "LengthLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_create", "ship_create",
"Length", "Length",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "BreadthLabel").setText( self.widget(QtGui.QLabel, "BreadthLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_create", "ship_create",
"Breadth", "Breadth",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "DraftLabel").setText( self.widget(QtGui.QLabel, "DraftLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_create", "ship_create",
"Draft", "Draft",
None, None))
QtGui.QApplication.UnicodeUTF8))
def clampVal(self, widget, val_min, val_max, val): def clampVal(self, widget, val_min, val_max, val):
if val >= val_min and val <= val_max: if val >= val_min and val <= val_max:

View File

@ -110,8 +110,7 @@ class TaskPanel:
"ship_tank", "ship_tank",
"Tanks objects can only be created on top of its geometry" "Tanks objects can only be created on top of its geometry"
" (no objects selected)", " (no objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for obj in selObjs: for obj in selObjs:
@ -123,8 +122,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_tank", "ship_tank",
"No solids found in the selected objects", "No solids found in the selected objects",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -141,8 +139,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_tank", "ship_tank",
"There are not ship objects to create weights into them", "There are not ship objects to create weights into them",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -163,14 +160,12 @@ class TaskPanel:
self.form.setWindowTitle(QtGui.QApplication.translate( self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_tank", "ship_tank",
"Create a new tank", "Create a new tank",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "ShipLabel").setText( self.widget(QtGui.QLabel, "ShipLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_tank", "ship_tank",
"Ship", "Ship",
None, None))
QtGui.QApplication.UnicodeUTF8))
def createTask(): def createTask():

View File

@ -114,8 +114,7 @@ class TaskPanel:
"ship_weight", "ship_weight",
"Weight objects can only be created on top of its geometry" "Weight objects can only be created on top of its geometry"
" (no objects selected)", " (no objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for obj in selObjs: for obj in selObjs:
@ -127,8 +126,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"No geometrical shapes found in the selected objects", "No geometrical shapes found in the selected objects",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -164,8 +162,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Unknow object shapes selected", "Unknow object shapes selected",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -182,8 +179,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"There are not ship objects to create weights into them", "There are not ship objects to create weights into them",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -217,42 +213,36 @@ class TaskPanel:
self.form.setWindowTitle(QtGui.QApplication.translate( self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Create a new weight", "Create a new weight",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "ShipLabel").setText( self.widget(QtGui.QLabel, "ShipLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Ship", "Ship",
None, None))
QtGui.QApplication.UnicodeUTF8))
if self.elem_type == 1: if self.elem_type == 1:
self.widget(QtGui.QLabel, "WeightLabel").setText( self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Mass", "Mass",
None, None))
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 2: elif self.elem_type == 2:
self.widget(QtGui.QLabel, "WeightLabel").setText( self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Linear density", "Linear density",
None, None))
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 3: elif self.elem_type == 3:
self.widget(QtGui.QLabel, "WeightLabel").setText( self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Area density", "Area density",
None, None))
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 4: elif self.elem_type == 4:
self.widget(QtGui.QLabel, "WeightLabel").setText( self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_weight", "ship_weight",
"Density", "Density",
None, None))
QtGui.QApplication.UnicodeUTF8))
def createTask(): def createTask():

View File

@ -57,8 +57,7 @@ class Plot(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Plot module is disabled, so I cannot perform the plot", "Plot module is disabled, so I cannot perform the plot",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n') FreeCAD.Console.PrintWarning(msg + '\n')
return True return True

View File

@ -134,8 +134,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A loading condition instance must be selected before using" "A loading condition instance must be selected before using"
" this tool (no objects selected)", " this tool (no objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for i in range(len(selObjs)): for i in range(len(selObjs)):
@ -159,8 +158,7 @@ class TaskPanel:
"ship_console", "ship_console",
"Wrong Ship label! (no instances labeled as" "Wrong Ship label! (no instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
obj.get('B1'))) obj.get('B1')))
else: else:
@ -168,8 +166,7 @@ class TaskPanel:
"ship_console", "ship_console",
"Ambiguous Ship label! ({} instances labeled as" "Ambiguous Ship label! ({} instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ships), len(ships),
obj.get('B1'))) obj.get('B1')))
@ -186,8 +183,7 @@ class TaskPanel:
"ship_console", "ship_console",
"More than one loading condition have been selected (the" "More than one loading condition have been selected (the"
" extra loading conditions will be ignored)", " extra loading conditions will be ignored)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
self.lc = obj self.lc = obj
@ -198,8 +194,7 @@ class TaskPanel:
"A loading condition instance must be selected before using" "A loading condition instance must be selected before using"
" this tool (no valid loading condition found at the selected" " this tool (no valid loading condition found at the selected"
" objects)", " objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -244,34 +239,29 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate( form.setWindowTitle(QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"Plot the GZ curve", "Plot the GZ curve",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "AngleLabel").setText( self.widget(QtGui.QLabel, "AngleLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"Maximum angle", "Maximum angle",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "NumPointsLabel").setText( self.widget(QtGui.QLabel, "NumPointsLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"Number of points", "Number of points",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QCheckBox, "VariableTrim").setText( self.widget(QtGui.QCheckBox, "VariableTrim").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"Variable trim", "Variable trim",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QCheckBox, "VariableTrim").setToolTip( self.widget(QtGui.QCheckBox, "VariableTrim").setToolTip(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"The ship will be rotated to the equilibrium trim angle for" + \ "The ship will be rotated to the equilibrium trim angle for" + \
" each roll angle. It will significantly increase the" + \ " each roll angle. It will significantly increase the" + \
" required computing time", " required computing time",
None, None))
QtGui.QApplication.UnicodeUTF8))
def save(self): def save(self):
""" Saves the data into ship instance. """ """ Saves the data into ship instance. """
@ -294,8 +284,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"GZ curve tool angle selected [deg]", "GZ curve tool angle selected [deg]",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "GZ curve tool angle selected [deg]" tooltip = "GZ curve tool angle selected [deg]"
self.ship.addProperty("App::PropertyAngle", self.ship.addProperty("App::PropertyAngle",
@ -310,8 +299,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"GZ curve tool number of points selected", "GZ curve tool number of points selected",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "GZ curve tool number of points selected" tooltip = "GZ curve tool number of points selected"
self.ship.addProperty("App::PropertyInteger", self.ship.addProperty("App::PropertyInteger",
@ -326,8 +314,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_gz", "ship_gz",
"GZ curve tool variable trim angle selection", "GZ curve tool variable trim angle selection",
None, None))
QtGui.QApplication.UnicodeUTF8))
except: except:
tooltip = "GZ curve tool variable trim angle selection" tooltip = "GZ curve tool variable trim angle selection"
self.ship.addProperty("App::PropertyBool", self.ship.addProperty("App::PropertyBool",

View File

@ -117,8 +117,7 @@ def solve_point(W, COG, TW, VOLS, ship, tanks, roll, var_trim=True):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Too much weight! The ship will never displace water enough", "Too much weight! The ship will never displace water enough",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + ' ({} vs. {})\n'.format( App.Console.PrintError(msg + ' ({} vs. {})\n'.format(
(max_disp / G).UserString, ((W + TW) / G).UserString)) (max_disp / G).UserString, ((W + TW) / G).UserString))
return None return None
@ -198,8 +197,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Wrong Ship label! (no instances labeled as" "Wrong Ship label! (no instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
lc.get('B1'))) lc.get('B1')))
else: else:
@ -207,8 +205,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Ambiguous Ship label! ({} instances labeled as" "Ambiguous Ship label! ({} instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ships), len(ships),
lc.get('B1'))) lc.get('B1')))
@ -233,8 +230,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Wrong Weight label! (no instances labeled as" "Wrong Weight label! (no instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
lc.get('A{}'.format(index - 1)))) lc.get('A{}'.format(index - 1))))
else: else:
@ -242,8 +238,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Ambiguous Weight label! ({} instances labeled as" "Ambiguous Weight label! ({} instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ws), len(ws),
lc.get('A{}'.format(index - 1)))) lc.get('A{}'.format(index - 1))))
@ -255,8 +250,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Invalid Weight! (the object labeled as" "Invalid Weight! (the object labeled as"
"'{}' is not a weight)", "'{}' is not a weight)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ws), len(ws),
lc.get('A{}'.format(index - 1)))) lc.get('A{}'.format(index - 1))))
@ -281,8 +275,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Wrong Tank label! (no instances labeled as" "Wrong Tank label! (no instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
lc.get('C{}'.format(index - 1)))) lc.get('C{}'.format(index - 1))))
else: else:
@ -290,8 +283,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Ambiguous Tank label! ({} instances labeled as" "Ambiguous Tank label! ({} instances labeled as"
"'{}' found)", "'{}' found)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ts), len(ts),
lc.get('C{}'.format(index - 1)))) lc.get('C{}'.format(index - 1))))
@ -303,8 +295,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console", "ship_console",
"Invalid Tank! (the object labeled as" "Invalid Tank! (the object labeled as"
"'{}' is not a tank)", "'{}' is not a tank)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n'.format( App.Console.PrintError(msg + '\n'.format(
len(ws), len(ws),
lc.get('C{}'.format(index - 1)))) lc.get('C{}'.format(index - 1))))

View File

@ -57,8 +57,7 @@ class Plot(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Plot module is disabled, so I cannot perform the plot", "Plot module is disabled, so I cannot perform the plot",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n') FreeCAD.Console.PrintWarning(msg + '\n')
return True return True

View File

@ -85,8 +85,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Failure detecting external faces from the ship object", "Failure detecting external faces from the ship object",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return False return False
faces = Part.makeShell(faces) faces = Part.makeShell(faces)
@ -95,8 +94,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Computing hydrostatics", "Computing hydrostatics",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintMessage(msg + '...\n') App.Console.PrintMessage(msg + '...\n')
points = [] points = []
for i in range(len(drafts)): for i in range(len(drafts)):
@ -200,8 +198,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" objects selected)", " objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for i in range(len(selObjs)): for i in range(len(selObjs)):
@ -217,8 +214,7 @@ class TaskPanel:
"ship_console", "ship_console",
"More than one ship have been selected (the extra" "More than one ship have been selected (the extra"
" ships will be ignored)", " ships will be ignored)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
self.ship = obj self.ship = obj
@ -228,8 +224,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before using this tool (no" "A ship instance must be selected before using this tool (no"
" valid ship found at the selected objects)", " valid ship found at the selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
@ -279,32 +274,27 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate( form.setWindowTitle(QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Plot hydrostatics", "Plot hydrostatics",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "TrimLabel").setText( self.widget(QtGui.QLabel, "TrimLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Trim", "Trim",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "MinDraftLabel").setText( self.widget(QtGui.QLabel, "MinDraftLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Minimum draft", "Minimum draft",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "MaxDraftLabel").setText( self.widget(QtGui.QLabel, "MaxDraftLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Maximum draft", "Maximum draft",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "NDraftLabel").setText( self.widget(QtGui.QLabel, "NDraftLabel").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Number of points", "Number of points",
None, None))
QtGui.QApplication.UnicodeUTF8))
def clampLength(self, widget, val_min, val_max, val): def clampLength(self, widget, val_min, val_max, val):
if val >= val_min and val <= val_max: if val >= val_min and val <= val_max:
@ -420,8 +410,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Hydrostatics tool trim selected", "Hydrostatics tool trim selected",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyAngle", self.ship.addProperty("App::PropertyAngle",
"HydrostaticsTrim", "HydrostaticsTrim",
"Ship", "Ship",
@ -434,8 +423,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Hydrostatics tool minimum draft selected [m]", "Hydrostatics tool minimum draft selected [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyLength", self.ship.addProperty("App::PropertyLength",
"HydrostaticsMinDraft", "HydrostaticsMinDraft",
"Ship", "Ship",
@ -448,8 +436,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Hydrostatics tool maximum draft selected [m]", "Hydrostatics tool maximum draft selected [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyLength", self.ship.addProperty("App::PropertyLength",
"HydrostaticsMaxDraft", "HydrostaticsMaxDraft",
"Ship", "Ship",
@ -462,8 +449,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic", "ship_hydrostatic",
"Hydrostatics tool number of points selected", "Hydrostatics tool number of points selected",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyInteger", self.ship.addProperty("App::PropertyInteger",
"HydrostaticsNDraft", "HydrostaticsNDraft",
"Ship", "Ship",
@ -500,8 +486,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Computing external faces", "Computing external faces",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintMessage(msg + '...\n') App.Console.PrintMessage(msg + '...\n')
# Valid/unvalid faces detection loop # Valid/unvalid faces detection loop
for i in range(len(faces)): for i in range(len(faces)):

View File

@ -124,8 +124,7 @@ def getUnderwaterSide(shape, force=True):
"Boolean operation failed when trying to get the underwater side." "Boolean operation failed when trying to get the underwater side."
" The tool is retrying such operation slightly moving the free" " The tool is retrying such operation slightly moving the free"
" surface position", " surface position",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
random_bounds = 0.01 * H random_bounds = 0.01 * H
i = 0 i = 0
@ -198,8 +197,7 @@ def areas(ship, n, draft=None,
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Part.OCCError: Transversal area computation failed", "Part.OCCError: Transversal area computation failed",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
areas.append((Units.Quantity(x, Units.Length), areas.append((Units.Quantity(x, Units.Length),
Units.Quantity(0.0, Units.Area))) Units.Quantity(0.0, Units.Area)))
@ -276,8 +274,7 @@ def displacement(ship, draft=None,
"ship_console", "ship_console",
"ZeroDivisionError: Null volume found during the displacement" "ZeroDivisionError: Null volume found during the displacement"
" computation!", " computation!",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
cb = 0.0 cb = 0.0
@ -377,8 +374,7 @@ def floatingArea(ship, draft=None,
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Part.OCCError: Floating area cannot be computed", "Part.OCCError: Floating area cannot be computed",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
area = Units.Quantity(0.0, Units.Area) area = Units.Quantity(0.0, Units.Area)
@ -391,8 +387,7 @@ def floatingArea(ship, draft=None,
"ship_console", "ship_console",
"ZeroDivisionError: Null area found during the floating area" "ZeroDivisionError: Null area found during the floating area"
" computation!", " computation!",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
cf = 0.0 cf = 0.0
@ -466,8 +461,7 @@ def mainFrameCoeff(ship, draft=None):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Part.OCCError: Main frame area cannot be computed", "Part.OCCError: Main frame area cannot be computed",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
area = 0.0 area = 0.0
@ -481,8 +475,7 @@ def mainFrameCoeff(ship, draft=None):
"ship_console", "ship_console",
"ZeroDivisionError: Null area found during the main frame area" "ZeroDivisionError: Null area found during the main frame area"
" coefficient computation!", " coefficient computation!",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
cm = 0.0 cm = 0.0

View File

@ -106,13 +106,11 @@ class TaskPanel:
self.form.setWindowTitle(QtGui.QApplication.translate( self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_load", "ship_load",
"Load example ship", "Load example ship",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QGroupBox, "ShipSelectionBox").setTitle( self.widget(QtGui.QGroupBox, "ShipSelectionBox").setTitle(
QtGui.QApplication.translate("ship_load", QtGui.QApplication.translate("ship_load",
"Select ship example geometry", "Select ship example geometry",
None, None))
QtGui.QApplication.UnicodeUTF8))
def createTask(): def createTask():

View File

@ -54,8 +54,7 @@ class Preview(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Computing sections", "Computing sections",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintMessage(msg + '...\n') FreeCAD.Console.PrintMessage(msg + '...\n')
# Destroy all previous entities # Destroy all previous entities
self.clean() self.clean()
@ -128,8 +127,7 @@ class Preview(object):
msg = QtGui.QApplication.translate( msg = QtGui.QApplication.translate(
"ship_console", "ship_console",
"Any valid ship section found", "Any valid ship section found",
None, None)
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n') FreeCAD.Console.PrintWarning(msg + '\n')
return return
obj = sections[0] obj = sections[0]

View File

@ -184,8 +184,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before use this tool (no" "A ship instance must be selected before use this tool (no"
" objects selected)", " objects selected)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
for i in range(0, len(selObjs)): for i in range(0, len(selObjs)):
@ -203,8 +202,7 @@ class TaskPanel:
"ship_console", "ship_console",
"More than one ship has been selected (just the first" "More than one ship has been selected (just the first"
" one will be used)", " one will be used)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n') App.Console.PrintWarning(msg + '\n')
break break
self.ship = obj self.ship = obj
@ -214,8 +212,7 @@ class TaskPanel:
"ship_console", "ship_console",
"A ship instance must be selected before use this tool (no" "A ship instance must be selected before use this tool (no"
"valid ships found in the selected objects)", "valid ships found in the selected objects)",
None, None)
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n') App.Console.PrintError(msg + '\n')
return True return True
# Load sections (if exist) # Load sections (if exist)
@ -227,47 +224,40 @@ class TaskPanel:
self.form.setWindowTitle(QtGui.QApplication.translate( self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Outline draw", "Outline draw",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QGroupBox, "AutoCreateBox").setTitle( self.widget(QtGui.QGroupBox, "AutoCreateBox").setTitle(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Auto create", "Auto create",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QPushButton, "DeleteButton").setText( self.widget(QtGui.QPushButton, "DeleteButton").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Delete all sections", "Delete all sections",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QPushButton, "CreateButton").setText( self.widget(QtGui.QPushButton, "CreateButton").setText(
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Create sections", "Create sections",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QComboBox, "SectionType").setItemText( self.widget(QtGui.QComboBox, "SectionType").setItemText(
0, 0,
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Transversal", "Transversal",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QComboBox, "SectionType").setItemText( self.widget(QtGui.QComboBox, "SectionType").setItemText(
1, 1,
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Longitudinal", "Longitudinal",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QComboBox, "SectionType").setItemText( self.widget(QtGui.QComboBox, "SectionType").setItemText(
2, 2,
QtGui.QApplication.translate( QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Water lines", "Water lines",
None, None))
QtGui.QApplication.UnicodeUTF8))
def onSectionType(self): def onSectionType(self):
""" Function called when the section type is changed. """ Function called when the section type is changed.
@ -479,8 +469,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Transversal section positions [m]", "Transversal section positions [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyFloatList", self.ship.addProperty("App::PropertyFloatList",
"LSections", "LSections",
"Ship", "Ship",
@ -488,8 +477,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Longitudinal section positions [m]", "Longitudinal section positions [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyFloatList", self.ship.addProperty("App::PropertyFloatList",
"BSections", "BSections",
"Ship", "Ship",
@ -497,8 +485,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate( tooltip = str(QtGui.QApplication.translate(
"ship_outline", "ship_outline",
"Water line positions [m]", "Water line positions [m]",
None, None))
QtGui.QApplication.UnicodeUTF8))
self.ship.addProperty("App::PropertyFloatList", self.ship.addProperty("App::PropertyFloatList",
"TSections", "TSections",
"Ship", "Ship",