From b6c28688fe6038a1058ee5b65d58bd80b6f7c97d Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 27 Dec 2016 18:56:30 +0100 Subject: [PATCH] remove UnicodeUTF8 --- src/Mod/Ship/InitGui.py | 3 +- src/Mod/Ship/Instance.py | 24 ++++------ src/Mod/Ship/TankInstance.py | 6 +-- src/Mod/Ship/WeightInstance.py | 15 +++---- src/Mod/Ship/shipAreasCurve/PlotAux.py | 5 +-- src/Mod/Ship/shipAreasCurve/TaskPanel.py | 35 +++++---------- src/Mod/Ship/shipCapacityCurve/PlotAux.py | 5 +-- src/Mod/Ship/shipCapacityCurve/TaskPanel.py | 15 +++---- src/Mod/Ship/shipCapacityCurve/Tools.py | 5 +-- .../Ship/shipCreateLoadCondition/__init__.py | 11 ++--- src/Mod/Ship/shipCreateShip/Preview.py | 15 +++---- src/Mod/Ship/shipCreateShip/TaskPanel.py | 24 ++++------ src/Mod/Ship/shipCreateTank/TaskPanel.py | 15 +++---- src/Mod/Ship/shipCreateWeight/TaskPanel.py | 30 +++++-------- src/Mod/Ship/shipGZ/PlotAux.py | 5 +-- src/Mod/Ship/shipGZ/TaskPanel.py | 41 ++++++----------- src/Mod/Ship/shipGZ/Tools.py | 29 +++++------- src/Mod/Ship/shipHydrostatics/PlotAux.py | 5 +-- src/Mod/Ship/shipHydrostatics/TaskPanel.py | 45 +++++++------------ src/Mod/Ship/shipHydrostatics/Tools.py | 23 ++++------ src/Mod/Ship/shipLoadExample/TaskPanel.py | 6 +-- src/Mod/Ship/shipOutlineDraw/Preview.py | 6 +-- src/Mod/Ship/shipOutlineDraw/TaskPanel.py | 39 ++++++---------- 23 files changed, 139 insertions(+), 268 deletions(-) diff --git a/src/Mod/Ship/InitGui.py b/src/Mod/Ship/InitGui.py index fc34cb41b..a33a8ea48 100644 --- a/src/Mod/Ship/InitGui.py +++ b/src/Mod/Ship/InitGui.py @@ -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", diff --git a/src/Mod/Ship/Instance.py b/src/Mod/Ship/Instance.py index d197f602f..7674e871d 100644 --- a/src/Mod/Ship/Instance.py +++ b/src/Mod/Ship/Instance.py @@ -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", diff --git a/src/Mod/Ship/TankInstance.py b/src/Mod/Ship/TankInstance.py index 053259b35..325a58934 100644 --- a/src/Mod/Ship/TankInstance.py +++ b/src/Mod/Ship/TankInstance.py @@ -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 diff --git a/src/Mod/Ship/WeightInstance.py b/src/Mod/Ship/WeightInstance.py index 8a78c5d61..1dd4b728f 100644 --- a/src/Mod/Ship/WeightInstance.py +++ b/src/Mod/Ship/WeightInstance.py @@ -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", diff --git a/src/Mod/Ship/shipAreasCurve/PlotAux.py b/src/Mod/Ship/shipAreasCurve/PlotAux.py index 35c5df9a6..5601be828 100644 --- a/src/Mod/Ship/shipAreasCurve/PlotAux.py +++ b/src/Mod/Ship/shipAreasCurve/PlotAux.py @@ -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 @@ -146,4 +145,4 @@ class Plot(object): s.set("B{}".format(i + 2), str(y[i])) # Recompute - FreeCAD.activeDocument().recompute() \ No newline at end of file + FreeCAD.activeDocument().recompute() diff --git a/src/Mod/Ship/shipAreasCurve/TaskPanel.py b/src/Mod/Ship/shipAreasCurve/TaskPanel.py index c32db44f5..7b814d250 100644 --- a/src/Mod/Ship/shipAreasCurve/TaskPanel.py +++ b/src/Mod/Ship/shipAreasCurve/TaskPanel.py @@ -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}
'.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", @@ -401,4 +390,4 @@ def createTask(): if panel.setupUi(): Gui.Control.closeDialog(panel) return None - return panel \ No newline at end of file + return panel diff --git a/src/Mod/Ship/shipCapacityCurve/PlotAux.py b/src/Mod/Ship/shipCapacityCurve/PlotAux.py index 2dc286429..087ea9016 100644 --- a/src/Mod/Ship/shipCapacityCurve/PlotAux.py +++ b/src/Mod/Ship/shipCapacityCurve/PlotAux.py @@ -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 @@ -131,4 +130,4 @@ class Plot(object): s.set("C{}".format(i + 2), str(v[i])) # Recompute - FreeCAD.activeDocument().recompute() \ No newline at end of file + FreeCAD.activeDocument().recompute() diff --git a/src/Mod/Ship/shipCapacityCurve/TaskPanel.py b/src/Mod/Ship/shipCapacityCurve/TaskPanel.py index f7cfd9ee9..5ce111a0e 100644 --- a/src/Mod/Ship/shipCapacityCurve/TaskPanel.py +++ b/src/Mod/Ship/shipCapacityCurve/TaskPanel.py @@ -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() diff --git a/src/Mod/Ship/shipCapacityCurve/Tools.py b/src/Mod/Ship/shipCapacityCurve/Tools.py index 5acfae82c..e73c44289 100644 --- a/src/Mod/Ship/shipCapacityCurve/Tools.py +++ b/src/Mod/Ship/shipCapacityCurve/Tools.py @@ -49,12 +49,11 @@ 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)) level = i * dlevel vol = tank.Proxy.getVolume(tank, level) out.append((level, level * dz, level * vol)) - return out \ No newline at end of file + return out diff --git a/src/Mod/Ship/shipCreateLoadCondition/__init__.py b/src/Mod/Ship/shipCreateLoadCondition/__init__.py index 7515040c5..3b36c535d 100644 --- a/src/Mod/Ship/shipCreateLoadCondition/__init__.py +++ b/src/Mod/Ship/shipCreateLoadCondition/__init__.py @@ -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,9 +67,8 @@ 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 - Tools.createLoadCondition(ship) \ No newline at end of file + Tools.createLoadCondition(ship) diff --git a/src/Mod/Ship/shipCreateShip/Preview.py b/src/Mod/Ship/shipCreateShip/Preview.py index d4d79e23f..12401476c 100644 --- a/src/Mod/Ship/shipCreateShip/Preview.py +++ b/src/Mod/Ship/shipCreateShip/Preview.py @@ -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', diff --git a/src/Mod/Ship/shipCreateShip/TaskPanel.py b/src/Mod/Ship/shipCreateShip/TaskPanel.py index fdc5bda34..3d496dac7 100644 --- a/src/Mod/Ship/shipCreateShip/TaskPanel.py +++ b/src/Mod/Ship/shipCreateShip/TaskPanel.py @@ -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: diff --git a/src/Mod/Ship/shipCreateTank/TaskPanel.py b/src/Mod/Ship/shipCreateTank/TaskPanel.py index 08fb43fcb..096914f6d 100644 --- a/src/Mod/Ship/shipCreateTank/TaskPanel.py +++ b/src/Mod/Ship/shipCreateTank/TaskPanel.py @@ -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(): diff --git a/src/Mod/Ship/shipCreateWeight/TaskPanel.py b/src/Mod/Ship/shipCreateWeight/TaskPanel.py index 390ce04b6..df4e4f774 100644 --- a/src/Mod/Ship/shipCreateWeight/TaskPanel.py +++ b/src/Mod/Ship/shipCreateWeight/TaskPanel.py @@ -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(): diff --git a/src/Mod/Ship/shipGZ/PlotAux.py b/src/Mod/Ship/shipGZ/PlotAux.py index 08da5e1dc..e9bb87317 100644 --- a/src/Mod/Ship/shipGZ/PlotAux.py +++ b/src/Mod/Ship/shipGZ/PlotAux.py @@ -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 @@ -103,4 +102,4 @@ class Plot(object): s.set("D{}".format(i + 2), str(trim[i])) # Recompute - FreeCAD.activeDocument().recompute() \ No newline at end of file + FreeCAD.activeDocument().recompute() diff --git a/src/Mod/Ship/shipGZ/TaskPanel.py b/src/Mod/Ship/shipGZ/TaskPanel.py index c5dc76255..28c93bb80 100644 --- a/src/Mod/Ship/shipGZ/TaskPanel.py +++ b/src/Mod/Ship/shipGZ/TaskPanel.py @@ -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", @@ -342,4 +329,4 @@ def createTask(): if panel.setupUi(): Gui.Control.closeDialog(panel) return None - return panel \ No newline at end of file + return panel diff --git a/src/Mod/Ship/shipGZ/Tools.py b/src/Mod/Ship/shipGZ/Tools.py index c3bad14b2..406230055 100644 --- a/src/Mod/Ship/shipGZ/Tools.py +++ b/src/Mod/Ship/shipGZ/Tools.py @@ -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)))) @@ -313,4 +304,4 @@ def gz(lc, rolls, var_trim=True): continue tanks.append((t, dens, level)) - return solve(ship, weights, tanks, rolls, var_trim) \ No newline at end of file + return solve(ship, weights, tanks, rolls, var_trim) diff --git a/src/Mod/Ship/shipHydrostatics/PlotAux.py b/src/Mod/Ship/shipHydrostatics/PlotAux.py index 51702c1c4..a1ec25f52 100644 --- a/src/Mod/Ship/shipHydrostatics/PlotAux.py +++ b/src/Mod/Ship/shipHydrostatics/PlotAux.py @@ -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 @@ -346,4 +345,4 @@ class Plot(object): str(point.Cm)) # Recompute - FreeCAD.activeDocument().recompute() \ No newline at end of file + FreeCAD.activeDocument().recompute() diff --git a/src/Mod/Ship/shipHydrostatics/TaskPanel.py b/src/Mod/Ship/shipHydrostatics/TaskPanel.py index c91f40912..124b62393 100644 --- a/src/Mod/Ship/shipHydrostatics/TaskPanel.py +++ b/src/Mod/Ship/shipHydrostatics/TaskPanel.py @@ -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)): diff --git a/src/Mod/Ship/shipHydrostatics/Tools.py b/src/Mod/Ship/shipHydrostatics/Tools.py index 5460d9dd5..e6b663a75 100644 --- a/src/Mod/Ship/shipHydrostatics/Tools.py +++ b/src/Mod/Ship/shipHydrostatics/Tools.py @@ -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 @@ -538,4 +531,4 @@ class Point: self.BMt = bm self.Cb = cb self.Cf = cf - self.Cm = cm \ No newline at end of file + self.Cm = cm diff --git a/src/Mod/Ship/shipLoadExample/TaskPanel.py b/src/Mod/Ship/shipLoadExample/TaskPanel.py index d9542c37a..46594aa30 100644 --- a/src/Mod/Ship/shipLoadExample/TaskPanel.py +++ b/src/Mod/Ship/shipLoadExample/TaskPanel.py @@ -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(): diff --git a/src/Mod/Ship/shipOutlineDraw/Preview.py b/src/Mod/Ship/shipOutlineDraw/Preview.py index f8bdc815b..f66a2c37e 100644 --- a/src/Mod/Ship/shipOutlineDraw/Preview.py +++ b/src/Mod/Ship/shipOutlineDraw/Preview.py @@ -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] diff --git a/src/Mod/Ship/shipOutlineDraw/TaskPanel.py b/src/Mod/Ship/shipOutlineDraw/TaskPanel.py index c900bfe74..a359b900e 100644 --- a/src/Mod/Ship/shipOutlineDraw/TaskPanel.py +++ b/src/Mod/Ship/shipOutlineDraw/TaskPanel.py @@ -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",