Commit Graph

13 Commits

Author SHA1 Message Date
Dave Pearson
c7fc66fa6c Ensure that TreeNode messages are posted when via-API changes are made
Until now the Tree.NodeExpanded and Tree.NodeCollapsed messages were only
sent out when changes were made to the tree by user interaction. This meant
that if any changes were made with the TreeNode expand, expand_all,
collapse, collapse_all, toggle or toggle_all API calls no messages would be
sent.

This PR corrects this.

The work here is, in part, required for #2456 (DirectoryTree lazy-loads
directory information on node expansion so if someone is expanding nodes
under code control the DirectoryTree never gets to know that it should load
a directory's content) and will build on #1644, essentially adding a missing
aspect to the latter PR.
2023-05-10 09:24:07 +01:00
Dave Pearson
02ed90c633 Add TreeNode.tree
Currently, in the various TreeNode messages, and the handlers you'd write to
handle them, there's no way to easily know *which* tree sent the message and
so which tree the node belongs to.

This commit adds public access to the tree reference to the nodes, so that
in an event handler the developer can check the tree involved in the event.

See #2413.
2023-04-28 10:23:38 +01:00
Will McGugan
41003e356c Fix content width (#1910)
* fix calculation for scrollbars

* added snapshot

* fix for name change

* snapshot

* fix for textual colors

* remove logs

* scrollbar logic

* scroll logic

* remove dead code

* snapshot tests

* scrollbar mechanism

* tidy

* demo tweak

* preset window size

* no need for repaint

* Restore repaint

* wait for idle on pause

* colors tweak

* remove wait for idle

* snapshot

* small sleep

* change stabilizer

* debug tweaks

* remove debug

* remove debug

* snapshot test

* docstring

* changelog

* add pause
2023-03-02 14:39:31 +00:00
Darren Burns
9287f64a66 Add isort pre-commit hook, sort imports in src and test directories 2023-02-09 13:28:08 +00:00
Dave Pearson
6db5217f3e Modify Tree message unit tests to take new action in to account
See #1433.
2023-01-31 13:32:46 +00:00
Will McGugan
3eac79568c remove some pauses 2023-01-26 16:10:13 +01:00
Dave Pearson
489ba10c8a Sprinkle some pauses into the node message tests 2023-01-09 13:36:29 +00:00
Dave Pearson
346659f47f Move typing of the tree into its own class 2023-01-09 13:28:25 +00:00
Dave Pearson
c00a6da90d Check if I need to import from the future for Python 3.8 2023-01-09 13:13:54 +00:00
Dave Pearson
151673cd53 Remove empty docstring 2023-01-09 13:12:57 +00:00
Dave Pearson
0cf299540f Add a message for when a node is highlighted
This is sort of different from selected. Selected is when someone mashes the
enter button or clicks on a node. Highlighted is when the cursor moves into
a new node.

See #1400.
2023-01-09 12:54:57 +00:00
Dave Pearson
6f10c63bb0 Perform tests on all recorded tree events 2023-01-09 12:54:26 +00:00
Dave Pearson
34ff6bf260 Add some unit tests for Tree messages/event handling
I'm about to work on #1400 and it seems like a good idea to put some tests
in place first to ensure nothing gets disturbed.
2023-01-09 11:47:40 +00:00