本文整理汇总了Python中code_saturne.Base.QtPage.ComboModel.setItem方法的典型用法代码示例。如果您正苦于以下问题:Python ComboModel.setItem方法的具体用法?Python ComboModel.setItem怎么用?Python ComboModel.setItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code_saturne.Base.QtPage.ComboModel
的用法示例。
在下文中一共展示了ComboModel.setItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ParticleBoundaryInteractionDelegate
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class ParticleBoundaryInteractionDelegate(QItemDelegate):
"""
Use of a combo box in the table.
"""
def __init__(self, parent):
super(ParticleBoundaryInteractionDelegate, self).__init__(parent)
self.parent = parent
def createEditor(self, parent, option, index):
editor = QComboBox(parent)
self.combo_mdl = ComboModel(editor,1,1)
nature = index.model()._data[index.row()][1]
self.dico = index.model().dicoM2V[nature]
for k, v in list(self.dico.items()):
self.combo_mdl.addItem(v, k)
editor.installEventFilter(self)
editor.setMinimumWidth(100)
return editor
def setEditorData(self, comboBox, index):
row = index.row()
col = index.column()
str_model = index.model()._data[row][col]
self.combo_mdl.setItem(str_model=str_model)
def setModelData(self, comboBox, model, index):
txt = str(comboBox.currentText())
value = self.combo_mdl.dicoV2M[txt]
selectionModel = self.parent.selectionModel()
for idx in selectionModel.selectedIndexes():
if idx.column() == index.column():
model.setData(idx, to_qvariant(value), Qt.DisplayRole)
def tr(self, text):
return text
示例2: ThermalScalarView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class ThermalScalarView(QWidget, Ui_ThermalScalarForm):
"""
Class to open Thermal Scalar Transport Page.
"""
def __init__(self, parent, case, tree):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_ThermalScalarForm.__init__(self)
self.setupUi(self)
self.browser = tree
self.case = case
self.case.undoStopGlobal()
self.thermal = ThermalScalarModel(self.case)
# combo Model
self.modelThermal = ComboModel(self.comboBoxThermal, 4, 1)
self.modelThermal.addItem(self.tr("No thermal scalar"), 'off')
self.modelThermal.addItem(self.tr("Temperature (Celsius)"), 'temperature_celsius')
self.modelThermal.addItem(self.tr("Temperature (Kelvin)"), 'temperature_kelvin')
self.modelThermal.addItem(self.tr("Enthalpy (J/kg)"), 'enthalpy')
self.modelThermal.addItem(self.tr("Potential temperature"), 'potential_temperature')
self.modelThermal.addItem(self.tr("Liquid potential temperature"), 'liquid_potential_temperature')
self.modelThermal.addItem(self.tr("Total energy (J/kg)"), 'total_energy')
self.connect(self.comboBoxThermal, SIGNAL("activated(const QString&)"), self.slotThermalScalar)
# Update the thermal scalar list with the calculation features
for sca in self.thermal.thermalModel:
if sca not in self.thermal.thermalScalarModelsList():
self.modelThermal.disableItem(str_model=sca)
if ElectricalModel(self.case).getElectricalModel() != 'off':
self.comboBoxThermal.setEnabled(False)
if CoalCombustionModel(self.case).getCoalCombustionModel() != 'off':
self.comboBoxThermal.setEnabled(False)
if GasCombustionModel(self.case).getGasCombustionModel() != 'off':
self.comboBoxThermal.setEnabled(False)
if CompressibleModel(self.case).getCompressibleModel() != 'off':
self.comboBoxThermal.setEnabled(False)
else:
self.modelThermal.delItem(6)
if AtmosphericFlowsModel(self.case).getAtmosphericFlowsModel() != 'off':
self.comboBoxThermal.setEnabled(False)
else:
self.modelThermal.delItem(5)
self.modelThermal.delItem(4)
# Select the thermal scalar model
model = self.thermal.getThermalScalarModel()
self.modelThermal.setItem(str_model=model)
self.case.undoStartGlobal()
@pyqtSignature("const QString &")
def slotThermalScalar(self, text):
"""
Update the thermal scalar markup.
"""
th = self.modelThermal.dicoV2M[str(text)]
self.thermal.setThermalModel(th)
self.browser.configureTree(self.case)
def tr(self, text):
"""
Translation
"""
return text
示例3: BoundaryConditionsMobileMeshView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
#.........这里部分代码省略.........
self.__model = MobileMeshModel(self.__case)
self.__comboModel = ComboModel(self.comboMobilBoundary, 6, 1)
self.__comboModel.addItem(self.tr("Fixed boundary"), "fixed_boundary")
self.__comboModel.addItem(self.tr("Sliding boundary"), "sliding_boundary")
self.__comboModel.addItem(self.tr("Internal coupling"), "internal_coupling")
self.__comboModel.addItem(self.tr("External coupling"), "external_coupling")
self.__comboModel.addItem(self.tr("Fixed velocity"), "fixed_velocity")
self.__comboModel.addItem(self.tr("Fixed displacement"), "fixed_displacement")
self.connect(self.comboMobilBoundary,
SIGNAL("activated(const QString&)"),
self.__slotCombo)
self.connect(self.pushButtonMobilBoundary,
SIGNAL("clicked(bool)"),
self.__slotFormula)
self.__case.undoStartGlobal()
@pyqtSignature("const QString&")
def __slotFormula(self, text):
"""
Run formula editor.
"""
exp = self.__boundary.getFormula()
aleChoice = self.__boundary.getALEChoice();
if aleChoice == "fixed_velocity":
if not exp:
exp = 'mesh_velocity_U ='
req = [('mesh_velocity_U', 'Fixed velocity of the mesh'),
('mesh_velocity_V', 'Fixed velocity of the mesh'),
('mesh_velocity_W', 'Fixed velocity of the mesh')]
exa = 'mesh_velocity_U = 1000;\nmesh_velocity_V = 1000;\nmesh_velocity_W = 1000;'
elif aleChoice == "fixed_displacement":
if not exp:
exp = 'mesh_x ='
req = [('mesh_x', 'Fixed displacement of the mesh'),
('mesh_y', 'Fixed displacement of the mesh'),
('mesh_z', 'Fixed displacement of the mesh')]
exa = 'mesh_x = 1000;\nmesh_y = 1000;\nmesh_z = 1000;'
symbs = [('dt', 'time step'),
('t', 'current time'),
('iter', 'number of iteration')]
dialog = QMeiEditorView(self,
check_syntax = self.__case['package'].get_check_syntax(),
expression = exp,
required = req,
symbols = symbs,
examples = exa)
if dialog.exec_():
result = dialog.get_result()
log.debug("slotFormulaMobileMeshBoundary -> %s" % str(result))
self.__boundary.setFormula(result)
setGreenColor(self.pushButtonMobilBoundary, False)
@pyqtSignature("const QString&")
def __slotCombo(self, text):
"""
Called when the combobox changed.
"""
modelData = self.__comboModel.dicoV2M[str(text)]
# Enable/disable formula button.
isFormulaEnabled = modelData in ["fixed_velocity", "fixed_displacement"]
self.pushButtonMobilBoundary.setEnabled(isFormulaEnabled)
setGreenColor(self.pushButtonMobilBoundary, isFormulaEnabled)
self.__boundary.setALEChoice(modelData)
def showWidget(self, b):
"""
Show the widget
"""
if self.__model.getMethod() != "off":
self.__boundary = Boundary("mobile_boundary", b.getLabel(), self.__case)
modelData = self.__boundary.getALEChoice()
self.__comboModel.setItem(str_model=modelData)
isFormulaEnabled = modelData in ["fixed_velocity", "fixed_displacement"]
self.pushButtonMobilBoundary.setEnabled(isFormulaEnabled)
self.show()
else:
self.hideWidget()
def hideWidget(self):
"""
Hide all
"""
self.hide()
def tr(self, text):
"""
Translation
"""
return text
示例4: InitializationView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class InitializationView(QWidget, Ui_InitializationForm):
"""
"""
def __init__(self, parent, case, stbar):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_InitializationForm.__init__(self)
self.setupUi(self)
self.case = case
self.parent = parent
self.case.undoStopGlobal()
self.init = InitializationModel(self.case)
self.turb = TurbulenceModel(self.case)
self.therm = ThermalScalarModel(self.case)
self.th_sca = DefineUserScalarsModel(self.case)
self.comp = CompressibleModel(self.case)
self.volzone = LocalizationModel('VolumicZone', self.case)
# create group to control hide/show options
self.turb_group = [self.labelTurbulence, self.pushButtonTurbulence,
self.comboBoxTurbulence]
self.thermal_group = [self.labelThermal, self.pushButtonThermal]
self.species_group = [self.labelSpecies, self.comboBoxSpecies, self.pushButtonSpecies]
self.meteo_group = [self.labelMeteo, self.comboBoxMeteo, self.pushButtonMeteo]
self.thermodynamic_list = ['Pressure', 'Density', 'Temperature', 'Energy']
# 1/ Combo box models
self.modelZone = ComboModel(self.comboBoxZone, 1, 1)
if self.comp.getCompressibleModel() != 'off':
self.groupBoxThermodynamic.show()
else:
self.groupBoxThermodynamic.hide()
self.zone = ""
zones = self.volzone.getZones()
for zone in zones:
if zone.getNature()['initialization'] == "on":
label = zone.getLabel()
name = str(zone.getCodeNumber())
self.modelZone.addItem(self.tr(label), name)
if label == "all_cells":
self.zone = name
if not self.zone:
self.zone = name
self.modelZone.setItem(str_model = self.zone)
self.modelTurbulence = ComboModel(self.comboBoxTurbulence, 2, 1)
self.modelTurbulence.addItem(self.tr("Initialization by formula"), 'formula')
self.modelTurbulence.addItem(self.tr("Initialization by reference value(s)"), 'reference_value')
# 2/ Connections
self.connect(self.comboBoxZone, SIGNAL("activated(const QString&)"), self.slotZone)
self.connect(self.comboBoxTurbulence, SIGNAL("activated(const QString&)"), self.slotChoice)
self.connect(self.comboBoxSpecies, SIGNAL("activated(const QString&)"), self.slotSpeciesChoice)
self.connect(self.comboBoxMeteo, SIGNAL("activated(const QString&)"), self.slotMeteoChoice)
self.connect(self.checkBoxPressure, SIGNAL("clicked()"), self.slotPressure)
self.connect(self.checkBoxDensity, SIGNAL("clicked()"), self.slotDensity)
self.connect(self.checkBoxTemperature, SIGNAL("clicked()"), self.slotTemperature)
self.connect(self.checkBoxEnergy, SIGNAL("clicked()"), self.slotEnergy)
self.connect(self.pushButtonVelocity, SIGNAL("clicked()"), self.slotVelocityFormula)
self.connect(self.pushButtonThermal, SIGNAL("clicked()"), self.slotThermalFormula)
self.connect(self.pushButtonTurbulence, SIGNAL("clicked()"), self.slotTurbulenceFormula)
self.connect(self.pushButtonSpecies, SIGNAL("clicked()"), self.slotSpeciesFormula)
self.connect(self.pushButtonMeteo, SIGNAL("clicked()"), self.slotMeteoFormula)
self.connect(self.pushButtonPressure, SIGNAL("clicked()"), self.slotPressureFormula)
self.connect(self.pushButtonDensity, SIGNAL("clicked()"), self.slotDensityFormula)
self.connect(self.pushButtonTemperature,SIGNAL("clicked()"), self.slotTemperatureFormula)
self.connect(self.pushButtonEnergy, SIGNAL("clicked()"), self.slotEnergyFormula)
self.connect(self.pushButtonPressure_2, SIGNAL("clicked()"), self.slotPressureFormula)
choice = self.init.getInitialTurbulenceChoice(self.zone)
self.modelTurbulence.setItem(str_model = choice)
# species treatment
self.modelSpecies = ComboModel(self.comboBoxSpecies, 1, 1)
self.scalar = ""
scalar_list = self.th_sca.getUserScalarNameList()
for s in self.th_sca.getScalarsVarianceList():
if s in scalar_list: scalar_list.remove(s)
if scalar_list != []:
self.scalar = scalar_list[0]
for item in self.species_group:
item.show()
for scalar in scalar_list:
self.modelSpecies.addItem(self.tr(scalar), scalar)
self.modelSpecies.setItem(str_model = self.scalar)
setGreenColor(self.pushButtonSpecies, True)
else:
for item in self.species_group:
item.hide()
#.........这里部分代码省略.........
示例5: SolutionVerifView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class SolutionVerifView(QWidget, Ui_SolutionVerifForm):
"""
"""
def __init__(self, parent, case):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_SolutionVerifForm.__init__(self)
self.setupUi(self)
self.parent = parent
self.case = case
self.case.undoStopGlobal()
self.mdl = SolutionDomainModel(self.case)
self.out = OutputControlModel(self.case)
self.case2 = Case(package = self.case['package'], file_name = None)
XMLinit(self.case2).initialize()
self.case2['xmlfile'] = 'cs_cmd'
self.case2['salome'] = self.case['salome']
self.node_domain = self.case.xmlGetNode('solution_domain')
faces_cutting = self.node_domain.xmlGetNode('faces_cutting')
joining = self.node_domain.xmlGetNode('joining')
periodicity = self.node_domain.xmlGetNode('periodicity')
sd_node = self.case2.xmlGetNode('solution_domain')
if faces_cutting != None:
if (faces_cutting)['status'] == 'on':
sd_node.xmlInitNode('faces_cutting',
status='on').xmlChildsCopy(faces_cutting)
if joining != None:
sd_node.xmlInitNode('joining').xmlChildsCopy(joining)
if periodicity != None:
sd_node.xmlInitNode('periodicity').xmlChildsCopy(periodicity)
self.out2 = OutputControlModel(self.case2)
# combo models
self.modelFMTCHR = ComboModel(self.comboBoxFMTCHR, 3, 1)
self.modelFormat = ComboModel(self.comboBoxFormat, 2, 1)
self.modelPolygon = ComboModel(self.comboBoxPolygon, 3, 1)
self.modelPolyhedra = ComboModel(self.comboBoxPolyhedra, 3, 1)
self.modelFMTCHR.addItem(self.tr("EnSight Gold"), 'ensight')
self.modelFMTCHR.addItem(self.tr("MED"), 'med')
self.modelFMTCHR.addItem(self.tr("CGNS"), 'cgns')
self.modelFMTCHR.addItem(self.tr("Catalyst"), 'catalyst')
self.modelFMTCHR.addItem(self.tr("CCM-IO"), 'ccm')
import cs_config
cfg = cs_config.config()
if cfg.libs['med'].have == "no":
self.comboBoxFMTCHR.setItemData(1, QColor(Qt.red), Qt.TextColorRole);
if cfg.libs['cgns'].have == "no":
self.comboBoxFMTCHR.setItemData(2, QColor(Qt.red), Qt.TextColorRole);
if cfg.libs['catalyst'].have == "no":
self.comboBoxFMTCHR.setItemData(3, QColor(Qt.red), Qt.TextColorRole);
if cfg.libs['ccm'].have == "no":
self.comboBoxFMTCHR.setItemData(4, QColor(Qt.red), Qt.TextColorRole);
self.modelFormat.addItem(self.tr("binary"), 'binary')
self.modelFormat.addItem(self.tr("text"), 'text')
self.modelPolygon.addItem(self.tr("display"), 'display')
self.modelPolygon.addItem(self.tr("discard"), 'discard_polygons')
self.modelPolygon.addItem(self.tr("subdivide"), 'divide_polygons')
self.modelPolyhedra.addItem(self.tr("display"), 'display')
self.modelPolyhedra.addItem(self.tr("discard"), 'discard_polyhedra')
self.modelPolyhedra.addItem(self.tr("subdivide"), 'divide_polyhedra')
# connections
self.connect(self.comboBoxFMTCHR, SIGNAL("activated(const QString&)"), self.slotOutputFormat)
self.connect(self.comboBoxFormat, SIGNAL("activated(const QString&)"), self.slotOutputOptions)
self.connect(self.comboBoxPolygon, SIGNAL("activated(const QString&)"), self.slotOutputOptions)
self.connect(self.comboBoxPolyhedra, SIGNAL("activated(const QString&)"), self.slotOutputOptions)
self.connect(self.checkBoxBigEndian, SIGNAL("clicked()"), self.slotOutputOptions)
self.connect(self.toolButtonBatch, SIGNAL("clicked()"), self.slotMeshChecking)
# INITIALISATIONS
# 1 - Values of post processing's format
fmt = self.out.getWriterFormat("-1")
self.modelFMTCHR.setItem(str_model=fmt)
line = self.out.getWriterOptions("-1")
self.__updateOptionsFormat(line)
if not (self.mdl.getMeshList() or self.mdl.getMeshInput()):
self.toolButtonBatch.setEnabled(False)
self.case.undoStartGlobal()
@pyqtSignature("const QString &")
def slotOutputFormat(self, text):
#.........这里部分代码省略.........
示例6: SourceTermsView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class SourceTermsView(QWidget, Ui_SourceTermsForm):
"""
"""
def __init__(self, parent, case, stbar):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_SourceTermsForm.__init__(self)
self.setupUi(self)
self.case = case
self.case.undoStopGlobal()
self.parent = parent
self.mdl = SourceTermsModel(self.case)
self.therm = ThermalScalarModel(self.case)
self.th_sca = DefineUserScalarsModel(self.case)
self.volzone = LocalizationModel('VolumicZone', self.case)
self.m_out = OutputVolumicVariablesModel(self.case)
# 0/ Read label names from XML file
# Velocity
# Thermal scalar
namesca, unit = self.getThermalLabelAndUnit()
self.th_sca_name = namesca
# 1/ Combo box models
self.modelSpecies = ComboModel(self.comboBoxSpecies, 1, 1)
self.modelZone = ComboModel(self.comboBoxZone, 1, 1)
self.zone = ""
zones = self.volzone.getZones()
for zone in zones:
active = 0
if (zone.getNature()['momentum_source_term'] == "on"):
active = 1
if ('thermal_source_term' in zone.getNature().keys()):
if (zone.getNature()['thermal_source_term'] == "on"):
active = 1
if ('scalar_source_term' in zone.getNature().keys()):
if (zone.getNature()['scalar_source_term'] == "on"):
active = 1
if (active):
label = zone.getLabel()
name = str(zone.getCodeNumber())
self.modelZone.addItem(self.tr(label), name)
if label == "all_cells":
self.zone = name
if not self.zone:
self.zone = name
self.modelZone.setItem(str_model = self.zone)
# 2/ Connections
self.connect(self.comboBoxZone, SIGNAL("activated(const QString&)"), self.slotZone)
self.connect(self.comboBoxSpecies, SIGNAL("activated(const QString&)"), self.slotSpeciesChoice)
self.connect(self.pushButtonMomentum, SIGNAL("clicked()"), self.slotMomentumFormula)
self.connect(self.pushButtonThermal, SIGNAL("clicked()"), self.slotThermalFormula)
self.connect(self.pushButtonSpecies, SIGNAL("clicked()"), self.slotSpeciesFormula)
# 3/ Initialize widget
self.initialize(self.zone)
self.case.undoStartGlobal()
def initialize(self, zone_num):
"""
Initialize widget when a new volumic zone is choosen
"""
zone = self.case.xmlGetNode("zone", id=zone_num)
if zone['momentum_source_term'] == "on":
self.labelMomentum.show()
self.pushButtonMomentum.show()
setGreenColor(self.pushButtonMomentum, True)
else:
self.labelMomentum.hide()
self.pushButtonMomentum.hide()
if zone['thermal_source_term'] == "on":
self.pushButtonThermal.show()
self.labelThermal.show()
setGreenColor(self.pushButtonThermal, True)
else:
self.pushButtonThermal.hide()
self.labelThermal.hide()
if zone['scalar_source_term'] == "on":
self.comboBoxSpecies.show()
self.pushButtonSpecies.show()
self.labelSpecies.show()
#.........这里部分代码省略.........
示例7: FluidCharacteristicsView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
#.........这里部分代码省略.........
self.modelDiff.addItem(self.tr('constant'), 'constant')
self.modelDiff.addItem(self.tr('variable'), 'variable')
self.modelViscv0.addItem(self.tr('constant'), 'constant')
self.modelViscv0.addItem(self.tr('variable'), 'variable')
self.modelViscv0.addItem(self.tr('thermal law'), 'thermal_law')
self.modelDiftl0.addItem(self.tr('constant'), 'constant')
self.modelDiftl0.addItem(self.tr('variable'), 'variable')
self.modelDiftl0.addItem(self.tr('thermal law'), 'thermal_law')
self.modelPhas.addItem(self.tr('liquid'), 'liquid')
self.modelPhas.addItem(self.tr('gas'), 'gas')
if (self.freesteam == 0 and EOS == 0) or \
self.m_th.getThermalScalarModel() == "off" or \
mdl_joule != 'off' or mdl_comp != 'off':
self.groupBoxTableChoice.hide()
else:
self.groupBoxTableChoice.show()
self.lineEditReference.setEnabled(False)
# suppress perfect gas
self.modelMaterial.addItem(self.tr('user material'), 'user_material')
tmp = ["Argon", "Nitrogen", "Hydrogen", "Oxygen", "Helium", "Air"]
if EOS == 1:
fls = self.ava.whichFluids()
for fli in fls:
if fli not in tmp:
tmp.append(fli)
self.modelMaterial.addItem(self.tr(fli), fli)
if self.freesteam == 1 and EOS == 0:
self.modelMaterial.addItem(self.tr('Water'), 'Water')
material = self.mdl.getMaterials()
self.modelMaterial.setItem(str_model=material)
self.updateMethod()
self.scalar = ""
scalar_list = self.m_sca.getUserScalarNameList()
for s in self.m_sca.getScalarsVarianceList():
if s in scalar_list: scalar_list.remove(s)
if scalar_list != []:
self.scalar = scalar_list[0]
for scalar in scalar_list:
self.modelNameDiff.addItem(scalar)
# Connections
self.connect(self.comboBoxRho, SIGNAL("activated(const QString&)"), self.slotStateRho)
self.connect(self.comboBoxMu, SIGNAL("activated(const QString&)"), self.slotStateMu)
self.connect(self.comboBoxCp, SIGNAL("activated(const QString&)"), self.slotStateCp)
self.connect(self.comboBoxAl, SIGNAL("activated(const QString&)"), self.slotStateAl)
self.connect(self.comboBoxDiff, SIGNAL("activated(const QString&)"), self.slotStateDiff)
self.connect(self.comboBoxNameDiff, SIGNAL("activated(const QString&)"), self.slotNameDiff)
self.connect(self.comboBoxViscv0, SIGNAL("activated(const QString&)"), self.slotStateViscv0)
self.connect(self.comboBoxMaterial, SIGNAL("activated(const QString&)"), self.slotMaterial)
self.connect(self.comboBoxMethod, SIGNAL("activated(const QString&)"), self.slotMethod)
self.connect(self.comboBoxPhas, SIGNAL("activated(const QString&)"), self.slotPhas)
self.connect(self.lineEditRho, SIGNAL("textChanged(const QString &)"), self.slotRho)
self.connect(self.lineEditMu, SIGNAL("textChanged(const QString &)"), self.slotMu)
self.connect(self.lineEditCp, SIGNAL("textChanged(const QString &)"), self.slotCp)
self.connect(self.lineEditAl, SIGNAL("textChanged(const QString &)"), self.slotAl)
self.connect(self.lineEditDiff, SIGNAL("textChanged(const QString &)"), self.slotDiff)
self.connect(self.lineEditDiftl0, SIGNAL("textChanged(const QString &)"), self.slotDiftl0)
self.connect(self.lineEditViscv0, SIGNAL("textChanged(const QString &)"), self.slotViscv0)
self.connect(self.pushButtonRho, SIGNAL("clicked()"), self.slotFormulaRho)
示例8: BoundaryConditionsElectricalView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class BoundaryConditionsElectricalView(QWidget, Ui_BoundaryConditionsElectricalForm):
"""
Boundary condifition for the velocity part
"""
def __init__(self, parent):
"""
Constructor.
"""
QWidget.__init__(self, parent)
Ui_BoundaryConditionsElectricalForm.__init__(self)
self.setupUi(self)
def setup(self, case):
"""
Setup the widget.
"""
self.__case = case
self.__boundary = None
self.__model = ElectricalModel(self.__case)
self.species_list = []
self.connect(self.lineEditValuePotElec, SIGNAL("textChanged(const QString &)"), self.slotPotElec)
self.connect(self.lineEditValuePotElecIm, SIGNAL("textChanged(const QString &)"), self.slotPotElecIm)
self.connect(self.lineEditValueSpecies, SIGNAL("textChanged(const QString &)"), self.slotSpecies)
self.connect(self.pushButtonPotVectorFormula, SIGNAL("clicked()"), self.slotPotVectorFormula)
self.connect(self.comboBoxTypePotElec, SIGNAL("activated(const QString&)"), self.slotPotElecChoice)
self.connect(self.comboBoxTypePotElecIm, SIGNAL("activated(const QString&)"), self.slotPotElecImChoice)
self.connect(self.comboBoxTypePotVector, SIGNAL("activated(const QString&)"), self.slotPotVectorChoice)
self.connect(self.comboBoxSpecies, SIGNAL("activated(const QString&)"), self.slotSpeciesChoice)
self.connect(self.comboBoxPotVector, SIGNAL("activated(const QString&)"), self.slotPotVectorComponentChoice)
## Validators
validatorPotElec = DoubleValidator(self.lineEditValuePotElec)
validatorPotElecIm = DoubleValidator(self.lineEditValuePotElecIm)
validatorSpecies = DoubleValidator(self.lineEditValueSpecies, min=0.)
self.lineEditValuePotElec.setValidator(validatorPotElec)
self.lineEditValuePotElecIm.setValidator(validatorPotElecIm)
self.lineEditValueSpecies.setValidator(validatorSpecies)
def __setBoundary(self, boundary):
"""
Set the current boundary
"""
self.__boundary = boundary
self.nature = boundary.getNature()
self.groupBoxPotElecIm.hide()
self.groupBoxPotVector.hide()
self.groupBoxMixture.hide()
self.modelPotElec = ComboModel(self.comboBoxTypePotElec, 1, 1)
self.modelPotElecIm = ComboModel(self.comboBoxTypePotElecIm, 1, 1)
self.modelPotVector = ComboModel(self.comboBoxTypePotVector, 1, 1)
self.modelPotElec.addItem(self.tr("Prescribed value"), 'dirichlet')
self.modelPotElec.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
self.modelPotElec.addItem(self.tr("Prescribed flux"), 'neumann')
self.modelPotElec.addItem(self.tr("Prescribed flux (user law)"), 'neumann_formula')
if self.__model.getScaling() == 'on':
self.modelPotElec.addItem(self.tr("Implicit value (dpot)"), 'dirichlet_implicit')
#TODO
self.modelPotElec.disableItem(1)
self.modelPotElec.disableItem(3)
self.potElec = "elec_pot_r"
self.modelPotElecLabel = ComboModel(self.comboBoxPotElec,1,1)
self.modelPotElecLabel.addItem(self.tr(self.potElec),self.potElec)
self.modelPotElecLabel.setItem(str_model = self.potElec)
self.modelPotElecIm.addItem(self.tr("Prescribed value"), 'dirichlet')
self.modelPotElecIm.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
self.modelPotElecIm.addItem(self.tr("Prescribed flux"), 'neumann')
self.modelPotElecIm.addItem(self.tr("Prescribed flux (user law)"), 'neumann_formula')
#TODO
self.modelPotElecIm.disableItem(1)
self.modelPotElecIm.disableItem(3)
self.potElecIm = 'elec_pot_i'
self.modelPotElecImLabel = ComboModel(self.comboBoxPotElecIm,1,1)
self.modelPotElecImLabel.addItem(self.tr(self.potElecIm),self.potElecIm)
self.modelPotElecImLabel.setItem(str_model = self.potElecIm)
self.modelPotVector.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
self.modelPotVector.addItem(self.tr("Null flux"), 'neumann')
self.modelPotVector.addItem(self.tr("Implicit flux"), 'neumann_implicit')
self.modelPotVector.disableItem(0)
self.potVect = 'vec_potential_01'
self.modelPotVectLabel = ComboModel(self.comboBoxPotVector, 3, 1)
self.modelPotVectLabel.addItem(self.tr('vec_potential_01'), 'vec_potential_01')
self.modelPotVectLabel.addItem(self.tr('vec_potential_02'), 'vec_potential_02')
self.modelPotVectLabel.addItem(self.tr('vec_potential_03'), 'vec_potential_03')
self.modelPotVectLabel.setItem(str_model = self.potVect)
#.........这里部分代码省略.........
示例9: BatchRunningView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
#.........这里部分代码省略.........
self.slotJobThreads)
self.connect(self.spinBoxDays, SIGNAL("valueChanged(int)"),
self.slotJobWallTime)
self.connect(self.spinBoxHours, SIGNAL("valueChanged(int)"),
self.slotJobWallTime)
self.connect(self.spinBoxMinutes, SIGNAL("valueChanged(int)"),
self.slotJobWallTime)
self.connect(self.spinBoxSeconds, SIGNAL("valueChanged(int)"),
self.slotJobWallTime)
self.connect(self.comboBoxClass, SIGNAL("activated(const QString&)"),
self.slotClass)
self.connect(self.lineEditJobAccount, SIGNAL("textChanged(const QString &)"),
self.slotJobAccount)
self.connect(self.lineEditJobWCKey, SIGNAL("textChanged(const QString &)"),
self.slotJobWCKey)
else:
self.connect(self.spinBoxNProcs, SIGNAL("valueChanged(int)"), self.slotNProcs)
self.connect(self.spinBoxNThreads, SIGNAL("valueChanged(int)"), self.slotNThreads)
self.connect(self.toolButtonSearchBatch, SIGNAL("clicked()"), self.slotSearchBatchFile)
self.connect(self.comboBoxRunType, SIGNAL("activated(const QString&)"), self.slotArgRunType)
self.connect(self.toolButtonAdvanced, SIGNAL("clicked()"), self.slotAdvancedOptions)
self.connect(self.pushButtonRunSubmit, SIGNAL("clicked()"), self.slotBatchRunning)
# Combomodels
self.modelArg_cs_verif = ComboModel(self.comboBoxRunType, 2, 1)
self.modelArg_cs_verif.addItem(self.tr("Import mesh only"), 'none')
self.modelArg_cs_verif.addItem(self.tr("Mesh preprocessing"), 'mesh preprocess')
self.modelArg_cs_verif.addItem(self.tr("Mesh quality criteria"), 'mesh quality')
self.modelArg_cs_verif.addItem(self.tr("Standard"), 'standard')
self.modelArg_cs_verif.setItem(str_model=self.mdl.getRunType())
# initialize Widgets
# Check if the script file name is already defined
if self.case['runcase']:
name = os.path.basename(self.case['runcase'].path)
self.labelBatchName.setText(str(name))
setGreenColor(self.toolButtonSearchBatch, False)
else:
setGreenColor(self.toolButtonSearchBatch, True)
if self.case['batch_type'] != None and self.case['runcase']:
self.displayBatchInfo()
# Script info is based on the XML model
self.displayScriptInfo()
self.case.undoStartGlobal()
@pyqtSignature("const QString &")
def slotJobName(self, v):
"""
Increment, decrement and colorize the input argument entry
"""
if self.lineEditJobName.validator().state == QValidator.Acceptable:
self.jmdl.dictValues['job_name'] = str(v)
self.jmdl.updateBatchFile('job_name')
示例10: TurboMachineryView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class TurboMachineryView(QWidget, Ui_TurboMachineryForm):
"""
"""
def __init__(self, parent, case):
"""
Constructor.
"""
QWidget.__init__(self, parent)
Ui_TurboMachineryForm.__init__(self)
self.setupUi(self)
self.case = case
self.case.undoStopGlobal()
self.mdl = TurboMachineryModel(self.case)
# Combo model
self.modelTurboMachineryType = ComboModel(self.comboBoxTurboMachineryType, 3, 1)
self.modelTurboMachineryType.addItem(self.tr("None"), "off")
self.modelTurboMachineryType.addItem(self.tr("Full transient simulation"), "transient")
self.modelTurboMachineryType.addItem(self.tr("Frozen rotor model"), "frozen")
# Set up validators
self.lineEditDX.setValidator(DoubleValidator(self.lineEditDX))
self.lineEditDY.setValidator(DoubleValidator(self.lineEditDY))
self.lineEditDZ.setValidator(DoubleValidator(self.lineEditDZ))
self.lineEditX1.setValidator(DoubleValidator(self.lineEditX1))
self.lineEditY1.setValidator(DoubleValidator(self.lineEditY1))
self.lineEditZ1.setValidator(DoubleValidator(self.lineEditZ1))
# tableView TurboMachinery
self.rotorModel = StandardItemModelRotor(self.mdl)
self.tableViewTurboMachinery.setModel(self.rotorModel)
self.tableViewTurboMachinery.resizeColumnsToContents()
self.tableViewTurboMachinery.resizeRowsToContents()
self.tableViewTurboMachinery.setAlternatingRowColors(True)
self.tableViewTurboMachinery.setSelectionBehavior(QAbstractItemView.SelectRows)
delegateVelocity = VelocityDelegate(self.tableViewTurboMachinery)
self.tableViewTurboMachinery.setItemDelegateForColumn(0, delegateVelocity)
delegateSelector = LineEditDelegateSelector(self.tableViewTurboMachinery)
self.tableViewTurboMachinery.setItemDelegateForColumn(1, delegateSelector)
self.tableViewTurboMachinery.resizeColumnsToContents()
self.tableViewTurboMachinery.resizeRowsToContents()
self.tableViewTurboMachinery.horizontalHeader().setResizeMode(1,QHeaderView.Stretch)
# Faces to join selection (Custom Widgets)
model = StandardItemModelFaces(self, self.mdl, 'face_joining')
self.widgetFacesJoin.modelFaces = model
self.widgetFacesJoin.tableView.setModel(model)
# Connections
self.connect(self.comboBoxTurboMachineryType, SIGNAL("activated(const QString&)"), self.slotTurboModel)
self.connect(self.rotorModel , SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), self.dataChanged)
self.connect(self.tableViewTurboMachinery , SIGNAL("clicked(const QModelIndex &)"), self.slotChangeSelection)
self.connect(self.pushButtonAdd, SIGNAL("clicked()"), self.slotAddRotor)
self.connect(self.pushButtonDelete, SIGNAL("clicked()"), self.slotDeleteRotor)
self.connect(self.lineEditDX, SIGNAL("textChanged(const QString &)"), self.slotRotationX)
self.connect(self.lineEditDY, SIGNAL("textChanged(const QString &)"), self.slotRotationY)
self.connect(self.lineEditDZ, SIGNAL("textChanged(const QString &)"), self.slotRotationZ)
self.connect(self.lineEditX1, SIGNAL("textChanged(const QString &)"), self.slotCenterRotationX1)
self.connect(self.lineEditY1, SIGNAL("textChanged(const QString &)"), self.slotCenterRotationY1)
self.connect(self.lineEditZ1, SIGNAL("textChanged(const QString &)"), self.slotCenterRotationZ1)
if self.mdl.getRotorList() != None:
for i in range(len(self.mdl.getRotorList())):
self.rotorModel.addItem(i)
# Initialize widget
self.updateView()
self.case.undoStartGlobal()
def __setValuesRotation(self):
"""
Put values found in xml file as soon as mode is "rotation"
"""
rotor_id = self.tableViewTurboMachinery.currentIndex().row()
rx, ry, rz = self.mdl.getRotationDirection(rotor_id)
px, py, pz = self.mdl.getRotationCenter(rotor_id)
self.lineEditDX.setText(str(rx))
self.lineEditDY.setText(str(ry))
self.lineEditDZ.setText(str(rz))
self.lineEditX1.setText(str(px))
self.lineEditY1.setText(str(py))
self.lineEditZ1.setText(str(pz))
def updateView(self):
"""
Update view
"""
mdl = self.mdl.getTurboMachineryModel()
self.modelTurboMachineryType.setItem(str_model = mdl)
#.........这里部分代码省略.........
示例11: TimeAveragesView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
#.........这里部分代码省略.........
"""
if self.sender().validator().state == QValidator.Acceptable:
start = from_qvariant(text, float)
timestart = start
else:
timestart = self.mdl.defaultValues()['timestart']
self.mdl.setTimeStart(self.label_select, timestart)
self.updateView()
@pyqtSignature("const QString&")
def slotRestartChoice(self, text):
choice = self.modelIMOOLD.dicoV2M[str(text)]
if choice == "automatic":
restart = -2
self.lineEditRestart.setDisabled(True)
self.lineEditRestart.setText(str(restart))
elif choice == "reset":
restart = -1
self.lineEditRestart.setDisabled(True)
self.lineEditRestart.setText(str(restart))
elif choice == "specified":
restart = self.mdl.defaultValues()['restart']
self.lineEditRestart.setDisabled(False)
self.lineEditRestart.setText(str(restart))
if self.label_select:
self.mdl.setRestart(self.label_select, restart)
self.updateView()
@pyqtSignature("const QString&")
def slotTimeChoice(self, text):
choice = self.modelStartType.dicoV2M[str(text)]
self.modelStartType.setItem(str_model=choice)
if choice == "time":
start = -1
self.mdl.setTimeStepStart(self.label_select, start)
timestart = self.mdl.getTimeStart(self.label_select)
self.lineEditStart.setText(str(start))
self.lineEditStartTime.setText(str(timestart))
self.lineEditStart.hide()
self.labelStart.hide()
self.lineEditStartTime.show()
self.labelStartTime.show()
elif choice == "iteration":
timestart = -1.
self.mdl.setTimeStart(self.label_select, timestart)
start = self.mdl.getTimeStepStart(self.label_select)
self.lineEditStart.setText(str(start))
self.lineEditStartTime.setText(str(timestart))
self.lineEditStart.show()
self.labelStart.show()
self.lineEditStartTime.hide()
self.labelStartTime.hide()
self.updateView()
@pyqtSignature("const QString&")
def slotRestart(self, text):
"""
Return an integer for imoold, value of restart of calculation.
"""
if self.sender().validator().state == QValidator.Acceptable:
restart = from_qvariant(text, int)
else:
restart = self.mdl.defaultValues()['restart']
if self.label_select:
示例12: ThermalRadiationAdvancedDialogView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class ThermalRadiationAdvancedDialogView(QDialog, Ui_ThermalRadiationAdvancedDialogForm):
"""
Building of popup window for advanced options.
"""
def __init__(self, parent, case, default):
"""
Constructor
"""
QDialog.__init__(self, parent)
Ui_ThermalRadiationAdvancedDialogForm.__init__(self)
self.setupUi(self)
self.case = case
self.case.undoStopGlobal()
self.setWindowTitle(self.tr("Advanced options"))
self.default = default
self.result = self.default.copy()
# Combo models
self.modelTSRay = ComboModel(self.comboBoxTSRay, 3, 1)
self.modelPrintT = ComboModel(self.comboBoxPrintT, 3, 1)
self.modelPrintL = ComboModel(self.comboBoxPrintL, 3, 1)
self.modelTSRay.addItem('0', '0')
self.modelTSRay.addItem('1', '1')
self.modelTSRay.addItem('2', '2')
self.modelPrintT.addItem('0', '0')
self.modelPrintT.addItem('1', '1')
self.modelPrintT.addItem('2', '2')
self.modelPrintL.addItem('0', '0')
self.modelPrintL.addItem('1', '1')
self.modelPrintL.addItem('2', '2')
self.frequ = self.default['frequency']
self.tsr = self.default['idiver']
self.printTemp = self.default['tempP']
self.printLum = self.default['intensity']
model = self.default['model']
# Initialization
self.lineEditFreq.setText(str(self.frequ))
self.modelTSRay.setItem(str_model=str(self.tsr))
self.modelPrintT.setItem(str_model=str(self.printTemp))
self.modelPrintL.setItem(str_model=str(self.printLum))
if model == 'dom':
self.labelPrintL.show()
self.comboBoxPrintL.show()
else:
self.labelPrintL.hide()
self.comboBoxPrintL.hide()
# Validator
validatorFreq = IntValidator(self.lineEditFreq, min=1)
self.lineEditFreq.setValidator(validatorFreq)
self.case.undoStartGlobal()
def accept(self):
"""
What to do when user clicks on 'OK'.
"""
if self.lineEditFreq.validator().state == QValidator.Acceptable:
self.result['frequency'] = from_qvariant(self.lineEditFreq.text(), int)
self.result['idiver'] = from_qvariant(self.comboBoxTSRay.currentText(), int)
self.result['tempP'] = from_qvariant(self.comboBoxPrintT.currentText(), int)
self.result['intensity'] = from_qvariant(self.comboBoxPrintL.currentText(), int)
QDialog.accept(self)
def reject(self):
"""
Method called when 'Cancel' button is clicked.
"""
QDialog.reject(self)
def get_result(self):
"""
Method to get the result.
"""
return self.result
def tr(self, text):
"""
Translation.
"""
return text
示例13: ThermalRadiationView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class ThermalRadiationView(QWidget, Ui_ThermalRadiationForm):
"""
Class to open Thermal Scalar Transport Page.
"""
def __init__(self, parent, case, tree):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_ThermalRadiationForm.__init__(self)
self.setupUi(self)
self.browser = tree
self.case = case
self.case.undoStopGlobal()
self.mdl = ThermalRadiationModel(self.case)
# Combo models
self.modelRadModel = ComboModel(self.comboBoxRadModel, 3, 1)
self.modelDirection = ComboModel(self.comboBoxQuadrature, 8, 1)
self.modelAbsorption = ComboModel(self.comboBoxAbsorption, 3, 1)
self.modelRadModel.addItem("No radiative transfers", 'off')
self.modelRadModel.addItem("Discrete ordinates method", 'dom')
self.modelRadModel.addItem("P-1 Model", 'p-1')
self.modelDirection.addItem("24 directions (S4)", "1")
self.modelDirection.addItem("48 directions (S6)", "2")
self.modelDirection.addItem("80 directions (S8)", "3")
self.modelDirection.addItem("32 directions (T2)", "4")
self.modelDirection.addItem("128 directions (T4)", "5")
self.modelDirection.addItem("8n^2 directions (Tn)", "6")
self.modelDirection.addItem("120 directions (LC11)", "7")
self.modelDirection.addItem("48 directions (DCT020-2468)", "8")
# Connections
self.connect(self.comboBoxRadModel,
SIGNAL("activated(const QString&)"),
self.slotRadiativeTransfer)
self.connect(self.radioButtonOn,
SIGNAL("clicked()"),
self.slotStartRestart)
self.connect(self.radioButtonOff,
SIGNAL("clicked()"),
self.slotStartRestart)
self.connect(self.comboBoxQuadrature,
SIGNAL("activated(const QString&)"),
self.slotDirection)
self.connect(self.lineEditNdirec,
SIGNAL("textChanged(const QString &)"),
self.slotNdirec)
self.connect(self.comboBoxAbsorption,
SIGNAL("activated(const QString&)"),
self.slotTypeCoefficient)
self.connect(self.lineEditCoeff,
SIGNAL("textChanged(const QString &)"),
self.slotAbsorptionCoefficient)
self.connect(self.toolButtonAdvanced,
SIGNAL("clicked()"),
self.slotAdvancedOptions)
# Validator
validatorCoeff = DoubleValidator(self.lineEditCoeff, min=0.0)
self.lineEditCoeff.setValidator(validatorCoeff)
validatorNdir = IntValidator(self.lineEditNdirec, min=3)
self.lineEditNdirec.setValidator(validatorNdir)
self.modelAbsorption.addItem('constant', 'constant')
self.modelAbsorption.addItem('user subroutine (usray3)', 'variable')
self.modelAbsorption.addItem('user law', 'formula')
self.modelAbsorption.addItem('H2O and CO2 mixing (Modak)', 'modak')
from code_saturne.Pages.CoalCombustionModel import CoalCombustionModel
if CoalCombustionModel(self.case).getCoalCombustionModel() != "off":
self.modelAbsorption.disableItem(str_model='variable')
self.modelAbsorption.enableItem(str_model='modak')
else:
self.modelAbsorption.disableItem(str_model='modak')
self.modelAbsorption.enableItem(str_model='variable')
del CoalCombustionModel
self.modelAbsorption.disableItem(str_model='formula')
# Initialization
self.modelRadModel.setItem(str_model=self.mdl.getRadiativeModel())
self.slotRadiativeTransfer()
if self.mdl.getRestart() == 'on':
self.radioButtonOn.setChecked(True)
self.radioButtonOff.setChecked(False)
else:
self.radioButtonOn.setChecked(False)
self.radioButtonOff.setChecked(True)
#.........这里部分代码省略.........
示例14: PorosityView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
class PorosityView(QWidget, Ui_PorosityForm):
def __init__(self, parent, case):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_PorosityForm.__init__(self)
self.setupUi(self)
self.case = case
self.case.undoStopGlobal()
self.mdl = PorosityModel(self.case)
# Create the Page layout.
# Model and QTreeView for Head Losses
self.modelPorosity = StandardItemModelPorosity()
self.treeView.setModel(self.modelPorosity)
# Combo model
self.modelPorosityType = ComboModel(self.comboBoxType, 2, 1)
self.modelPorosityType.addItem(self.tr("isotropic"), 'isotropic')
self.modelPorosityType.addItem(self.tr("anisotropic"), 'anisotropic')
# Connections
self.connect(self.treeView, SIGNAL("clicked(const QModelIndex &)"), self.slotSelectPorosityZones)
self.connect(self.comboBoxType, SIGNAL("activated(const QString&)"), self.slotPorosity)
self.connect(self.pushButtonPorosity, SIGNAL("clicked()"), self.slotFormulaPorosity)
# Initialize Widgets
self.entriesNumber = -1
d = self.mdl.getNameAndLocalizationZone()
liste=[]
liste=list(d.items())
t=[]
for t in liste :
NamLoc=t[1]
Lab=t[0 ]
self.modelPorosity.insertItem(Lab, NamLoc[0],NamLoc[1])
self.forgetStandardWindows()
self.case.undoStartGlobal()
@pyqtSignature("const QModelIndex&")
def slotSelectPorosityZones(self, index):
label, name, local = self.modelPorosity.getItem(index.row())
if hasattr(self, "modelScalars"): del self.modelScalars
log.debug("slotSelectPorosityZones label %s " % label )
self.groupBoxType.show()
self.groupBoxDef.show()
choice = self.mdl.getPorosityModel(name)
self.modelPorosityType.setItem(str_model=choice)
setGreenColor(self.pushButtonPorosity, True)
self.entriesNumber = index.row()
def forgetStandardWindows(self):
"""
For forget standard windows
"""
self.groupBoxType.hide()
self.groupBoxDef.hide()
@pyqtSignature("const QString &")
def slotPorosity(self, text):
"""
Method to call 'getState' with correct arguements for 'rho'
"""
label, name, local = self.modelPorosity.getItem(self.entriesNumber)
choice = self.modelPorosityType.dicoV2M[str(text)]
self.mdl.setPorosityModel(name, choice)
@pyqtSignature("")
def slotFormulaPorosity(self):
"""
User formula for density
"""
label, name, local = self.modelPorosity.getItem(self.entriesNumber)
exp = self.mdl.getPorosityFormula(name)
choice = self.mdl.getPorosityModel(name)
if exp == None:
exp = self.getDefaultPorosityFormula(choice)
if choice == "isotropic":
req = [('porosity', 'Porosity')]
#.........这里部分代码省略.........
示例15: BoundaryConditionsCoalInletView
# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import setItem [as 别名]
#.........这里部分代码省略.........
self.lineEditDirectionZ.setValidator(validatorZ)
self.lineEditTemperature.setValidator(validatorTemp)
self.connect(self.pushButtonVelocityFormula,
SIGNAL("clicked()"),
self.__slotVelocityFormula)
self.connect(self.pushButtonDirectionFormula,
SIGNAL("clicked()"),
self.__slotDirectionFormula)
# Useful information about coals, classes, and ratios
mdl = CoalCombustion.CoalCombustionModel(self.__case)
if mdl.getCoalCombustionModel() != "off":
self.__coalNumber = mdl.getCoalNumber()
self.__coalClassesNumber = []
for coal in range(0, self.__coalNumber):
self.__coalClassesNumber.append(mdl.getClassNumber(str(coal+1)))
self.__maxOxydantNumber = mdl.getOxidantNumber()
else:
self.__coalNumber = 0
self.__coalClassesNumber = [0]
self.__maxOxydantNumber = 1
self.__ratio = self.__coalNumber*[0]
for i in range(0, self.__coalNumber):
self.__ratio[i] = self.__coalClassesNumber[i]*[0]
# Coal table
self.__modelCoal = StandardItemModelCoal(self.__case)
self.tableViewCoal.setModel(self.__modelCoal)
delegateValue = ValueDelegate(self.tableViewCoal)
self.tableViewCoal.setItemDelegateForColumn(1, delegateValue)
self.tableViewCoal.setItemDelegateForColumn(2, delegateValue)
# Coal mass ratio table
self.__modelCoalMass = StandardItemModelCoalMass(self.__case,
self.__coalNumber,
self.__coalClassesNumber)
self.tableViewCoalMass.setModel(self.__modelCoalMass)
delegateValueMass = ValueDelegate(self.tableViewCoalMass)
for c in range(self.__modelCoalMass.columnCount()):
self.tableViewCoalMass.setItemDelegateForColumn(c, delegateValueMass)
self.__case.undoStartGlobal()
def showWidget(self, b):
"""
Show the widget
"""
label = b.getLabel()
self.__boundary = Boundary('coal_inlet', label, self.__case)
# Initialize velocity
choice = self.__boundary.getVelocityChoice()
self.modelVelocity.setItem(str_model=choice)
self.__updateLabel()
if choice[-7:] == "formula":
self.pushButtonVelocityFormula.setEnabled(True)
self.lineEditVelocity.setEnabled(False)
else: