Hey, for the past couple of months I’ve been extensively using listCOMP
and gathered some feedback that I wanted to share.
First of all let me tell you about my approach to using it: I have built a system that vaguely resembles html/css. Meaning every cell of a listCOMP
has a python object associated with it, and when listCOMP
emits onInitCell
callback I’m storing attribs
to my custom object to be able to dictate the look of the cell based on the settings of this python object (sorry, can’t share the code because it’s very hard to understand without context, our system is pretty advanced.) So in the end I was able to make it work for me, but I had so many head scratching moments during these times. And without having a proper debugger some things took me a ridiculous amount of time to figure out. So in the end I thought I should share some feedback on using listCOMP
.
So here we go:
-
Barebones/ sometimes weird api:
1.1. The biggest problem is that you cannot directly access a cell of alistCOMP
and tell it what to do. All attributes of thelistCOMP
are read-only and although you actually can modify them, sometimes it will lead to listcomp stop responding to any further commands.
1.2. The hierarchy of the attributes is confusing: you have cell attributes, row attributes, col attributes, table attributes that all contribute to the final look in a very obscured way. But also as mentioned before, all these attributes are read only, so you can only query them, but in this case most of the time these attributes will give youNone
as an answer, despite you can clearly see that this is not None by the way your cell/row/col looks. To actually get final value of the cell you need to query it fromdisplayAttribs
property, which raises the question why do we even need cell/row/col etc attribs?
Also if you compare memory addresses ofcellAttribs
oflistCOMP
andattribs
that gets passed inonInitCell
callback you will see that it’s different objects
1.3. The only way you can alter the look of your cells is viaonInitCell
/row/col callback. Which happens automatically, you don’t have any control over it. It happens when new cells needs to be drawn because you are scrolling through or when you pressreset
(this is actually the only way you can trigger those callbacks manually), it means that every time you want to change the look of thelistCOMP
you need to reset the whole thing, which is an overkill in most cases.(Because I store cell attribs in my objects at the moment of cell initialization I can affect some attributes without resetting the whole thing, but some of them don’t work reliably this way).
1.4. In general the api is very poor. For a thing that allow such deep level of customization we only have two methods:scroll
andsetKeyboardFocus
-
Bugginess
2.1 There are a lot of small bugs surroundinglistCOMP
. Unfortunately most of them are very random so I can’t make a proper bug report, but most prominent one islistCOMP
randomly freaks out and saysonInitRow
was given 4 arguments when it only takes three, keep in mind that user can’t call this callback and also I don’t have any code in it so it just says return. Which means it’s some kind of behind the scenes problem
2.2. The initialization order of cells rows columns and table is shuffled. You can simply put a print statement in eachonInit
callback and see it.
2.3. I had a small problem with my code in which one cell from a column had a differentcolWidth
compared to other ones and this was completely freaking out thelistCOMP
it was basically rendering all the content on top of each other. Although it was my mistake in the first place, I thinklistCOMP
should at least issue a warning in that case or maybe automatically set thecolWidth
to the biggestcolWidth
value of the cell in a given column -
Lack of documentation
3.1. I spent a whole 8 hours day looking for the first column of my content, it was gone. I checked everything only to realize in the end that therowIndent
property should be set to-1
to have no effect (why?) and I was initializing it to0
.
3.2. There is no explanation of the idea behind different attributes of the list comp (cellAttribs
,rowAttribs
etc.)
3.3. The internal mechanics are not documented, it took me a while to realize that if you reset thelistCOMP
all the objects that were visible are getting reused and not destroyed but as soon as the cell goes out of sight it gets quietly destroyed. It would be nice to have some degree of control over this behaviour or at least have it explicitly documented
3.4. It also took me a while to troubleshootonRollover
withoff cell callbacks
on. It was never documented but I found out that in some cases it gives you-1
for row/col index and sometimes it gives youNone
, which was completely tripping up my callback logic and wasn’t easy to find. -
Lack of functionality
To be honestlistCOMP
feels like it was very quickly put together from the initial python prototype and since then nobody touched it
4.1. No way of having a padding or margin in the cells, so your text in the adjacent cells will just render next to each other without any separation
4.2. No deeper control over the backend oflistCOMP
: can’t control initialization of single cells/rows/colls, only areset
that flushes everything at once.
4.3. No row/col size auto adjustments based on the text size: you need to calculate it yourself from textsize and other parameters
4.4. Word wrap looks ugly: it will just very mechanically put the letters that won’t fit on the next string
There’s a lot of tiny stuff that I probably forgot to mention because it wasn’t so prominent.
Also I apologize if it came out a bit angry, I didn’t have such intentions, it’s just the fact that I spent so much time wrestling with listCOMP
to make it do in the end not a very complicated functionality and the amount of head scratching and wtf’s I had along the way, so it’s hard to stay away from emotions in my text
Last but not least, fot it not to be just me blowing off some steam, I actually have a list of concrete suggestions on how to improve listCOMP
-
Make a
listCompCell
class and hide all attribs behind its interface (it’s even weird that oninitcell gives you an instance oftd.ListAttribs
class and not some kind of cell object). Make this class interface directly accept cell property modifications and then you can just store it (in case this cell is currently not in sight) and apply as soon as cell.render() method is called -
Provide a method to connect an object to a listcomp, so that when you click on the cell for example you can directly know which object instance you are selecting, rather than deriving this information from row/col index or even from text of the selected cell.
-
Provide a better boilerplate experience: right out of the box it’s very confusing to understand what you should do in order to make it start showing some text, whereas in excel or similar software you can straight away double click and start editing.
-
Add niceties like being able to drag and drop out of the box or being able to resize rows and cols with mouse
-
Improve the documentation
Thanks, I hope it helps.