Conversation
…or rebasing issues.
Uses smarter logic for determining how a docstring should be un-indented for INI parsing. Previously, param options nested under NumPy parameter specifications would be missed since they were under the indentation of a previous block. This new logic un-indents by checking for option indent level rather than relying on textwrap.dedent
9b8a823 to
2fb21d4
Compare
|
@j9ac9k nudging this PR... Any chance we can get someone to look at it? There are multiple aspects of the lib I can update to use interactive ptrees, but it is tedious to rework them multiple times. Once this is merged, substantially less effort required. Note for anyone reviewing the changelist -- there is substantial associated documentation: https://pyqtgraph--2318.org.readthedocs.build/en/2318/parametertree/interactiveparameters.html (There is also a "Parameter-function Interaction" example under I am also happy to add to the docs to clarify any behavior |
Removes docstring parsing and `runFunc` behavior. The former is complex and error-prone, while the latter can be easily facilitated with a call to `functools.wraps` and doesn't need to pollute the interactive api.
- Unicode instead of ASCII quotes/em-dashes
- 3-space instead of 4-space indents
- Case issues ("runOPts" vs "runOpts")
- Long one-line paragraphs rather than breaking by wrap boundary
Previously, when a `sigValue{Changed,Changing}` fired, this value would once again be propagated back to that Parameter before the function ran. This is just a minor performance overhead for `sigValueChanged`, since an equality check on the new value means it is a no-op. However, `sigValueChanging` shouldn't update the value of the parameter at all. Forcing `propagateChanges` to `False` prevents this.
Utilize OOP to turn `interact` into an object method and greatly reduce the number of argument parameters for most helper methods. Has the nice side-benefit of better representing the state of defaults across different function calls, and lets users spawn their own `Interactor` classes if custom behavior is needed
d040c70 to
bbe026f
Compare
1ce7504 to
cef77ab
Compare
cef77ab to
214ec4a
Compare
|
@ntjess you've had the patience of a saint on this code change, to say I appreciate your efforts here and patience is an understatement. I looked this over, I have no code issues, I added a comment on some nit-pick stuff. the other nit-pick comment I have, and this is not a mandate come here, this one I legit want to get your thoughts on is expanding out the use of Oh, the other ones that I have, on the |
Good point, this is also how the
This was one of my reasons for using
The python standard library, sckikit-*, and other popular frameworks use it even if they don't abbreviate anything else, but Qt always expands their abbreviations. I'm happy to change it based on the goal of future code to avoid abbreviations where possible.
This one I'm less concerned about, since it's only used inside the function and not part of the API. Qt also allows abbrevs (😉) within function blocks and
I also considered something along these lines. |
For this one I think we might get some guidance/inspiration from the QAbstractButton signals: https://doc.qt.io/qt-6/qabstractbutton.html#signals That said, I don't think my comment there should hold up this PR either, I threw that out for your consideration 👍🏻 |
- Wrap long lines - Double-backtick literal expressions for proper sphinx rendering - Fix typos
e370d41 to
369a78f
Compare
…subclasses. If a subclass overrides `interact`, the subclass's method won't be called from `__call__` unless this fix is added.
|
I've started reviewing this by basically just trying it out and building up a little demo. One thing I've noticed so far is it doesn't seem possible to pass a class method to import pyqtgraph as pg
from pyqtgraph import parametertree as ptree
class Foo:
def update(self, a=1):
print(a)
app = pg.mkQApp()
foo = Foo()
params = ptree.interact(foo.update)
tree = ptree.ParameterTree()
tree.setParameters(params)
tree.show()
app.exec()Output: It's not a huge hassle to write a wrapper function, but maybe this limitation could be mentioned in the docs so there's a search match if a user runs into it. |
|
Great catch. TIL functions allow you to add member attributes, but methods don't. Without a stored reference to the InteractiveFunction, signals don't end up firing. In other words, you can get around this error by calling There are a few ways around this:
class MyClass:
def func(self, a=1):
print(a)
inst = MyClass()
# Or do this in __init__ depending on whether every instance should have this option
inst.interactive_func = InteractiveFunction(inst.func)
params = interact(inst.interactive_func)
# Same as your test code from here down
class MyClass:
@InteractiveFunction
def func(self, a=1):
print(a)
cls = MyClass()
params = interact(func)
# Same as your test code from here down
inst.interactive_func, params = interact(inst.func)
What are your thoughts? edit: Relevant changes to refOwner = func.__func__ if inspect.ismethod(func) else func
# ^^^^^ This line
if hasattr(refOwner, "interactiveRefs"):
refOwner.interactiveRefs.append(interactive)
else:
refOwner.interactiveRefs = [interactive] |
|
1 and 4 seem reasonable to me, also leaning toward 4. 2 and 3 would seem to add more complexity to usage where I think it's already a little complicated. |
|
@ixjlyons sounds good. Can you take a look at the new test under |
6e9295f to
401521e
Compare
401521e to
e4cc79b
Compare
|
Segmentation fault in CI? Uh-oh |
|
In ROI test though? I don't think that's from this PR |
|
Just because that’s where the segfault occurs doesn’t mean the cause of the
segfault is there. Will attempt to replicate lodally.
…On Sat, Aug 20, 2022 at 18:31 ntjess ***@***.***> wrote:
In ROI test though? I don't think that's from this PR
—
Reply to this email directly, view it on GitHub
<#2318 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE5Z7WWMURQRTUPYKAHCSDV2GBG5ANCNFSM5XORH6FQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@ntjess CI on this repo segfaults; even on re-run. On my fork, no segfault. Running it locally, no segfault... Can you try pushing an empty commit to this branch and trigger a new CI run, I'm wondering if "re-run" is caching something problematic. |
- The initial choice of a list came from the outdated `weakref` usage and is no longer relevant - `extras` is also a dict, so this would represent consistent usage - Makes it easier to identify which runtime kwargs match self's parameters
|
going to close/re-open to trigger a new CI Run, doing "re-run" doesn't seem to be cutting it. |
Squashes all changes from #1812 into one commit onto current
HEADto account for rebasing issues