<commit_before>#***************************************************************************
#*																		 *
#*   Copyright (c) 2011, 2012											  *  
#*   <NAME> <<EMAIL>>							*  
#*																		 *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)	*
#*   as published by the Free Software Foundation; either version 2 of	 *
#*   the License, or (at your option) any later version.				   *
#*   for detail see the LICENCE text file.								 *
#*																		 *
#*   This program is distributed in the hope that it will be useful,	   *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of		*
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		 *
#*   GNU Library General Public License for more details.				  *
#*																		 *
#*   You should have received a copy of the GNU Library General Public	 *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA																   *
#*																		 *
#***************************************************************************

class ShipWorkbench ( Workbench ):
	""" @brief Workbench of Ship design module. Here toolbars & icons are append. """
	from PyQt4 import QtCore, QtGui
	from shipUtils import Paths
	import ShipGui

	Icon = "Ico"
	MenuText = str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship"))
	ToolTip = str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship module provides some of the commonly used tool to design ship forms"))

	def Initialize(self):
		from PyQt4 import QtCore, QtGui

		# Print a warning if Plot module can't be used
		try:
			import matplotlib
		except ImportError:
			msg = QtGui.QApplication.translate("ship_console", "Plot module is disabled, tools can't graph output curves",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		# ToolBar
		shiplist    = ["Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics"]
		weightslist = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
		self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")),shiplist)
		self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Weights")),weightslist)
		self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")),shiplist)
		self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Weights")),weightslist)
		# Simulation stuff only if pyOpenCL & numpy are present
		hasOpenCL = True
		hasNumpy  = True
		try:
			import pyopencl
		except ImportError:
			hasOpenCL = False
			msg = QtGui.QApplication.translate("ship_console", "pyOpenCL not installed, simulations stuff will disabled therefore",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		try:
			import numpy
		except ImportError:
			hasNumpy = False
			msg = QtGui.QApplication.translate("ship_console", "numpy not installed, simulations stuff will disabled therefore",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		if hasOpenCL and hasNumpy:
			simlist = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim", "Ship_TrackSim"]
			self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Simulation")),simlist)
			self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Simulation")),simlist)

Gui.addWorkbench(ShipWorkbench())
<commit_msg>Fixed Plot module test<commit_after>#***************************************************************************
#*																		 *
#*   Copyright (c) 2011, 2012											  *  
#*   <NAME> <<EMAIL>>							*  
#*																		 *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)	*
#*   as published by the Free Software Foundation; either version 2 of	 *
#*   the License, or (at your option) any later version.				   *
#*   for detail see the LICENCE text file.								 *
#*																		 *
#*   This program is distributed in the hope that it will be useful,	   *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of		*
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		 *
#*   GNU Library General Public License for more details.				  *
#*																		 *
#*   You should have received a copy of the GNU Library General Public	 *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA																   *
#*																		 *
#***************************************************************************

class ShipWorkbench ( Workbench ):
	""" @brief Workbench of Ship design module. Here toolbars & icons are append. """
	from PyQt4 import QtCore, QtGui
	from shipUtils import Paths
	import ShipGui

	Icon = "Ico"
	MenuText = str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship"))
	ToolTip = str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship module provides some of the commonly used tool to design ship forms"))

	def Initialize(self):
		from PyQt4 import QtCore, QtGui

		# Print a warning if Plot module can't be used
		try:
			import Plot
		except ImportError:
			msg = QtGui.QApplication.translate("ship_console", "Plot module is disabled, tools can't graph output curves",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		# ToolBar
		shiplist    = ["Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics"]
		weightslist = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
		self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")),shiplist)
		self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Weights")),weightslist)
		self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")),shiplist)
		self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Weights")),weightslist)
		# Simulation stuff only if pyOpenCL & numpy are present
		hasOpenCL = True
		hasNumpy  = True
		try:
			import pyopencl
		except ImportError:
			hasOpenCL = False
			msg = QtGui.QApplication.translate("ship_console", "pyOpenCL not installed, simulations stuff will disabled therefore",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		try:
			import numpy
		except ImportError:
			hasNumpy = False
			msg = QtGui.QApplication.translate("ship_console", "numpy not installed, simulations stuff will disabled therefore",
                                       None,QtGui.QApplication.UnicodeUTF8)
			FreeCAD.Console.PrintMessage(msg + '\n')
		if hasOpenCL and hasNumpy:
			simlist = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim", "Ship_TrackSim"]
			self.appendToolbar(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Simulation")),simlist)
			self.appendMenu(str(QtCore.QT_TRANSLATE_NOOP("Ship", "Simulation")),simlist)

Gui.addWorkbench(ShipWorkbench())

{'fraction_non_alphanumeric': 0.14152128401953942, 'fraction_numerical': 0.007815771109560363, 'mean_word_length': 3.380195599022005, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169938', 'n_tokens_mistral': 2538, 'n_tokens_neox': 2179, 'n_words': 599}