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(
"ship_console",
"Plot module is disabled, tools cannot graph output curves",
None,
QtGui.QApplication.UnicodeUTF8)
None)
FreeCAD.Console.PrintMessage(msg + '\n')
# ToolBar
shiplist = ["Ship_LoadExample",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -134,8 +134,7 @@ class TaskPanel:
"ship_console",
"A loading condition instance must be selected before using"
" this tool (no objects selected)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
return True
for i in range(len(selObjs)):
@ -159,8 +158,7 @@ class TaskPanel:
"ship_console",
"Wrong Ship label! (no instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
obj.get('B1')))
else:
@ -168,8 +166,7 @@ class TaskPanel:
"ship_console",
"Ambiguous Ship label! ({} instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ships),
obj.get('B1')))
@ -186,8 +183,7 @@ class TaskPanel:
"ship_console",
"More than one loading condition have been selected (the"
" extra loading conditions will be ignored)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintWarning(msg + '\n')
break
self.lc = obj
@ -198,8 +194,7 @@ class TaskPanel:
"A loading condition instance must be selected before using"
" this tool (no valid loading condition found at the selected"
" objects)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
return True
@ -244,34 +239,29 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate(
"ship_gz",
"Plot the GZ curve",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "AngleLabel").setText(
QtGui.QApplication.translate(
"ship_gz",
"Maximum angle",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "NumPointsLabel").setText(
QtGui.QApplication.translate(
"ship_gz",
"Number of points",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QCheckBox, "VariableTrim").setText(
QtGui.QApplication.translate(
"ship_gz",
"Variable trim",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QCheckBox, "VariableTrim").setToolTip(
QtGui.QApplication.translate(
"ship_gz",
"The ship will be rotated to the equilibrium trim angle for" + \
" each roll angle. It will significantly increase the" + \
" required computing time",
None,
QtGui.QApplication.UnicodeUTF8))
None))
def save(self):
""" Saves the data into ship instance. """
@ -294,8 +284,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_gz",
"GZ curve tool angle selected [deg]",
None,
QtGui.QApplication.UnicodeUTF8))
None))
except:
tooltip = "GZ curve tool angle selected [deg]"
self.ship.addProperty("App::PropertyAngle",
@ -310,8 +299,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_gz",
"GZ curve tool number of points selected",
None,
QtGui.QApplication.UnicodeUTF8))
None))
except:
tooltip = "GZ curve tool number of points selected"
self.ship.addProperty("App::PropertyInteger",
@ -326,8 +314,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_gz",
"GZ curve tool variable trim angle selection",
None,
QtGui.QApplication.UnicodeUTF8))
None))
except:
tooltip = "GZ curve tool variable trim angle selection"
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(
"ship_console",
"Too much weight! The ship will never displace water enough",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + ' ({} vs. {})\n'.format(
(max_disp / G).UserString, ((W + TW) / G).UserString))
return None
@ -198,8 +197,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Wrong Ship label! (no instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
lc.get('B1')))
else:
@ -207,8 +205,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Ambiguous Ship label! ({} instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ships),
lc.get('B1')))
@ -233,8 +230,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Wrong Weight label! (no instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
lc.get('A{}'.format(index - 1))))
else:
@ -242,8 +238,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Ambiguous Weight label! ({} instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ws),
lc.get('A{}'.format(index - 1))))
@ -255,8 +250,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Invalid Weight! (the object labeled as"
"'{}' is not a weight)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ws),
lc.get('A{}'.format(index - 1))))
@ -281,8 +275,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Wrong Tank label! (no instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
lc.get('C{}'.format(index - 1))))
else:
@ -290,8 +283,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Ambiguous Tank label! ({} instances labeled as"
"'{}' found)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ts),
lc.get('C{}'.format(index - 1))))
@ -303,8 +295,7 @@ def gz(lc, rolls, var_trim=True):
"ship_console",
"Invalid Tank! (the object labeled as"
"'{}' is not a tank)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n'.format(
len(ws),
lc.get('C{}'.format(index - 1))))

View File

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

View File

@ -85,8 +85,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate(
"ship_console",
"Failure detecting external faces from the ship object",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
return False
faces = Part.makeShell(faces)
@ -95,8 +94,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate(
"ship_console",
"Computing hydrostatics",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintMessage(msg + '...\n')
points = []
for i in range(len(drafts)):
@ -200,8 +198,7 @@ class TaskPanel:
"ship_console",
"A ship instance must be selected before using this tool (no"
" objects selected)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
return True
for i in range(len(selObjs)):
@ -217,8 +214,7 @@ class TaskPanel:
"ship_console",
"More than one ship have been selected (the extra"
" ships will be ignored)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintWarning(msg + '\n')
break
self.ship = obj
@ -228,8 +224,7 @@ class TaskPanel:
"ship_console",
"A ship instance must be selected before using this tool (no"
" valid ship found at the selected objects)",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
return True
@ -279,32 +274,27 @@ class TaskPanel:
form.setWindowTitle(QtGui.QApplication.translate(
"ship_hydrostatic",
"Plot hydrostatics",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "TrimLabel").setText(
QtGui.QApplication.translate(
"ship_hydrostatic",
"Trim",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "MinDraftLabel").setText(
QtGui.QApplication.translate(
"ship_hydrostatic",
"Minimum draft",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "MaxDraftLabel").setText(
QtGui.QApplication.translate(
"ship_hydrostatic",
"Maximum draft",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.widget(QtGui.QLabel, "NDraftLabel").setText(
QtGui.QApplication.translate(
"ship_hydrostatic",
"Number of points",
None,
QtGui.QApplication.UnicodeUTF8))
None))
def clampLength(self, widget, val_min, val_max, val):
if val >= val_min and val <= val_max:
@ -420,8 +410,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic",
"Hydrostatics tool trim selected",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.ship.addProperty("App::PropertyAngle",
"HydrostaticsTrim",
"Ship",
@ -434,8 +423,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic",
"Hydrostatics tool minimum draft selected [m]",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.ship.addProperty("App::PropertyLength",
"HydrostaticsMinDraft",
"Ship",
@ -448,8 +436,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic",
"Hydrostatics tool maximum draft selected [m]",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.ship.addProperty("App::PropertyLength",
"HydrostaticsMaxDraft",
"Ship",
@ -462,8 +449,7 @@ class TaskPanel:
tooltip = str(QtGui.QApplication.translate(
"ship_hydrostatic",
"Hydrostatics tool number of points selected",
None,
QtGui.QApplication.UnicodeUTF8))
None))
self.ship.addProperty("App::PropertyInteger",
"HydrostaticsNDraft",
"Ship",
@ -500,8 +486,7 @@ class TaskPanel:
msg = QtGui.QApplication.translate(
"ship_console",
"Computing external faces",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintMessage(msg + '...\n')
# Valid/unvalid faces detection loop
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."
" The tool is retrying such operation slightly moving the free"
" surface position",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintWarning(msg + '\n')
random_bounds = 0.01 * H
i = 0
@ -198,8 +197,7 @@ def areas(ship, n, draft=None,
msg = QtGui.QApplication.translate(
"ship_console",
"Part.OCCError: Transversal area computation failed",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
areas.append((Units.Quantity(x, Units.Length),
Units.Quantity(0.0, Units.Area)))
@ -276,8 +274,7 @@ def displacement(ship, draft=None,
"ship_console",
"ZeroDivisionError: Null volume found during the displacement"
" computation!",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
cb = 0.0
@ -377,8 +374,7 @@ def floatingArea(ship, draft=None,
msg = QtGui.QApplication.translate(
"ship_console",
"Part.OCCError: Floating area cannot be computed",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
area = Units.Quantity(0.0, Units.Area)
@ -391,8 +387,7 @@ def floatingArea(ship, draft=None,
"ship_console",
"ZeroDivisionError: Null area found during the floating area"
" computation!",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
cf = 0.0
@ -466,8 +461,7 @@ def mainFrameCoeff(ship, draft=None):
msg = QtGui.QApplication.translate(
"ship_console",
"Part.OCCError: Main frame area cannot be computed",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
area = 0.0
@ -481,8 +475,7 @@ def mainFrameCoeff(ship, draft=None):
"ship_console",
"ZeroDivisionError: Null area found during the main frame area"
" coefficient computation!",
None,
QtGui.QApplication.UnicodeUTF8)
None)
App.Console.PrintError(msg + '\n')
cm = 0.0

View File

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

View File

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

View File

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