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


Python Tabla.setRowHeight方法代码示例

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


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

示例1: UI_equipment

# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import setRowHeight [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


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