Skip to content

Add a proxy delay to checklist parameter changes via children edits#2097

Merged
j9ac9k merged 4 commits intopyqtgraph:masterfrom
ntjess:rate-limit-checklist
Nov 17, 2021
Merged

Add a proxy delay to checklist parameter changes via children edits#2097
j9ac9k merged 4 commits intopyqtgraph:masterfrom
ntjess:rate-limit-checklist

Conversation

@ntjess
Copy link
Copy Markdown
Contributor

@ntjess ntjess commented Nov 15, 2021

Randomly testing with a touchpad I found 1s proxy delay was usually adequate. Input from others would be nice on this

checklist-demo.mp4

.

@ntjess
Copy link
Copy Markdown
Contributor Author

ntjess commented Nov 15, 2021

This is similar to how the SpinBox parameter (int/float) doesn't emit value changes until after the delay is reached. I just wasn't sure about hard-coding 1s delay, so I just made it an option.

the parameter tree fixup PR added a new layer of children to the tree, which broke the 'lazy recurson' of the sigValueChanging logic. Now it is restored
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 15, 2021

Hi @ntjess I haven't worked w/ this much, but what is the issue that this solves?

@ntjess
Copy link
Copy Markdown
Contributor Author

ntjess commented Nov 15, 2021

Same issue that is solved in spinbox. It lets individual check boxes act as sigValueChanging while valueChanged only fires when the user is done editing

So you can toggle two boxes and "valueChanged" will only fire once

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 15, 2021

Oh, so in this case, when you're checking the checkboxes, instead of running the function that's being called on each time it's checked as its checked, it waits a second to see if a user checks anything else, and then runs the slot that's connected to the stateChanged signal (in the case of the checkboxes)?

@ntjess
Copy link
Copy Markdown
Contributor Author

ntjess commented Nov 15, 2021

Yep! Just like changing vs changed on a spinbox (waiting until the spinner is motionless for awhile)

@@ -1,5 +1,6 @@
from ... import functions as fn
from ...Qt import QtWidgets
from ...Qt import QtWidgets, QtCore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of the QtCore import here?

- Remove unused import
- Rename 'coalesceProxy' into something more meaningful
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 17, 2021

LGTM, thanks @ntjess for the PR!

@j9ac9k j9ac9k merged commit f1c62c0 into pyqtgraph:master Nov 17, 2021
@ntjess ntjess deleted the rate-limit-checklist branch November 17, 2021 01:17
@ntjess
Copy link
Copy Markdown
Contributor Author

ntjess commented Nov 18, 2021

Looking at #2086 (comment), should this logic be changed to "when no child is focused" rather than "after 1 second"?

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 18, 2021

I can see a case for being made for if lose focus, emit signal right away, else wait for the delay period.

ntjess added a commit to ntjess/pyqtgraph that referenced this pull request Dec 10, 2021
…yqtgraph#2097)

* Add a proxy delay to checklist parameter changes via buttons

* Intermediate checklist changes should be "valueChanging"

* Bugfix: parameter tree now prints changing values
the parameter tree fixup PR added a new layer of children to the tree, which broke the 'lazy recurson' of the sigValueChanging logic. Now it is restored

* Minor refactoring of checklist
- Remove unused import
- Rename 'coalesceProxy' into something more meaningful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants