def __init__(self, parent): """ Constructor """ QWidget.__init__(self, parent) Ui_BoundaryConditionsTurbulenceInletForm.__init__(self) self.setupUi(self) # Connections self.comboBoxTurbulence.activated[str].connect( self.__slotChoiceTurbulence) self.__modelTurbulence = ComboModel(self.comboBoxTurbulence, 3, 1) self.__modelTurbulence.addItem( self.tr("Calculation by hydraulic diameter"), 'hydraulic_diameter') self.__modelTurbulence.addItem( self.tr("Calculation by turbulent intensity"), 'turbulent_intensity') self.__modelTurbulence.addItem(self.tr("Calculation by formula"), 'formula') self.lineEditDiameter.textChanged[str].connect(self.__slotDiam) self.lineEditIntensity.textChanged[str].connect(self.__slotIntensity) self.lineEditDiameterIntens.textChanged[str].connect(self.__slotDiam) self.pushButtonTurb.clicked.connect(self.__slotTurbulenceFormula) validatorDiam = DoubleValidator(self.lineEditDiameter, min=0.) validatorDiam.setExclusiveMin(True) validatorIntensity = DoubleValidator(self.lineEditIntensity, min=0.) self.lineEditDiameter.setValidator(validatorDiam) self.lineEditDiameterIntens.setValidator(validatorDiam) self.lineEditIntensity.setValidator(validatorIntensity)
def setup(self, case): self.case = case self.case.undoStopGlobal() self.mdl = DropletCondensationEvaporationModel(self.case) self.modelYPlus = ComboModel(self.comboBoxYPlus, 3, 1) self.modelYPlus.addItem(self.tr("Boundary cell center"), "center") self.modelYPlus.addItem(self.tr("Y+ = "), "Yplus_value") self.modelYPlus.addItem(self.tr("Droplets diameter"), "diameter") # Validators validatorYplus = DoubleValidator(self.lineEditYPlus, min=0.0) validatorYplus.setExclusiveMin(True) self.lineEditYPlus.setValidator(validatorYplus) # Connect signals to slots self.comboBoxYPlus.activated[str].connect(self.slotYPlus) self.lineEditYPlus.textChanged[str].connect(self.slotYPlusValue) isYPlus = self.mdl.getYPlusModel() self.modelYPlus.setItem(str_model=isYPlus) if isYPlus == "Yplus_value": self.lineEditYPlus.show() self.lineEditYPlus.setText(str(self.mdl.getYPlusValue())) else: self.lineEditYPlus.hide() self.case.undoStartGlobal()
def setup(self, case): """ Setup the widget """ self.case = case self.__boundary = None self.case.undoStopGlobal() self.notebook = NotebookModel(self.case) self.comboBoxTurbulence.activated[str].connect(self.__slotChoiceTurbulence) self.__modelTurbulence = ComboModel(self.comboBoxTurbulence, 2, 1) self.__modelTurbulence.addItem(self.tr("Calculation by hydraulic diameter"), 'hydraulic_diameter') self.__modelTurbulence.addItem(self.tr("Calculation by turbulent intensity"), 'turbulent_intensity') self.__modelTurbulence.addItem(self.tr("Calculation by formula"), 'formula') self.lineEditDiameter.textChanged[str].connect(self.__slotDiam) self.lineEditIntensity.textChanged[str].connect(self.__slotIntensity) self.lineEditDiameterIntens.textChanged[str].connect(self.__slotDiam) self.pushButtonTurb.clicked.connect(self.__slotTurbulenceFormula) validatorDiam = DoubleValidator(self.lineEditDiameter, min=0.) validatorDiam.setExclusiveMin(True) validatorIntensity = DoubleValidator(self.lineEditIntensity, min=0.) self.lineEditDiameter.setValidator(validatorDiam) self.lineEditDiameterIntens.setValidator(validatorDiam) self.lineEditIntensity.setValidator(validatorIntensity) self.case.undoStartGlobal()
def createEditor(self, parent, option, index): editor = QLineEdit(parent) if index.column() == 1 or index.column() == 2: v = DoubleValidator(editor, min=0.) v.setExclusiveMin(True) else: v = DoubleValidator(editor) editor.setValidator(v) return editor
def __addValidators(self): """ Add the validator for NALIMX and EPALIM """ validatorNALIMX = IntValidator(self.lineEditNALIMX, min=1) self.lineEditNALIMX.setValidator(validatorNALIMX) validatorEPALIM = DoubleValidator(self.lineEditEPALIM, min=0.0) validatorEPALIM.setExclusiveMin(True) self.lineEditEPALIM.setValidator(validatorEPALIM)
def setup(self, case): self.case = case self.case.undoStopGlobal() self.__model = ConjugateHeatTransferModel(self.case) # Models self.modelSyrthes = StandardItemModelSyrthes(self.__model) self.tableViewSyrthes.setModel(self.modelSyrthes) if QT_API == "PYQT4": self.tableViewSyrthes.verticalHeader().setResizeMode( QHeaderView.ResizeToContents) self.tableViewSyrthes.horizontalHeader().setResizeMode( QHeaderView.ResizeToContents) self.tableViewSyrthes.horizontalHeader().setResizeMode( 1, QHeaderView.Stretch) elif QT_API == "PYQT5": self.tableViewSyrthes.verticalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) self.tableViewSyrthes.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) self.tableViewSyrthes.horizontalHeader().setSectionResizeMode( 1, QHeaderView.Stretch) self.modelProjectionAxis = ComboModel(self.comboBoxProjectionAxis, 1, 1) self.modelProjectionAxis.addItem("off") self.modelProjectionAxis.addItem("x") self.modelProjectionAxis.addItem("y") self.modelProjectionAxis.addItem("z") # connections self.comboBoxProjectionAxis.currentTextChanged[str].connect( self.slotProjectionAxis) self.lineEditVerbosity.textChanged[str].connect(self.slotVerbosity) self.lineEditVisualization.textChanged[str].connect( self.slotVisualization) self.lineEditTolerance.editingFinished.connect(self.slotTolerance) self.lineEditVerbosity.setValidator( IntValidator(self.lineEditVerbosity)) self.lineEditVisualization.setValidator( IntValidator(self.lineEditVisualization)) _tolValidator = DoubleValidator(self.lineEditTolerance, min=0.) _tolValidator.setExclusiveMin() self.lineEditTolerance.setValidator(_tolValidator) self.initializeParameters() self.case.undoStartGlobal()
def createEditor(self, parent, option, index): editor = QLineEdit(parent) if index.column() == 3: validator = DoubleValidator(editor, min=0., max=0.01) validator.setExclusiveMin(True) elif (index.column() == 2 or index.column() == 4): validator = IntValidator(editor, min=1) elif index.column() == 5: validator = DoubleValidator(editor, min=0.) validator.setExclusiveMin(True) editor.setValidator(validator) editor.installEventFilter(self) return editor
def __init__(self, parent): """ Constructor """ QWidget.__init__(self, parent) Ui_BoundaryConditionsInterfacialArea.__init__(self) self.setupUi(self) # Connections self.lineEditDiameter.textChanged[str].connect(self.__slotDiameter) validatorDiam = DoubleValidator(self.lineEditDiameter, min = 0.) validatorDiam.setExclusiveMin(True) self.lineEditDiameter.setValidator(validatorDiam)
def _setValidators(self): validatorIJNBP = IntValidator(self.lineEditIJNBP, min=0) validatorIJFRE = IntValidator(self.lineEditIJFRE, min=0) validatorICLST = IntValidator(self.lineEditICLST, min=0) validatorIDEBT = DoubleValidator(self.lineEditIDEBT, min=0.) validatorIPOIT = DoubleValidator(self.lineEditIPOIT, min=0.) validatorIPOIT.setExclusiveMin(True) validatorIROPT = DoubleValidator(self.lineEditIROPT, min=0.) validatorIROPT.setExclusiveMin(True) validatorIRCOLM = DoubleValidator(self.lineEditIRCOLM, min=0.) validatorIUNO = DoubleValidator(self.lineEditIUNO) validatorIUPT = DoubleValidator(self.lineEditIUPT) validatorIVPT = DoubleValidator(self.lineEditIVPT) validatorIWPT = DoubleValidator(self.lineEditIWPT) validatorITPT = DoubleValidator(self.lineEditITPT) validatorICPT = DoubleValidator(self.lineEditICPT) validatorIEPSI = DoubleValidator(self.lineEditIEPSI) validatorIDPT = DoubleValidator(self.lineEditIDPT, min=0.) validatorIVDPT = DoubleValidator(self.lineEditIVDPT) validatorINUCHL = IntValidator(self.lineEditINUCHL, min=0) validatorIHPT = DoubleValidator(self.lineEditIHPT) self.lineEditIJNBP.setValidator(validatorIJNBP) self.lineEditIJFRE.setValidator(validatorIJFRE) self.lineEditICLST.setValidator(validatorICLST) self.lineEditIDEBT.setValidator(validatorIDEBT) self.lineEditIPOIT.setValidator(validatorIPOIT) self.lineEditIROPT.setValidator(validatorIROPT) self.lineEditIRCOLM.setValidator(validatorIRCOLM) self.lineEditIUNO.setValidator(validatorIUNO) self.lineEditIUPT.setValidator(validatorIUPT) self.lineEditIVPT.setValidator(validatorIVPT) self.lineEditIWPT.setValidator(validatorIWPT) self.lineEditITPT.setValidator(validatorITPT) self.lineEditICPT.setValidator(validatorICPT) self.lineEditIEPSI.setValidator(validatorIEPSI) self.lineEditIDPT.setValidator(validatorIDPT) self.lineEditIVDPT.setValidator(validatorIVDPT) self.lineEditINUCHL.setValidator(validatorINUCHL) self.lineEditIHPT.setValidator(validatorIHPT)
def __init__(self, parent): """ Constructor """ QWidget.__init__(self, parent) Ui_BoundaryConditionsNonCondensable.__init__(self) self.setupUi(self) # Connections self.comboBoxNonCondensable.activated[str].connect( self.__slotChoiceNonCondensable) self.__NonCondensablemodel = ComboModel(self.comboBoxNonCondensable, 1, 1) self.lineEditNonCondensable.textChanged[str].connect( self.__slotNonCondensable) validatorNonCond = DoubleValidator(self.lineEditNonCondensable, min=0.) validatorNonCond.setExclusiveMin(False) self.lineEditNonCondensable.setValidator(validatorNonCond)
def __init__(self, parent): """ Constructor """ QWidget.__init__(self, parent) Ui_BoundaryConditionsFraction.__init__(self) self.setupUi(self) self.__modelFraction = ComboModel(self.comboBoxFraction, 2, 1) self.__modelFraction.addItem(self.tr("Imposed value"), 'dirichlet') self.__modelFraction.addItem(self.tr("Automatic value"), 'automatic') # Connections self.lineEditFraction.textChanged[str].connect(self.__slotFraction) self.comboBoxFraction.activated[str].connect(self.__slotChoiceFraction) validatorFraction = DoubleValidator(self.lineEditFraction, min=0., max=1.) validatorFraction.setExclusiveMin(False) validatorFraction.setExclusiveMax(False) self.lineEditFraction.setValidator(validatorFraction)
def __init__(self, parent, case): """ Constructor """ QWidget.__init__(self, parent) Ui_GlobalNumericalParameters.__init__(self) self.setupUi(self) self.case = case self.case.undoStopGlobal() self.mdl = GlobalNumericalParametersModel(self.case) # Combo model self.modelVelocityAlgorithm = ComboModel( self.comboBoxVelocityAlgorithm, 3, 1) self.modelVelocityAlgorithm.addItem(self.tr("Standard"), "standard_difvit") self.modelVelocityAlgorithm.addItem(self.tr("Coupled"), "coupled_difvitc") self.modelVelocityAlgorithm.addItem( self.tr("Mean velocity - relative velocity"), "mean_velocity_relative_velocity") mfm = MainFieldsModel(self.case) if len(mfm.getFieldIdList()) < 2: self.modelVelocityAlgorithm.disableItem(2) else: self.modelVelocityAlgorithm.enableItem(2) # Validator validatorMaxRestart = IntValidator(self.lineEditMaxRestart, min=0) validatorSplitting = DoubleValidator(self.lineEditTimeSplitting, min=0.) validatorPRelax = DoubleValidator(self.lineEditPressureRelaxation, min=0.) validatorMinP = DoubleValidator(self.lineEditMinimumPressure) validatorMaxP = DoubleValidator(self.lineEditMaximumPressure) validatorMaxRestart.setExclusiveMin(False) validatorSplitting.setExclusiveMin(True) validatorPRelax.setExclusiveMin(True) self.lineEditMaxRestart.setValidator(validatorMaxRestart) self.lineEditTimeSplitting.setValidator(validatorSplitting) self.lineEditPressureRelaxation.setValidator(validatorPRelax) self.lineEditMinimumPressure.setValidator(validatorMinP) self.lineEditMaximumPressure.setValidator(validatorMaxP) # Connections self.checkBoxRestart.clicked.connect(self.slotRestart) self.checkBoxPotentialState.clicked.connect(self.slotPotentialState) self.checkBoxFacesReconstruction.clicked.connect( self.slotFacesReconstruction) self.checkBoxMultigrid.clicked.connect(self.slotMultigrid) self.lineEditMinimumPressure.textChanged[str].connect( self.slotMinimumPressure) self.lineEditMaximumPressure.textChanged[str].connect( self.slotMaximumPressure) self.pushButtonAdvanced.clicked.connect(self.slotAdvancedOptions) self.lineEditMaxRestart.textChanged[str].connect(self.slotMaxRestart) self.lineEditTimeSplitting.textChanged[str].connect( self.slotTimeSplitting) self.lineEditPressureRelaxation.textChanged[str].connect( self.slotPressureRelaxation) self.checkBoxUpwindAlphaEnergy.clicked.connect( self.slotUpwindAlphaEnergy) self.checkBoxStopRestart.clicked.connect(self.slotStopRestart) self.comboBoxVelocityAlgorithm.activated[str].connect( self.slotVelocityAlgorithm) self.checkBoxRegulBadCells.clicked.connect(self.slotRegulateBadCells) # Initialize widget status = self.mdl.getRestartTimeStep() if status == 'on': self.checkBoxRestart.setChecked(1) self.groupBoxRestartOption.show() value = self.mdl.getMaxNumberOfRestart() self.lineEditMaxRestart.setText(str(value)) value = self.mdl.getTimeSplit() self.lineEditTimeSplitting.setText(str(value)) value = self.mdl.getPressureRelaxation() self.lineEditPressureRelaxation.setText(str(value)) status = self.mdl.getUpwindScheme() if status == 'on': self.checkBoxUpwindAlphaEnergy.setChecked(True) else: self.checkBoxUpwindAlphaEnergy.setChecked(False) status = self.mdl.getStopNoConvergence() if status == 'on': self.checkBoxStopRestart.setChecked(True) else: self.checkBoxStopRestart.setChecked(False) else: self.checkBoxRestart.setChecked(0) self.groupBoxRestartOption.hide() is_compressible = False for fid in mfm.getFieldIdList(): if mfm.getCompressibleStatus(int(fid)) == 'on': is_compressible = True break if is_compressible: self.mdl.setPotentielState('off') self.checkBoxPotentialState.setChecked(0) self.checkBoxPotentialState.setEnabled(False) else: status = self.mdl.getPotentielState() if status == 'on': self.checkBoxPotentialState.setChecked(1) else: self.checkBoxPotentialState.setChecked(0) status = self.mdl.getFacesReconstruction() if status == 'on': self.checkBoxFacesReconstruction.setChecked(1) else: self.checkBoxFacesReconstruction.setChecked(0) status = self.mdl.getRegulateBadCElls() self.checkBoxRegulBadCells.setChecked(status == 'on') status = self.mdl.getMultigridStatus() if status == 'on': self.checkBoxMultigrid.setChecked(1) else: self.checkBoxMultigrid.setChecked(0) value = self.mdl.getMinPressure() self.lineEditMinimumPressure.setText(str(value)) value = self.mdl.getMaxPressure() self.lineEditMaximumPressure.setText(str(value)) model = self.mdl.getVelocityPredictorAlgo() self.modelVelocityAlgorithm.setItem(str_model=model) self.case.undoStartGlobal() predefined_flow = MainFieldsModel(self.case).getPredefinedFlow() if predefined_flow in ["free_surface", "droplet_flow", "multiregime"]: self.modelVelocityAlgorithm.setItem(str_model="coupled_difvitc") self.comboBoxVelocityAlgorithm.setEnabled(False) elif predefined_flow == "boiling_flow": self.modelVelocityAlgorithm.setItem( str_model="mean_velocity_relative_velocity") self.comboBoxVelocityAlgorithm.setEnabled(False)
def __init__(self, parent, case): """ Constructor """ QWidget.__init__(self, parent) Ui_Turbulence.__init__(self) self.setupUi(self) self.case = case self.case.undoStopGlobal() self.mdl = TurbulenceModel(self.case) # Dico self.dicoM2V = { "none": 'none', "mixing_length": 'mixing length', "k-epsilon": 'k-epsilon', "rij-epsilon_ssg": 'Rij-epsilon SSG', "rij-epsilon_ebrsm": 'Rij-epsilon EBRSM', "k-epsilon_linear_production": 'k-epsilon linear production', "les_smagorinsky": 'LES (Smagorinsky)', "les_wale": 'LES (WALE)', "tchen": 'Tchen', "q2-q12": 'Q2-Q12', "r2-q12": 'R2-Q12', "r2-r12-tchen": 'R2-R12 Tchen', "separate_phase": 'separate phase', "separate_phase_cond": 'separate phase cond', "small_inclusions": 'small inclusions', "large_inclusions": 'large inclusions', "sgdh": 'SGDH', "ggdh": 'GGDH' } self.dicoV2M = { "none": 'none', "mixing length": 'mixing_length', "k-epsilon": 'k-epsilon', "Rij-epsilon SSG": 'rij-epsilon_ssg', "Rij-epsilon EBRSM": 'rij-epsilon_ebrsm', "k-epsilon linear production": 'k-epsilon_linear_production', "LES (Smagorinsky)": 'les_smagorinsky', "LES (WALE)": 'les_wale', "Tchen": 'tchen', "Q2-Q12": 'q2-q12', "R2-Q12": 'r2-q12', "R2-R12 Tchen": 'r2-r12-tchen', "separate phase": 'separate_phase', "separate phase cond": 'separate_phase_cond', "small inclusions": 'small_inclusions', "large inclusions": 'large_inclusions', "SGDH": 'sgdh', "GGDH": 'ggdh' } # Validators validatorMix = DoubleValidator(self.lineEditMixingLength, min=0.0) validatorMix.setExclusiveMin(False) self.lineEditMixingLength.setValidator(validatorMix) self.tableModelTurbulence = StandardItemModelTurbulence( self.mdl, self.case, self.dicoM2V, self.dicoV2M) self.tableViewTurbulence.setModel(self.tableModelTurbulence) self.tableViewTurbulence.resizeColumnsToContents() self.tableViewTurbulence.resizeRowsToContents() if QT_API == "PYQT4": self.tableViewTurbulence.verticalHeader().setResizeMode( QHeaderView.ResizeToContents) self.tableViewTurbulence.horizontalHeader().setResizeMode( QHeaderView.ResizeToContents) self.tableViewTurbulence.horizontalHeader().setResizeMode( 0, QHeaderView.Stretch) elif QT_API == "PYQT5": self.tableViewTurbulence.verticalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) self.tableViewTurbulence.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) self.tableViewTurbulence.horizontalHeader().setSectionResizeMode( 0, QHeaderView.Stretch) self.tableViewTurbulence.setSelectionBehavior( QAbstractItemView.SelectRows) self.tableViewTurbulence.setSelectionMode( QAbstractItemView.SingleSelection) delegateTurbulence = TurbulenceDelegate(self.tableViewTurbulence, self.mdl, self.dicoM2V, self.dicoV2M) delegateTurbFlux = TurbFluxDelegate(self.tableViewTurbulence, self.mdl, self.dicoM2V, self.dicoV2M) delegateCoupling = CouplingDelegate(self.tableViewTurbulence, self.mdl, self.dicoM2V, self.dicoV2M) self.tableViewTurbulence.setItemDelegateForColumn( 2, delegateTurbulence) self.tableViewTurbulence.setItemDelegateForColumn(3, delegateTurbFlux) self.tableViewTurbulence.setItemDelegateForColumn(4, delegateCoupling) # Combo models self.modelContinuousCoupling = ComboModel( self.comboBoxContinuousCoupling, 1, 1) self.modelContinuousCoupling.addItem(self.tr('none'), 'none') if self.mdl.getHeatMassTransferStatus() == "off": self.modelContinuousCoupling.addItem(self.tr("separate phases"), "separate_phase") else: self.modelContinuousCoupling.addItem( self.tr("separate phases + cond"), "separate_phase_cond") # hide groupBoxMixingLength self.groupBoxMixingLength.hide() # Connect signals to slots self.tableModelTurbulence.dataChanged.connect(self.dataChanged) self.lineEditMixingLength.textChanged[str].connect( self.slotMixingLength) self.tableViewTurbulence.clicked.connect(self.slotChangeSelection) self.comboBoxContinuousCoupling.activated[str].connect( self.slotContinuousCoupling) # hide/show groupBoxContinuousCoupling if len(self.mdl.getContinuousFieldList()) >= 2: self.groupBoxContinuousCoupling.show() model = self.mdl.getContinuousCouplingModel() self.modelContinuousCoupling.setItem(str_model=model) else: self.groupBoxContinuousCoupling.hide() for fieldId in self.mdl.getFieldIdList(): self.tableModelTurbulence.newItem(fieldId) self.case.undoStartGlobal()
def createEditor(self, parent, option, index): editor = QLineEdit(parent) validator = DoubleValidator(editor, min=0.) validator.setExclusiveMin(True) editor.setValidator(validator) return editor
def __init__(self, parent, case): """ Constructor """ QWidget.__init__(self, parent) Ui_InterfacialArea.__init__(self) self.setupUi(self) self.case = case self.case.undoStopGlobal() self.mdl = InterfacialAreaModel(self.case) dispersed_fields = self.mdl.getDispersedFieldList( ) + InterfacialForcesModel(self.case).getGLIMfields() if dispersed_fields == []: self.groupBoxField.hide() self.groupBoxMinMaxDiameter.hide() self.groupBoxModel.hide() self.labelNoDispersedPhase.show() self.mdl.remove() return # Combo box models id_to_set = -1 self.modelField = ComboModel(self.comboBoxField, 1, 1) # For consistency with the previous pages, the second phase of the # Large Interface Model is set before the dispersed fields for fieldId in dispersed_fields: label = self.mdl.getLabel(fieldId) name = str(fieldId) self.modelField.addItem(self.tr(label), name) if len(dispersed_fields) > 0 and id_to_set == -1: id_to_set = dispersed_fields[0] self.modelField.setItem(str_model=id_to_set) # case no field self.currentid = id_to_set self.modelModel = ComboModel(self.comboBoxModel, 2, 1) self.modelModel.addItem(self.tr("constant"), "constant") self.modelModel.addItem(self.tr("interfacial area transport"), "interfacial_area_transport") self.modelSourceTerm = ComboModel(self.comboBoxSourceTerm, 4, 1) self.modelSourceTerm.addItem( self.tr("No coalescence, no fragmentation"), "no_coalescence_no_fragmentation") self.modelSourceTerm.addItem(self.tr("Yao & Morel"), "wei_yao") self.modelSourceTerm.addItem(self.tr("Kamp & Colin"), "kamp_colin") self.modelSourceTerm.addItem(self.tr("Ruyer & Seiler"), "ruyer_seiler") self.modelSourceTerm.disableItem(2) # Why ? # Validators validatorDefDiam = DoubleValidator(self.lineEditDefaultDiameter, min=0.0) validatorMinDiam = DoubleValidator(self.lineEditMinDiameter, min=0.0) validatorMaxDiam = DoubleValidator(self.lineEditMaxDiameter, min=0.0) validatorDefDiam.setExclusiveMin(True) validatorMinDiam.setExclusiveMin(True) validatorMaxDiam.setExclusiveMin(True) self.lineEditDefaultDiameter.setValidator(validatorDefDiam) self.lineEditMinDiameter.setValidator(validatorMinDiam) self.lineEditMaxDiameter.setValidator(validatorMaxDiam) # Connect signals to slots self.comboBoxField.activated[str].connect(self.slotField) self.comboBoxModel.activated[str].connect(self.slotModel) self.comboBoxSourceTerm.activated[str].connect(self.slotSourceTerm) self.lineEditDefaultDiameter.textChanged[str].connect( self.slotDefaultDiameter) self.lineEditMinDiameter.textChanged[str].connect(self.slotMinDiameter) self.lineEditMaxDiameter.textChanged[str].connect(self.slotMaxDiameter) # Initialize widget self.initializeVariables(self.currentid) self.case.undoStartGlobal()
def __init__(self, parent, case): """ Constructor """ QWidget.__init__(self, parent) Ui_Solid.__init__(self) self.setupUi(self) self.case = case self.case.undoStopGlobal() self.mdl = SolidModel(self.case) if self.mdl.getSolidFieldIdList() == []: self.groupBoxField.hide() self.groupBoxInteractions.hide() self.groupBoxGeneral.hide() self.labelNoParticles.show() return # Combo box models self.modelField = ComboModel(self.comboBoxField, 1, 1) for fieldId in self.mdl.getSolidFieldIdList(): label = self.mdl.getLabel(fieldId) name = str(fieldId) self.modelField.addItem(self.tr(label), name) self.currentid = -1 if len(self.mdl.getSolidFieldIdList()) > 0: self.currentid = self.mdl.getSolidFieldIdList()[0] self.modelField.setItem(str_model=self.currentid) self.modelFriction = ComboModel(self.comboBoxFriction, 3, 1) self.modelFriction.addItem(self.tr("none"), "none") self.modelFriction.addItem(self.tr("pressure"), "pressure") self.modelFriction.addItem(self.tr("fluxes"), "fluxes") self.modelGranular = ComboModel(self.comboBoxGranular, 3, 1) self.modelGranular.addItem(self.tr("none"), "none") self.modelGranular.addItem(self.tr("pressure"), "pressure") self.modelGranular.addItem(self.tr("fluxes"), "fluxes") self.modelKinetic = ComboModel(self.comboBoxKinetic, 3, 1) self.modelKinetic.addItem(self.tr("none"), "none") self.modelKinetic.addItem(self.tr("uncorrelated collision"), "uncorrelate_collision") self.modelKinetic.addItem(self.tr("correlated collision"), "correlate_collision") # Validators validatorComp = DoubleValidator(self.lineEditCompaction, min=0.0) validatorComp.setExclusiveMin(True) self.lineEditCompaction.setValidator(validatorComp) # Connect signals to slots self.comboBoxField.activated[str].connect(self.slotField) self.comboBoxFriction.activated[str].connect(self.slotFriction) self.comboBoxGranular.activated[str].connect(self.slotGranular) self.comboBoxKinetic.activated[str].connect(self.slotKinetic) self.lineEditCompaction.textChanged[str].connect(self.slotCompaction) self.checkBoxCoupling.clicked[bool].connect(self.slotCoupling) # Initialize widget self.initializeVariables(self.currentid) self.case.undoStartGlobal()
def __init__(self, parent, case): """ Constructor """ QWidget.__init__(self, parent) Ui_TimeStep.__init__(self) self.setupUi(self) self.case = case self.case.undoStopGlobal() self.mdl = TimeStepModel(self.case) # Combo box models self.modelTimeStepOption = ComboModel(self.comboBoxTimeStepOption, 3, 1) self.modelTimeStepOption.addItem(self.tr("Constant"), "constant") self.modelTimeStepOption.addItem(self.tr("Adaptive"), "uniform") self.modelTimeStepOption.addItem(self.tr("Steady"), "steady") self.modelTimeStop = ComboModel(self.comboBoxTimeStopType, 2, 1) self.modelTimeStop.addItem(self.tr("Number of time steps"), "iteration") self.modelTimeStop.addItem(self.tr("Time analysis (s)"), "time") # Validators validatorRefT = DoubleValidator(self.lineEditReferenceTimeStep, min = 0.0) validatorNumT = IntValidator(self.lineEditNumberTimeStep, min = 0) validatorAnaT = DoubleValidator(self.lineEditTimeAnalysis) validatorDtMin = DoubleValidator(self.lineEditDtMin, min = 0.0) validatorDtMax = DoubleValidator(self.lineEditDtMax, min = 0.0) validatorIncMax = DoubleValidator(self.lineEditDtIncreasingMax, min = 0.0) validatorDecMax = DoubleValidator(self.lineEditDtDecreasingMax, min = 0.0) validatorRefT.setExclusiveMin(True) validatorNumT.setExclusiveMin(True) validatorDtMin.setExclusiveMin(True) validatorDtMax.setExclusiveMin(True) validatorIncMax.setExclusiveMin(True) validatorDecMax.setExclusiveMin(True) self.lineEditReferenceTimeStep.setValidator(validatorRefT) self.lineEditNumberTimeStep.setValidator(validatorNumT) self.lineEditTimeAnalysis.setValidator(validatorAnaT) self.lineEditDtMin.setValidator(validatorDtMin) self.lineEditDtMax.setValidator(validatorDtMax) self.lineEditDtIncreasingMax.setValidator(validatorIncMax) self.lineEditDtDecreasingMax.setValidator(validatorDecMax) # tableViewCourantFourier self.tableModelCourantFourier = StandardItemModelCourantFourier(self.mdl) self.tableViewCourantFourier.setModel(self.tableModelCourantFourier) self.tableViewCourantFourier.resizeColumnsToContents() self.tableViewCourantFourier.resizeRowsToContents() if QT_API == "PYQT4": self.tableViewCourantFourier.verticalHeader().setResizeMode(QHeaderView.ResizeToContents) self.tableViewCourantFourier.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents) self.tableViewCourantFourier.horizontalHeader().setResizeMode(0,QHeaderView.Stretch) elif QT_API == "PYQT5": self.tableViewCourantFourier.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.tableViewCourantFourier.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.tableViewCourantFourier.horizontalHeader().setSectionResizeMode(0,QHeaderView.Stretch) self.tableViewCourantFourier.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableViewCourantFourier.setSelectionMode(QAbstractItemView.SingleSelection) delegateMaxFourier = ValueDelegate(self.tableViewCourantFourier) delegateMaxCourant = ValueDelegate(self.tableViewCourantFourier) self.tableViewCourantFourier.setItemDelegateForColumn(1, delegateMaxFourier) self.tableViewCourantFourier.setItemDelegateForColumn(2, delegateMaxCourant) # Connect signals to slots self.comboBoxTimeStepOption.activated[str].connect(self.slotTimeStepOption) self.comboBoxTimeStopType.activated[str].connect(self.slotTimeStop) self.lineEditReferenceTimeStep.textChanged[str].connect(self.slotReferenceTimeStep) self.lineEditNumberTimeStep.textChanged[str].connect(self.slotNumberTimeStep) self.lineEditTimeAnalysis.textChanged[str].connect(self.slotTimeAnalysis) self.lineEditDtMin.textChanged[str].connect(self.slotDtMin) self.lineEditDtMax.textChanged[str].connect(self.slotDtMax) self.lineEditDtIncreasingMax.textChanged[str].connect(self.slotDtIncreasingMax) self.lineEditDtDecreasingMax.textChanged[str].connect(self.slotDtDecreasingMax) self.tableModelCourantFourier.dataChanged.connect(self.dataChanged) # Initialize widget self.initializeVariables() self.case.undoStartGlobal()