Source code for equipment.widget.wirecoil

#!/usr/bin/python3
# -*- coding: utf-8 -*-

'''Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2025, Juan José Gómez Romera <jjgomera@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


Helical wire-coil insert is a enhancement for heat transfer of a pipe. This
module implement several correlation to calculate its thermal eficiency and
friction factor

Friction factor:

    * :func:`f_wire_Garcia`: García et al. (2005)
    * :func:`f_wire_Inaba`: Inaba et al. (1994)
    * :func:`f_wire_Naphon`: Naphon (2006)
    * :func:`f_wire_Gunes`: Gunes et al. (2010)
    * :func:`f_wire_Ravigururajan`: Ravigururajan-Bergles (1996)
    * :func:`f_wire_Sethumadhavan`: Sethumadhavan-Raja Rao (1983)
    * :func:`f_wire_Yakut`: Yakut-Sahin (2004)

Heat transfer:

    * :func:`Nu_wire_Garcia`: García et al. (2005)
    * :func:`Nu_wire_Uttarwar`: Uttarwar-Raja Rao (1985)
    * :func:`Nu_wire_Inaba`: Inaba et al. (1994)
    * :func:`Nu_wire_Naphon`: Naphon (2006)
    * :func:`Nu_wire_Gunes`: Gunes et al. (2010)
    * :func:`Nu_wire_Klaczak`: Klaczak (1973)
    * :func:`Nu_wire_Ravigururajan`: Ravigururajan-Bergles (1996)
    * :func:`Nu_wire_Sethumadhavan`: Sethumadhavan-Raja Rao (1983)
    * :func:`Nu_wire_Yakut`: Yakut-Sahin (2004)


All methods are integrated in:

* :class:`WireCoil`. A simple callable to integrate all calculation method
* :class:`UI_WireCoil`. Graphical interface to define methods and properties


'''

from functools import partial
from math import pi, log, atan, tan

from scipy.optimize import newton
from tools.qt import QtCore, QtWidgets, translate

from equipment.widget.gui import ToolGui, CallableEntity
from lib.unidades import Length
from lib.utilities import refDoc
from UI.widgets import Entrada_con_unidades


__doi__ = {
    1:
        {"autor": "García, A., Vicente, P.G., Viedma, A.",
         "title": "Experimental study of heat transfer enhancement with "
                  "wire coil inserts in laminar-transition-turbulent regimes "
                  "at different Prandtl numbers",
         "ref": "Int. J. Heat Mass Transfer 48(21-22) (2005) 4640-4651",
         "doi": "10.1016/j.ijheatmasstransfer.2005.04.024"},
    2:
        {"autor": "Uttarwar, S.B., Raja Rao, M.",
         "title": "Augmentation of Laminar Flow Heat Transfer in Tubes by "
                  "Means of Wire Coil Inserts",
         "ref": "J. Heat Transfer 107(4) (1985) 930-935",
         "doi": "10.1115/1.3247523"},
    3:
        {"autor": "Inaba, H., Ozaki, K., Kanaoka, S.",
         "title": "A Fundamental Study of Heat-Transfer Enhancement and "
                  "Flow-Drag Reduction in Tubes by Means of Wire Coil Insert",
         "ref": "Trans. Jpn. Soc. Mech. Eng. 60 (1994) 240-247",
         "doi": "10.1299/kikaib.60.240"},
    4:
        {"autor": "Naphon, P.",
         "title": "Effect of coil-wire insert on heat trasnfer enhancement "
                  "pressure drop of the horizontal concentric tubes",
         "ref": "Int. Comm. Heat Mass Transfer 33(6) (2006) 753-763",
         "doi": "10.1016/j.icheatmasstransfer.2006.01.020"},
    5:
        {"autor": "Gunes, S., Ozceyhan, V., Buyukalaca, O.",
         "title": "Heat transfer enhancement in a tube with equilateral "
                  "triangle cross sectioned coiled wire inserts",
         "ref": "Exp. Thermal Fluid Sci. 34(6) (2010) 684-691",
         "doi": "10.1016/j.expthermflusci.2009.12.010"},
    6:
        {"autor": "Klaczak, A.",
         "title": "Heat Transfer in Tubes With Spiral and Helical "
                  "Turbulators",
         "ref": "J. Heat Transfer 95(4) (1973) 557-559",
         "doi": "10.1115/1.3450114"},
    7:
        {"autor": "Ravigururajan, T.S., Bergles, A.E.",
         "title": "Development and Verification of General Correlations for"
                  "Pressure Drop and Heat Transfer in Single-Phase Turbulent "
                  "Flow in Enhanced Tubes",
         "ref": "Exp. Thermal Fluid Sci. 13(1) (1996) 55-70",
         "doi": "10.1016/0894-1777(96)00014-3"},
    8:
        {"autor": "Sethumadhavan, R., Raja Rao, M.",
         "title": "Turbulent Flow Heat Transfer and Fluid Friction in "
                  "Helical-Wire-Coil-Inserted Tubes",
         "ref": "Int. J. Heat Mass Transfer 26(12) (1983) 1833-1845",
         "doi": "10.1016/s0017-9310(83)80154-9"},
    9:
        {"autor": "Yakut, K., Sahin, B.",
         "title": "The effects of vortex characteristics on performance of "
                  "coiled wire turbulators used for heat transfer augmentation",
         "ref": "Applied Thermal Eng. 24(16) (2004) 2427-2438",
         "doi": "10.1016/j.applthermaleng.2004.03.008"}}


# Friction factor correlations
[docs] @refDoc(__doi__, [1]) def f_wire_Garcia(Re, P, e): """Calculate friction factor for a pipe with a wire coil using the Garcia et al. correlation (2005). Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] Returns ------- f : float Friction factor, [-] """ # Eq 4 f = 9.35*(P/e)**-1.16*Re**-0.217 return f
[docs] @refDoc(__doi__, [3]) def f_wire_Inaba(Re, P, e): """Calculate friction factor for a pipe with a wire coil using the Inaba correlation (1994). Valid for P/e > 10, for bellow ratio the pipe is like a rough pipe Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] Returns ------- f : float Friction factor, [-] """ # Eq 7 f = 11.5*Re**-0.39*(P/e)**-0.87 return f
[docs] @refDoc(__doi__, [4]) def f_wire_Naphon(Re, P, D): """Calculate friction factor for a pipe with a wire coil using the Naphon correlation (2006). Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] D : float Internal diameter of tube, [m] Returns ------- f : float Friction factor, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Eq 7 f = 322.92*log(Re)**-1.849*(P/D)**0.061 return f
[docs] @refDoc(__doi__, [5]) def f_wire_Gunes(Re, P, a, D): """Calculate friction factor for a pipe with a wire coil using the Gunes et al. correlation (2010). This correlation apply to a special wire coil of triangular shape. Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] a : float side length of equilateral triangle in the wire cross section D : float Internal diameter of tube, [m] Returns ------- f : float Friction factor, [-] """ if Re < 3500: raise NotImplementedError("Input out of bound") # Eq 15 f = 83.70924 * Re**-0.305268 * (P/D)**-0.388*(a/D)**1.319018 return f
[docs] @refDoc(__doi__, [7]) def f_wire_Ravigururajan(Re, P, e, D): """Calculate friction factor for a pipe with a wire coil using the Ravigururajan-Bergles correlation (1996). Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] Returns ------- f : float Friction factor, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Helix angle alpha = atan(P/pi/D)*180/pi # Eq 4 rhs = (1 + (29.1*Re**(0.67-0.06*P/D-0.49*alpha/90) * (e/D)**(1.37-0.157*P/D) * (P/D)**(-1.66e-6*Re-0.33*alpha/90) * (alpha/90)**(4.59+4.11e-6*Re-0.15*P/D))**(15/16))**(16/15) fs = (1.58*log(Re)-3.28)**-2 # Eq 1 return fs*rhs
[docs] @refDoc(__doi__, [8]) def f_wire_Sethumadhavan(Re, P, e, D): """Calculate friction factor for a pipe with a wire coil using the Sethumadhavan-Raja Rao correlation (1983). Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] Returns ------- f : float Friction factor, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Helix angle alpha = atan(P/pi/D)*180/pi Deq = D-e # Eq 13 def f_res(f): """Iterative solution of intrinsic equation""" R = (2/f)**0.5 + 2.5*log(2*e/Deq) + 3.75 h = e/Deq * Re * (f/2)**0.5 return R*tan(alpha)**0.18-7*h**0.13 fo = f_wire_Garcia(Re, P, e) f = newton(f_res, fo) if isinstance(f, complex): raise ValueError("Solution don't converge") return f
[docs] @refDoc(__doi__, [9]) def f_wire_Yakut(Re, P, D): """Calculate nusselt number for a pipe with a wire coil using the Yakut-Sahin correlation (2004). Parameters ---------- Re : float Reynolds number, [-] P : float helical pitch for twist of 2π radians (360º), [m] D : float Internal diameter of tube, [m] Returns ------- f : float Friction factor, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Eq 13 f = 4.44 / Re**0.218 / (P/D)**0.223 return f
# Heat Transfer coefficient correlations
[docs] @refDoc(__doi__, [1]) def Nu_wire_Garcia(Re, Pr, P, e): """Calculate Nusselt number for a pipe with a wire coil using the Garcia et al. correlation (2005). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] Returns ------- Nu : float Nusselt number, [-] """ # Eq 10 Nu = 0.132*(P/e)**-0.372*Re**0.72*Pr**0.37 return Nu
[docs] @refDoc(__doi__, [2]) def Nu_wire_Uttarwar(Re, Pr, P, D, mu=None, muW=None): """Calculate Nusselt number for a pipe with a wire coil using the Uttarwar- Raja Rao correlation (1985). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] mu : float Bulk flow temperature viscosity, [Pa·s] muW : float Wall flow temperature viscosity, [Pa·s] Returns ------- Nu : float Nusselt number, [-] """ # Helix angle tan_alpha = P/pi/D # Eq 8 Nu = 1.65*tan_alpha * Re**(0.25*tan_alpha**-0.38)*Pr**0.35 if mu and muW: Nu *= (mu/muW)**0.14 return Nu
[docs] @refDoc(__doi__, [3]) def Nu_wire_Inaba(Re, Pr, P, e): """Calculate Nusselt number for a pipe with a wire coil using the Inaba correlation (1994). Valid for P/e > 10, for bellow ratio the pipe is like a rough pipe Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 2000: # Eq 11 Nu = 0.225*Re**0.8*Pr**(1/3)*(P/e)**-0.48 else: # Eq 10 Nu = 0.803*Re**0.63*Pr**(1/3)*(P/e)**-0.48 return Nu
[docs] @refDoc(__doi__, [4]) def Nu_wire_Naphon(Re, Pr, P, D): """Calculate Nusselt number for a pipe with a wire coil using the Naphon correlation (2006). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Eq 6 Nu = 0.156*Re**0.512*Pr**(1/3)*(P/D)**0.253 return Nu
[docs] @refDoc(__doi__, [5]) def Nu_wire_Gunes(Re, Pr, P, a, D): """Calculate Nusselt number for a pipe with a wire coil using the Gunes correlation (2010). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] a : float side length of equilateral triangle in the wire cross section D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 3500: raise NotImplementedError("Input out of bound") # Eq 14 Nu = 0.598417*Re**0.745064 * (P/D)**-0.268374 * (a/D)**0.813205 * Pr**0.39 return Nu
[docs] @refDoc(__doi__, [6]) def Nu_wire_Klaczak(Re, Pr, P, e, D): """Calculate Nusselt number for a pipe with a wire coil using the Klaczak correlation (1973). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 1700: raise NotImplementedError("Input out of bound") # Eq 15 Nu = 1.04 * Re**0.52 * Pr**0.54 * (D/P)**0.29 * (e/D)**0.35 return Nu
[docs] @refDoc(__doi__, [7]) def Nu_wire_Ravigururajan(Re, Pr, P, e, D): """Calculate Nusselt number for a pipe with a wire coil using the Ravigururajan-Bergles correlation (1996). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Helix angle alpha = atan(P/pi/D)*180/pi # Eq 7 rhs = (1 + (2.64*Re**0.036*(e/D)**0.212 * (P/D)**-0.21 * (alpha/90)**0.29*Pr**0.024)**7)**(1/7) fs = (1.58*log(Re)-3.28)**-2 # Eq 1 Nus = fs/2*Re*Pr/(1+12.7*(fs/2)**0.5*(Pr**(2/3)-1)) return Nus*rhs
[docs] @refDoc(__doi__, [8]) def Nu_wire_Sethumadhavan(Re, Pr, P, e, D): """Calculate Nusselt number for a pipe with a wire coil using the Sethumadhavan-Raja Rao correlation (1983). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Helix angle alpha = atan(P/pi/D)*180/pi Deq = D-e f = f_wire_Garcia(Re, P, e) h = e/Deq * Re * (f/2)**0.5 R = (2/f)**0.5 + 2.5*log(2*e/Deq) + 3.75 # Eq 16 G = 8.6*h**0.13/tan(alpha)**0.18/Pr**-0.55 # Eq 7 St = 1/((((G-R)*(f/2)**0.5)+1)*2/f) return St*Re*Pr
[docs] @refDoc(__doi__, [9]) def Nu_wire_Yakut(Re, Pr, P, D): """Calculate nusselt number for a pipe with a wire coil using the Yakut-Sahin correlation (2004). Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] P : float helical pitch for twist of 2π radians (360º), [m] D : float Internal diameter of tube, [m] Returns ------- Nu : float Nusselt number, [-] """ if Re < 5000: raise NotImplementedError("Input out of bound") # Eq 12 Nu = 0.91 * Re**0.522 * Pr**0.4 * (P/D)**0.128 return Nu
[docs] class WireCoil(CallableEntity): """Wire coil insert for pipe to improve heat transfer Parameters ---------- P : float helical pitch for twist of 2π radians (360º), [m] e : float Wire diameter, [m] """ TEXT_FRICTION = ( "García (2005)", "Inaba (1994)", "Naphon (2006)", "Gunes (2010)", "Ravigururajan (1996)", "Sethumadhavan-Raja Rao (1983)", "Yakut-Sahin (2004)") TEXT_HEAT = ( "García (2005)", "Uttarwar-Raja Rao (1985)", "Inaba (1994)", "Naphon (2006)", "Gunes (2010)", "Klaczak (1973)", "Ravigururajan (1996)", "Sethumadhavan-Raja Rao (1983)", "Yakut-Sahin (2004)") status = 0 msg = "" kw = { "methodFriction": 0, "methodHeat": 0, "P": 0, "e": 0} valueChanged = QtCore.pyqtSignal(object) inputChanged = QtCore.pyqtSignal(object) @property def isCalculable(self): """Check if all input are defined""" if not self.kw["P"]: self.msg = translate("equipment", "undefined wire coil pitch") self.status = 0 return False if not self.kw["e"]: self.msg = translate("equipment", "undefined wire coil diameter") self.status = 0 return False self.msg = "" self.status = 1 return True
[docs] def calculo(self): """Definition of twisted tape inserts for annuli sections""" self.e = self.kw["e"] self.P = self.kw["P"] self.valueChanged.emit(self)
[docs] def Nu(self, Re, Pr, D, mu, muW, method=None): """Calculate nusselt number""" msg = "" if method is None: method = self.kw["methodHeat"] if method == 1: # Uttarwar-Raja Rao (1985) Nu = Nu_wire_Uttarwar(Re, Pr, self.P, D, mu, muW) elif method == 2: # Inaba (1994) Nu = Nu_wire_Inaba(Re, Pr, self.P, self.e) elif method == 3: # Naphon (2006) if Re < 5000: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Naphon correlation only valid in turbulent flow, using " msg += "Garcia instead" else: Nu = Nu_wire_Naphon(Re, Pr, self.P, D) elif method == 4: # Gunes (2010) if Re < 3500: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Gunes Ncorrelation only valid in turbulent flow, using " msg += "Garcia instead" else: Nu = Nu_wire_Gunes(Re, Pr, self.P, self.e, D) elif method == 5: # Klaczak (1973) if Re < 1700: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Klaczak correlation only valid in turbulent flow, using" msg += " Garcia instead" else: Nu = Nu_wire_Klaczak(Re, Pr, self.P, self.e, D) elif method == 6: # Ravigururajan (1996) if Re < 5000: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Ravigururajan correlation only valid in turbulent flow," msg += " using Garcia instead" else: Nu = Nu_wire_Ravigururajan(Re, Pr, self.P, self.e, D) elif method == 7: # Sethumadhavan-Raja Rao (1983) if Re < 5000: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Sethumadhavan correlation only valid in turbulent flow," msg += " using Garcia instead" else: Nu = Nu_wire_Sethumadhavan(Re, Pr, self.P, self.e, D) elif method == 8: # Yakut-Sahin (2004) if Re < 5000: Nu = self.Nu(Re, Pr, D, mu, muW, 0) msg = "Yakut-Sahin correlation only valid in turbulent flow," msg += " using Garcia instead" else: Nu = Nu_wire_Yakut(Re, Pr, self.P, D) else: # García (2005) Nu = Nu_wire_Garcia(Re, Pr, self.P, self.e) if msg: self.status = 3 self.msg = translate("equipment", msg) self.inputChanged.emit(self) return Nu
[docs] def f(self, Re, D, method=None): """Calculate friction factor""" msg = "" if method is None: method = self.kw["methodFriction"] if method == 1: # Inaba (1994) f = f_wire_Inaba(Re, self.P, self.e) elif method == 2: # Naphon (2006) if Re < 5000: f = self.f(Re, D, 0) msg = "Naphon correlation only valid in turbulent flow, using " msg += "Garcia instead" f = f_wire_Naphon(Re, self.P, D) elif method == 3: # Gunes (2010) if Re < 3500: f = self.f(Re, D, 0) msg = "Gunes Ncorrelation only valid in turbulent flow, using " msg += "Garcia instead" else: f = f_wire_Gunes(Re, self.P, self.e, D) elif method == 4: # Ravigururajan (1996) if Re < 5000: f = self.f(Re, D, 0) msg = "Ravigururajan correlation only valid in turbulent flow," msg += " using Garcia instead" else: f = f_wire_Ravigururajan(Re, self.P, self.e, D) elif method == 5: # Sethumadhavan-Raja Rao (1983) if Re < 5000: f = self.f(Re, D, 0) msg = "Ravigururajan correlation only valid in turbulent flow," msg += " using Garcia instead" else: try: f = f_wire_Sethumadhavan(Re, self.P, self.e, D) except ValueError: f = self.f(Re, D, 0) msg = "Ravigururajan correlation don't converge," msg += " using Garcia instead" elif method == 6: # Yakut-Sahin (2004) if Re < 5000: f = self.f(Re, D, 0) msg = "Yakut-Sahin correlation only valid in turbulent flow," msg += " using Garcia instead" else: f = f_wire_Yakut(Re, self.P, D) else: # García (2005) f = f_wire_Garcia(Re, self.P, self.e) if msg: self.status = 3 self.msg = translate("equipment", msg) self.inputChanged.emit(self) return f
[docs] class UI_WireCoil(ToolGui): """Wire-coil insert dialog""" title = translate("equipment", "Use wire coil insert")
[docs] def loadUI(self): """Add widget""" self.Entity = WireCoil() lyt = self.wdg.layout() lytH = QtWidgets.QHBoxLayout() lytH.addWidget(QtWidgets.QLabel( self.tr("Friction factor calculation method"))) self.methodFriction = QtWidgets.QComboBox() for method in WireCoil.TEXT_FRICTION: self.methodFriction.addItem(method) self.methodFriction.currentIndexChanged.connect( partial(self.changeParams, "methodFriction")) lytH.addWidget(self.methodFriction) lyt.addLayout(lytH, 2, 1, 1, 2) lytH = QtWidgets.QHBoxLayout() lytH.addWidget(QtWidgets.QLabel( self.tr("Heat transfer calculation method"))) self.methodHeat = QtWidgets.QComboBox() for method in WireCoil.TEXT_HEAT: self.methodHeat.addItem(method) self.methodHeat.currentIndexChanged.connect( partial(self.changeParams, "methodHeat")) lytH.addWidget(self.methodHeat) lyt.addLayout(lytH, 3, 1, 1, 2) label = QtWidgets.QLabel(self.tr("Wire pitch")) label.setToolTip(self.tr("Wire pitch for twist of 2π radians (360º)")) lyt.addWidget(label, 4, 1) self.P = Entrada_con_unidades(Length) self.P.valueChanged.connect(partial(self.changeParams, "P")) lyt.addWidget(self.P, 4, 2) label = QtWidgets.QLabel("Wire diameter") lyt.addWidget(label, 5, 1) self.e = Entrada_con_unidades(Length, "Thickness") self.e.valueChanged.connect(partial(self.changeParams, "e")) lyt.addWidget(self.e, 5, 2) self.Entity.valueChanged.connect(self.valueChanged.emit) self.Entity.inputChanged.connect(self.populate)
[docs] class Dialog(QtWidgets.QDialog): """Component list config dialog"""
[docs] def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle(self.tr("Twisted-tape insert")) layout = QtWidgets.QVBoxLayout(self) self.datos = UI_WireCoil() layout.addWidget(self.datos) self.buttonBox = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.StandardButton.Cancel | QtWidgets.QDialogButtonBox.StandardButton.Ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) layout.addWidget(self.buttonBox)
if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) Dialog = Dialog() Dialog.show() sys.exit(app.exec())