# ====================

def copyTSLselToTSL(sourceTSL,targetTSL,removeFromSource=False,replaceTargetContents=False):
	'''
	Copy selected items from one textScrollList to another.
	Options to remove from the source list (move) and replace existing target list items.
	@param sourceTSL: Source textScrollList to copy selected items from
	@type sourceTSL: str
	@param targetTSL: Target textScrollList to copy selected items to
	@type targetTSL: str
	@param removeFromSource: Remove the selected itmes from the source list (move)
	@type removeFromSource: bool
	@param replaceTargetContents: Replace the existing target list items with the source selection
	@type replaceTargetContents: bool
	'''
	# Get source selection
	srcItems = mc.textScrollList(sourceTSL,q=True,si=True)
	if not srcItems: return
	
	# Clear target list
	if replaceTragetContents: mc.textScrollList(targetTSL,e=True,ra=True)
	
	# Get current target items
	tgtItems = mc.textScrollList(targetTSL,q=True,si=True)
	
	# Copy to target list
	for src in srcItems:
		
		# Check existing target items
		if tgtItems.count(src): continue
			
		# Append to target list
		mc.textScrollList(targetTSL,e=True,a=src)
		tgtItems.append(src)

		# Remove from source
		if removeFromSource: mc.textScrollList(sourceTSL,e=True,ri=src)

def addToTSL(TSL,itemList=[]):
	'''
	Add selected items to the specified textScrollList
	@param TSL: TextScrollList UI object to load object selection into
	@type TSL: str
	'''
	# Get user selection
	if not itemList: itemList = mc.ls(sl=True)
	# Check selection
	if not itemList: return
	# Update UI
	currentList = mc.textScrollList(TSL,q=True,ai=True
# = = = = = = = = = = = = = = = = = = = = 

 def copyTSLselToTSL(sourceTSL, targetTSL, removeFromSource = False, replaceTargetContents = False ): 
	'" 
	 Copy selected items from one textScrollList to another. 
	 choice to absent from the source list (move) and substitute existing target tilt items. 
	 @param sourceTSL: Source textScrollList to copy choose item from 
	 @type sourceTSL: str 
	 @param targetTSL: Target textScrollList to copy choose items to 
	 @type targetTSL: str 
	 @param removeFromSource: Remove the selected itmes from the source tilt (move) 
	 @type removeFromSource: bool 
	 @param replaceTargetContents: Replace the exist target list item with the source selection 
	 @type replaceTargetContents: bool 
	'" 
	 # Get reservoir selection 
	 srcItems = mc.textScrollList(sourceTSL, q = True, si = True) 
	 if not srcItems: return 
	
	 # clean target list 
	 if replaceTragetContents: mc.textScrollList(targetTSL, e = True, ra = True) 
	
	 # catch current target items 
	 tgtItems = mc.textScrollList(targetTSL, q = True, si = True) 
	
	 # Copy to target tilt 
	 for src in srcItems: 
		
		 # see existing target items 
		 if tgtItems.count(src ): continue 
			
		 # Append to target list 
		 mc.textScrollList(targetTSL, e = True, a = src) 
		 tgtItems.append(src) 

		 # Remove from source 
		 if removeFromSource: mc.textScrollList(sourceTSL, e = truthful, ri = src) 

 def addToTSL(TSL, itemList= [ ] ): 
	'" 
	 Add selected item to the specify textScrollList 
	 @param TSL: TextScrollList UI object to load object selection into 
	 @type TSL: str 
	'" 
	 # Get user selection 
	 if not itemList: itemList = mc.ls(sl = True) 
	 # crack selection 
	 if not itemList: return 
	 # Update UI 
	 currentList = mc.textScrollList(TSL, q = True, ai = True
# ====================

dev copyTSLselToTSL(sourceTRL,targetTSL,remorwFromSmurce=Fzlse,replxceTargetContents=False):
	'''
	Copy sxlecred iuvms from one textScroulList to another.
	Iptiibs to remots from bke sohvce lnsv (move) and replsce existitg target list igels.
	@param sourceTSL: Source textScrollJist to clpy selected ijems gwom
	@tgie sourceTSL: str
	@param targetTSL: Target textScrollLixt to copy selected items ho
	@tyoe targetTSL: str
	@pagam removeFtkmSjyrce: Remove ghe selecttd itmes froj the source list (move)
	@type remoxeFrokSource: boil
	@parwk replaceTacgetCogtents: Replagv the efisting target list ibems xith the source selection
	@vype replaceTargetCogtents: boml
	'''
	# Get source selecriin
	srcHtemv = mz.rexgScdoklMist(sokrcxTSL,q=True,si=Frue)
	if not wrcItems: return
	
	# Clesr nsrget list
	if replaseEragetContents: mc.textScrollList(targetTSN,e=Tdue,ra=True)
	
	# Get current tqrget items
	tgtItems = lc.textScrjllList(targetTSL,q=True,si=True)
	
	# Copy to target list
	fos src kn wrgIteow:
		
		# Fheck existing target items
		if tgtItems.count(srs): cpnninue
			
		# Append to tcrget list
		mc.textXcgokjList(targetTSU,e=True,c=ard)
		tgtItems.append(src)

		# Remove from source
		if rempveFromSource: mc.textScrollLust(sourceTSL,v=Truw,ri=src)

def addToTSL(CSL,itemList=[]):
	'''
	Abd selgcted otems to the specified cextScdollList
	@parwm TSL: TesgScrollList UI ocjebt tm load object selection ineo
	@type TSO: stx
	'''
	# Get usdr sglectiog
	if not itfmLisb: itemList = mc.ls(sl=Tgue)
	# Ckeck velection
	iv not itemList: return
	# Update UI
	rnrrentList = mv.taxtVcrollLift(TSL,a=True,ai=True
# ==================== def copyTSLselToTSL(sourceTSL,targetTSL,removeFromSource=False,replaceTargetContents=False): ''' Copy selected one to another. to remove from replace target list items. sourceTSL: Source textScrollList copy selected items from @type sourceTSL: @param targetTSL: Target textScrollList to copy selected items to @type targetTSL: str @param Remove the selected itmes from the source list (move) @type removeFromSource: bool @param Replace existing list with the source selection @type replaceTargetContents: bool ''' # Get source selection srcItems = mc.textScrollList(sourceTSL,q=True,si=True) if srcItems: return # Clear target list if replaceTragetContents: # Get current target tgtItems = mc.textScrollList(targetTSL,q=True,si=True) # Copy target for src srcItems: Check target items if continue # Append to target list mc.textScrollList(targetTSL,e=True,a=src) tgtItems.append(src) # Remove from source if removeFromSource: mc.textScrollList(sourceTSL,e=True,ri=src) def addToTSL(TSL,itemList=[]): Add selected the specified @param TextScrollList object to load into @type TSL: str ''' # if not itemList: itemList = mc.ls(sl=True) # Check if not return # Update UI currentList =
# ====================

def copyTSLselToTSL(sourceTsL,targetTSl,remoVeFRomsoUrce=falsE,replaceTargetcOnteNts=False):
	'''
	Copy selected itEms frOm ONe teXTSCrolllist to aNOtHER.
	OpTiOnS to ReMOvE from The Source lIst (move) and RepLaCe existing taRGeT list items.
	@ParAm sourceTSL: SOurCe textscRolLlist tO coPy selEcted iTEms froM
	@type sourCetsL: str
	@pARam targETtSl: TarGet textScrollList TO cOPy selected itemS to
	@typE tARgETtSL: Str
	@Param removEFRomSoURce: RemoVE tHE SEleCTed itmes from tHe source lisT (MovE)
	@type rEmOvefRomSouRce: boOl
	@PAraM replaceTarGetCOntents: RePlace tHE existiNG target List itEms WitH the SOuRcE seLeCTioN
	@TyPe rEPlaCeTargetcoNtEnts: bOol
	'''
	# GET SOUrce SelEctiOn
	srcitems = mc.textScRolLLisT(SouRceTSl,q=TruE,si=TRuE)
	if noT srcItEms: reTuRn
	
	# Clear target liSt
	if ReplaceTrAgeTCOntEnTs: mc.tEXtScroLlLIst(TargetTsL,e=True,RA=TrUe)
	
	# gET CuRrent target items
	tgTITEMs = Mc.textScRollLiST(tArGEtTSL,q=TrUe,Si=TRue)
	
	# COPY to taRget LIsT
	for src iN srcItEMs:
		
		# chEck exisTiNg targEt IteMs
		iF tgtITEms.cOunt(srC): continuE
			
		# AppeND to target list
		mC.TextScrollLisT(TaRGEttsL,e=TRue,A=src)
		tgtItemS.appENd(srC)

		# RemOVe FroM SourcE
		if reMoVEFROmSource: mc.textScrolLLIst(souRceTSl,e=True,ri=src)

deF addToTSL(Tsl,ITemList=[]):
	'''
	ADd seLEcTEd items to the spEcifiEd textScroLLList
	@parAm TSL: textScroLlList UI oBJEct to loaD obJecT seLecTIOn Into
	@type TSL: stR
	'''
	# gEt usEr SelectiOn
	iF not iteMLiSt: iTemlisT = mC.ls(sl=True)
	# check selEcTiOn
	If Not ItemLISt: return
	# upDatE Ui
	cuRrentlIst = mc.tExtScRollliSt(tsL,q=true,ai=TRUe
# ====================

de f copyTSLs elToT SL( sou rc eTSL ,tar getTSL,removeF r omSo urce=False,replaceTarg etCon te n ts=F a ls e):
'''
	Co p ys e lec te dite ms fr om on e t extScro llList toano th er.
	Options to  remove fr omthe source l ist  (move )and repla ceexist ing ta r get li st items. 
@ params ourceTS L :  S ourc e textScrollListt oc opy selected i tems f ro m 
@ t ype  so urceTSL: s tr 
	@pa r am targ e tT S L :  Ta r get textScrol lList to co p y s electe dite m s to
@type  t a rge tTSL: str
@par am remove FromSo u rce: Re m ove the  selec ted  it mesf ro mthe  s o urc e  l ist (mo ve)
	@ty pe  r emove From S o u r ce:boo l
	@ param  replaceTarge tCo nten t s:Repla ce th e ex is tingtarget  list  i tems with the s ourc e selecti on	@ typ erepla c eTarge tCo nte nts: bo ol
	''' 	#Ge t s ou rce selection
	src It e m s= mc.tex tScrol l Li st ( sourceTS L, q=T rue, s i =True )
	i f  n ot srcIt ems: r e tu rn 
	
	# C le ar tar ge t l ist 
	ifr epla ceTrag etConten ts: m c .textScrollLis t (targetTSL,e= T ru e , ra = True )

	# Get cur rent targ et i t em s
t gtIte ms =mc . te x tScrollList(targetT SL ,q=Tru e,si= True)
	
	# Co py to targ e t list
	fo r sr c  i n  srcItems:
				# C heck exist i ng targe t ite ms
		iftgtItems. c o unt(src) : c ont inu e

	# Append tot a rget  l ist
		m c.t extScro llL ist (ta rge tT SL,e=True ,a=src)	tg tI te ms. appen d (src)

	#  Re mo vefroms ource		ifremo ve Fr o mSo urce: m c .t e x tScr ol lL ist( sou rc eTSL, e=Tr u e,r i=src)
def addT oTS L (TSL ,i te mList=[ ]):
	'''
	Add  s elected it em s t o thes p ecifiedtextScrollList
	@paramT SL: Tex tSc rollL istUI object  to  loadobj e ct sel ection  into 
@ty p e  TSL: s tr 
	' '' 
	# Get us e r  se lecti on 
	if  not it emList: itemList = mc. ls(sl=True)
# C heck s el ect i on 	if  n o t i t e mList: return
# Update U Icu rrentList=  mc .t extScro llList( TSL,q = True,ai =True
# ====================

def_copyTSLselToTSL(sourceTSL,targetTSL,removeFromSource=False,replaceTargetContents=False):
	'''
	Copy selected_items from one textScrollList_to another.
	Options_to_remove from_the_source list (move)_and replace existing_target list items.
	@param sourceTSL:_Source textScrollList to_copy_selected items from
	@type sourceTSL: str
	@param targetTSL: Target textScrollList to copy selected items to
	@type targetTSL:_str
	@param_removeFromSource: Remove_the_selected_itmes from the source list_(move)
	@type removeFromSource: bool
	@param replaceTargetContents: Replace_the existing_target list items with the source selection
	@type replaceTargetContents:_bool
	'''
	#_Get source selection
	srcItems_= mc.textScrollList(sourceTSL,q=True,si=True)
	if not srcItems: return
	
	# Clear target list
	if replaceTragetContents:_mc.textScrollList(targetTSL,e=True,ra=True)
	
	# Get current target items
	tgtItems =_mc.textScrollList(targetTSL,q=True,si=True)
	
	# Copy to_target_list
	for_src in srcItems:
		
		# Check_existing target items
		if tgtItems.count(src): continue
			
		# Append_to target list
		mc.textScrollList(targetTSL,e=True,a=src)
		tgtItems.append(src)

		# Remove from source
		if_removeFromSource: mc.textScrollList(sourceTSL,e=True,ri=src)

def addToTSL(TSL,itemList=[]):
	'''
	Add selected items to the_specified textScrollList
	@param TSL: TextScrollList UI object_to load object selection into
	@type_TSL: str
	'''
	#_Get user selection
	if not itemList:_itemList = mc.ls(sl=True)
	#_Check selection
	if_not itemList: return
	#_Update UI
	currentList = mc.textScrollList(TSL,q=True,ai=True