class BoundaryConditionsWallRadiativeTransferView(QWidget,
                                                  Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)


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

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative,3,1)
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed internal temperature"), 'itpimp')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed external temperature"), 'ipgrno')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and flux of fixed conduction"), 'ifgrno')

        # Validator
        validatorZone = IntValidator(self.lineEditZone, min=0)
        validatorZone.setExclusiveMin(True)
        self.lineEditZone.setValidator(validatorZone)

        # Connections
        self.comboBoxRadiative.activated[str].connect(self.slotRadiativeChoice)
        self.lineEditZone.textChanged[str].connect(self.slotZone)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.nb_zone = self.__boundary.getOutputRadiativeZone()
            self.lineEditZone.setText(str(self.nb_zone))

            self.show()
        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()


    @pyqtSlot(str)
    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


    @pyqtSlot(str)
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s "%cond)
        self.__boundary.setRadiativeChoice(cond)
        self.modelScalars.deleteAll()
        self.modelScalars = StandardItemModelScalars(self.__boundary)
        self.tableViewScalars.setModel(self.modelScalars)


    def tr(self, text):
        """
        Translation
        """
        return text
class BoundaryConditionsWallRadiativeTransferView(QWidget,
                                                  Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)


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

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative,3,1)
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed internal temperature"), 'itpimp')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed external temperature"), 'ipgrno')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and flux of fixed conduction"), 'ifgrno')

        # Validator
        validatorZone = IntValidator(self.lineEditZone, min=0)
        validatorZone.setExclusiveMin(True)
        self.lineEditZone.setValidator(validatorZone)

        # Connections
        self.connect(self.comboBoxRadiative,
                     SIGNAL("activated(const QString&)"),
                     self.slotRadiativeChoice)
        self.connect(self.lineEditZone,
                     SIGNAL("textChanged(const QString &)"),
                     self.slotZone)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.nb_zone = self.__boundary.getOutputRadiativeZone()
            self.lineEditZone.setText(str(self.nb_zone))

            self.show()
        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()


    @pyqtSignature("const QString&")
    def slotZone(self, text):
        if self.sender().validator().state == QValidator.Acceptable:
            nb_zone = from_qvariant(text, int)
            self.__boundary.setOutputRadiativeZone(nb_zone)
            return nb_zone


    @pyqtSignature("const QString&")
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s "%cond)
        self.__boundary.setRadiativeChoice(cond)
        self.modelScalars.deleteAll()
        self.modelScalars = StandardItemModelScalars(self.__boundary)
        self.tableViewScalars.setModel(self.modelScalars)


    def tr(self, text):
        """
        Translation
        """
        return text
Exemplo n.º 3
0
class BoundaryConditionsWallRadiativeTransferView(
        QWidget, Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)

        validatorEmissivity = DoubleValidator(self.lineEditEmissivity, min=0.0)
        self.lineEditEmissivity.setValidator(validatorEmissivity)

        validatorConductivity = DoubleValidator(self.lineEditConductivity,
                                                min=0.0)
        self.lineEditConductivity.setValidator(validatorConductivity)

        validatorThickness = DoubleValidator(self.lineEditThickness, min=0.0)
        self.lineEditThickness.setValidator(validatorThickness)

        validatorExtTemperature = DoubleValidator(self.lineEditExtTemperature,
                                                  min=0.0)
        self.lineEditExtTemperature.setValidator(validatorExtTemperature)

        validatorIntTemperature = DoubleValidator(self.lineEditIntTemperature,
                                                  min=0.0)
        self.lineEditIntTemperature.setValidator(validatorIntTemperature)

        validatorConductionFlux = DoubleValidator(self.lineEditConductionFlux,
                                                  min=0.0)
        self.lineEditConductionFlux.setValidator(validatorConductionFlux)

    def __updateView__(self):
        cond = self.__boundary.getRadiativeChoice()

        #self.labelEmissivity.show()
        #self.lineEditEmissivity.show()
        self.lineEditEmissivity.setText(str(self.__boundary.getEmissivity()))

        #self.labelIntTemperature.hide()
        #self.lineEditIntTemperature.hide()
        #self.labelIntTemperatureUnit.hide()
        self.lineEditIntTemperature.setText(
            str(self.__boundary.getInternalTemperatureProfile()))

        self.labelConductivity.hide()
        self.lineEditConductivity.hide()
        self.labelConductivityUnit.hide()
        self.lineEditConductivity.setText(
            str(self.__boundary.getThermalConductivity()))

        self.labelThickness.hide()
        self.lineEditThickness.hide()
        self.labelThicknessUnit.hide()
        self.lineEditThickness.setText(str(self.__boundary.getThickness()))

        self.labelExtTemperature.hide()
        self.lineEditExtTemperature.hide()
        self.labelExtTemperatureUnit.hide()
        self.lineEditExtTemperature.setText(
            str(self.__boundary.getExternalTemperatureProfile()))

        self.labelConductionFlux.hide()
        self.lineEditConductionFlux.hide()
        self.labelConductionFluxUnit.hide()
        self.lineEditConductionFlux.setText(str(self.__boundary.getFlux()))

        if cond == 'ipgrno':
            self.labelConductivity.show()
            self.lineEditConductivity.show()
            self.labelConductivityUnit.show()

            self.labelThickness.show()
            self.lineEditThickness.show()
            self.labelThicknessUnit.show()

            self.labelExtTemperature.show()
            self.lineEditExtTemperature.show()
            self.labelExtTemperatureUnit.show()
        elif cond == 'ifgrno':
            self.labelConductionFlux.show()
            self.lineEditConductionFlux.show()
            self.labelConductionFluxUnit.show()

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

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative, 3, 1)
        self.modelRadiative.addItem(self.tr("Fixed interior temperature"),
                                    'itpimp')
        self.modelRadiative.addItem(self.tr("Fixed exterior temperature"),
                                    'ipgrno')
        self.modelRadiative.addItem(self.tr("Fixed conduction flux"), 'ifgrno')

        # Connections
        self.comboBoxRadiative.activated[str].connect(self.slotRadiativeChoice)

        self.lineEditEmissivity.textChanged[str].connect(self.slotEmissivity)
        self.lineEditConductivity.textChanged[str].connect(
            self.slotConductivity)
        self.lineEditThickness.textChanged[str].connect(self.slotThickness)
        self.lineEditExtTemperature.textChanged[str].connect(
            self.slotExtTemperature)
        self.lineEditIntTemperature.textChanged[str].connect(
            self.slotIntTemperature)
        self.lineEditConductionFlux.textChanged[str].connect(
            self.slotConductionFlux)

        self.__case.undoStartGlobal()

    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)
            self.__updateView__()
            self.show()
        else:
            self.hideWidget()

    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()

    @pyqtSlot(str)
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s " % cond)
        self.__boundary.setRadiativeChoice(cond)
        self.__updateView__()

    @pyqtSlot(str)
    def slotEmissivity(self, text):
        """
        """
        if self.lineEditEmissivity.validator().state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setEmissivity(c)

    @pyqtSlot(str)
    def slotConductivity(self, text):
        """
        """
        if self.lineEditConductivity.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setThermalConductivity(c)

    @pyqtSlot(str)
    def slotThickness(self, text):
        """
        """
        if self.lineEditThickness.validator().state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setThickness(c)

    @pyqtSlot(str)
    def slotExtTemperature(self, text):
        """
        """
        if self.lineEditExtTemperature.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setExternalTemperatureProfile(c)

    @pyqtSlot(str)
    def slotIntTemperature(self, text):
        """
        """
        if self.lineEditIntTemperature.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setInternalTemperatureProfile(c)

    @pyqtSlot(str)
    def slotConductionFlux(self, text):
        """
        """
        if self.lineEditConductionFlux.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setFlux(c)

    def tr(self, text):
        """
        Translation
        """
        return text