def setData(self, index, value, role):
        #
        if index.column() == 0:
            self.dataVolumicNames[index.row()][index.column()] = \
                        str(from_qvariant(value, to_text_string))
            vname = self.dataVolumicNames[index.row()][0]

        elif index.column() == 1:
            labelv = str(from_qvariant(value, to_text_string))
            self.dataVolumicNames[index.row()][index.column()] = labelv
            name = self.dataVolumicNames[index.row()][0]

        elif index.column() == 2:
            v = from_qvariant(value, int)
            if v == Qt.Unchecked:
                status = "off"
                self.dataVolumicNames[index.row()][index.column()] = "off"
            else:
                status = "on"
                self.dataVolumicNames[index.row()][index.column()] = "on"

            vname = self.dataVolumicNames[index.row()][0]
            self.model.setPostprocessingVolStatusFromName(vname, status)

        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        return True
    def setData(self, index, value, role):
        if not index.isValid():
            return Qt.ItemIsEnabled

        # Update the row in the table
        row = index.row()
        col = index.column()

        # Label
        if col == 0:
            old_pname = self._data[row][col]
            new_pname = str(from_qvariant(value, to_text_string))
            self._data[row][col] = new_pname
            self.mdl.renameScalarLabel(old_pname, new_pname)


        # Variance
        elif col == 1:
            variance = str(from_qvariant(value, to_text_string))
            self._data[row][col] = variance
            [name, var] = self._data[row]
            self.mdl.setScalarVariance(name,var)

        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        return True
    def setData(self, index, value, role):
        row = index.row()
        col = index.column()

        [old_label, old_code, old_nature, old_local] = self._data[row]

        old_zone = Zone(self.zoneType,
                        case         = self.case,
                        label        = old_label,
                        codeNumber   = old_code,
                        localization = old_local,
                        nature       = old_nature)

        new_label  = old_label
        new_code   = old_code
        new_nature = old_nature
        new_local  = old_local

        if col == 0:
            new_label = from_qvariant(value, to_text_string)
            self._data[row][col] = new_label

        elif col == 1:
            new_code = from_qvariant(value, int)
            self._data[row][col] = new_code

        elif col == 2:

            if self.zoneType == "VolumicZone":
                # We modify the dictionary here
                nature_list = str(from_qvariant(value, to_text_string)).split(";")

                for key in list(self._data[row][col].keys()):
                    if key in nature_list:
                        self._data[row][col][key] = "on"
                    else:
                        self._data[row][col][key] = "off"

                    new_nature = self._data[row][col].copy()

            elif self.zoneType == "BoundaryZone":
                new_nature = str(from_qvariant(value, to_text_string))
                self._data[row][col] = new_nature

        elif col == 3:
            new_local = str(from_qvariant(value, to_text_string))
            self._data[row][col] = new_local

        new_zone = Zone(self.zoneType,
                        case         = self.case,
                        label        = new_label,
                        codeNumber   = new_code,
                        localization = new_local,
                        nature       = new_nature)

        self.mdl.replaceZone(old_zone, new_zone)

        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        self.browser.configureTree(self.case)
        return True
 def setModelData(self, editor, model, index):
     if editor.validator().state == QValidator.Acceptable:
         if index.column() == 3:
             value = from_qvariant(editor.text(), float)
         elif (index.column() == 2 or index.column() == 4):
             value = from_qvariant(editor.text(), int)
         selectionModel = self.parent.selectionModel()
         for idx in selectionModel.selectedIndexes():
             if idx.column() == index.column():
                 model.setData(idx, to_qvariant(value))
    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 setData(self, index, value, role):
        row = index.row()
        col = index.column()

        if col == 0:
            vel = from_qvariant(value, float)
            self._data[row][col] = vel
            self.mdl.setRotorVelocity(row, vel)
        elif col == 1:
            criteria = from_qvariant(value, to_text_string)
            self._data[row][col] = criteria
            self.mdl.setRotorCriteria(row, criteria)

        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        return True
 def __slotEnergyValue(self, text):
     """
     INPUT inlet Energy
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setThermoValue('energy', t)
 def slotNbIter(self, text):
     """
     Input itarations number.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         nb_iter = from_qvariant(text, int)
         self.mdl.setNbIter(nb_iter)
 def __slotTemperatureGasComb(self, text):
     """
     INPUT inlet temperature
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setGasCombustionTemperature(t)
示例#10
0
 def slotPlaneDefEpsilon(self, text):
     """
     Input define plane
     """
     if self.sender().validator().state == QValidator.Acceptable:
         current = from_qvariant(text, float)
         self.model.setPlaneDefinition("epsilon", current)
 def slotRelaxCoef(self, text):
     """
     Input relaxation coefficient.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         relax_coef = from_qvariant(text, float)
         self.mdl.setRelaxCoefficient(relax_coef)
示例#12
0
 def slotPower(self, text):
     """
     Input Imposed Power
     """
     if self.sender().validator().state == QValidator.Acceptable:
         power = from_qvariant(text, float)
         self.model.setPower(power)
示例#13
0
 def slotCurrent(self, text):
     """
     Input Imposed current intensity
     """
     if self.sender().validator().state == QValidator.Acceptable:
         current = from_qvariant(text, float)
         self.model.setCurrent(current)
 def slotPressureValue(self, text):
     """
     INPUT outlet pressure
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setPressureValue(t)
示例#15
0
 def slotSRROM(self, text):
     """
     Input Relaxation coefficient for mass density
     """
     if self.sender().validator().state == QValidator.Acceptable:
         srrom = from_qvariant(text, float)
         self.model.setSRROM(srrom)
 def slotINUCHL(self, text):
     """
     Input IHPT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, int)
         self.model.setCoalNumberValue(self.label, self.iclass, value)
 def slotIHPT(self, text):
     """
     Input IHPT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setCoalTemperatureValue(self.label, self.iclass, value)
 def slotIEPSI(self, text):
     """
     Input IEPSI.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setEmissivityValue(self.label, self.iclass, value)
 def slotIVDPT(self, text):
     """
     Input IVDPT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setDiameterVarianceValue(self.label, self.iclass, value)
 def slotIWPT(self, text):
     """
     Input IWPT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setVelocityDirectionValue(self.label, self.iclass, "w", value)
 def slotICPT(self, text):
     """
     Input ICPT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setSpecificHeatValue(self.label, self.iclass, value)
 def slotIPOIT(self, text):
     """
     Input IPOIT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setStatisticalWeightValue(self.label, self.iclass, value)
 def slotIUNO(self, text):
     """
     Input IUNO.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setVelocityNormValue(self.label, self.iclass, value)
 def slotICLST(self, text):
     """
     Input ICLST.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, int)
         self.model.setParticleGroupNumberValue(self.label, self.iclass, value)
 def slotIDEBT(self, text):
     """
     Input IDEBT.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         self.model.setMassFlowRateValue(self.label, self.iclass, value)
 def slotIJNBP(self, text):
     """
     Input IJNBP.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, int)
         self.model.setNumberOfParticulesInClassValue(self.label, self.iclass, value)
 def __slotMeanMixtureFraction(self, text):
     """
     INPUT inlet mean mixutre fraction
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setMeanMixtureFraction(f)
 def slotIJFRE(self, text):
     """
     Input IJFRE.
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(text, int)
         self.model.setInjectionFrequencyValue(self.label, self.iclass, value)
 def __slotTotalPressure(self, text):
     """
     INPUT inlet total pressure
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setThermoValue('total_pressure', t)
 def __slotTotalEnthalpy(self, text):
     """
     INPUT inlet total enthalpy
     """
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setThermoValue('enthalpy', t)
 def slotMaxDiameter(self, var):
     """
     """
     if self.lineEditMaxDiameter.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.mdl.setMaxDiameter(value)
示例#32
0
 def slotSpecies(self, var):
     """
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.__b.setElecScalarValue(self.species, 'dirichlet', value)
示例#33
0
 def slotPotElec(self, var):
     """
     """
     if self.sender().validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.__b.setElecScalarValue(self.potElec, self.potElec_type, value)
示例#34
0
 def setEditorData(self, editor, index):
     editor.setAutoFillBackground(True)
     v = from_qvariant(index.model().data(index, Qt.DisplayRole),
                       to_text_string)
     self.p_value = str(v)
     editor.setText(v)
示例#35
0
 def setEditorData(self, editor, index):
     value = from_qvariant(index.model().data(index, Qt.DisplayRole),
                           to_text_string)
     editor.setText(value)
示例#36
0
 def setModelData(self, editor, model, index):
     if editor.validator().state == QValidator.Acceptable:
         value = from_qvariant(editor.text(), int)
         model.setData(index, value, Qt.DisplayRole)
    def setEditorData(self, lineEdit, index):
        # This line is used to avoid an overlay of old and new text
        lineEdit.setAutoFillBackground(True)

        value = from_qvariant(index.model().data(index, Qt.DisplayRole), to_text_string)
        lineEdit.setText(value)
 def slotConductionFlux(self, text):
     """
     """
     if self.lineEditConductionFlux.validator().state == QValidator.Acceptable:
         c  = from_qvariant(text, float)
         self.__boundary.setFlux(c)
示例#39
0
 def slotAbsorptionCoefficient(self, text):
     """
     """
     if self.lineEditCoeff.validator().state == QValidator.Acceptable:
         c = from_qvariant(text, float)
         self.mdl.setAbsorCoeff(c)
示例#40
0
 def slotNdirec(self, text):
     """
     """
     if self.lineEditNdirec.validator().state == QValidator.Acceptable:
         n = from_qvariant(text, int)
         self.mdl.setNbDir(n)
示例#41
0
 def slotDtMax(self, var):
     """
     """
     if self.lineEditDtMax.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.mdl.setMaxDtDt0Variation(value)
示例#42
0
    def setData(self, index, value, role):
        if not index.isValid():
            return Qt.ItemIsEnabled

        # Update the row in the table
        row = index.row()
        col = index.column()
        FieldId = row + 1

        # Label
        if col == 0:
            new_plabel = from_qvariant(value, to_text_string)

            # Since all fields' labels are using the phase label, we rename
            # the labels in all formulas!
            old_plabel = self._data[row][col]
            for nf in self.mdl.case.xmlGetNodeList('formula'):
                if nf:
                    ftext = (str(nf).replace('<formula>',
                                             '')).replace('</formula>', '')
                    nf.xmlSetTextNode(ftext.replace(old_plabel, new_plabel))

            self._data[row][col] = new_plabel
            self.mdl.setLabel(FieldId, new_plabel)
            self.updateItem()

        # Nature of field
        elif col == 1:
            new_nature = from_qvariant(value, to_text_string)
            self._data[row][col] = new_nature
            self.mdl.setFieldNature(FieldId, new_nature)
            self.updateItem()

        # Interfacial criterion
        elif col == 2:
            new_crit = from_qvariant(value, to_text_string)
            self._data[row][col] = new_crit
            self.mdl.setCriterion(FieldId, new_crit)
            # update carrier field
            self.updateItem()

        # Carrier field
        elif col == 3:
            new_carrier = from_qvariant(value, to_text_string)
            self._data[row][col] = new_carrier
            # set carrier field Id in XML
            if self._data[row][col] != "off":
                id = self.mdl.getFieldId(self._data[row][col])
            else:
                id = self._data[row][col]
            self.mdl.setCarrierField(FieldId, id)

        # Compressible
        elif col == 4:
            state = from_qvariant(value, int)
            if state == Qt.Unchecked:
                self._data[row][col] = "off"
                self.mdl.setCompressibleStatus(FieldId, "off")
            else:
                self._data[row][col] = "on"
                self.mdl.setCompressibleStatus(FieldId, "on")

        # Energy resolution
        elif col == 5:
            state = from_qvariant(value, to_text_string)
            self._data[row][col] = state
            self.mdl.setEnergyModel(FieldId, state)

        self.dataChanged.emit(index, index)
        return True
示例#43
0
 def slotKzz(self, text):
     zone_id = self.zone.getCodeNumber()
     model = HeadLossesModel(self.case)
     if self.lineEdit_kzz.validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         model.setCoefficient(zone_id, 'kzz', value)
示例#44
0
 def slotA33(self, text):
     zone_id = self.zone.getCodeNumber()
     model = HeadLossesModel(self.case)
     if self.lineEdit_a33.validator().state == QValidator.Acceptable:
         value = from_qvariant(text, float)
         model.setMatrixComponent(zone_id, 'a33', value)
    def setData(self, index, value, role):
        if not index.isValid():
            return Qt.ItemIsEnabled

        row = index.row()
        col = index.column()

        # field A choice
        if col == 0:
            oldField = self._data[row][col]
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            oldFieldId = self.mdl.getFieldId(oldField)
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            fieldaId = self.mdl.getFieldId(new_pmodel)

            self.mdl.setFielda(oldFieldId, fieldbId, fieldaId)
            self.updateItem(index)

        # field B choice
        elif col == 1:
            oldField = self._data[row][col]
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            oldFieldId = self.mdl.getFieldId(oldField)
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(new_pmodel)

            self.mdl.setFieldb(fieldaId, oldFieldId, fieldbId)
            self.updateItem(index)

        # drag
        elif col == 2:
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            self.mdl.setDragModel(fieldaId, fieldbId, self.dicoV2M[new_pmodel])

        # added mass
        elif col == 3:
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            self.mdl.setAddMassModel(fieldaId, fieldbId,
                                     self.dicoV2M[new_pmodel])

        # lift
        elif col == 4:
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            self.mdl.setLiftModel(fieldaId, fieldbId, self.dicoV2M[new_pmodel])

        # turbulent dispersion
        elif col == 5:
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            self.mdl.setTurbDispModel(fieldaId, fieldbId,
                                      self.dicoV2M[new_pmodel])

        # wall forces
        elif col == 6:
            new_pmodel = from_qvariant(value, to_text_string)
            self._data[row][col] = new_pmodel
            fieldaId = self.mdl.getFieldId(self._data[row][0])
            fieldbId = self.mdl.getFieldId(self._data[row][1])
            self.mdl.setWallForceModel(fieldaId, fieldbId,
                                       self.dicoV2M[new_pmodel])

        self.dataChanged.emit(index, index)
        return True
    def setData(self, index, value, role=None):
        row = index.row()
        column = index.column()
        name = self.dataScheme[row]['name']

        # for Pressure, most fields are empty
        if column > 0 and str(from_qvariant(value,
                                            to_text_string)) in ['', 'None']:
            if (row, column) not in self.disabledItem:
                self.disabledItem.append((row, column))
            return False

        # set ISCHCV
        if column == 1:
            self.dataScheme[row]['ischcv'] = self.dicoV2M[str(
                from_qvariant(value, to_text_string))]
            if self.dataScheme[row]['ischcv'] == "upwind":
                if (row, 2) not in self.disabledItem:
                    self.disabledItem.append((row, 2))
                if (row, 3) not in self.disabledItem:
                    self.disabledItem.append((row, 3))
                self.dataScheme[row]['blencv'] = 0.0
                self.dataScheme[row]['isstpc'] = "off"
            else:
                if (row, 2) in self.disabledItem:
                    self.disabledItem.remove((row, 2))
                    self.dataScheme[row]['blencv'] = 1.0
                if (row, 3) in self.disabledItem:
                    self.disabledItem.remove((row, 3))
                    self.dataScheme[row]['isstpc'] = "on"

            self.NPE.setScheme(name, self.dataScheme[row]['ischcv'])
            self.NPE.setBlendingFactor(name, self.dataScheme[row]['blencv'])

        # set BLENCV
        elif column == 2:
            if self.dataScheme[row]['ischcv'] != "upwind":
                self.dataScheme[row]['blencv'] = from_qvariant(value, float)
                self.NPE.setBlendingFactor(name,
                                           self.dataScheme[row]['blencv'])

        # set ISSTPC
        elif column == 3:
            if self.dataScheme[row]['ischcv'] != "upwind":
                v = from_qvariant(value, int)
                if v == Qt.Unchecked:
                    self.dataScheme[row]['isstpc'] = "off"
                else:
                    self.dataScheme[row]['isstpc'] = "on"
                self.NPE.setSlopeTest(name, self.dataScheme[row]['isstpc'])

        # set IRCFLU
        elif column == 4:
            v = from_qvariant(value, int)
            if v == Qt.Unchecked:
                self.dataScheme[row]['ircflu'] = "off"
            else:
                self.dataScheme[row]['ircflu'] = "on"
            self.NPE.setFluxReconstruction(name,
                                           self.dataScheme[row]['ircflu'])

        # set NSWRSM
        elif column == 5:
            self.dataScheme[row]['nswrsm'] = from_qvariant(value, int)
            self.NPE.setRhsReconstruction(name, self.dataScheme[row]['nswrsm'])

        self.dataChanged.emit(index, index)
        return True
示例#47
0
 def slotTimeAnalysis(self, var):
     """
     """
     if self.lineEditTimeAnalysis.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.mdl.setMaximumTime(value)
示例#48
0
 def slotNsuit(self, text):
     if self.lineEditNSUIT.validator().state == QValidator.Acceptable:
         n = from_qvariant(text, int)
         self.nsuit = n
         log.debug("getNsuit-> nsuit = %s" % n)
示例#49
0
 def slotReferenceTimeStep(self, var):
     """
     """
     if self.lineEditReferenceTimeStep.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.mdl.setTimeStep(value)
示例#50
0
 def slotNumberTimeStep(self, var):
     """
     """
     if self.lineEditNumberTimeStep.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, int)
         self.mdl.setTimeStepsNumber(value)
示例#51
0
    def ui_initialize(self):
        self.setAttribute(Qt.WA_DeleteOnClose)
        MainView.Instances.add(self)

        self.setWindowTitle(self.package.code_name + " TRACKING CONVERGENCE" +
                            " - " + self.package.version)

        # Validator
        validator = DoubleValidator(self.lineEditTime, min=0.0)
        self.lineEditTime.setValidator(validator)

        # connections
        self.fileCloseAction.triggered.connect(self.close)
        self.fileQuitAction.triggered.connect(self.fileQuit)
        self.actionSave_state.triggered.connect(self.SaveState)
        self.actionLoad_state.triggered.connect(self.LoadState)

        self.displayAboutAction.triggered.connect(self.displayAbout)
        self.backgroundColorAction.triggered.connect(self.setColor)
        self.actionFont.triggered.connect(self.setFontSize)
        self.RestoreStyleDefaults.triggered.connect(self.restoreStyleDefaults)

        self.displayLicenceAction.triggered.connect(self.displayLicence)

        self.toolButtonDir.clicked.connect(self.slotOpenCase)
        self.lineEditTime.textChanged[str].connect(self.slotRefreshTime)
        self.pushButtonRefresh.clicked.connect(self.slotRefresh)

        # connection for page layout
        self.destroyed.connect(MainView.updateInstances)

        # Ctrl+C signal handler (allow to shutdown the GUI with Ctrl+C)

        signal.signal(signal.SIGINT, signal.SIG_DFL)

        self.resize(800, 700)

        # restore system settings

        settings = QSettings()

        try:
            self.restoreGeometry(
                settings.value("MainWindow/Geometry", QByteArray()))
            self.restoreState(settings.value("MainWindow/State", QByteArray()))
        except:
            self.restoreGeometry(
                settings.value("MainWindow/Geometry").toByteArray())
            self.restoreState(settings.value("MainWindow/State").toByteArray())

        app = QCoreApplication.instance()

        self.palette_default = None
        self.font_default = None

        if settings.contains("MainWindow/Color"):
            color = settings.value(
                "MainWindow/Color",
                self.palette().color(QPalette.Window).name())
            color = QColor(color)
            if color.isValid():
                if not self.palette_default:
                    self.palette_default = QPalette().resolve(self.palette())
                self.setPalette(QPalette(color))
                app.setPalette(QPalette(color))

        if settings.contains("MainWindow/Font"):
            f = settings.value("MainWindow/Font", str(self.font()))
            if f:
                if not self.font_default:
                    self.font_default = self.font()
                font = QFont()
                if (font.fromString(from_qvariant(f, to_text_string))):
                    self.setFont(font)
                    app.setFont(font)

        # Init
        if self.caseName == None:
            self.toolButtonDir.setStyleSheet("background-color: red")
        else:
            self.lineEditCase.setText(self.caseName)
            self.loadDirectoryContent()
        self.lineEditCase.setEnabled(False)
        self.lineEditTime.setText(str(self.timeRefresh))

        # treeViewDirectory
        self.modelCases = CaseStandardItemModel(self.parent, self.fileList,
                                                self.listFileProbes)
        self.treeViewDirectory.setModel(self.modelCases)
        self.treeViewDirectory.setAlternatingRowColors(True)
        self.treeViewDirectory.setSelectionBehavior(
            QAbstractItemView.SelectItems)
        self.treeViewDirectory.setSelectionMode(
            QAbstractItemView.ExtendedSelection)
        self.treeViewDirectory.setEditTriggers(QAbstractItemView.DoubleClicked)
        self.treeViewDirectory.expandAll()
        self.treeViewDirectory.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.treeViewDirectory.setDragEnabled(False)
        self.treeViewDirectory.resizeColumnToContents(0)
        self.treeViewDirectory.resizeColumnToContents(1)
        self.treeViewDirectory.resizeColumnToContents(2)
        self.treeViewDirectory.resizeColumnToContents(3)
        self.modelCases.dataChanged.connect(self.treeViewChanged)

        self.timer.timeout.connect(self.updateView)

        self.spinBox.valueChanged[int].connect(self.updateSubplotNumber)

        # gestion des figures
        l = QVBoxLayout(self.widget)
        self.dc = MyMplCanvas(self.widget,
                              subplotNb=self.subplotNumber,
                              width=5,
                              height=4,
                              dpi=50)
        l.addWidget(self.dc)

        # this is the Navigation widget
        # it takes the Canvas widget and a parent
        self.toolbar = NavigationToolbar(self.dc, self.widget)
        l.addWidget(self.toolbar)

        self.statusbar.setSizeGripEnabled(False)
        self.statusbar.showMessage(self.tr("Ready"), 5000)
        self.updateView()
示例#52
0
 def __slotTemperature(self, text):
     if self.sender().validator().state == QValidator.Acceptable:
         t = from_qvariant(text, float)
         self.__boundary.setOxydantTemperature(t)
示例#53
0
 def slotCompaction(self, var):
     """
     """
     if self.lineEditCompaction.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.mdl.setCompaction(value)
示例#54
0
    def setData(self, index, value, role=None):
        item = index.internalPointer()

        if index.column() == 1:
            v = from_qvariant(value, int)
            if v == Qt.Checked:
                item.item.status = "on"
            else:
                item.item.status = "off"
            if item in self.noderoot.values():
                (name, name_long, status, subplot_id,
                 probes_number) = self.lst[index.row()]
                self.lst[index.row()] = (name, name_long, item.item.status,
                                         subplot_id, probes_number)
                for it in self.lstFileProbes[name]:
                    it.status = item.item.status
            else:
                size = len(item.parentItem.childItems)
                active = 0
                for itm in item.parentItem.childItems:
                    if itm.item.status == "on":
                        active = active + 1
                if active == 0:
                    item.parentItem.item.status = "off"
                elif active == size:
                    item.parentItem.item.status = "on"
                else:
                    item.parentItem.item.status = "onoff"
                # update self.lst
                idx = 0
                for (name, name_long, status, subplot_id,
                     probes_number) in self.lst:
                    nm, ext = os.path.splitext(name)
                    if nm == item.parentItem.item.name:
                        self.lst[idx] = (name, name_long,
                                         item.parentItem.item.status,
                                         subplot_id, probes_number)
                    idx = idx + 1

        elif index.column() == 2:
            v = from_qvariant(value, int)
            item.item.subplot_id = v
            if item in self.noderoot.values():
                (name, name_long, status, subplot_id,
                 probes_number) = self.lst[index.row()]
                self.lst[index.row()] = (name, name_long, status,
                                         item.item.subplot_id, probes_number)
                for it in self.lstFileProbes[name]:
                    it.subplot_id = item.item.subplot_id
            else:
                size = len(item.parentItem.childItems)
                subplotid = item.parentItem.childItems[0]
                for itm in item.parentItem.childItems:
                    if itm.item.subplot_id != subplotid:
                        subplotid = -1
                # update self.lst
                item.parentItem.item.subplot_id = subplotid
                idx = 0
                for (name, name_long, status, subplot_id,
                     probes_number) in self.lst:
                    nm, ext = os.path.splitext(name)
                    if nm == item.parentItem.item.name:
                        self.lst[idx] = (name, name_long, status, subplotid,
                                         probes_number)
                    idx = idx + 1

        self.dataChanged.emit(QModelIndex(), QModelIndex())

        return True
示例#55
0
 def slotExMeteo(self, var):
     """
     """
     if self.lineEditExMeteo.validator().state == QValidator.Acceptable:
         value = from_qvariant(var, float)
         self.__boundary.setScalarValue(self.meteo, 'exchange_coefficient', value)
 def slotMODCPL(self, text):
     """
     Input MODCPL.
     """
     if self.lineEditMODCPL.validator().state == QValidator.Acceptable:
         self.result['complete_model_iteration'] = from_qvariant(text, int)
 def slotEmissivity(self, text):
     """
     """
     if self.lineEditEmissivity.validator().state == QValidator.Acceptable:
         c = from_qvariant(text, float)
         self.__boundary.setEmissivity(c)
 def slotZone(self, text):
     if self.lineEditZone.validator().state == QValidator.Acceptable:
         nb_zone = from_qvariant(text, int)
         self.__boundary.setOutputRadiativeZone(nb_zone)
         return nb_zone
 def slotIntTemperature(self, text):
     """
     """
     if self.lineEditIntTemperature.validator().state == QValidator.Acceptable:
         c  = from_qvariant(text, float)
         self.__boundary.setInternalTemperatureProfile(c)
 def slotThickness(self, text):
     """
     """
     if self.lineEditThickness.validator().state == QValidator.Acceptable:
         c = from_qvariant(text, float)
         self.__boundary.setThickness(c)