class ShipWorkbench(Workbench): """ @brief Workbench of Ship design module. Here toolbars & icons are append. """ from shipUtils import Paths, Translator import ShipGui Icon = Paths.iconsPath() + "/Ico.png" MenuText = str(Translator.translate("Ship design")) ToolTip = str(Translator.translate("Ship design")) def Initialize(self): # ToolBar list = [ "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics" ] self.appendToolbar("Ship design", list) list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"] self.appendToolbar("Loading", list) # Menu list = [ "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics" ] self.appendMenu("Ship design", list) list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"] self.appendToolbar("Loading", list)
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/HydrostaticsIco.png" MenuText = str(Translator.translate('GZ curve')) ToolTip = str( Translator.translate('Transversal stability GZ curve computation')) return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/SimCreateIco.png" MenuText = str(Translator.translate('Create a new simulation')) ToolTip = str( Translator.translate( 'Create a new simulation in order to process later')) return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/Weight.png" MenuText = str(Translator.translate('Set ship weights')) ToolTip = str( Translator.translate( 'Set ship weights, tanks must be added later')) return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def setupUi(self): mw = self.getMainWindow() form = mw.findChild(QtGui.QWidget, "TaskPanel") form.ship = form.findChild(QtGui.QComboBox, "Ship") form.mainLogo = form.findChild(QtGui.QLabel, "MainLogo") iconPath = Paths.iconsPath() + "/Ico.xpm" form.mainLogo.setPixmap(QtGui.QPixmap(iconPath)) self.form = form self.retranslateUi()
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/LoadIco.png" MenuText = str(Translator.translate('Load an example ship geometry')) ToolTip = str( Translator.translate( 'Load an example ship geometry able to be converted into a ship.' )) return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
class ShipWorkbench(Workbench): """ @brief Workbench of Ship design module. Here toolbars & icons are append. """ from shipUtils import Paths, Translator import ShipGui Icon = Paths.iconsPath() + "/Ico.png" MenuText = str(Translator.translate("Ship design")) ToolTip = str(Translator.translate("Ship design")) def Initialize(self): from shipUtils import Translator # ToolBar list = [ "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics" ] self.appendToolbar("Ship design", list) list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"] self.appendToolbar("Weights", list) # Simulation stuff only if pyOpenCL & numpy are present hasOpenCL = True hasNumpy = True try: import pyopencl except ImportError: hasOpenCL = False msg = Translator.translate( "pyOpenCL not installed, ship simulations disabled\n") App.Console.PrintWarning(msg) try: import numpy except ImportError: hasNumpy = False msg = Translator.translate( "numpy not installed, ship simulations disabled\n") App.Console.PrintWarning(msg) if hasOpenCL and hasNumpy: list = [ "Ship_CreateSim", "Ship_RunSim", "Ship_StopSim", "Ship_TrackSim" ] self.appendToolbar("Simulation", list) # Menu list = [ "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics" ] self.appendMenu("Ship design", list) list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"] self.appendMenu("Weights", list) if hasOpenCL and hasNumpy: list = [ "Ship_CreateSim", "Ship_RunSim", "Ship_StopSim", "Ship_TrackSim" ] self.appendMenu("Simulation", list)
def accept(self): path = Paths.modulePath() + "/Examples/" if (self.form.ship.currentIndex() == 0): # s60 from Iowa University App.open(path + "s60.fcstd") elif (self.form.ship.currentIndex() == 1): # Barehull 5415 App.open(path + "barehull5415.fcstd") elif (self.form.ship.currentIndex() == 2): # s60 (Katamaran) App.open(path + "s60_katamaran.fcstd") return True
def accept(self): path = Paths.modulePath() + "/Examples/" if(self.form.ship.currentIndex() == 0): # s60 from Iowa University App.open(path + "s60.fcstd") elif(self.form.ship.currentIndex() == 1): # Barehull 5415 App.open(path + "barehull5415.fcstd") elif(self.form.ship.currentIndex() == 2): # s60 (Katamaran) App.open(path + "s60_katamaran.fcstd") return True
def __init__(self): self.ui = Paths.modulePath() + "/shipOutlineDraw/TaskPanel.ui" self.ship = None self.skip = False self.LSections = [] self.BSections = [] self.TSections = [] self.obj = None self.preview = Preview.Preview()
def accept(self): path = Paths.modulePath() + "/Examples/" if(self.form.ship.currentIndex() == 0): # s60 from Iowa University App.open(path + "s60.fcstd") elif(self.form.ship.currentIndex() == 1): # Wigley canonical ship App.open(path + "wigley.fcstd") elif(self.form.ship.currentIndex() == 2): # s60 (Katamaran) App.open(path + "s60_katamaran.fcstd") elif(self.form.ship.currentIndex() == 2): # Wigley (Katamaran) App.open(path + "wigley_katamaran.fcstd") return True
def accept(self): path = Paths.modulePath() + "/Examples/" if (self.form.ship.currentIndex() == 0): # s60 from Iowa University App.open(path + "s60.fcstd") elif (self.form.ship.currentIndex() == 1): # Wigley canonical ship App.open(path + "wigley.fcstd") elif (self.form.ship.currentIndex() == 2): # s60 (Katamaran) App.open(path + "s60_katamaran.fcstd") elif (self.form.ship.currentIndex() == 2): # Wigley (Katamaran) App.open(path + "wigley_katamaran.fcstd") return True
def accept(self): path = Paths.modulePath() + "/Resources/VENDING/" if(self.form.ship.currentIndex() == 0): # box2 App.open(path + "box2.fcstd") elif(self.form.ship.currentIndex() == 1): # CircleFan App.open(path + "CircleFan.fcstd") elif(self.form.ship.currentIndex() == 2): # Part 1 App.open(path + "Part1.fcstd") elif(self.form.ship.currentIndex() == 2): # Part 4 App.open(path + "Part4.fcstd") return True
def accept(self): path = Paths.modulePath() + "/Resources/VENDING/" if (self.form.ship.currentIndex() == 0): # box2 App.open(path + "box2.fcstd") elif (self.form.ship.currentIndex() == 1): # CircleFan App.open(path + "CircleFan.fcstd") elif (self.form.ship.currentIndex() == 2): # Part 1 App.open(path + "Part1.fcstd") elif (self.form.ship.currentIndex() == 2): # Part 4 App.open(path + "Part4.fcstd") return True
def accept(self): """Load the selected hull example.""" path = Paths.modulePath() + "/resources/examples/" mw = self.getMainWindow() form = mw.findChild(QtGui.QWidget, "TaskPanel") form.ship = self.widget(QtGui.QComboBox, "Ship") if(form.ship.currentIndex() == 0): # s60 from Iowa University App.open(path + "s60.fcstd") elif(form.ship.currentIndex() == 1): # Wigley canonical ship App.open(path + "wigley.fcstd") elif(form.ship.currentIndex() == 2): # s60 (Katamaran) App.open(path + "s60_katamaran.fcstd") elif(form.ship.currentIndex() == 2): # Wigley (Katamaran) App.open(path + "wigley_katamaran.fcstd") return True
def setupUi(self): mw = self.getMainWindow() form = mw.findChild(QtGui.QWidget, "TaskPanel") form.length = form.findChild(QtGui.QDoubleSpinBox, "Length") form.beam = form.findChild(QtGui.QDoubleSpinBox, "Beam") form.draft = form.findChild(QtGui.QDoubleSpinBox, "Draft") form.mainLogo = form.findChild(QtGui.QLabel, "MainLogo") iconPath = Paths.iconsPath() + "/Ico.xpm" form.mainLogo.setPixmap(QtGui.QPixmap(iconPath)) self.form = form # Initial values if self.initValues(): return True self.retranslateUi() self.preview.update(self.L, self.B, self.T) # Connect Signals and Slots QtCore.QObject.connect(form.length, QtCore.SIGNAL("valueChanged(double)"), self.onData) QtCore.QObject.connect(form.beam, QtCore.SIGNAL("valueChanged(double)"), self.onData) QtCore.QObject.connect(form.draft, QtCore.SIGNAL("valueChanged(double)"), self.onData)
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/Ico.png" MenuText = str(Translator.translate('Create a new ship')) ToolTip = str(Translator.translate('Create a new ship in order to work with them')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/LoadIco.png" MenuText = str(Translator.translate('Load an example ship geometry')) ToolTip = str(Translator.translate('Load an example ship geometry able to be converted into a ship.')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def __init__(self): self.ui = Paths.modulePath() + "/tankWeights/TaskPanel.ui" self.ship = None self.preview = Preview.Preview()
def __init__(self): self.ui = Paths.modulePath() + "/simCreate/TaskPanel.ui"
def path(): """ Gets the OpenCL kernels path @return OpenCL kernels path """ path = Paths.modulePath() + "/resources/opencl" return path
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/HydrostaticsIco.png" MenuText = str(Translator.translate('Hydrostatics')) ToolTip = str(Translator.translate('Plot ship hydrostatics')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/SimPostIco.png" MenuText = str(Translator.translate('Track simulation')) ToolTip = str(Translator.translate('Track simulation')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/SimCreateIco.png" MenuText = str(Translator.translate('Create a new simulation')) ToolTip = str(Translator.translate('Create a new simulation in order to process later')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/HydrostaticsIco.png" MenuText = str(Translator.translate('GZ curve')) ToolTip = str(Translator.translate('Transversal stability GZ curve computation')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/SimPostIco.png" MenuText = str(Translator.translate('Track simulation')) ToolTip = str(Translator.translate('Track simulation')) return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def __init__(self): self.ui = Paths.modulePath() + "/tankCreateTank/TaskPanel.ui"
def __init__(self): """Constructor""" self.ui = Paths.modulePath() + "/shipCreateWeight/TaskPanel.ui"
def __init__(self): self.ui = Paths.modulePath() + "/simPost/TaskPanel.ui"
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/OutlineDrawIco.png" MenuText = str(Translator.translate('Outline draw')) ToolTip = str(Translator.translate('Plot ship outline draw')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/AreaCurveIco.png" MenuText = str(Translator.translate('Areas curve')) ToolTip = str(Translator.translate('Plot transversal areas curve')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/Weight.png" MenuText = str(Translator.translate('Set ship weights')) ToolTip = str(Translator.translate('Set ship weights, tanks must be added later')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
def __init__(self): self.ui = Paths.modulePath() + "/shipHydrostatics/TaskPanel.ui" self.ship = None
def __init__(self): self.ui = Paths.modulePath() + "/shipGZ/TaskPanel.ui"
def __init__(self): """Constructor""" self.ui = Paths.modulePath() + "/shipCreateShip/TaskPanel.ui" self.preview = Preview.Preview()
def initValues(self): """ Get selected geometry. @return False if sucessfully values initialized. """ # Get selected objects selObjs = FreeCADGui.Selection.getSelection() if not selObjs: msg = QtGui.QApplication.translate( "ship_console", "Ship instance must be selected (no object selected)", None, QtGui.QApplication.UnicodeUTF8, ) App.Console.PrintError(msg) return True for i in range(0, len(selObjs)): obj = selObjs[i] # Test if is a ship instance props = obj.PropertiesList try: props.index("IsShip") except ValueError: continue if obj.IsShip: # Test if another ship already selected if self.ship: msg = QtGui.QApplication.translate( "ship_console", "More than one ship selected (extra ships will be neglected)", None, QtGui.QApplication.UnicodeUTF8, ) App.Console.PrintWarning(msg + "\n") break self.ship = obj # Test if any valid ship was selected if not self.ship: msg = QtGui.QApplication.translate( "ship_console", "Ship instance must be selected (no valid ship found at selected objects)", None, QtGui.QApplication.UnicodeUTF8, ) App.Console.PrintError(msg + "\n") return True props = self.ship.PropertiesList try: props.index("WeightNames") except: msg = QtGui.QApplication.translate( "ship_console", "Ship weights has not been set. You need to set weights before use this tool", None, QtGui.QApplication.UnicodeUTF8, ) App.Console.PrintError(msg + "\n") return True # Setup available tanks list objs = App.ActiveDocument.Objects iconPath = Paths.iconsPath() + "/Tank.xpm" icon = QtGui.QIcon(QtGui.QPixmap(iconPath)) for obj in objs: # Try to get valid tank property props = obj.PropertiesList try: props.index("IsShipTank") except ValueError: continue if not obj.IsShipTank: continue # Add tank to list name = obj.Name label = obj.Label tag = label + " (" + name + ")" self.tanks[tag] = name # self.tanks.append([name, tag]) item = QtGui.QListWidgetItem(tag) item.setIcon(icon) self.form.tanks.addItem(item) return False
def __init__(self): self.ui = Paths.modulePath() + "/shipAreasCurve/TaskPanel.ui" self.preview = Preview.Preview() self.ship = None
def __init__(self): self.ui = Paths.modulePath() + "/tankGZ/TaskPanel.ui" self.ship = None self.tanks = {}
def __init__(self): self.ui = Paths.modulePath() + "/simRun/TaskPanel.ui" self.sim = False
def GetResources(self): from shipUtils import Paths, Translator IconPath = Paths.iconsPath() + "/Tank.png" MenuText = str(Translator.translate('Create a new tank')) ToolTip = str(Translator.translate('Create a new ship tank')) return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}