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


Python Tabla.getColumn方法代码示例

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


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

示例1: UI_equipment

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import getColumn [as 别名]
class UI_equipment(UI_equip):
    """Divider equipment edition dialog"""
    Equipment = Divider()

    def __init__(self, equipment=None, salidas=0, parent=None):
        """
        equipment: Initial equipment instance to model
        salidas: Stream Output number to equipment
        """
        super().__init__(Divider, entrada=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Separation")), 1, 1, 1, 1)
        self.criterio = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_CRITERIO:
            self.criterio.addItem(txt)
        self.criterio.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.criterio, 1, 2, 1, 1)

        self.fracciones = Tabla(1, horizontalHeader=[True], stretch=False)
        self.fracciones.setItemDelegateForColumn(0, CellEditor(self))
        lyt_Calc.addWidget(self.fracciones, 2, 1, 1, 2)

        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure lost")), 3, 1, 1, 1)
        self.deltaP = Entrada_con_unidades(Pressure, value=0)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        lyt_Calc.addWidget(self.deltaP, 3, 2, 1, 1)

        if equipment and salidas:
            equipment(salidas=salidas)
        elif equipment:
            salidas = equipment.kwargs["salidas"]
        else:
            self.Equipment = Divider(salidas=salidas)

        self.fracciones.setRowCount(salidas)
        for i in range(salidas):
            itm = QtWidgets.QTableWidgetItem("%i" % i)
            itm.setTextAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
            self.fracciones.setItem(0, i, itm)
            self.fracciones.setRowHeight(i, 20)
            widget = UI_corriente.Ui_corriente(readOnly=True)
            self.Salida.addTab(widget, str(i+1))

        self.criterio_Changed(0)
        self.fracciones.editingFinished.connect(
            partial(self.changeParams, "split"))
        self.setEquipment(equipment)

    def criterio_Changed(self, int):
        if int:
            item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
                "pychemqt", "Flow")+", "+MassFlow.text())
            self.fracciones.setHorizontalHeaderItem(0, item)
            self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
                QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled |
                QtCore.Qt.ItemIsSelectable)
        else:
            item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
                "pychemqt", "Flow")+", "+MassFlow.text())
            self.fracciones.setHorizontalHeaderItem(0, item)
            self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
                QtCore.Qt.NoItemFlags)
        self.changeParams("criterio", int)

    def changeParams(self, parametro, valor=None):
        if parametro == "split":
            valor = self.fracciones.getColumn(0, False)
            if self.criterio.currentIndex() == 0:
                if len(valor)+1 < self.fracciones.rowCount():
                    return
                elif len(valor)+1 == self.fracciones.rowCount():
                    valor.append(1-sum(valor))
                elif len(valor) == self.fracciones.rowCount():
                    valor[-1] = 1-sum(valor[:-1])
        self.calculo(**{parametro: valor})

    def rellenar(self):
        UI_equip.rellenar(self)
        if self.Equipment.status == 1 and self.criterio.currentIndex() == 1:
                self.entrada.setCorriente(self.Equipment.entrada)

    def rellenarInput(self):
        UI_equip.rellenarInput(self)
        self.fracciones.setColumn(0, self.Equipment.kwargs["split"])
开发者ID:ChEsolve,项目名称:pychemqt,代码行数:90,代码来源:UI_divider.py

示例2: UI_equipment

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import getColumn [as 别名]

#.........这里部分代码省略.........
            "pychemqt", "Cloth resistence")), 7, 4)
        self.resistenciaFiltro = Entrada_con_unidades(float)
        self.resistenciaFiltro.valueChanged.connect(
            partial(self.changeParams, "resistenciaFiltro"))
        lyt_Calc.addWidget(self.resistenciaFiltro, 7, 5)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cake resistence")), 8, 4)
        self.resistenciaTorta = Entrada_con_unidades(float)
        self.resistenciaTorta.valueChanged.connect(
            partial(self.changeParams, "resistenciaTorta"))
        lyt_Calc.addWidget(self.resistenciaTorta, 8, 5)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cells cleaned")), 9, 4)
        self.limpieza = Entrada_con_unidades(int, spinbox=True, step=1, min=0)
        self.limpieza.valueChanged.connect(
            partial(self.changeParams, "limpieza"))
        lyt_Calc.addWidget(self.limpieza, 9, 5)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1, 1, 6)

        groupbox = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        lyt_Calc.addWidget(groupbox, 11, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(groupbox)

        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "No cells")), 1, 1)
        self.num_filtrosCalc = Entrada_con_unidades(int, readOnly=True)
        lyt.addWidget(self.num_filtrosCalc, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Time")), 2, 1)
        self.tiempoCalc = Entrada_con_unidades(Time, readOnly=True)
        lyt.addWidget(self.tiempoCalc, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure drop")), 3, 1)
        self.deltaPCalc = Entrada_con_unidades(Pressure, readOnly=True)
        lyt.addWidget(self.deltaPCalc, 3, 2)

        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Gas velocity")), 1, 4)
        self.Vgas = Entrada_con_unidades(Speed, retornar=False, readOnly=True)
        lyt.addWidget(self.Vgas, 1, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 2, 4)
        self.rendimiento = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.rendimiento, 2, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Area")), 3, 4)
        self.floorArea = Entrada_con_unidades(Area, readOnly=True)
        lyt.addWidget(self.floorArea, 3, 5)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 12, 1, 1, 6)

        # Output tab
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Filtered gas"))
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Collected solids"))

        if equipment:
            self.setEquipment(equipment)

    def cambiarRendimientos(self):
        self.changeParams("rendimientos", self.efic.getColumn(1))

    def tipoCalculoCambiado(self, tipo_calculo):
        if tipo_calculo == 0:
            self.num_filtros.setReadOnly(False)
            self.num_filtros.setResaltado(True)
            self.tiempo.setReadOnly(False)
            self.tiempo.setResaltado(True)
            self.deltaP.setReadOnly(True)
            self.deltaP.setResaltado(False)
        elif tipo_calculo == 1:
            self.num_filtros.setReadOnly(False)
            self.num_filtros.setResaltado(True)
            self.tiempo.setReadOnly(True)
            self.tiempo.setResaltado(False)
            self.deltaP.setReadOnly(False)
            self.deltaP.setResaltado(True)
        else:
            self.num_filtros.setReadOnly(True)
            self.num_filtros.setResaltado(False)
            self.tiempo.setReadOnly(False)
            self.tiempo.setResaltado(True)
            self.deltaP.setReadOnly(False)
            self.deltaP.setResaltado(True)
        self.changeParams("metodo", tipo_calculo)

    def rellenarInput(self):
        UI_equip.rellenarInput(self)
        if self.Equipment.kwargs["entrada"].solido:
            diametros = []
            for d in self.Equipment.kwargs["entrada"].solido.diametros:
                diametros.append(d.config("ParticleDiameter"))
            self.efic.setColumn(0, diametros)
        if any(self.Equipment.kwargs["rendimientos"]):
            self.efic.setColumn(1, self.Equipment.kwargs["rendimientos"])
开发者ID:bkt92,项目名称:pychemqt,代码行数:104,代码来源:UI_baghouse.py

示例3: InputTableWidget

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import getColumn [as 别名]

#.........这里部分代码省略.........
    def showTc(self, value):
        """Show/hide Tc widget"""
        self.labelTc.setVisible(value in (7, 9))
        self.tc.setVisible(value in (7, 9))

    def open(self):
        """Load data from a test file"""
        fname, ext = QtWidgets.QFileDialog.getOpenFileName(
            self,
            QtWidgets.QApplication.translate("pychemqt", "Open text file"),
            "./")
        if fname:
            try:
                # Numpy raise error if use the fname directly and find a
                # non-latin1 character, inclusive in comment lines
                with open(fname, "rb") as file:
                    data = loadtxt(file)
                self.delete()
                self.tabla.setData(data)
            except ValueError as er:
                # Raise a error msg if the file can load by loadtxt, the user
                # can select any type of file and the input error is possible
                title = QtWidgets.QApplication.translate(
                    "pychemqt", "Failed to load file")
                msg = fname + "\n" + er.args[0]
                QtWidgets.QMessageBox.critical(self, title, msg)

    def save(self):
        """Save currend data of table to a file"""
        fname, ext = QtWidgets.QFileDialog.getSaveFileName(
            self,
            QtWidgets.QApplication.translate("pychemqt", "Save data to file"),
            "./")
        if fname:
            with open(fname, 'w') as file:
                file.write("#"+self.title+"\n")
                file.write("#")
                for i in range(self.tabla.columnCount()):
                    item = self.tabla.horizontalHeaderItem(i)
                    file.write(item.text()+"\t")
                file.write("\n")
                data = self.data
                for fila in range(len(data)):
                    for columna in range(self.tabla.columnCount()):
                        file.write(str(data[fila][columna])+"\t")
                    file.write("\n")

    def delete(self):
        """Clear table"""
        self.tabla.setRowCount(0)
        self.tabla.clearContents()
        self.tabla.addRow()

    @property
    def data(self):
        return self.tabla.getData()

    def column(self, column, magnitud=None, unit="conf"):
        """
        column: column to get
        magnitud: magnitud to get the values
        unit: unit of the values in table"""
        data = self.tabla.getColumn(column)
        if self.unit:
            magnitud = self.unit[column]
            tx = self.tabla.horizontalHeaderItem(column).text().split(", ")[-1]
            unit = magnitud.__units__[magnitud.__text__.index(tx)]

        if magnitud is not None:
            data = [magnitud(x, unit) for x in data]
        return data

    def editUnit(self, col):
        """Show dialog to config input unit"""
        unit = self.unit[col]
        widget = QtWidgets.QComboBox(self.tabla)
        for txt in unit.__text__:
            widget.addItem(txt)
        txt = self.tabla.horizontalHeaderItem(col).text().split(", ")[-1]
        widget.setCurrentText(txt)

        # Define Unit combobox geometry
        size = self.tabla.horizontalHeader().sectionSize(col)
        pos = self.tabla.horizontalHeader().sectionPosition(col)
        h = self.tabla.horizontalHeader().height()
        geometry = QtCore.QRect(pos, 0, size, h)
        widget.setGeometry(geometry)
        widget.currentIndexChanged["int"].connect(
            partial(self.updateHeader, col))
        widget.show()
        widget.showPopup()

    def updateHeader(self, col, index):
        """Change the text in header"""
        widget = self.sender()
        txt = self.tabla.horizontalHeaderItem(col).text()
        newtxt = "%s, %s" % (txt.split(",")[0], widget.currentText())
        self.tabla.setHorizontalHeaderItem(
                col, QtWidgets.QTableWidgetItem(newtxt))
        widget.close()
开发者ID:bkt92,项目名称:pychemqt,代码行数:104,代码来源:inputTable.py

示例4: UI_reacciones

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import getColumn [as 别名]

#.........这里部分代码省略.........


        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        self.status=Status()
        gridLayout.addWidget(self.status, 10,1)
        self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        gridLayout.addWidget(self.buttonBox,10,2,1,4)

        if reaccion:
            self.setReaction(reaccion)

    def changeParams(self, parametro, valor):
        self.calculo(**{parametro: valor})

    def calculo(self, **kwargs):
        self.status.setState(4)
        self.evaluate.start(self.reaction, kwargs)

    def changeHr(self, bool):
        self.Hr.setReadOnly(not bool)
        self.changeParams("customHr", bool)

    def reaccionCambiada(self):
        kwargs={"componentes": self.indices,
                    "coeficientes": self.Estequiometria.getColumn(0)[:-1]}
        self.calculo(**kwargs)

    def setReaction(self, reaction):
        self.reaction=reaction
        self.rellenar()

#        if self.Estequiometria.getValue(0, self.Base.currentIndex()):
#            reaccion=reaction.Reaction(self.indices, self.Estequiometria.getColumn(0), base=self.Base.currentIndex(), estequiometria=[0, 0, 0.5], formulas=self.checkFormula.isChecked(), calor=self.checkCalorEspecificado.isChecked(), Hr=self.Hr.value, tipo=self.tipo.currentIndex(), conversion=self.Conversion.getColumn(0)[-1::-1])
#            self.Balance.setValue(reaccion.error)
#            if reaccion.state:
#                self.Formula.setText(reaccion._txt(self.checkFormula.isChecked()))
#                self.Hr.setValue(reaccion.Hr)
#            else:
#                self.Formula.clear()
#                self.Hr.clear()
#            self.botonAdd.setEnabled(reaccion.state and not self.botonEdit.isChecked())
#            self.reaccion=reaccion

    def rellenar(self):
        self.blockSignals(True)
        for variable in self.reaction.kwargsValue:
            self.__getattribute__(variable).setValue(self.reaction.kwargs[variable])
        for combo in self.reaction.kwargsList:
            self.__getattribute__(combo).setCurrentIndex(self.reaction.kwargs[combo])
        for check in self.reaction.kwargsCheck:
            self.__getattribute__(check).setChecked(self.reaction.kwargs[check])

        self.Estequiometria.setColumn(0, self.reaction.kwargs["coeficientes"])
#        self.Conversion.setColumn(0, self.reaction.estequiometria[-1::-1])
        self.blockSignals(False)

        self.status.setState(self.reaction.status, self.reaction.msg)
开发者ID:bkt92,项目名称:pychemqt,代码行数:70,代码来源:UI_reactor.py

示例5: Definicion_Petro

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import getColumn [as 别名]

#.........这里部分代码省略.........
        self.N.valueChanged.connect(partial(self.changeParams, "N"))
        layout.addWidget(self.N, 15, 2)

        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Carbons number")), 19, 1)
        self.carbonos = Entrada_con_unidades(int, width=50, spinbox=True,
                                             step=1, start=7, min=5, max=100)
        self.N.valueChanged.connect(partial(self.changeParams, "Nc"))
        layout.addWidget(self.carbonos, 19, 2)

        layout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Expanding,
                                         QtGui.QSizePolicy.Expanding), 3, 3, 15, 1)
        self.checkCurva = QtGui.QCheckBox(QtGui.QApplication.translate(
            "pychemqt", "Define destillation curve"))
        layout.addWidget(self.checkCurva, 3, 4, 1, 2)
        self.tipoCurva = QtGui.QComboBox()
        self.tipoCurva.addItem("ASTM D86")
        self.tipoCurva.addItem("TBP")
        self.tipoCurva.addItem("EFV")
        self.tipoCurva.addItem("ASTM D1186")
        self.tipoCurva.addItem("ASTM D2887 (SD)")
        self.tipoCurva.setEnabled(False)
        layout.addWidget(self.tipoCurva, 4, 4, 1, 2)
        self.textoPresion = QtGui.QLabel(
            QtGui.QApplication.translate("pychemqt", "Pressure"))
        self.textoPresion.setEnabled(False)
        layout.addWidget(self.textoPresion, 5, 4)
        self.presion = Entrada_con_unidades(Pressure, value=101325.)
        self.presion.setEnabled(False)
        self.presion.valueChanged.connect(partial(self.changeParams, "P_dist"))
        layout.addWidget(self.presion, 5, 5)
        self.curvaDestilacion = Tabla(
            2, filas=1, horizontalHeader=["%dist", "Tb, "+Temperature.text()],
            verticalHeader=False, dinamica=True)
        self.curvaDestilacion.setEnabled(False)
        self.curvaDestilacion.editingFinished.connect(self.changeCurva)
        layout.addWidget(self.curvaDestilacion, 6, 4, 13, 2)
        self.checkBlend = QtGui.QCheckBox(QtGui.QApplication.translate(
            "pychemqt", "Blend if its necessary"))
        layout.addWidget(self.checkBlend, 19, 4, 1, 2)

        self.checkCurva.toggled.connect(self.tipoCurva.setEnabled)
        self.checkCurva.toggled.connect(self.presion.setEnabled)
        self.checkCurva.toggled.connect(self.textoPresion.setEnabled)
        self.checkCurva.toggled.connect(self.curvaDestilacion.setEnabled)

        layout.addItem(QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed), 20, 1, 1, 2)
        self.checkCrudo = QtGui.QCheckBox(QtGui.QApplication.translate(
            "pychemqt", "Use petrol fraction from list"))
        self.checkCrudo.toggled.connect(self.changeUnknown)
        layout.addWidget(self.checkCrudo, 21, 1, 1, 2)
        self.crudo = QtGui.QComboBox()
        self.crudo.setEnabled(False)
        self.crudo.addItem("")
        for i in crudo[1:]:
            self.crudo.addItem("%s (%s)  API: %s %S: %s" % (i[0], i[1], i[3], i[4]))
            # i[0]+" ("+i[1]+")"+"   API: "+str(i[3])+"  %S: "+str(i[4]))
        self.crudo.currentIndexChanged.connect(partial(
            self.changeParams, "indice"))
        layout.addWidget(self.crudo, 23, 1, 1, 5)
        layout.addWidget(QtGui.QLabel("Pseudo C+"), 24, 1)
        self.Cplus = Entrada_con_unidades(int, width=50, spinbox=True, step=1,
                                          min=6)
        self.Cplus.valueChanged.connect(partial(self.changeParams, "Cplus"))
        layout.addWidget(self.Cplus, 24, 2)
        self.checkCrudo.toggled.connect(self.crudo.setEnabled)
        self.checkCrudo.toggled.connect(self.Cplus.setEnabled)
        layout.addItem(QtGui.QSpacerItem(5, 5, QtGui.QSizePolicy.Expanding,
                                         QtGui.QSizePolicy.Expanding), 29, 1, 1, 2)

        newComponent.loadUI(self)

        self.Petroleo = Petroleo()
        self.Crudo = Crudo()

    @property
    def unknown(self):
        if self.checkCrudo.isChecked():
            return self.Crudo
        else:
            return self.Petroleo

    def changeUnknown(self):
        self.status.setState(self.unknown.status, self.unknown.msg)
        self.buttonShowDetails.setEnabled(self.unknown.status)
        self.buttonBox.button(QtGui.QDialogButtonBox.Save).setEnabled(
            self.unknown.status)

    def changeCurva(self):
        temp = self.curvaDestilacion.getColumn(0)
        T_dist = self.curvaDestilacion.getColumn(1)
        curvas = ["D86", "TBP", "EFV", "D1160", "SD"]
        x = curvas.pop(self.tipoCurva.currentIndex())
        kwargs = {}
        kwargs[x] = temp
        kwargs["Tdist"] = T_dist
        for curva in curvas:
            kwargs[curva] = []
        self.calculo(**kwargs)
开发者ID:edusegzy,项目名称:pychemqt,代码行数:104,代码来源:newComponent.py


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