示例#1
0
    def __init__(self, curva=[], parent=None):
        """curva: Parametro opcional indicando la curva de la bomba"""
        super(Ui_bombaCurva, self).__init__(parent)
        self.setWindowTitle(
            QtGui.QApplication.translate("pychemqt", "Pump curves dialog"))
        self.showMaximized()

        self.gridLayout = QtGui.QGridLayout(self)
        self.botones = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Apply | QtGui.QDialogButtonBox.Open
            | QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Reset,
            QtCore.Qt.Vertical)
        self.botones.clicked.connect(self.botones_clicked)
        self.gridLayout.addWidget(self.botones, 1, 1, 3, 1)
        self.gridLayout.addItem(
            QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed), 1, 2, 3, 1)
        self.gridLayout.addWidget(
            QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Curves")),
            1, 3)
        self.lista = QtGui.QComboBox()
        self.lista.currentIndexChanged.connect(self.cambiarCurvaVista)
        self.gridLayout.addWidget(self.lista, 1, 4)
        self.gridLayout.addWidget(
            QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Diameter")),
            2, 3)
        self.diametro = Entrada_con_unidades(int, width=60, textounidad='"')
        self.gridLayout.addWidget(self.diametro, 2, 4)
        self.gridLayout.addWidget(
            QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "RPM")), 3,
            3)
        self.rpm = Entrada_con_unidades(int, width=60, textounidad="rpm")
        self.gridLayout.addWidget(self.rpm, 3, 4)
        self.gridLayout.addItem(
            QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed), 4, 1, 1, 4)

        self.Tabla = Tabla(
            4,
            horizontalHeader=[
                QtGui.QApplication.translate("pychemqt", "Flowrate"),
                QtGui.QApplication.translate("pychemqt", "Head"),
                QtGui.QApplication.translate("pychemqt", "Power"),
                QtGui.QApplication.translate("pychemqt", "NPSH")
            ],
            verticalOffset=1,
            filas=1,
            stretch=False)
        self.Tabla.setColumnWidth(0, 100)
        self.unidadesCaudal = QtGui.QComboBox()
        self.Tabla.setCellWidget(0, 0, self.unidadesCaudal)
        self.Tabla.setColumnWidth(1, 80)
        self.unidadesCarga = QtGui.QComboBox()
        self.Tabla.setCellWidget(0, 1, self.unidadesCarga)
        self.Tabla.setColumnWidth(2, 80)
        self.unidadesPotencia = QtGui.QComboBox()
        self.Tabla.setCellWidget(0, 2, self.unidadesPotencia)
        self.Tabla.setColumnWidth(3, 80)
        self.unidadesNPSH = QtGui.QComboBox()
        self.Tabla.setCellWidget(0, 3, self.unidadesNPSH)
        self.Tabla.setRowHeight(0, 24)
        self.Tabla.setFixedWidth(360)
        self.Tabla.setConnected()
        self.Tabla.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.gridLayout.addWidget(self.Tabla, 5, 1, 1, 4)
        self.gridLayout.addItem(
            QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed), 1, 5, 5, 1)

        self.checkCarga = QtGui.QCheckBox(
            QtGui.QApplication.translate("pychemqt", "Heat"))
        self.gridLayout.addWidget(self.checkCarga, 1, 6)
        self.checkPotencia = QtGui.QCheckBox(
            QtGui.QApplication.translate("pychemqt", "Power"))
        self.gridLayout.addWidget(self.checkPotencia, 1, 7)
        self.checkNPSH = QtGui.QCheckBox(
            QtGui.QApplication.translate("pychemqt", "NPSH"))
        self.gridLayout.addWidget(self.checkNPSH, 1, 8)
        self.rejilla = QtGui.QCheckBox(
            QtGui.QApplication.translate("pychemqt", "Grid"))
        self.rejilla.toggled.connect(self.rejilla_toggled)
        self.gridLayout.addWidget(self.rejilla, 1, 9)
        self.gridLayout.addItem(
            QtGui.QSpacerItem(1000, 20, QtGui.QSizePolicy.Expanding,
                              QtGui.QSizePolicy.Fixed), 1, 10)
        self.Plot = Plot(self, width=5, height=1, dpi=100)
        self.gridLayout.addWidget(self.Plot, 2, 6, 4, 5)

        self.buttonBox = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.gridLayout.addWidget(self.buttonBox, 6, 9, 1, 2)

        if curva:
            self.curvas = curva
            for i in curva:
                self.lista.addItem(str(i[0]) + '", ' + str(i[1]) + " rpm")
            self.lista.setCurrentIndex(self.lista.count() - 1)
            self.cambiarCurvaVista(self.lista.count() - 1)

            #            self.curva=curva[-1]
            #            self.diametro.setValue(self.curva[0])
            #            self.rpm.setValue(self.curva[1])
            #            self.Tabla.setMatrix(self.curva[2:])
            #            self.Tabla.addRow()
            self.actualizarPlot()
        else:
            self.curva = []

        for i in Length.__text__:
            self.unidadesCarga.addItem(i)
            self.unidadesNPSH.addItem(i)
        for i in VolFlow.__text__:
            self.unidadesCaudal.addItem(i)
        for i in Power.__text__:
            self.unidadesPotencia.addItem(i)

        self.oldIndices = [0, 0, 0, 0]
        self.unidadesCaudal.currentIndexChanged.connect(
            partial(self.cambiar_unidades, 0, VolFlow, "VolFlow"))
        self.unidadesCarga.currentIndexChanged.connect(
            partial(
                self.cambiar_unidades,
                1,
                Length,
                "Head",
            ))
        self.unidadesPotencia.currentIndexChanged.connect(
            partial(self.cambiar_unidades, 2, Power, "Power"))
        self.unidadesNPSH.currentIndexChanged.connect(
            partial(
                self.cambiar_unidades,
                3,
                Length,
                "Head",
            ))

        Config = config.getMainWindowConfig()
        self.unidadesCaudal.setCurrentIndex(Config.getint("Units", "QLiq"))
        self.unidadesCarga.setCurrentIndex(Config.getint("Units", "Head"))
        self.unidadesPotencia.setCurrentIndex(Config.getint("Units", "Power"))
        self.unidadesNPSH.setCurrentIndex(Config.getint("Units", "Head"))

        self.checkCarga.toggled.connect(self.actualizarPlot)
        self.checkPotencia.toggled.connect(self.actualizarPlot)
        self.checkNPSH.toggled.connect(self.actualizarPlot)
示例#2
0
    def __init__(self,
                 data=None,
                 t=[],
                 property=[],
                 horizontalHeader=[],
                 title="",
                 help=False,
                 helpFile="",
                 DIPPR=False,
                 tc=0,
                 tcValue=None,
                 eq=1,
                 parent=None):
        """
        title: window title
        data: mrray with original data
        t: values for x column, generally temperature
        property: values for 2...n columns
        horizontalHeader: List with column title
        help: boolean to show help button
        helpFile: Path for help file, file or url
        DIPPR: boolean to show DIPPR widget
        tc: boolean to show critical temperature (same DIPPR eq need it)
        tcValue: value for critical temperature
        eq: Value for DIPPR equation
        """
        super(Entrada_Datos, self).__init__(parent)
        self.setWindowTitle(title)
        self.columnas = len(horizontalHeader)
        self.horizontalHeader = horizontalHeader
        self.title = title
        self.helpFile = helpFile
        gridLayout = QtGui.QGridLayout(self)
        self.botonAbrir = QtGui.QPushButton(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["pychemqt"] +
                              "/images/button/fileOpen.png")),
            QtGui.QApplication.translate("pychemqt", "Open"))
        self.botonAbrir.clicked.connect(self.Abrir)
        gridLayout.addWidget(self.botonAbrir, 1, 1)
        self.botonGuardar = QtGui.QPushButton(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["pychemqt"] +
                              "/images/button/fileSave.png")),
            QtGui.QApplication.translate("pychemqt", "Save"))
        self.botonGuardar.clicked.connect(self.Guardar)
        gridLayout.addWidget(self.botonGuardar, 1, 2)
        self.botonDelete = QtGui.QPushButton(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["pychemqt"] +
                              "/images/button/clear.png")),
            QtGui.QApplication.translate("pychemqt", "Clear"))
        self.botonDelete.clicked.connect(self.Borrar)
        gridLayout.addWidget(self.botonDelete, 1, 3)
        gridLayout.addItem(
            QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding,
                              QtGui.QSizePolicy.Expanding), 1, 4)

        self.tabla = Tabla(self.columnas,
                           horizontalHeader=horizontalHeader,
                           verticalHeader=False,
                           stretch=False)
        self.tabla.setConnected()
        if data:
            self.tabla.setMatrix(data)
            self.tabla.addRow()
        elif t and property:
            self.tabla.setColumn(0, t)
            self.tabla.setColumn(1, property)
        gridLayout.addWidget(self.tabla, 2, 1, 1, 4)

        if DIPPR:
            self.eqDIPPR = eqDIPPR(eq)
            gridLayout.addWidget(self.eqDIPPR, 3, 1, 1, 4)
            self.eqDIPPR.eqDIPPR.valueChanged.connect(self.showTc)

        if tc:
            lyt = QtGui.QHBoxLayout()
            self.labelTc = QtGui.QLabel("Tc: ", self)
            lyt.addWidget(self.labelTc)
            self.tc = Entrada_con_unidades(Temperature, value=tcValue)
            lyt.addWidget(self.tc)
            lyt.addItem(
                QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding,
                                  QtGui.QSizePolicy.Expanding))
            gridLayout.addItem(lyt, 4, 1, 1, 4)
            self.showTc(1)

        if help:
            botones = QtGui.QDialogButtonBox.Help | \
                QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok
        else:
            botones = QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok
        self.boton = QtGui.QDialogButtonBox(botones)
        self.boton.accepted.connect(self.accept)
        self.boton.rejected.connect(self.reject)
        self.boton.helpRequested.connect(self.ayuda)
        gridLayout.addWidget(self.boton, 5, 1, 1, 4)