def __init__(self, title: str, message: str, detailed_text: str = None, details_lang=InformationDetailsMode.PLAIN): super().__init__() self.main_layout = QtGui.QVBoxLayout() self.setWindowTitle(str(title)) self.setMinimumWidth(self.MINIMUM_WIDTH) self.message_label = QtGui.QLabel(str(message)) self.message_label.setWordWrap(True) self.button_layout = QtGui.QHBoxLayout() self.details_widget = QtGui.QWidget() self.show_details_button = QtGui.QPushButton(self.SHOW_DETAILS_TEXT) self.ok_button = QtGui.QPushButton("OK") self.button_layout.addStretch(1) self.button_layout.addWidget(self.show_details_button) self.button_layout.addWidget(self.ok_button) self.details_textarea = QtGui.QTextEdit() if details_lang == InformationDetailsMode.PLAIN: self.details_textarea.insertPlainText( str(detailed_text).replace("\\n", "\n")) elif details_lang == InformationDetailsMode.HTML: self.details_textarea.insertHtml( str(detailed_text).replace("\\n", "\n")) self.details_textarea.setReadOnly(True) self.details_widget_layout = QtGui.QVBoxLayout() self.details_widget_layout.setContentsMargins(0, 0, 0, 0) self.details_widget_layout.addWidget(h_line_generator()) self.details_widget_layout.addWidget(self.details_textarea) self.details_widget.setLayout(self.details_widget_layout) self.details_widget.setVisible(False) self.show_details_button.clicked.connect(self.on_details_button) self.ok_button.clicked.connect(self.on_ok_button) self.main_layout.addWidget(self.message_label) self.main_layout.addLayout(self.button_layout) self.main_layout.addWidget(self.details_widget) if not detailed_text: self.show_details_button.setVisible(False) self.setLayout(self.main_layout) self.exec_()
def __init__(self, parent=None): super().__init__(parent=parent) self.setObjectName(MAIN_WIDGET_INTERNAL_NAME) self.setWindowTitle("{} {}".format(APP_NAME, str(VERSION))) self.root_widget = QtGui.QWidget() self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(5, 0, 5, 0) self.dock_logo_widget = DockLogoWidget(parent=get_fc_main_window()) self.dock_configuration_widget = DockConfigurationWidget( parent=get_fc_main_window()) self.dp_widget = DockDPWidget(parent=get_fc_main_window()) self.pre_proccessing_widget = DockPreProcessingWidget( parent=get_fc_main_window()) self.simulation_widget = DockSimulationWidget( parent=get_fc_main_window()) self.post_processing_widget = DockPostProcessingWidget( parent=get_fc_main_window()) self.object_list_widget = DockObjectListTableWidget( parent=get_fc_main_window()) self.main_layout.addWidget(self.dock_logo_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.dock_configuration_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.dp_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.pre_proccessing_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.simulation_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.post_processing_widget) self.main_layout.addWidget(h_line_generator()) self.main_layout.addWidget(self.object_list_widget) self.root_widget.setLayout(self.main_layout) self.setWidget(self.root_widget) self.adapt_to_no_case() # Signal handling self.pre_proccessing_widget.force_pressed.connect( self.on_preprocessing_force_pressed) self.pre_proccessing_widget.need_refresh.connect(self.on_refresh) self.pre_proccessing_widget.update_dp.connect(self.on_signal_update_dp) self.pre_proccessing_widget.case_created.connect( self.adapt_to_new_case) self.pre_proccessing_widget.gencase_completed.connect( self.adapt_to_gencase_done) self.pre_proccessing_widget.simulation_completed.connect( self.adapt_to_simulation_done) self.simulation_widget.simulation_complete.connect( self.adapt_to_simulation_done) self.simulation_widget.simulation_started.connect( self.adapt_to_simulation_start) self.simulation_widget.simulation_cancelled.connect( self.adapt_to_simulation_cancel)
def __init__(self, selection_name, parent=None): super().__init__(parent=parent) self.setMinimumSize(400, 240) self.setWindowTitle(__("Material configuration")) self.ok_button = QtGui.QPushButton(__("OK")) self.cancel_button = QtGui.QPushButton(__("Cancel")) self.root_layout = QtGui.QVBoxLayout() self.target_object: SimulationObject = Case.the( ).get_simulation_object(selection_name) self.target_mkbasedproperties: MKBasedProperties = Case.the( ).get_mk_based_properties(self.target_object.type, self.target_object.obj_mk) self.selector_layout = QtGui.QHBoxLayout() self.material_label = QtGui.QLabel(__("Select a material:")) self.material_combo = QtGui.QComboBox() self.mk_label = QtGui.QLabel( __("Target MKBound: <b>{}</b>").format(self.target_object.obj_mk)) self.selector_layout.addWidget(self.material_label) self.selector_layout.addWidget(self.material_combo) self.selector_layout.addStretch(1) self.selector_layout.addWidget(self.mk_label) self.material_details_label = QtGui.QLabel(self.NO_MATERIAL_LABEL) self.button_layout = QtGui.QHBoxLayout() self.button_layout.addStretch(1) self.button_layout.addWidget(self.cancel_button) self.button_layout.addWidget(self.ok_button) self.ok_button.clicked.connect(self.on_ok) self.cancel_button.clicked.connect(self.on_cancel) self.root_layout.addLayout(self.selector_layout) self.root_layout.addWidget(h_line_generator()) self.root_layout.addWidget(self.material_details_label) self.root_layout.addStretch(1) self.root_layout.addLayout(self.button_layout) self.setLayout(self.root_layout) self.material_combo.currentIndexChanged.connect( self._on_material_combo_change) self.populate_materials() self._on_material_combo_change(self.material_combo.currentIndex()) self.exec_()
def __init__(self, body): super().__init__() self.body: MoorDynBody = body self.setWindowTitle(__("MoorDyn Body Configuration")) self.setMinimumWidth(440) self.root_layout: QtGui.QVBoxLayout = QtGui.QVBoxLayout() # Label self.reference_label: QtGui.QLable = QtGui.QLabel( __("Editing settings for reference (mkbound): <b>{}</b>").format( body.ref)) # Depth value introduction self.depth_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.depth_label: QtGui.QLabel = QtGui.QLabel(__("Water depth: ")) self.depth_enable_check: QtGui.QCheckBox = QtGui.QCheckBox( __("Override")) self.depth_value_line_edit: QtGui.QLineEdit = QtGui.QLineEdit() self.depth_layout.addWidget(self.depth_label) self.depth_layout.addStretch(1) self.depth_layout.addWidget(self.depth_enable_check) self.depth_layout.addWidget(self.depth_value_line_edit) # Bottom button row self.button_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.ok_button: QtGui.QPushButton = QtGui.QPushButton(__("OK")) self.button_layout.addStretch(1) self.button_layout.addWidget(self.ok_button) # Main layout composition self.root_layout.addWidget(self.reference_label) self.root_layout.addWidget(h_line_generator()) self.root_layout.addLayout(self.depth_layout) self.root_layout.addStretch(1) self.root_layout.addLayout(self.button_layout) self.setLayout(self.root_layout) # Connections self.ok_button.clicked.connect(self._on_ok) self.depth_enable_check.stateChanged.connect(self._on_enable) self._fill_data() self.exec_()
def __init__(self, mk=None, mlpiston1d=None, parent=None): super().__init__(parent=parent) self.mk = mk self.temp_mlpiston1d = mlpiston1d if mlpiston1d is not None else MLPiston1D( ) self.mlpiston1d = mlpiston1d self.main_layout = QtGui.QVBoxLayout() self.data_layout = QtGui.QVBoxLayout() self.button_layout = QtGui.QHBoxLayout() self.mk_label = QtGui.QLabel(__("MK to use: {}").format(self.mk)) self.filevelx_layout = QtGui.QHBoxLayout() self.filevelx_label = QtGui.QLabel(__("File with X velocity:")) self.filevelx_input = QtGui.QLineEdit() self.filevelx_browse = QtGui.QPushButton("...") for x in [ self.filevelx_label, self.filevelx_input, self.filevelx_browse ]: self.filevelx_layout.addWidget(x) self.incz_layout = QtGui.QHBoxLayout() self.incz_label = QtGui.QLabel(__("Z offset (m):")) self.incz_input = QtGui.QLineEdit() for x in [self.incz_label, self.incz_input]: self.incz_layout.addWidget(x) self.timedataini_layout = QtGui.QHBoxLayout() self.timedataini_label = QtGui.QLabel(__("Time offset (s):")) self.timedataini_input = QtGui.QLineEdit() for x in [self.timedataini_label, self.timedataini_input]: self.timedataini_layout.addWidget(x) self.smooth_layout = QtGui.QHBoxLayout() self.smooth_label = QtGui.QLabel(__("Smooth motion level:")) self.smooth_input = QtGui.QLineEdit() for x in [self.smooth_label, self.smooth_input]: self.smooth_layout.addWidget(x) for x in [ self.filevelx_layout, self.incz_layout, self.timedataini_layout, self.smooth_layout ]: self.data_layout.addLayout(x) self.delete_button = QtGui.QPushButton( __("Delete piston configuration")) self.apply_button = QtGui.QPushButton(__("Apply this configuration")) self.button_layout.addStretch(1) self.button_layout.addWidget(self.delete_button) self.button_layout.addWidget(self.apply_button) self.main_layout.addWidget(self.mk_label) self.main_layout.addWidget(h_line_generator()) self.main_layout.addLayout(self.data_layout) self.main_layout.addStretch(1) self.main_layout.addLayout(self.button_layout) self.apply_button.clicked.connect(self.on_apply) self.delete_button.clicked.connect(self.on_delete) self.filevelx_browse.clicked.connect(self.on_browse) self.setLayout(self.main_layout) self.fill_data() self.exec_()
def __init__(self, case_name: str, processor: str, number_of_particles: int, cmd_string="", parent=None): super().__init__(parent=parent) self.run_watcher = QtCore.QFileSystemWatcher() self.cmd_string = cmd_string # Title and size self.setModal(False) self.setWindowTitle(__("DualSPHysics Simulation: {}%").format("0")) self.run_dialog_layout = QtGui.QVBoxLayout() # Information GroupBox self.run_group = QtGui.QGroupBox(__("Simulation Data")) self.run_group_layout = QtGui.QVBoxLayout() self.run_group_label_case = QtGui.QLabel( __("Case name: {}").format(case_name)) self.run_group_label_proc = QtGui.QLabel( __("Simulation processor: {}").format(processor)) self.run_group_label_part = QtGui.QLabel( __("Number of particles: {}").format(number_of_particles)) self.run_group_label_partsout = QtGui.QLabel( self.PARTICLES_OUT_TEMPLATE.format(0)) self.run_group_label_eta = QtGui.QLabel(self) self.run_group_label_eta.setText( self.ETA_TEMPLATE.format("Calculating...")) self.run_group_label_completed = QtGui.QLabel("<b>{}</b>".format( __("Simulation is complete."))) self.run_group_label_completed.setVisible(False) self.run_group_layout.addWidget(self.run_group_label_case) self.run_group_layout.addWidget(self.run_group_label_proc) self.run_group_layout.addWidget(self.run_group_label_part) self.run_group_layout.addWidget(self.run_group_label_partsout) self.run_group_layout.addWidget(self.run_group_label_eta) self.run_group_layout.addWidget(self.run_group_label_completed) self.run_group_layout.addStretch(1) self.run_group.setLayout(self.run_group_layout) # Progress Bar self.run_progbar_layout = QtGui.QHBoxLayout() self.run_progbar_bar = QtGui.QProgressBar() self.run_progbar_bar.setRange(0, 100) self.run_progbar_bar.setTextVisible(False) self.run_progbar_layout.addWidget(self.run_progbar_bar) # Buttons self.run_button_layout = QtGui.QHBoxLayout() self.run_button_warnings = QtGui.QPushButton(__("Show Warnings")) self.run_button_warnings.hide() self.run_button_details = QtGui.QPushButton(__("Details")) self.run_button_cancel = QtGui.QPushButton(__("Cancel Simulation")) self.run_button_layout.addWidget(self.run_button_warnings) self.run_button_layout.addStretch(1) self.run_button_layout.addWidget(self.run_button_details) self.run_button_layout.addWidget(self.run_button_cancel) # Defines run details self.run_details = QtGui.QWidget() self.run_details.setWindowTitle(__("Simulation details")) self.run_details_layout = QtGui.QVBoxLayout() self.run_details_layout.setContentsMargins(0, 0, 0, 0) self.run_details_text = QtGui.QTextEdit() self.run_details_text.setReadOnly(True) self.run_details_layout.addWidget(h_line_generator()) self.run_details_layout.addWidget(self.run_details_text) self.run_details.hide() self.run_button_cancel.clicked.connect(self.cancelled.emit) self.run_button_details.clicked.connect(self.toggle_run_details) self.run_details.setLayout(self.run_details_layout) self.run_dialog_layout.addWidget(self.run_group) self.run_dialog_layout.addLayout(self.run_progbar_layout) self.run_dialog_layout.addLayout(self.run_button_layout) self.run_dialog_layout.addWidget(self.run_details) self.setLayout(self.run_dialog_layout) self.setMinimumWidth(self.MIN_WIDTH) self.adjustSize()
def __init__(self, irreg_wave_gen, parent=None): if not isinstance(irreg_wave_gen, IrregularPistonWaveGen): raise TypeError( "You tried to spawn an irregular wave generator " "motion widget in the timeline with a wrong object") if irreg_wave_gen is None: raise TypeError( "You tried to spawn an irregular wave generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel(__("Irregular wave generator (Piston)")) self.duration_label = QtGui.QLabel(__("Duration")) self.duration_input = QtGui.QLineEdit() self.wave_order_label = QtGui.QLabel(__("Wave Order")) self.wave_order_selector = QtGui.QComboBox() self.wave_order_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.depth_label = QtGui.QLabel(__("Depth (m): ")) self.depth_input = QtGui.QLineEdit() self.piston_dir_label = QtGui.QLabel( __("Piston direction (X, Y, Z): ")) self.piston_dir_x = QtGui.QLineEdit() self.piston_dir_y = QtGui.QLineEdit() self.piston_dir_z = QtGui.QLineEdit() self.wave_height_label = QtGui.QLabel(__("Wave height (m): ")) self.wave_height_input = QtGui.QLineEdit() self.wave_period_label = QtGui.QLabel(__("Wave period (s): ")) self.wave_period_input = QtGui.QLineEdit() self.spectrum_label = QtGui.QLabel(__("Spectrum")) self.spectrum_selector = QtGui.QComboBox() # Index numbers match IrregularSpectrum static values self.spectrum_selector.insertItems(0, ["Jonswap", "Pierson-Moskowitz"]) self.discretization_label = QtGui.QLabel(__("Discretization")) self.discretization_selector = QtGui.QComboBox() # Index numbers match IrregularDiscretization static values self.discretization_selector.insertItems( 0, ["Regular", "Random", "Stretched", "Crosstreched"]) self.peak_coef_label = QtGui.QLabel(__("Peak Coeff")) self.peak_coef_input = QtGui.QLineEdit() self.waves_label = QtGui.QLabel(__("Number of waves")) self.waves_input = QtGui.QLineEdit() self.randomseed_label = QtGui.QLabel(__("Random Seed")) self.randomseed_input = QtGui.QLineEdit() self.serieini_label = QtGui.QLabel( __("Initial time in wave serie (s): ")) self.serieini_input = QtGui.QLineEdit() self.serieini_autofit = QtGui.QCheckBox("Auto fit") self.ramptime_label = QtGui.QLabel(__("Time of ramp (s): ")) self.ramptime_input = QtGui.QLineEdit() self.savemotion_label = QtGui.QLabel(__("Motion saving > ")) self.savemotion_time_input = QtGui.QLineEdit() self.savemotion_time_label = QtGui.QLabel(__("Time (s): ")) self.savemotion_timedt_input = QtGui.QLineEdit() self.savemotion_timedt_label = QtGui.QLabel(__("DT Time (s): ")) self.savemotion_xpos_input = QtGui.QLineEdit() self.savemotion_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.savemotion_zpos_input = QtGui.QLineEdit() self.savemotion_zpos_label = QtGui.QLabel(__("Z Pos (m): ")) self.saveserie_label = QtGui.QLabel(__("Save serie > ")) self.saveserie_timemin_input = QtGui.QLineEdit() self.saveserie_timemin_label = QtGui.QLabel(__("Min. Time (s): ")) self.saveserie_timemax_input = QtGui.QLineEdit() self.saveserie_timemax_label = QtGui.QLabel(__("Max. Time (s): ")) self.saveserie_timedt_input = QtGui.QLineEdit() self.saveserie_timedt_label = QtGui.QLabel(__("DT Time (s): ")) self.saveserie_xpos_input = QtGui.QLineEdit() self.saveserie_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.saveseriewaves_label = QtGui.QLabel(__("Save serie waves > ")) self.saveseriewaves_timemin_input = QtGui.QLineEdit() self.saveseriewaves_timemin_label = QtGui.QLabel(__("Min. Time (s): ")) self.saveseriewaves_timemax_input = QtGui.QLineEdit() self.saveseriewaves_timemax_label = QtGui.QLabel(__("Max. Time (s): ")) self.saveseriewaves_xpos_input = QtGui.QLineEdit() self.saveseriewaves_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.awas_label = QtGui.QLabel(__("AWAS configuration")) self.awas_enabled = QtGui.QCheckBox(__("Enabled")) self.awas_startawas_label = QtGui.QLabel(__("Start AWAS (s): ")) self.awas_startawas_input = QtGui.QLineEdit() self.awas_swl_label = QtGui.QLabel(__("Still water level (m): ")) self.awas_swl_input = QtGui.QLineEdit() self.awas_elevation_label = QtGui.QLabel(__("Wave order: ")) self.awas_elevation_selector = QtGui.QComboBox() self.awas_elevation_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.awas_gaugex_label = QtGui.QLabel(__("Gauge X (value*h): ")) self.awas_gaugex_input = QtGui.QLineEdit() self.awas_gaugey_label = QtGui.QLabel(__("Gauge Y (m): ")) self.awas_gaugey_input = QtGui.QLineEdit() self.awas_gaugezmin_label = QtGui.QLabel(__("Gauge Z Min (m): ")) self.awas_gaugezmin_input = QtGui.QLineEdit() self.awas_gaugezmax_label = QtGui.QLabel(__("Gauge Z Max (m): ")) self.awas_gaugezmax_input = QtGui.QLineEdit() self.awas_gaugedp_label = QtGui.QLabel(__("Gauge dp: ")) self.awas_gaugedp_input = QtGui.QLineEdit() self.awas_coefmasslimit_label = QtGui.QLabel(__("Coef. mass limit: ")) self.awas_coefmasslimit_input = QtGui.QLineEdit() self.awas_savedata_label = QtGui.QLabel(__("Save data: ")) self.awas_savedata_selector = QtGui.QComboBox() self.awas_savedata_selector.insertItems( 0, [__("By Part"), __("More Info"), __("By Step")]) self.awas_limitace_label = QtGui.QLabel(__("Limit acceleration: ")) self.awas_limitace_input = QtGui.QLineEdit() self.awas_correction_label = QtGui.QLabel(__("Drift correction: ")) self.awas_correction_enabled = QtGui.QCheckBox(__("Enabled")) self.awas_correction_coefstroke_label = QtGui.QLabel(__("Coefstroke")) self.awas_correction_coefstroke_input = QtGui.QLineEdit() self.awas_correction_coefperiod_label = QtGui.QLabel(__("Coefperiod")) self.awas_correction_coefperiod_input = QtGui.QLineEdit() self.awas_correction_powerfunc_label = QtGui.QLabel(__("Powerfunc")) self.awas_correction_powerfunc_input = QtGui.QLineEdit() self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) for x in [self.duration_label, self.duration_input]: self.root_layout.addWidget(x) self.first_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_order_label, self.wave_order_selector, self.depth_label, self.depth_input ]: self.first_row_layout.addWidget(x) self.second_row_layout = QtGui.QHBoxLayout() for x in [ self.piston_dir_label, self.piston_dir_x, self.piston_dir_y, self.piston_dir_z ]: self.second_row_layout.addWidget(x) self.third_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_height_label, self.wave_height_input, self.wave_period_label, self.wave_period_input ]: self.third_row_layout.addWidget(x) self.fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.spectrum_label, self.spectrum_selector, self.discretization_label, self.discretization_selector, self.peak_coef_label, self.peak_coef_input ]: self.fourth_row_layout.addWidget(x) self.fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.waves_label, self.waves_input, self.randomseed_label, self.randomseed_input ]: self.fifth_row_layout.addWidget(x) self.sixth_row_layout = QtGui.QHBoxLayout() for x in [ self.serieini_label, self.serieini_input, self.serieini_autofit ]: self.sixth_row_layout.addWidget(x) self.seventh_row_layout = QtGui.QHBoxLayout() for x in [self.ramptime_label, self.ramptime_input]: self.seventh_row_layout.addWidget(x) self.eighth_row_layout = QtGui.QHBoxLayout() for x in [ self.savemotion_label, self.savemotion_time_label, self.savemotion_time_input, self.savemotion_timedt_label, self.savemotion_timedt_input, self.savemotion_xpos_label, self.savemotion_xpos_input, self.savemotion_zpos_label, self.savemotion_zpos_input ]: self.eighth_row_layout.addWidget(x) self.ninth_row_layout = QtGui.QHBoxLayout() for x in [ self.saveserie_label, self.saveserie_timemin_label, self.saveserie_timemin_input, self.saveserie_timemax_label, self.saveserie_timemax_input, self.saveserie_timedt_label, self.saveserie_timedt_input, self.saveserie_xpos_label, self.saveserie_xpos_input ]: self.ninth_row_layout.addWidget(x) self.tenth_row_layout = QtGui.QHBoxLayout() for x in [ self.saveseriewaves_label, self.saveseriewaves_timemin_label, self.saveseriewaves_timemin_input, self.saveseriewaves_timemax_label, self.saveseriewaves_timemax_input, self.saveseriewaves_xpos_label, self.saveseriewaves_xpos_input ]: self.tenth_row_layout.addWidget(x) self.awas_root_layout = QtGui.QHBoxLayout() self.awas_root_layout.addWidget(self.awas_label) self.awas_root_layout.addStretch(1) self.awas_root_layout.addWidget(self.awas_enabled) self.awas_first_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_startawas_label, self.awas_startawas_input, self.awas_swl_label, self.awas_swl_input, self.awas_elevation_label, self.awas_elevation_selector ]: self.awas_first_row_layout.addWidget(x) self.awas_second_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugex_label, self.awas_gaugex_input, self.awas_gaugey_label, self.awas_gaugey_input ]: self.awas_second_row_layout.addWidget(x) self.awas_third_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugezmin_label, self.awas_gaugezmin_input, self.awas_gaugezmax_label, self.awas_gaugezmax_input ]: self.awas_third_row_layout.addWidget(x) self.awas_fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugedp_label, self.awas_gaugedp_input, self.awas_coefmasslimit_label, self.awas_coefmasslimit_input ]: self.awas_fourth_row_layout.addWidget(x) self.awas_fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_savedata_label, self.awas_savedata_selector, self.awas_limitace_label, self.awas_limitace_input ]: self.awas_fifth_row_layout.addWidget(x) self.awas_sixth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_correction_label, self.awas_correction_enabled, self.awas_correction_coefstroke_label, self.awas_correction_coefstroke_input, self.awas_correction_coefperiod_label, self.awas_correction_coefperiod_input, self.awas_correction_powerfunc_label, self.awas_correction_powerfunc_input ]: self.awas_sixth_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.first_row_layout, self.second_row_layout, self.third_row_layout, self.fourth_row_layout, self.fifth_row_layout, self.sixth_row_layout, self.seventh_row_layout, self.eighth_row_layout, self.ninth_row_layout, self.tenth_row_layout ]: self.main_layout.addLayout(x) self.main_layout.addWidget(h_line_generator()) self.main_layout.addLayout(self.awas_root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.awas_first_row_layout, self.awas_second_row_layout, self.awas_third_row_layout, self.awas_fourth_row_layout, self.awas_fifth_row_layout, self.awas_sixth_row_layout ]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(irreg_wave_gen) self._init_connections()
def __init__(self, reg_wave_gen, parent=None): if not isinstance(reg_wave_gen, RegularFlapWaveGen): raise TypeError( "You tried to spawn a regular flap wave generator " "motion widget in the timeline with a wrong object") if reg_wave_gen is None: raise TypeError( "You tried to spawn a regular flap wave generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel( __("Regular flap wave generator (Flap)")) self.duration_label = QtGui.QLabel(__("Duration (s): ")) self.duration_input = QtGui.QLineEdit() self.wave_order_label = QtGui.QLabel(__("Wave Order")) self.wave_order_selector = QtGui.QComboBox() self.wave_order_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.depth_label = QtGui.QLabel(__("Depth (m): ")) self.depth_input = QtGui.QLineEdit() self.flap_axis_0_label = QtGui.QLabel(__("Flap axis 0 (X, Y, Z): ")) self.flap_axis_0_x = QtGui.QLineEdit() self.flap_axis_0_y = QtGui.QLineEdit() self.flap_axis_0_z = QtGui.QLineEdit() self.flap_axis_1_label = QtGui.QLabel(__("Flap axis 1 (X, Y, Z): ")) self.flap_axis_1_x = QtGui.QLineEdit() self.flap_axis_1_y = QtGui.QLineEdit() self.flap_axis_1_z = QtGui.QLineEdit() self.wave_height_label = QtGui.QLabel(__("Wave height (m): ")) self.wave_height_input = QtGui.QLineEdit() self.wave_period_label = QtGui.QLabel(__("Wave period (s): ")) self.wave_period_input = QtGui.QLineEdit() self.variable_draft_label = QtGui.QLabel(__("Variable Draft (m): ")) self.variable_draft_input = QtGui.QLineEdit() self.phase_label = QtGui.QLabel(__("Phase (rad): ")) self.phase_input = QtGui.QLineEdit() self.ramp_label = QtGui.QLabel(__("Ramp: ")) self.ramp_input = QtGui.QLineEdit() self.disksave_label = QtGui.QLabel(__("Save theoretical values > ")) self.disksave_periods = QtGui.QLineEdit() self.disksave_periods_label = QtGui.QLabel(__("Periods: ")) self.disksave_periodsteps = QtGui.QLineEdit() self.disksave_periodsteps_label = QtGui.QLabel(__("Period Steps: ")) self.disksave_xpos = QtGui.QLineEdit() self.disksave_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.disksave_zpos = QtGui.QLineEdit() self.disksave_zpos_label = QtGui.QLabel(__("Z Pos (m): ")) self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) for x in [self.duration_label, self.duration_input]: self.root_layout.addWidget(x) self.first_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_order_label, self.wave_order_selector, self.depth_label, self.depth_input ]: self.first_row_layout.addWidget(x) self.second_row_layout = QtGui.QHBoxLayout() for x in [ self.flap_axis_0_label, self.flap_axis_0_x, self.flap_axis_0_y, self.flap_axis_0_z ]: self.second_row_layout.addWidget(x) self.third_row_layout = QtGui.QHBoxLayout() for x in [ self.flap_axis_1_label, self.flap_axis_1_x, self.flap_axis_1_y, self.flap_axis_1_z ]: self.third_row_layout.addWidget(x) self.fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_height_label, self.wave_height_input, self.wave_period_label, self.wave_period_input, self.variable_draft_label, self.variable_draft_input ]: self.fourth_row_layout.addWidget(x) self.fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.phase_label, self.phase_input, self.ramp_label, self.ramp_input ]: self.fifth_row_layout.addWidget(x) self.sixth_row_layout = QtGui.QHBoxLayout() for x in [ self.disksave_label, self.disksave_periods_label, self.disksave_periods, self.disksave_periodsteps_label, self.disksave_periodsteps, self.disksave_xpos_label, self.disksave_xpos, self.disksave_zpos_label, self.disksave_zpos ]: self.sixth_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.first_row_layout, self.second_row_layout, self.third_row_layout, self.fourth_row_layout, self.fifth_row_layout, self.sixth_row_layout ]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(reg_wave_gen) self._init_connections()
def __init__(self, particle_count=0, detail_text="No details", cmd_string="", parent=None): super().__init__(parent=parent) # Window Creation self.setWindowModality(QtCore.Qt.NonModal) self.setWindowTitle(__("Save & GenCase")) self.setMinimumSize(400, 100) # Main Layout creation self.main_layout = QtGui.QVBoxLayout() # Main Layout elements self.info_message = QtGui.QLabel( __("Gencase exported <b>{}</b> particles.<br/>" "Press the <i>Details</i> button to check the output.").format( str(particle_count))) self.button_layout = QtGui.QHBoxLayout() self.bt_open_with_paraview = QtGui.QPushButton( __("Open with Paraview")) self.open_menu = QtGui.QMenu() self.open_menu.addAction("{}_MkCells.vtk".format(Case.the().name)) self.open_menu.addAction("{}_All.vtk".format(Case.the().name)) self.open_menu.addAction("{}_Fluid.vtk".format(Case.the().name)) self.open_menu.addAction("{}_Bound.vtk".format(Case.the().name)) self.bt_open_with_paraview.setMenu(self.open_menu) self.bt_details = QtGui.QPushButton(__("Details")) self.bt_ok = QtGui.QPushButton(__("OK")) self.button_layout.addWidget(self.bt_open_with_paraview) self.button_layout.addStretch(1) self.button_layout.addWidget(self.bt_details) self.button_layout.addWidget(self.bt_ok) # Details widget self.detail_text_widget = QtGui.QWidget() self.detail_text_widget.setContentsMargins(0, 0, 0, 0) self.detail_text_widget_layout = QtGui.QVBoxLayout() self.detail_text_widget_layout.setContentsMargins(0, 0, 0, 0) self.detail_text_area = QtGui.QTextEdit() self.detail_text_area.setText( "<b>{}:</b> <tt>{}</tt><br><pre>{}</pre>".format( __("The executed command line was"), cmd_string, detail_text)) self.detail_text_widget_layout.addWidget(h_line_generator()) self.detail_text_widget_layout.addWidget(self.detail_text_area) self.detail_text_widget.setLayout(self.detail_text_widget_layout) # Main Layout scaffolding self.main_layout.addWidget(self.info_message) self.main_layout.addStretch(1) self.main_layout.addLayout(self.button_layout) self.main_layout.addWidget(self.detail_text_widget) # Window logic self.detail_text_widget.hide() if Case.the().executable_paths.paraview: self.bt_open_with_paraview.show() else: self.bt_open_with_paraview.hide() self.bt_ok.clicked.connect(self.on_ok) self.bt_details.clicked.connect(self.on_view_details) self.open_menu.triggered.connect(self.on_open_paraview_menu) # Window scaffolding and execution self.setLayout(self.main_layout) self.setMinimumWidth(self.DETAILS_MIN_WIDTH)
def __init__(self, mk=None, mlpiston2d=None, parent=None): super().__init__(parent=parent) self.mk = mk self.temp_mlpiston2d = mlpiston2d if mlpiston2d else MLPiston2D() self.mlpiston2d = mlpiston2d self.main_layout = QtGui.QVBoxLayout() self.data_layout = QtGui.QVBoxLayout() self.button_layout = QtGui.QHBoxLayout() self.mk_label = QtGui.QLabel(__("MK to use: {}").format(self.mk)) self.incz_layout = QtGui.QHBoxLayout() self.incz_label = QtGui.QLabel(__("Z offset (m):")) self.incz_input = QtGui.QLineEdit() for x in [self.incz_label, self.incz_input]: self.incz_layout.addWidget(x) self.smooth_layout = QtGui.QHBoxLayout() self.smooth_label = QtGui.QLabel(__("Smooth motion level (Z, Y):")) self.smooth_z = QtGui.QLineEdit() self.smooth_y = QtGui.QLineEdit() for x in [self.smooth_label, self.smooth_z, self.smooth_y]: self.smooth_layout.addWidget(x) self.veldata_groupbox = QtGui.QGroupBox(__("Velocity data")) self.veldata_groupbox_layout = QtGui.QVBoxLayout() self.veldata_filevelx_layout = QtGui.QHBoxLayout() self.veldata_filevelx_label = QtGui.QLabel(__("File series")) self.veldata_filevelx_input = QtGui.QLineEdit() self.veldata_filevelx_browse = QtGui.QPushButton("...") for x in [ self.veldata_filevelx_label, self.veldata_filevelx_input, self.veldata_filevelx_browse ]: self.veldata_filevelx_layout.addWidget(x) self.veldata_files_label = QtGui.QLabel(__("No files selected")) self.veldata_posy_layout = QtGui.QHBoxLayout() self.veldata_posy_label = QtGui.QLabel( __("Y positions (separated by commas):")) self.veldata_posy_input = QtGui.QLineEdit() for x in [self.veldata_posy_label, self.veldata_posy_input]: self.veldata_posy_layout.addWidget(x) self.veldata_timedataini_layout = QtGui.QHBoxLayout() self.veldata_timedataini_label = QtGui.QLabel( __("Time offsets (separated by commas):")) self.veldata_timedataini_input = QtGui.QLineEdit() for x in [ self.veldata_timedataini_label, self.veldata_timedataini_input ]: self.veldata_timedataini_layout.addWidget(x) self.veldata_groupbox_layout.addLayout(self.veldata_filevelx_layout) self.veldata_groupbox_layout.addWidget(self.veldata_files_label) self.veldata_groupbox_layout.addLayout(self.veldata_posy_layout) self.veldata_groupbox_layout.addLayout(self.veldata_timedataini_layout) self.veldata_groupbox.setLayout(self.veldata_groupbox_layout) for x in [self.incz_layout, self.smooth_layout]: self.data_layout.addLayout(x) self.data_layout.addWidget(self.veldata_groupbox) self.delete_button = QtGui.QPushButton( __("Delete piston configuration")) self.apply_button = QtGui.QPushButton(__("Apply this configuration")) self.button_layout.addStretch(1) self.button_layout.addWidget(self.delete_button) self.button_layout.addWidget(self.apply_button) self.main_layout.addWidget(self.mk_label) self.main_layout.addWidget(h_line_generator()) self.main_layout.addLayout(self.data_layout) self.main_layout.addStretch(1) self.main_layout.addLayout(self.button_layout) self.apply_button.clicked.connect(self.on_apply) self.delete_button.clicked.connect(self.on_delete) self.veldata_filevelx_browse.clicked.connect(self.on_browse) self.setLayout(self.main_layout) self.fill_data() self.exec_()
def __init__(self, irreg_wave_gen, parent=None): if not isinstance(irreg_wave_gen, IrregularFlapWaveGen): raise TypeError( "You tried to spawn an irregular flap wave generator " "motion widget in the timeline with a wrong object") if irreg_wave_gen is None: raise TypeError( "You tried to spawn an irregular flap wave generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel( __("Irregular flap wave generator (Flap)")) self.duration_label = QtGui.QLabel(__("Duration")) self.duration_input = QtGui.QLineEdit() self.wave_order_label = QtGui.QLabel(__("Wave Order")) self.wave_order_selector = QtGui.QComboBox() self.wave_order_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.depth_label = QtGui.QLabel(__("Depth (m): ")) self.depth_input = QtGui.QLineEdit() self.flap_axis_0_label = QtGui.QLabel(__("Flap axis 0 (X, Y, Z): ")) self.flap_axis_0_x = QtGui.QLineEdit() self.flap_axis_0_y = QtGui.QLineEdit() self.flap_axis_0_z = QtGui.QLineEdit() self.flap_axis_1_label = QtGui.QLabel(__("Flap axis 1 (X, Y, Z): ")) self.flap_axis_1_x = QtGui.QLineEdit() self.flap_axis_1_y = QtGui.QLineEdit() self.flap_axis_1_z = QtGui.QLineEdit() self.wave_height_label = QtGui.QLabel(__("Wave height (m): ")) self.wave_height_input = QtGui.QLineEdit() self.wave_period_label = QtGui.QLabel(__("Wave period (s): ")) self.wave_period_input = QtGui.QLineEdit() self.variable_draft_label = QtGui.QLabel(__("Variable Draft (m): ")) self.variable_draft_input = QtGui.QLineEdit() self.spectrum_label = QtGui.QLabel(__("Spectrum")) self.spectrum_selector = QtGui.QComboBox() # Index numbers match IrregularSpectrum static values self.spectrum_selector.insertItems(0, ["Jonswap", "Pierson-Moskowitz"]) self.discretization_label = QtGui.QLabel(__("Discretization")) self.discretization_selector = QtGui.QComboBox() # Index numbers match IrregularDiscretization static values self.discretization_selector.insertItems( 0, ["Regular", "Random", "Stretched", "Crosstreched"]) self.peak_coef_label = QtGui.QLabel(__("Peak Coeff")) self.peak_coef_input = QtGui.QLineEdit() self.waves_label = QtGui.QLabel(__("Number of waves")) self.waves_input = QtGui.QLineEdit() self.randomseed_label = QtGui.QLabel(__("Random Seed")) self.randomseed_input = QtGui.QLineEdit() self.serieini_label = QtGui.QLabel( __("Initial time in wave serie (s): ")) self.serieini_input = QtGui.QLineEdit() self.serieini_autofit = QtGui.QCheckBox("Auto fit") self.ramptime_label = QtGui.QLabel(__("Time of ramp (s): ")) self.ramptime_input = QtGui.QLineEdit() self.savemotion_label = QtGui.QLabel(__("Motion saving > ")) self.savemotion_time_input = QtGui.QLineEdit() self.savemotion_time_label = QtGui.QLabel(__("Time (s): ")) self.savemotion_timedt_input = QtGui.QLineEdit() self.savemotion_timedt_label = QtGui.QLabel(__("DT Time (s): ")) self.savemotion_xpos_input = QtGui.QLineEdit() self.savemotion_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.savemotion_zpos_input = QtGui.QLineEdit() self.savemotion_zpos_label = QtGui.QLabel(__("Z Pos (m): ")) self.saveserie_label = QtGui.QLabel(__("Save serie > ")) self.saveserie_timemin_input = QtGui.QLineEdit() self.saveserie_timemin_label = QtGui.QLabel(__("Min. Time (s): ")) self.saveserie_timemax_input = QtGui.QLineEdit() self.saveserie_timemax_label = QtGui.QLabel(__("Max. Time (s): ")) self.saveserie_timedt_input = QtGui.QLineEdit() self.saveserie_timedt_label = QtGui.QLabel(__("DT Time (s): ")) self.saveserie_xpos_input = QtGui.QLineEdit() self.saveserie_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.saveseriewaves_label = QtGui.QLabel(__("Save serie waves > ")) self.saveseriewaves_timemin_input = QtGui.QLineEdit() self.saveseriewaves_timemin_label = QtGui.QLabel(__("Min. Time (s): ")) self.saveseriewaves_timemax_input = QtGui.QLineEdit() self.saveseriewaves_timemax_label = QtGui.QLabel(__("Max. Time (s): ")) self.saveseriewaves_xpos_input = QtGui.QLineEdit() self.saveseriewaves_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) for x in [self.duration_label, self.duration_input]: self.root_layout.addWidget(x) self.first_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_order_label, self.wave_order_selector, self.depth_label, self.depth_input ]: self.first_row_layout.addWidget(x) self.second_row_layout = QtGui.QHBoxLayout() for x in [ self.flap_axis_0_label, self.flap_axis_0_x, self.flap_axis_0_y, self.flap_axis_0_z ]: self.second_row_layout.addWidget(x) self.third_row_layout = QtGui.QHBoxLayout() for x in [ self.flap_axis_1_label, self.flap_axis_1_x, self.flap_axis_1_y, self.flap_axis_1_z ]: self.third_row_layout.addWidget(x) self.fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_height_label, self.wave_height_input, self.wave_period_label, self.wave_period_input, self.variable_draft_label, self.variable_draft_input ]: self.fourth_row_layout.addWidget(x) self.fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.spectrum_label, self.spectrum_selector, self.discretization_label, self.discretization_selector, self.peak_coef_label, self.peak_coef_input ]: self.fifth_row_layout.addWidget(x) self.sixth_row_layout = QtGui.QHBoxLayout() for x in [ self.waves_label, self.waves_input, self.randomseed_label, self.randomseed_input ]: self.sixth_row_layout.addWidget(x) self.seventh_row_layout = QtGui.QHBoxLayout() for x in [ self.serieini_label, self.serieini_input, self.serieini_autofit ]: self.seventh_row_layout.addWidget(x) self.eighth_row_layout = QtGui.QHBoxLayout() for x in [self.ramptime_label, self.ramptime_input]: self.eighth_row_layout.addWidget(x) self.ninth_row_layout = QtGui.QHBoxLayout() for x in [ self.savemotion_label, self.savemotion_time_label, self.savemotion_time_input, self.savemotion_timedt_label, self.savemotion_timedt_input, self.savemotion_xpos_label, self.savemotion_xpos_input, self.savemotion_zpos_label, self.savemotion_zpos_input ]: self.ninth_row_layout.addWidget(x) self.tenth_row_layout = QtGui.QHBoxLayout() for x in [ self.saveserie_label, self.saveserie_timemin_label, self.saveserie_timemin_input, self.saveserie_timemax_label, self.saveserie_timemax_input, self.saveserie_timedt_label, self.saveserie_timedt_input, self.saveserie_xpos_label, self.saveserie_xpos_input ]: self.tenth_row_layout.addWidget(x) self.eleventh_row_layout = QtGui.QHBoxLayout() for x in [ self.saveseriewaves_label, self.saveseriewaves_timemin_label, self.saveseriewaves_timemin_input, self.saveseriewaves_timemax_label, self.saveseriewaves_timemax_input, self.saveseriewaves_xpos_label, self.saveseriewaves_xpos_input ]: self.eleventh_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.first_row_layout, self.second_row_layout, self.third_row_layout, self.fourth_row_layout, self.fifth_row_layout, self.sixth_row_layout, self.seventh_row_layout, self.eighth_row_layout, self.ninth_row_layout, self.tenth_row_layout, self.eleventh_row_layout ]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(irreg_wave_gen) self._init_connections()
def __init__(self, rot_file_gen, project_folder_path, parent=None): if not isinstance(rot_file_gen, RotationFileGen): raise TypeError("You tried to spawn a rotation file generator " "motion widget in the timeline with a wrong object") if rot_file_gen is None: raise TypeError("You tried to spawn a rotation file generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) # Needed for copying movement file to root of the case. self.project_folder_path = project_folder_path self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel(__("Rotation file movement")) self.duration_label = QtGui.QLabel(__("Duration (s): ")) self.duration_input = QtGui.QLineEdit() self.filename_label = QtGui.QLabel(__("File name: ")) self.filename_input = QtGui.QLineEdit() self.filename_browse = QtGui.QPushButton(__("Browse")) self.anglesunits_label = QtGui.QLabel(__("Angle Units: ")) self.anglesunits_selector = QtGui.QComboBox() self.anglesunits_selector.insertItems( 0, [__("Degrees"), __("Radians")]) self.axisp1x_label = QtGui.QLabel(__("Axis 1 X: ")) self.axisp1x_input = QtGui.QLineEdit() self.axisp1y_label = QtGui.QLabel(__("Axis 1 Y: ")) self.axisp1y_input = QtGui.QLineEdit() self.axisp1z_label = QtGui.QLabel(__("Axis 1 Z: ")) self.axisp1z_input = QtGui.QLineEdit() self.axisp2x_label = QtGui.QLabel(__("Axis 2 X: ")) self.axisp2x_input = QtGui.QLineEdit() self.axisp2y_label = QtGui.QLabel(__("Axis 2 Y: ")) self.axisp2y_input = QtGui.QLineEdit() self.axisp2z_label = QtGui.QLabel(__("Axis 2 Z: ")) self.axisp2z_input = QtGui.QLineEdit() self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) self.root_layout.addWidget(self.anglesunits_label) self.root_layout.addWidget(self.anglesunits_selector) self.root_layout.addWidget(self.duration_label) self.root_layout.addWidget(self.duration_input) self.first_row_layout = QtGui.QHBoxLayout() self.first_row_layout.addWidget(self.filename_label) self.first_row_layout.addWidget(self.filename_input) self.first_row_layout.addWidget(self.filename_browse) self.second_row_layout = QtGui.QHBoxLayout() for x in [self.axisp1x_label, self.axisp1x_input, self.axisp1y_label, self.axisp1y_input, self.axisp1z_label, self.axisp1z_input]: self.second_row_layout.addWidget(x) self.third_row_layout = QtGui.QHBoxLayout() for x in [self.axisp2x_label, self.axisp2x_input, self.axisp2y_label, self.axisp2y_input, self.axisp2z_label, self.axisp2z_input]: self.third_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [self.first_row_layout, self.second_row_layout, self.third_row_layout]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(rot_file_gen) self._init_connections()
def __init__(self, line, stored_configuration): super().__init__() self.line: MoorDynLine = line self.stored_configuration = stored_configuration self.setWindowTitle(__("MoorDyn Line Configuration")) self.setMinimumWidth(440) self.root_layout: QtGui.QVBoxLayout = QtGui.QVBoxLayout() # Label self.reference_label: QtGui.QLabel = QtGui.QLabel( __("Editing settings for line: <b>{}</b>").format(line.line_id)) # Basic configuration group self.basic_configuration_groupbox: QtGui.QGroupBox = QtGui.QGroupBox( __("Basic configuration")) self.basic_configuration_groupbox_layout: QtGui.QFormLayout = QtGui.QFormLayout( ) self.connection_type_combobox: QtGui.QComboBox = QtGui.QComboBox() self.connection_type_combobox.addItems( ["Vessel to Fix connection", "Vessel to Vessel connection"]) self.vessel_connection_label: QtGui.QLabel = QtGui.QLabel( __("Vessel Connection: ")) self.vessel_connection_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.vessel_connection_body_combo: QtGui.QComboBox = QtGui.QComboBox() self.vessel_connection_point_label: QtGui.QLabel = QtGui.QLabel( __("Point (X, Y, Z):")) self.vessel_connection_point_x: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel_connection_point_y: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel_connection_point_z: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel_connection_layout.addWidget( self.vessel_connection_body_combo) self.vessel_connection_layout.addWidget( self.vessel_connection_point_label) self.vessel_connection_layout.addWidget(self.vessel_connection_point_x) self.vessel_connection_layout.addWidget(self.vessel_connection_point_y) self.vessel_connection_layout.addWidget(self.vessel_connection_point_z) self.vessel2_connection_label: QtGui.QLabel = QtGui.QLabel( __("Vessel Connection (2nd): ")) self.vessel2_connection_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.vessel2_connection_body_combo: QtGui.QComboBox = QtGui.QComboBox() self.vessel2_connection_point_label: QtGui.QLabel = QtGui.QLabel( __("Point (X, Y, Z):")) self.vessel2_connection_point_x: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel2_connection_point_y: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel2_connection_point_z: QtGui.QLineEdit = QtGui.QLineEdit() self.vessel2_connection_layout.addWidget( self.vessel2_connection_body_combo) self.vessel2_connection_layout.addWidget( self.vessel2_connection_point_label) self.vessel2_connection_layout.addWidget( self.vessel2_connection_point_x) self.vessel2_connection_layout.addWidget( self.vessel2_connection_point_y) self.vessel2_connection_layout.addWidget( self.vessel2_connection_point_z) self.fix_connection_label: QtGui.QLabel = QtGui.QLabel( __("Fix Connection (X, Y, Z): ")) self.fix_connection_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.fix_connection_point_x: QtGui.QLineEdit = QtGui.QLineEdit() self.fix_connection_point_y: QtGui.QLineEdit = QtGui.QLineEdit() self.fix_connection_point_z: QtGui.QLineEdit = QtGui.QLineEdit() self.fix_connection_layout.addWidget(self.fix_connection_point_x) self.fix_connection_layout.addWidget(self.fix_connection_point_y) self.fix_connection_layout.addWidget(self.fix_connection_point_z) self.length_input: QtGui.QLineEdit = QtGui.QLineEdit() self.segments_input: QtGui.QLineEdit = QtGui.QLineEdit() self.basic_configuration_groupbox_layout.addRow( __("Type of connection: "), self.connection_type_combobox) self.basic_configuration_groupbox_layout.addRow( self.vessel_connection_label, self.vessel_connection_layout) self.basic_configuration_groupbox_layout.addRow( self.vessel2_connection_label, self.vessel2_connection_layout) self.basic_configuration_groupbox_layout.addRow( self.fix_connection_label, self.fix_connection_layout) self.basic_configuration_groupbox_layout.addRow(h_line_generator()) self.basic_configuration_groupbox_layout.addRow( __("Line Length (m):"), self.length_input) self.basic_configuration_groupbox_layout.addRow( __("Number of Segments:"), self.segments_input) self.basic_configuration_groupbox.setLayout( self.basic_configuration_groupbox_layout) # Override configuration group self.override_configuration_groupbox: QtGui.QGroupBox = QtGui.QGroupBox( __("Configuration Overrides")) self.override_configuration_groupbox_layout: QtGui.QFormLayout = QtGui.QFormLayout( ) self.ea_input: QtGui.QLineEdit = QtGui.QLineEdit() self.ea_input_check: QtGui.QCheckBox = QtGui.QCheckBox() self.ea_input_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.ea_input_layout.addWidget(self.ea_input) self.ea_input_layout.addWidget(self.ea_input_check) self.diameter_input: QtGui.QLineEdit = QtGui.QLineEdit() self.diameter_input_check: QtGui.QCheckBox = QtGui.QCheckBox() self.diameter_input_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.diameter_input_layout.addWidget(self.diameter_input) self.diameter_input_layout.addWidget(self.diameter_input_check) self.massDenInAir_input: QtGui.QLineEdit = QtGui.QLineEdit() self.massDenInAir_input_check: QtGui.QCheckBox = QtGui.QCheckBox() self.massDenInAir_input_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.massDenInAir_input_layout.addWidget(self.massDenInAir_input) self.massDenInAir_input_layout.addWidget(self.massDenInAir_input_check) self.ba_input: QtGui.QLineEdit = QtGui.QLineEdit() self.ba_input_check: QtGui.QCheckBox = QtGui.QCheckBox() self.ba_input_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.ba_input_layout.addWidget(self.ba_input) self.ba_input_layout.addWidget(self.ba_input_check) self.override_configuration_groupbox_layout.addRow( __("Stiffness (N):"), self.ea_input_layout) self.override_configuration_groupbox_layout.addRow( __("Diameter (m):"), self.diameter_input_layout) self.override_configuration_groupbox_layout.addRow( __("Mass in Air (kg/m):"), self.massDenInAir_input_layout) self.override_configuration_groupbox_layout.addRow( __("Line internal damping (Ns):"), self.ba_input_layout) self.override_configuration_groupbox.setLayout( self.override_configuration_groupbox_layout) # Bottom button row self.button_layout: QtGui.QHBoxLayout = QtGui.QHBoxLayout() self.ok_button: QtGui.QPushButton = QtGui.QPushButton(__("OK")) self.button_layout.addStretch(1) self.button_layout.addWidget(self.ok_button) # Main layout composition self.root_layout.addWidget(self.reference_label) self.root_layout.addWidget(h_line_generator()) self.root_layout.addWidget(self.basic_configuration_groupbox) # self.root_layout.addWidget(self.override_configuration_groupbox) self.root_layout.addStretch(1) self.root_layout.addLayout(self.button_layout) self.setLayout(self.root_layout) # Connections self.ok_button.clicked.connect(self._on_ok) self.ea_input_check.stateChanged.connect(self._on_ea_check) self.diameter_input_check.stateChanged.connect(self._on_diameter_check) self.massDenInAir_input_check.stateChanged.connect( self._on_massDenInAir_check) self.ba_input_check.stateChanged.connect(self._on_ba_check) self.connection_type_combobox.currentIndexChanged.connect( self._on_type_of_connection_change) self._fill_data() self._on_type_of_connection_change( self.connection_type_combobox.currentIndex()) self.exec_()
def __init__(self, reg_wave_gen, parent=None): if not isinstance(reg_wave_gen, RegularPistonWaveGen): raise TypeError( "You tried to spawn a regular wave generator " "motion widget in the timeline with a wrong object") if reg_wave_gen is None: raise TypeError( "You tried to spawn a regular wave generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel(__("Regular wave generator (Piston)")) self.duration_label = QtGui.QLabel(__("Duration (s): ")) self.duration_input = QtGui.QLineEdit() self.wave_order_label = QtGui.QLabel(__("Wave Order")) self.wave_order_selector = QtGui.QComboBox() self.wave_order_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.depth_label = QtGui.QLabel(__("Depth (m): ")) self.depth_input = QtGui.QLineEdit() self.piston_dir_label = QtGui.QLabel( __("Piston direction (X, Y, Z): ")) self.piston_dir_x = QtGui.QLineEdit() self.piston_dir_y = QtGui.QLineEdit() self.piston_dir_z = QtGui.QLineEdit() self.wave_height_label = QtGui.QLabel(__("Wave height (m): ")) self.wave_height_input = QtGui.QLineEdit() self.wave_period_label = QtGui.QLabel(__("Wave period (s): ")) self.wave_period_input = QtGui.QLineEdit() self.phase_label = QtGui.QLabel(__("Phase (rad): ")) self.phase_input = QtGui.QLineEdit() self.ramp_label = QtGui.QLabel(__("Ramp: ")) self.ramp_input = QtGui.QLineEdit() self.disksave_label = QtGui.QLabel(__("Save theoretical values > ")) self.disksave_periods = QtGui.QLineEdit() self.disksave_periods_label = QtGui.QLabel(__("Periods: ")) self.disksave_periodsteps = QtGui.QLineEdit() self.disksave_periodsteps_label = QtGui.QLabel(__("Period Steps: ")) self.disksave_xpos = QtGui.QLineEdit() self.disksave_xpos_label = QtGui.QLabel(__("X Pos (m): ")) self.disksave_zpos = QtGui.QLineEdit() self.disksave_zpos_label = QtGui.QLabel(__("Z Pos (m): ")) self.awas_label = QtGui.QLabel(__("AWAS configuration")) self.awas_enabled = QtGui.QCheckBox(__("Enabled")) self.awas_startawas_label = QtGui.QLabel(__("Start AWAS (s): ")) self.awas_startawas_input = QtGui.QLineEdit() self.awas_swl_label = QtGui.QLabel(__("Still water level (m): ")) self.awas_swl_input = QtGui.QLineEdit() self.awas_elevation_label = QtGui.QLabel(__("Wave order: ")) self.awas_elevation_selector = QtGui.QComboBox() self.awas_elevation_selector.insertItems( 0, [__("1st Order"), __("2nd Order")]) self.awas_gaugex_label = QtGui.QLabel(__("Gauge X (value*h): ")) self.awas_gaugex_input = QtGui.QLineEdit() self.awas_gaugey_label = QtGui.QLabel(__("Gauge Y (m): ")) self.awas_gaugey_input = QtGui.QLineEdit() self.awas_gaugezmin_label = QtGui.QLabel(__("Gauge Z Min (m): ")) self.awas_gaugezmin_input = QtGui.QLineEdit() self.awas_gaugezmax_label = QtGui.QLabel(__("Gauge Z Max (m): ")) self.awas_gaugezmax_input = QtGui.QLineEdit() self.awas_gaugedp_label = QtGui.QLabel(__("Gauge dp: ")) self.awas_gaugedp_input = QtGui.QLineEdit() self.awas_coefmasslimit_label = QtGui.QLabel(__("Coef. mass limit: ")) self.awas_coefmasslimit_input = QtGui.QLineEdit() self.awas_savedata_label = QtGui.QLabel(__("Save data: ")) self.awas_savedata_selector = QtGui.QComboBox() self.awas_savedata_selector.insertItems( 0, [__("By Part"), __("More Info"), __("By Step")]) self.awas_limitace_label = QtGui.QLabel(__("Limit acceleration: ")) self.awas_limitace_input = QtGui.QLineEdit() self.awas_correction_label = QtGui.QLabel(__("Drift correction: ")) self.awas_correction_enabled = QtGui.QCheckBox(__("Enabled")) self.awas_correction_coefstroke_label = QtGui.QLabel(__("Coefstroke")) self.awas_correction_coefstroke_input = QtGui.QLineEdit() self.awas_correction_coefperiod_label = QtGui.QLabel(__("Coefperiod")) self.awas_correction_coefperiod_input = QtGui.QLineEdit() self.awas_correction_powerfunc_label = QtGui.QLabel(__("Powerfunc")) self.awas_correction_powerfunc_input = QtGui.QLineEdit() self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) for x in [self.duration_label, self.duration_input]: self.root_layout.addWidget(x) self.first_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_order_label, self.wave_order_selector, self.depth_label, self.depth_input ]: self.first_row_layout.addWidget(x) self.second_row_layout = QtGui.QHBoxLayout() for x in [ self.piston_dir_label, self.piston_dir_x, self.piston_dir_y, self.piston_dir_z ]: self.second_row_layout.addWidget(x) self.third_row_layout = QtGui.QHBoxLayout() for x in [ self.wave_height_label, self.wave_height_input, self.wave_period_label, self.wave_period_input ]: self.third_row_layout.addWidget(x) self.fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.phase_label, self.phase_input, self.ramp_label, self.ramp_input ]: self.fourth_row_layout.addWidget(x) self.fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.disksave_label, self.disksave_periods_label, self.disksave_periods, self.disksave_periodsteps_label, self.disksave_periodsteps, self.disksave_xpos_label, self.disksave_xpos, self.disksave_zpos_label, self.disksave_zpos ]: self.fifth_row_layout.addWidget(x) self.awas_root_layout = QtGui.QHBoxLayout() self.awas_root_layout.addWidget(self.awas_label) self.awas_root_layout.addStretch(1) self.awas_root_layout.addWidget(self.awas_enabled) self.awas_first_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_startawas_label, self.awas_startawas_input, self.awas_swl_label, self.awas_swl_input, self.awas_elevation_label, self.awas_elevation_selector ]: self.awas_first_row_layout.addWidget(x) self.awas_second_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugex_label, self.awas_gaugex_input, self.awas_gaugey_label, self.awas_gaugey_input ]: self.awas_second_row_layout.addWidget(x) self.awas_third_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugezmin_label, self.awas_gaugezmin_input, self.awas_gaugezmax_label, self.awas_gaugezmax_input ]: self.awas_third_row_layout.addWidget(x) self.awas_fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_gaugedp_label, self.awas_gaugedp_input, self.awas_coefmasslimit_label, self.awas_coefmasslimit_input ]: self.awas_fourth_row_layout.addWidget(x) self.awas_fifth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_savedata_label, self.awas_savedata_selector, self.awas_limitace_label, self.awas_limitace_input ]: self.awas_fifth_row_layout.addWidget(x) self.awas_sixth_row_layout = QtGui.QHBoxLayout() for x in [ self.awas_correction_label, self.awas_correction_enabled, self.awas_correction_coefstroke_label, self.awas_correction_coefstroke_input, self.awas_correction_coefperiod_label, self.awas_correction_coefperiod_input, self.awas_correction_powerfunc_label, self.awas_correction_powerfunc_input ]: self.awas_sixth_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.first_row_layout, self.second_row_layout, self.third_row_layout, self.fourth_row_layout, self.fifth_row_layout ]: self.main_layout.addLayout(x) self.main_layout.addWidget(h_line_generator()) self.main_layout.addLayout(self.awas_root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.awas_first_row_layout, self.awas_second_row_layout, self.awas_third_row_layout, self.awas_fourth_row_layout, self.awas_fifth_row_layout, self.awas_sixth_row_layout ]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(reg_wave_gen) self._init_connections()
def __init__(self, file_wave_gen, project_folder_path, parent=None): if not isinstance(file_wave_gen, FileGen): raise TypeError( "You tried to spawn a regular wave generator " "motion widget in the timeline with a wrong object") if file_wave_gen is None: raise TypeError( "You tried to spawn a regular wave generator " "motion widget in the timeline without a motion object") super().__init__(parent=parent) # Needed for copying movement file to root of the case. self.project_folder_path = project_folder_path self.main_layout = QtGui.QVBoxLayout() self.main_layout.setContentsMargins(10, 10, 10, 10) self.root_label = QtGui.QLabel(__("File movement: ")) self.duration_label = QtGui.QLabel(__("Duration (s): ")) self.duration_input = QtGui.QLineEdit() self.filename_label = QtGui.QLabel(__("File name: ")) self.filename_input = QtGui.QLineEdit() self.filename_browse = QtGui.QPushButton(__("Browse")) self.fields_label = QtGui.QLabel(__("Number of fields: ")) self.fields_input = QtGui.QLineEdit() self.fieldtime_label = QtGui.QLabel(__("Column with time: ")) self.fieldtime_input = QtGui.QLineEdit() self.fieldx_label = QtGui.QLabel(__("X position column: ")) self.fieldx_input = QtGui.QLineEdit() self.fieldy_label = QtGui.QLabel(__("Y position column: ")) self.fieldy_input = QtGui.QLineEdit() self.fieldz_label = QtGui.QLabel(__("Z position column: ")) self.fieldz_input = QtGui.QLineEdit() self.root_layout = QtGui.QHBoxLayout() self.root_layout.addWidget(self.root_label) self.root_layout.addStretch(1) self.root_layout.addWidget(self.duration_label) self.root_layout.addWidget(self.duration_input) self.first_row_layout = QtGui.QHBoxLayout() self.first_row_layout.addWidget(self.filename_label) self.first_row_layout.addWidget(self.filename_input) self.first_row_layout.addWidget(self.filename_browse) self.second_row_layout = QtGui.QHBoxLayout() self.second_row_layout.addWidget(self.fields_label) self.second_row_layout.addWidget(self.fields_input) self.third_row_layout = QtGui.QHBoxLayout() self.third_row_layout.addWidget(self.fieldtime_label) self.third_row_layout.addWidget(self.fieldtime_input) self.fourth_row_layout = QtGui.QHBoxLayout() for x in [ self.fieldx_label, self.fieldx_input, self.fieldy_label, self.fieldy_input, self.fieldz_label, self.fieldz_input ]: self.fourth_row_layout.addWidget(x) self.main_layout.addLayout(self.root_layout) self.main_layout.addWidget(h_line_generator()) for x in [ self.first_row_layout, self.second_row_layout, self.third_row_layout, self.fourth_row_layout ]: self.main_layout.addLayout(x) self.setLayout(self.main_layout) self.fill_values(file_wave_gen) self._init_connections()