TD 2022.35320
Moving the code to onSetRowLook works, but is not documented !
I am trying to apply custom backgrounds to a treelister based on some operators.
Reading the docs I found the SetRowOverlay command which, per docs, should be called from either an reactionCallback or from onRefresh.
This is the code I came up with (not the biggest fan of using Dicts here, but thats another story )
def onRefresh(info):
for row in info["ownerComp"].Data:
if row["rowObject"] is None: continue
operatorObject = op( row["rowObject"]["path"])
try:
info["ownerComp"].SetRowOverlay(row["sourceIndex"], [*operatorObject.color, 0.5], apply=True)
except AttributeError:
continue
The problem here is that the colors are either not working at or not sticking.
Depending on which part of the Treelister I expand or not I sometimes get the flashing colors for maybe a frame.
Also also (hence the AttributeError Catching) Sometimes I do get an error that “None does not have attribute bgColor”, while still having a valid Row-Object.
I assume onRefresh might not be the best place for this?
Putting onRefresh in a delayedCall sometimes results in it working but also not always.
def onRefresh(info):
run( "args[0]()", lambda : _onRefresh(info), delayFrames = 1 )