本文整理汇总了Python中UI.widgets.Tabla.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python Tabla.setEnabled方法的具体用法?Python Tabla.setEnabled怎么用?Python Tabla.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI.widgets.Tabla
的用法示例。
在下文中一共展示了Tabla.setEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UI_equipment
# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import setEnabled [as 别名]
class UI_equipment(UI_equip):
"""Spreadsheet interaction equipment edition dialog"""
Equipment = Spreadsheet()
def __init__(self, equipment=None, project=None, parent=None):
"""
equipment: Initial equipment instance to model
"""
super().__init__(Spreadsheet, entrada=True, salida=True,
calculo=False, parent=parent)
self.project = project
# Calculate tab
layout = QtWidgets.QGridLayout(self.Entrada)
label = QtWidgets.QApplication.translate(
"pychemqt", "Spreadsheet path")+":"
msg = QtWidgets.QApplication.translate(
"pychemqt", "Select Spreadsheet")
patrones = []
if os.environ["ezodf"]:
patrones.append(QtWidgets.QApplication.translate(
"pychemqt", "Libreoffice spreadsheet files")+" (*.ods)")
if os.environ["xlwt"]:
patrones.append(QtWidgets.QApplication.translate(
"pychemqt", "Microsoft Excel 97/2000/XP/2003 XML")+" (*.xls)")
if os.environ["openpyxl"]:
patrones.append(QtWidgets.QApplication.translate(
"pychemqt", "Microsoft Excel 2007/2010 XML")+" (*.xlsx)")
patron = ";;".join(patrones)
self.filename = PathConfig(label, msg=msg, patron=patron)
self.filename.valueChanged.connect(self.changeSpreadsheet)
layout.addWidget(self.filename, 1, 1)
header = [QtWidgets.QApplication.translate("pychemqt", "Entity"),
QtWidgets.QApplication.translate("pychemqt", "Variable"),
QtWidgets.QApplication.translate("pychemqt", "Unit value"),
QtWidgets.QApplication.translate("pychemqt", "Sheet"),
QtWidgets.QApplication.translate("pychemqt", "Cell")]
self.datamap = Tabla(
5, filas=1, dinamica=True, horizontalHeader=header,
verticalHeader=False, orientacion=QtCore.Qt.AlignLeft,
delegate=None, delegateforRow=TableDelegate, parent=self)
self.datamap.setEnabled(False)
self.datamap.cellChanged.connect(self.cellChanged)
self.datamap.rowFinished.connect(self.addRow)
layout.addWidget(self.datamap, 2, 1)
layout.addItem(QtWidgets.QSpacerItem(
10, 10, QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding), 10, 1)
entitys = []
for stream in list(self.project.streams.keys()):
entitys.append("s%i" % stream)
for equip in list(self.project.items.keys()):
if equip[0] == "e":
entitys.append(equip)
self.datamap.itemDelegateForRow(0).setItemsByIndex(0, entitys)
self.entitys = entitys
if equipment:
self.setEquipment(equipment)
def changeSpreadsheet(self, path):
self.datamap.setEnabled(bool(path))
self.changeParams("filename", str(path))
self.datamap.blockSignals(True)
self.datamap.clear()
self.datamap.blockSignals(False)
spreadsheet = ezodf.opendoc(path)
sheets = [name for name in spreadsheet.sheets.names()]
self.datamap.itemDelegateForRow(0).setItemsByIndex(3, sheets)
def rellenarInput(self):
self.blockSignals(True)
self.datamap.itemDelegateForRow(
self.datamap.rowCount()-1).setItemsByIndex(0, self.entitys)
if self.Equipment.status:
self.datamap.setEnabled(True)
self.filename.setText(self.Equipment.kwargs["filename"])
self.datamap.itemDelegateForRow(0).setItemsByIndex(
3, self.Equipment.sheets)
self.datamap.blockSignals(True)
self.datamap.clear()
if self.Equipment.kwargs["datamap"]:
for i, data in enumerate(self.Equipment.kwargs["datamap"]):
self.datamap.addRow()
self.datamap.itemDelegateForRow(i).setItemsByIndex(
0, self.entitys)
self.datamap.itemDelegateForRow(i).setItemsByIndex(
3, self.Equipment.sheets)
self.datamap.setItem(
i, 0, QtWidgets.QTableWidgetItem(data["entity"]))
self.datamap.setItem(
i, 1, QtWidgets.QTableWidgetItem(data["property"]))
self.datamap.setItem(
i, 2, QtWidgets.QTableWidgetItem(data["unit"]))
self.datamap.setItem(
i, 3, QtWidgets.QTableWidgetItem(data["sheet"]))
self.datamap.setItem(
i, 4, QtWidgets.QTableWidgetItem(data["cell"]))
self.datamap.itemDelegateForRow(
#.........这里部分代码省略.........
示例2: UI_reacciones
# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import setEnabled [as 别名]
#.........这里部分代码省略.........
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)
self.Estequiometria.item(len(self.indices), 0).setText(str(self.reaction.error))
if self.reaction.status:
self.Formula.setText(self.reaction._txt())
self.Hr.setValue(self.reaction.Hr)
def KeqChanged(self):
self.Keq.setReadOnly(not self.check_KFijo.isChecked())
self.KEq_Dat.setEnabled(self.check_KEq.isChecked())
self.KEq_Tab.setEnabled(self.check_KTabla.isChecked())
self.botonTablaClear.setEnabled(self.check_KTabla.isChecked())
self.botonTablaPlot.setEnabled(self.check_KTabla.isChecked())
def Regresion(self):
t=array(self.KEq_Tab.getColumn(0)[:-1])
k=array(self.KEq_Tab.getColumn(1)[:-1])
if len(t)>=4:
if 4<=len(t)<8:
inicio=r_[0, 0, 0, 0]
f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
resto=lambda par, T, k: k-f(par, T)
else:
inicio=r_[0, 0, 0, 0, 0, 0, 0, 0]
f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)
resto=lambda par, T, k: k-f(par, T)
ajuste=leastsq(resto,inicio,args=(t, k))
kcalc=f(ajuste[0], t)
error=(k-kcalc)/k*100
self.KEq_Dat.setColumn(0, ajuste[0])
self.KEq_Tab.setColumn(2, kcalc)
self.KEq_Tab.setColumn(3, error)
if ajuste[1] in [1, 2, 3, 4]:
self.ajuste=ajuste[0]
def Plot(self):
if self.ajuste!=None:
t=array(self.KEq_Tab.getColumn(0)[:-1])
k=array(self.KEq_Tab.getColumn(1)[:-1])
if 4<=len(t)<8:
f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
else:
f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)
grafico=plot.Plot()
grafico.data(t, k, 'ro', t, f(self.ajuste, t))
grafico.exec_()
示例3: Definicion_Petro
# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import setEnabled [as 别名]
class Definicion_Petro(newComponent):
"""Dialog for define hypothetical crude and oil fraction"""
ViewDetails = View_Petro
def __init__(self, parent=None):
super(Definicion_Petro, self).__init__(parent)
self.setWindowTitle(QtGui.QApplication.translate(
"pychemqt", "Petrol component definition"))
layout = QtGui.QGridLayout(self)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Name")), 1, 1)
self.nombre = QtGui.QLineEdit()
self.nombre.textChanged.connect(partial(self.changeParams, "name"))
layout.addWidget(self.nombre, 1, 2, 1, 4)
layout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed), 2, 1, 1, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Boiling point")), 3, 1)
self.Tb = Entrada_con_unidades(Temperature)
self.Tb.valueChanged.connect(partial(self.changeParams, "Tb"))
layout.addWidget(self.Tb, 3, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Molecular Weight")), 4, 1)
self.M = Entrada_con_unidades(float, textounidad="g/mol")
self.M.valueChanged.connect(partial(self.changeParams, "M"))
layout.addWidget(self.M, 4, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Specific Gravity")), 5, 1)
self.SG = Entrada_con_unidades(float)
self.SG.valueChanged.connect(partial(self.changeParams, "SG"))
layout.addWidget(self.SG, 5, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "API gravity")), 6, 1)
self.API = Entrada_con_unidades(float)
self.API.valueChanged.connect(partial(self.changeParams, "API"))
layout.addWidget(self.API, 6, 2)
layout.addWidget(QtGui.QLabel("K watson:"), 7, 1)
self.Kw = Entrada_con_unidades(float)
self.Kw.valueChanged.connect(partial(self.changeParams, "Kw"))
layout.addWidget(self.Kw, 7, 2)
layout.addWidget(QtGui.QLabel("C/H:"), 8, 1)
self.CH = Entrada_con_unidades(float)
self.CH.valueChanged.connect(partial(self.changeParams, "CH"))
layout.addWidget(self.CH, 8, 2)
layout.addWidget(QtGui.QLabel(u"ν<sub>100F</sub>:"), 9, 1)
self.v100 = Entrada_con_unidades(Diffusivity)
self.v100.valueChanged.connect(partial(self.changeParams, "v100"))
layout.addWidget(self.v100, 9, 2)
layout.addWidget(QtGui.QLabel(u"ν<sub>210F</sub>:"), 10, 1)
self.v210 = Entrada_con_unidades(Diffusivity)
self.v210.valueChanged.connect(partial(self.changeParams, "v210"))
layout.addWidget(self.v210, 10, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Refraction index")), 11, 1)
self.n = Entrada_con_unidades(float)
self.n.valueChanged.connect(partial(self.changeParams, "n"))
layout.addWidget(self.n, 11, 2)
layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
"pychemqt", "Huang parameter")), 12, 1)
self.I = Entrada_con_unidades(float)
self.I.valueChanged.connect(partial(self.changeParams, "I"))
layout.addWidget(self.I, 12, 2)
layout.addWidget(QtGui.QLabel("%S"), 13, 1)
self.S = Entrada_con_unidades(float, spinbox=True, step=1.0, max=100)
self.S.valueChanged.connect(partial(self.changeParams, "S"))
layout.addWidget(self.S, 13, 2)
layout.addWidget(QtGui.QLabel("%H"), 14, 1)
self.H = Entrada_con_unidades(float, spinbox=True, step=1.0, max=100)
self.H.valueChanged.connect(partial(self.changeParams, "H"))
layout.addWidget(self.H, 14, 2)
layout.addWidget(QtGui.QLabel("%N"), 15, 1)
self.N = Entrada_con_unidades(float, spinbox=True, step=1.0, max=100)
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.)
#.........这里部分代码省略.........