class UI_equipment(UI_equip): """Mixer equipment edition dialog""" Equipment = Mixer() def __init__(self, equipment=None, entradas=1, parent=None): """ equipment: Initial equipment instance to model entradas: Stream Input number to equipment """ super().__init__(Mixer, salida=False, parent=parent) # Input tab for i in range(entradas): entrada = UI_corriente.Ui_corriente() entrada.Changed.connect(partial(self.cambiarEntrada, i)) self.Entrada.addTab(entrada, str(i+1)) # Calculate tab lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo) lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate( "pychemqt", "Output Pressure Method")), 1, 1) self.criterio = QtWidgets.QComboBox() for txt in self.Equipment.TEXT_METODO: self.criterio.addItem(txt) self.criterio.currentIndexChanged.connect(self.criterio_Changed) lyt_Calc.addWidget(self.criterio, 1, 2) lyt_Calc.addItem(QtWidgets.QSpacerItem( 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed), 2, 1, 1, 3) lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate( "pychemqt", "Output Pressure")), 3, 1) self.Pout = Entrada_con_unidades(Pressure) self.Pout.valueChanged.connect(partial(self.changeParams, "Pout")) lyt_Calc.addWidget(self.Pout, 3, 2) lyt_Calc.addItem(QtWidgets.QSpacerItem( 20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding), 4, 1, 1, 3) self.criterio_Changed(0) if equipment: self.setEquipment(equipment) else: self.Equipment = Mixer(entradas=entradas) def criterio_Changed(self, int): self.Pout.setEnabled(int == 2) self.changeParams("criterio", int) def cambiarEntrada(self, ind, corriente): self.Equipment(id_entrada=ind, entrada=corriente) def rellenarInput(self): UI_equip.rellenarInput(self) for i, entrada in enumerate(self.Equipment.kwargs["entrada"]): if entrada: self.Entrada.widget(i).setCorriente(entrada)
def __init__(self, equipment=None, entradas=1, parent=None): """ equipment: Initial equipment instance to model entradas: Stream Input number to equipment """ super(UI_equipment, self).__init__(Mixer, salida=False, parent=parent) # Input tab for i in range(entradas): entrada = UI_corriente.Ui_corriente() entrada.Changed.connect(partial(self.cambiarEntrada, i)) self.entrada.addTab(entrada, str(i + 1)) # Calculate tab lyt_Calc = QtGui.QGridLayout(self.tabCalculo) lyt_Calc.addWidget( QtGui.QLabel( QtGui.QApplication.translate("pychemqt", "Output Pressure Method")), 1, 1) self.criterio = QtGui.QComboBox() for txt in self.Equipment.TEXT_METODO: self.criterio.addItem(txt) self.criterio.currentIndexChanged.connect(self.criterio_Changed) lyt_Calc.addWidget(self.criterio, 1, 2) lyt_Calc.addItem( QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 2, 1, 1, 3) lyt_Calc.addWidget( QtGui.QLabel( QtGui.QApplication.translate("pychemqt", "Output Pressure")), 3, 1) self.Pout = Entrada_con_unidades(Pressure) self.Pout.valueChanged.connect(partial(self.changeParams, "Pout")) lyt_Calc.addWidget(self.Pout, 3, 2) lyt_Calc.addItem( QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding), 4, 1, 1, 3) self.criterio_Changed(0) if equipment: self.setEquipment(equipment) else: self.Equipment = Mixer(entradas=entradas)
# project.setInput(2, fria) # Cambiador(modo=1, # DiTube=0.0525, DeTube=0.0603, DeeTube=0.0779, kTube=54, rTube=0.0459994e-3, # annulliFouling= 0.000352, tubeFouling=0.000176, LTube=2.5) # project.setItem(1, Cambiador) # print project.getOutput(1), project.getStream(2) # eq=project.getItem(1) # print eq.kwargs # print eq.status, eq.msg # print "Project has cycle: ", project.hasCycle() # bomba(entrada=entrada, rendimiento=0.75, deltaP=2) # # items={"i1": entrada, "e1": bomba} # streams=[("i1", "e1", 0, 0), ("e1", "o1", 0, 0)] # # project=Project(items=items, streams=streams) # project.printer() # print dir(gv) # print gv.nextin(project.graph) project = Project() project.addItem("i1", Corriente()) project.addItem("i2", Corriente()) mezclador = Mixer() project.addItem("e1", mezclador) project.addStream(1, "i1", "e1", ind_down=0) project.addStream(2, "i2", "e1", ind_down=1) project.addItem("o1", Corriente()) project.addStream(3, "e1", "o1")
else: self.Equipment = Mixer(entradas=entradas) def criterio_Changed(self, int): self.Pout.setEnabled(int == 2) self.changeParams("criterio", int) def cambiarEntrada(self, ind, corriente): self.Equipment(id_entrada=ind, entrada=corriente) def rellenarInput(self): UI_equip.rellenarInput(self) for i, entrada in enumerate(self.Equipment.kwargs["entrada"]): if entrada: self.Entrada.widget(i).setCorriente(entrada) if __name__ == "__main__": import sys from lib.corriente import Corriente app = QtWidgets.QApplication(sys.argv) agua = Corriente(T=300, P=101325., caudalMasico=1, ids=[62], fraccionMasica=[1.]) agua2 = Corriente(T=300, P=101325.*2, caudalMasico=2, ids=[62], fraccionMasica=[1.]) # mezclador = Mixer(entrada=[agua, agua2], criterio=0) mezclador = Mixer(criterio=0) dialogo = UI_equipment(mezclador, entradas=2) dialogo.show() sys.exit(app.exec_())
self.Equipment = Mixer(entradas=entradas) def criterio_Changed(self, int): self.Pout.setEnabled(int == 2) self.changeParams("criterio", int) def cambiarEntrada(self, ind, corriente): self.Equipment(id_entrada=ind, entrada=corriente) def rellenarInput(self): UI_equip.rellenarInput(self) for i, entrada in enumerate(self.Equipment.kwargs["entrada"]): if entrada: self.entrada.widget(i).setCorriente(entrada) if __name__ == "__main__": import sys from lib.corriente import Corriente app = QtGui.QApplication(sys.argv) agua = Corriente(T=300, P=101325., caudalMasico=1, fraccionMasica=[1.]) agua2 = Corriente(T=300, P=101325. * 2, caudalMasico=2, fraccionMasica=[1.]) mezclador = Mixer(entrada=[agua, agua2], criterio=0) # mezclador=Mixer(criterio=0) dialogo = UI_equipment(mezclador, entradas=2) dialogo.show() sys.exit(app.exec_())