<s> from PySide . QtCore import Slot , Signal , QObject <EOL> from Table import * <EOL> class FilterCoupler ( QObject ) : <EOL> """<STR_LIT>""" <EOL> changeSignal = Signal ( QObject ) <EOL> deleteSignal = Signal ( QObject ) <EOL> def __init__ ( self , name , parent = None , modifier = None ) : <EOL> """<STR_LIT>""" <EOL> super ( FilterCoupler , self ) . __init__ ( ) <EOL> self . name = name <EOL> self . parent = parent <EOL> self . upstream_chain = list ( ) <EOL> self . deleteSignal . connect ( parent . deleteCoupler ) <EOL> self . _modifier = modifier <EOL> self . _modifier_chain = list ( ) <EOL> @ property <EOL> def modifier ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _modifier <EOL> @ modifier . setter <EOL> def modifier ( self , mod ) : <EOL> self . _modifier = mod <EOL> self . modifierChanged ( ) <EOL> @ property <EOL> def modifier_chain ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _modifier_chain <EOL> @ modifier_chain . setter <EOL> def modifier_chain ( self , chain ) : <EOL> self . _modifier_chain = chain [ : ] <EOL> def createUpstream ( self , parent , modifier ) : <EOL> """<STR_LIT>""" <EOL> upstream = FilterCoupler ( self . name , parent , modifier ) <EOL> upstream . changeSignal . connect ( self . upstreamChanged ) <EOL> upstream . deleteSignal . connect ( self . upstreamDeleted ) <EOL> self . deleteSignal . connect ( upstream . delete ) <EOL> return upstream <EOL> @ Slot ( QObject ) <EOL> def upstreamChanged ( self , upstream ) : <EOL> """<STR_LIT>""" <EOL> self . upstream_chain = upstream . modifier_chain [ : ] <EOL> self . modifier_chain = self . upstream_chain [ : ] <EOL> if self . modifier is not None : <EOL> self . modifier_chain . append ( self . modifier ) <EOL> self . changeSignal . emit ( self ) <EOL> def modifierChanged ( self ) : <EOL> """<STR_LIT>""" <EOL> self . modifier_chain = self . upstream_chain [ : ] <EOL> if self . modifier is not None : <EOL> self . modifier_chain . append ( self . modifier ) <EOL> self . changeSignal . emit ( self ) <EOL> @ Slot ( QObject ) <EOL> def upstreamDeleted ( self , upstream ) : <EOL> """<STR_LIT>""" <EOL> upstream . deleteSignal . disconnect ( self . upstreamDeleted ) <EOL> upstream . changeSignal . disconnect ( self . upstreamChanged ) <EOL> @ Slot ( QObject ) <EOL> def delete ( self , downstream = None ) : <EOL> """<STR_LIT>""" <EOL> self . deleteSignal . emit ( self ) </s>
