Features/Optimize TreeViews: Difference between revisions
m sort in Category view |
|||
| Line 25: | Line 25: | ||
* Sugar CellRendererIcon has too much logic inside. It should only handle how to render itself. | * Sugar CellRendererIcon has too much logic inside. It should only handle how to render itself. | ||
In particular, a CellRenderer is not a Widget, then do not have event to know when the mouse interact, | |||
then needed attach to the events on the treeview [https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/graphics/icon.py#L826] | |||
* Sugar CellRendererIcon is connected to many signals. Just detaching them while scrolling provides a performance boost. | * Sugar CellRendererIcon is connected to many signals. Just detaching them while scrolling provides a performance boost. | ||
| Line 30: | Line 32: | ||
* Sugar CellRendererIcon could benefit from caching values instead of calculating them on each render. | * Sugar CellRendererIcon could benefit from caching values instead of calculating them on each render. | ||
* There are a additional block in the Journal. That is not addressed by this feature, we guess there is a DBus blocking call, | |||
but we could't confirm that. | |||
=== Implementation === | |||
* ScrollingDetector: A new class ScrollingDetector allow simplify slow operations while the treeview is scrolling. | |||
To use it, just do: | |||
scrolling_detector = ScrollingDetector(self._scrolled_window) | |||
scrolling_detector.connect_treeview(self._tree_view) | |||
* CellRendererIcon changes: | |||
The CellRendererIcon is not a widget, then, do not receive events when the mouse | |||
enter or leaves, and all the logic in the CellRendererInvoker is more complex than should be. | |||
Worst, we had 6 different CellRendererIcons in the Journal, then we simplified (and solved issues) implementing a | |||
TreeViewInvoker. The TreeView knows where is every cell then the code is much more simple. | |||
The ObjectPalettes was created in the mouse enter callback, then if a user moved | |||
the mouse cursor over the activity icons, many palettes were created, and that palette creation is expensive [http://bugs.sugarlabs.org/ticket/4343]. | |||
Moving the palette creation to the treeview, we can create the palette when the mouse was in a cell for a specified timeout and not before. | |||
=== GTK+ concepts === | === GTK+ concepts === | ||
| Line 39: | Line 61: | ||
* GtkCellRenderer — An object for rendering a single cell https://developer.gnome.org/gtk3/stable/GtkCellRenderer | * GtkCellRenderer — An object for rendering a single cell https://developer.gnome.org/gtk3/stable/GtkCellRenderer | ||
== Benefit to Sugar == | == Benefit to Sugar == | ||