当前位置: 首页>>代码示例>>Python>>正文


Python ComboModel.addItem方法代码示例

本文整理汇总了Python中code_saturne.Base.QtPage.ComboModel.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python ComboModel.addItem方法的具体用法?Python ComboModel.addItem怎么用?Python ComboModel.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在code_saturne.Base.QtPage.ComboModel的用法示例。


在下文中一共展示了ComboModel.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ParticleBoundaryInteractionDelegate

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:41,代码来源:LagrangianBoundariesView.py

示例2: VarianceDelegate

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]
class VarianceDelegate(QItemDelegate):
    """
    Use of a combo box in the table.
    """
    def __init__(self, parent):
        super(VarianceDelegate, self).__init__(parent)
        self.parent   = parent


    def createEditor(self, parent, option, index):
        editor = QComboBox(parent)
        self.modelCombo = ComboModel(editor, 1, 1)
        editor.installEventFilter(self)
        return editor


    def setEditorData(self, editor, index):
        l1 = index.model().mdl.getScalarNameList()
        for label in index.model().mdl.getThermalScalarName():
            l1.append(label)
        for s in index.model().mdl.getScalarsVarianceList():
            if s in l1: l1.remove(s)

        for s in l1:
            self.modelCombo.addItem(s, s)


    def setModelData(self, comboBox, model, index):
        txt = str(comboBox.currentText())
        value = self.modelCombo.dicoV2M[txt]
        model.setData(index, to_qvariant(value), Qt.DisplayRole)


    def tr(self, text):
        """
        Translation
        """
        return text
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:40,代码来源:DefineUserScalarsView.py

示例3: GGDHDelegate

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]
class GGDHDelegate(QItemDelegate):
    """
    Use of a combo box in the table.
    """
    def __init__(self, parent, case):
        super(GGDHDelegate, self).__init__(parent)
        self.parent   = parent
        self.case     = case


    def createEditor(self, parent, option, index):
        editor = QComboBox(parent)
        self.modelCombo = ComboModel(editor, 1, 1)
        editor.installEventFilter(self)
        return editor


    def setEditorData(self, editor, index):

        self.modelCombo.addItem(self.tr("SGDH"), "SGDH")
        if TurbulenceModel(self.case).getTurbulenceModel() == "Rij-epsilon" or \
           TurbulenceModel(self.case).getTurbulenceModel() == "Rij-SSG" or \
           TurbulenceModel(self.case).getTurbulenceModel() == "Rij-EBRSM":
            self.modelCombo.addItem(self.tr("GGDH"), "GGDH")
            self.modelCombo.addItem(self.tr("AFM"), "AFM")
            self.modelCombo.addItem(self.tr("DFM"), "DFM")


    def setModelData(self, comboBox, model, index):
        txt = str(comboBox.currentText())
        value = self.modelCombo.dicoV2M[txt]
        model.setData(index, to_qvariant(value), Qt.DisplayRole)


    def tr(self, text):
        """
        Translation
        """
        return text
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:41,代码来源:DefineUserScalarsView.py

示例4: ThermalRadiationView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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)
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:ThermalRadiationView.py

示例5: BoundaryConditionsMobileMeshView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]
class BoundaryConditionsMobileMeshView(QWidget, Ui_BoundaryConditionsMobileMeshForm):
    """
    Boundary condifition for mobil mesh (ALE and/or Fluid-interaction)
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsMobileMeshForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        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
        """
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:BoundaryConditionsMobileMeshView.py

示例6: SolutionVerifView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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):
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:SolutionVerifView.py

示例7: InitializationView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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()

#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:InitializationView.py

示例8: FluidCharacteristicsView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]

#.........这里部分代码省略.........
        self.list_scalars = []
        self.m_th = ThermalScalarModel(self.case)
        s = self.m_th.getThermalScalarName()
        mdl = self.m_th.getThermalScalarModel()

        if mdl == "temperature_celsius":
            self.list_scalars.append((s, self.tr("Thermal scalar: temperature (C)")))
        elif mdl == "temperature_kelvin":
            self.list_scalars.append((s, self.tr("Thermal scalar: temperature (K)")))
        elif mdl != "off":
            self.list_scalars.append((s, self.tr("Thermal scalar")))

        self.m_sca = DefineUserScalarsModel(self.case)
        for s in self.m_sca.getUserScalarNameList():
            self.list_scalars.append((s, self.tr("Additional scalar")))

        # Particular Widget initialization taking into account of "Calculation Features"
        mdl_atmo, mdl_joule, mdl_thermal, mdl_gas, mdl_coal, mdl_comp = self.mdl.getThermoPhysicalModel()

        # Combo models

        self.modelRho      = ComboModel(self.comboBoxRho, 3, 1)
        self.modelMu       = ComboModel(self.comboBoxMu, 3, 1)
        self.modelCp       = ComboModel(self.comboBoxCp, 3, 1)
        self.modelAl       = ComboModel(self.comboBoxAl, 3, 1)
        self.modelDiff     = ComboModel(self.comboBoxDiff, 2, 1)
        self.modelNameDiff = ComboModel(self.comboBoxNameDiff,1,1)
        self.modelViscv0   = ComboModel(self.comboBoxViscv0, 3, 1)
        self.modelDiftl0   = ComboModel(self.comboBoxDiftl0, 3, 1)
        self.modelMaterial = ComboModel(self.comboBoxMaterial, 1, 1)
        self.modelMethod   = ComboModel(self.comboBoxMethod, 1, 1)
        self.modelPhas     = ComboModel(self.comboBoxPhas, 2, 1)

        self.modelRho.addItem(self.tr('constant'), 'constant')
        self.modelRho.addItem(self.tr('variable'), 'variable')
        self.modelRho.addItem(self.tr('thermal law'), 'thermal_law')
        if mdl_atmo != 'off':
            self.modelRho.addItem(self.tr('defined in atphyv'), 'variable')
        elif mdl_joule == 'arc':
            self.modelRho.addItem(self.tr('defined in elphyv'), 'variable')

        self.modelMu.addItem(self.tr('constant'), 'constant')
        self.modelMu.addItem(self.tr('variable'), 'variable')
        self.modelMu.addItem(self.tr('thermal law'), 'thermal_law')
        if mdl_joule == 'arc':
            self.modelMu.addItem(self.tr('defined in elphyv'), 'variable')

        self.modelCp.addItem(self.tr('constant'), 'constant')
        self.modelCp.addItem(self.tr('variable'), 'variable')
        self.modelCp.addItem(self.tr('thermal law'), 'thermal_law')
        if mdl_joule == 'arc':
            self.modelCp.addItem(self.tr('defined in elphyv'), 'variable')

        self.modelAl.addItem(self.tr('constant'), 'constant')
        self.modelAl.addItem(self.tr('variable'), 'variable')
        self.modelAl.addItem(self.tr('thermal law'), 'thermal_law')
        if mdl_joule == 'arc':
            self.modelAl.addItem(self.tr('defined in elphyv'), 'variable')

        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')
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:69,代码来源:FluidCharacteristicsView.py

示例9: SourceTermsView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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()
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:SourceTermsView.py

示例10: BatchRunningView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]

#.........这里部分代码省略.........
                         self.slotJobPpn)
            self.connect(self.spinBoxProcs, SIGNAL("valueChanged(int)"),
                         self.slotJobProcs)
            self.connect(self.spinBoxThreads, SIGNAL("valueChanged(int)"),
                         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:
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:70,代码来源:BatchRunningView.py

示例11: BoundaryConditionsElectricalView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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)
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:BoundaryConditionsElectricalView.py

示例12: TimeAveragesView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]
class TimeAveragesView(QWidget, Ui_TimeAveragesForm):
    """
    """
    def __init__(self, parent, case, stbar):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_TimeAveragesForm.__init__(self)
        self.setupUi(self)

        self.case = case
        self.case.undoStopGlobal()
        self.mdl = TimeAveragesModel(self.case)
        self.entriesNumber = 0

        self.label_select = None

        # Create the Page layout.

        # Models
        self.modelAverage = StandardItemModelAverage(self)
        self.treeViewAverage.setModel(self.modelAverage)
        self.treeViewAverage.resizeColumnToContents(0)
        self.treeViewAverage.resizeColumnToContents(1)
        self.treeViewAverage.resizeColumnToContents(2)
        self.treeViewAverage.resizeColumnToContents(3)
        self.treeViewAverage.resizeColumnToContents(4)

        self.modelDrag = QStringListModel()
        self.modelDrop = QStringListModel()
        self.listViewDrag.setModel(self.modelDrag)
        self.listViewDrop.setModel(self.modelDrop)
        self.listViewDrag.setAlternatingRowColors(True)
        self.listViewDrag.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.listViewDrop.setAlternatingRowColors(True)
        self.listViewDrop.setEditTriggers(QAbstractItemView.NoEditTriggers)

        self.modelIMOOLD  = ComboModel(self.comboBoxIMOOLD, 3, 1)
        self.modelIMOOLD.addItem(self.tr('automatic'), 'automatic')
        self.modelIMOOLD.addItem(self.tr('reset'), 'reset')
        self.modelIMOOLD.addItem(self.tr('specified'), 'specified')

        self.modelStartType  = ComboModel(self.comboBoxStartType, 2, 1)
        self.modelStartType.addItem(self.tr('time'), 'time')
        self.modelStartType.addItem(self.tr('iteration'), 'iteration')

        # Connections
        self.connect(self.pushButtonAdd,         SIGNAL("clicked()"),                    self.slotAddAverage)
        self.connect(self.pushButtonDelete,      SIGNAL("clicked()"),                    self.slotdeleteTimeAverage)
        self.connect(self.pushButtonAddVar,      SIGNAL("clicked()"),                    self.slotAddVarAverage)
        self.connect(self.pushButtonSuppressVar, SIGNAL("clicked()"),                    self.slotDeleteVarAverage)
        self.connect(self.treeViewAverage,       SIGNAL("pressed(const QModelIndex &)"), self.slotSelectAverage)
        self.connect(self.lineEditStart,         SIGNAL("textChanged(const QString &)"), self.slotStart)
        self.connect(self.lineEditStartTime,     SIGNAL("textChanged(const QString &)"), self.slotStartTime)
        self.connect(self.comboBoxIMOOLD,        SIGNAL("activated(const QString&)"),    self.slotRestartChoice)
        self.connect(self.comboBoxStartType,     SIGNAL("activated(const QString&)"),    self.slotTimeChoice)
        self.connect(self.lineEditRestart,       SIGNAL("textChanged(const QString &)"), self.slotRestart)
        self.connect(self.lineEditAverage,       SIGNAL("textChanged(const QString &)"), self.slotBaseName)

        # Validators
        validatorStart = IntValidator(self.lineEditStart, min=-1)
        self.lineEditStart.setValidator(validatorStart)

        validatorStartTime = DoubleValidator(self.lineEditStartTime, min=-1.)
        self.lineEditStartTime.setValidator(validatorStartTime)

        validatorRestart = IntValidator(self.lineEditRestart, min=-2, max=50)
        validatorRestart.setExclusiveValues([0])
        self.lineEditRestart.setValidator(validatorRestart)

        rx = "[\-_A-Za-z0-9]{1," + str(LABEL_LENGTH_MAX) + "}"
        validatorLabel =  RegExpValidator(self.lineEditAverage, QRegExp(rx))
        self.lineEditAverage.setValidator(validatorLabel)

        # Initialize

        # Update list of variables, properties, scalars ...

        lst_label = [str(label) for label in list(self.mdl.dicoLabel2Name.keys())]

        self.modelDrag.setStringList(sorted(lst_label, key=str.lower))

        # Is it a following calculation ?

        if not StartRestartModel(self.case).getRestartPath():
            self.labelRestart.setDisabled(True)
            self.comboBoxIMOOLD.setDisabled(True)
            self.lineEditRestart.setDisabled(True)
            self.treeViewAverage.hideColumn(4)
        else:
            self.slotRestartChoice("automatic")

        # Update list of averages for view from xml file

        for nb in range(self.mdl.getNumberOfTimeAverage()):
            self.entriesNumber = self.entriesNumber + 1
            label, start, timestart, restart, lst = self.mdl.getTimeAverageData(nb+1)
            self.insertAverage(label, start, timestart, restart, lst)
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:TimeAveragesView.py

示例13: TurboMachineryView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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)
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:TurboMachineryView.py

示例14: ThermalRadiationAdvancedDialogView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [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
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:100,代码来源:ThermalRadiationView.py

示例15: BoundaryConditionsCoalInletView

# 需要导入模块: from code_saturne.Base.QtPage import ComboModel [as 别名]
# 或者: from code_saturne.Base.QtPage.ComboModel import addItem [as 别名]
class BoundaryConditionsCoalInletView(QWidget, Ui_BoundaryConditionsCoalInletForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsCoalInletForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Connections
        self.connect(self.comboBoxTypeInlet,
                     SIGNAL("activated(const QString&)"),
                     self.__slotInletType)
        self.connect(self.comboBoxVelocity,
                     SIGNAL("activated(const QString&)"),
                     self.__slotChoiceVelocity)
        self.connect(self.lineEditVelocity,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotVelocityValue)
        self.connect(self.lineEditTemperature,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotTemperature)
        self.connect(self.spinBoxOxydantNumber,
                     SIGNAL("valueChanged(int)"),
                     self.__slotOxydantNumber)

        self.connect(self.comboBoxDirection,
                     SIGNAL("activated(const QString&)"),
                     self.__slotChoiceDirection)
        self.connect(self.lineEditDirectionX,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirX)
        self.connect(self.lineEditDirectionY,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirY)
        self.connect(self.lineEditDirectionZ,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirZ)

        # Combo models
        self.modelTypeInlet = ComboModel(self.comboBoxTypeInlet, 2, 1)
        self.modelTypeInlet.addItem(self.tr("only oxydant"), 'oxydantFlow')
        self.modelTypeInlet.addItem(self.tr("oxydant and coal"), 'coalFlow')

        self.modelVelocity = ComboModel(self.comboBoxVelocity, 4, 1)
        self.modelVelocity.addItem(self.tr("norm"), 'norm')
        self.modelVelocity.addItem(self.tr("mass flow rate"), 'flow1')
        self.modelVelocity.addItem(self.tr("norm (user law)"), 'norm_formula')
        self.modelVelocity.addItem(self.tr("mass flow rate (user law)"), 'flow1_formula')

        self.modelDirection = ComboModel(self.comboBoxDirection, 3, 1)
        self.modelDirection.addItem(self.tr("normal to the inlet"), 'normal')
        self.modelDirection.addItem(self.tr("specified coordinates"), 'coordinates')
        self.modelDirection.addItem(self.tr("user profile"), 'formula')

        # Validators
        validatorVelocity = DoubleValidator(self.lineEditVelocity)
        validatorX = DoubleValidator(self.lineEditDirectionX)
        validatorY = DoubleValidator(self.lineEditDirectionY)
        validatorZ = DoubleValidator(self.lineEditDirectionZ)
        validatorTemp = DoubleValidator(self.lineEditTemperature, min=0.)

        # Apply validators
        self.lineEditVelocity.setValidator(validatorVelocity)
        self.lineEditDirectionX.setValidator(validatorX)
        self.lineEditDirectionY.setValidator(validatorY)
        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
#.........这里部分代码省略.........
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:103,代码来源:BoundaryConditionsCoalInletView.py


注:本文中的code_saturne.Base.QtPage.ComboModel.addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。