feature More parameter item types#1844
Conversation
|
Some bindings issues:
|
|
@pijyoi wow, turns out combo boxes implicitly convert enums to ints, fun... It should be fixed now, thanks. |
| tooltip = str(os.path.realpath(fn)) | ||
| elif dialogType in ["getOpenFileNames","openFiles"]: | ||
| fn = dialogFunction(None, dialogCaption, self.lastDirectory, filterString) | ||
| fn = [os.path.realpath(asUnicode(f)) for f in fn if os.path.isfile(f) and f != ""] |
There was a problem hiding this comment.
this throws an Exception if the user clicks on Cancel in the dialog
There was a problem hiding this comment.
I had more difficulty porting this over without problems, so I replaced it with a file parameter I've been using for about a 8 months without many issues. It supports almost all these features, but with (IMO) a bit smoother of a option interface.
There was a problem hiding this comment.
ok, but you need to change the enums to the long spelling and also the exec_().
You should try running on PyQt6 6.1.1.
There was a problem hiding this comment.
Jeez, installed pyside6 and I see what you mean. The enums should be fixed there as well.
|
In Qt4, there was only QtCore and QtGui. In Qt5, QtGui was split into QtGui
and QtWidgets.
Pyqtgraph when adding Qt5 support chose to emulate the Qt4 interface by
monkey-patching all of QtWidgets into QtGui.
…On Sun, 20 Jun 2021, 08:33 ntjess, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pyqtgraph/widgets/PenSelectorDialogbox.py
<#1844 (comment)>:
> @@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'PenSelectorDialogbox.ui'
+#
+# Created by: PyQt4 UI code generator 4.11.4
Many of the widgets in pyqtgraph come from QtGui... Is this just old
code? I thought it was for a reason, but I'm happy to transition to
QtWidgets instead
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1844 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUIWA3EB7M6S4MFGORCAILTTUZO3ANCNFSM466OAQDQ>
.
|
|
Ok to merge? Suggestions? Comments? I want to do some housekeeping on parameter types but also want to wait until this is resolved. |
|
I haven't looked over the code in detail yet, but a few high-level notes from playing around with the example:
|
|
@ixjlyons Thanks for the feedback. Do you recommend the current value of the file picker not show up anywhere visually? I'm ok with it and it's an easy change, I just wanted to be sure. Some alternatives are to just show the filename instead of full path or use ellipses (change elide mode on the label)
|
This is the kind of API nitpick I can get behind!
Is there a reason we shouldn't match up the existing Qt API here and just use
Unless there is demand for another format, I would stick w/ that for a few reasons.
If there is a feature request to add another syntax, we can evaluate that on its own merit, but even if we come up with a potentially simpler format; there is likely no guarantee it would be simpler for enough use-cases to make it worthwhile.
|
I tend not to use builtin functions as variables, which is why I stayed away from
The other accepted arguments are boolean versions of enum flags which are easier to store in the
FWIW, my initial reason for the boolean interface was simplicity and it might be intimidating to expose every aspect of a file dialog even if ~80% of it isn't used in common practice. |
Ahh good point!
Oh, missed the part this was a variable name, yeah built-ins as variable names is a no-no, could do
Either option (list of bools, list of stringified enums) sounds good to me; probably should support default behavior, and put a link in the documentation to the Qt docs for more info.
You've thought about this more than I have at this point, I'm good w/ it either way 👍🏻 |
Fair point, horizontal space is a premium in parameter trees. How about this? If you like it, I'll push the fix. kFpecVNWUC.mp4 |
|
That seems reasonable, definitely an improvement. It still seems like it'd be useful to have the path in a line edit so it can be manually changed or copied/pasted. Maybe a button with just I'm totally fine saving that as an enhancement idea for later. |
|
Take 2 vokoscreenNG-2021-06-29_00-16-54.mp4I also took the liberty of making a slightly more interactive pen parameter 🙂 vokoscreenNG-2021-06-29_00-42-45.mp4 |
|
I'm realizing right after pushing that a line edit will not interact nicely with There's also no input sanitation currently, i.e. if you edit directly you can violate all constraints set on the parameter. I don't quite know what the ideal solution is other than to leave it for now. Maybe make it readonly by default, and the adventurous user can enable it if they so choose? |
|
With that, I think I've addressed all comments from the previous round. @ixjlyons and @j9ac9k thanks for your prior input, are you up for another go? File picker is readonly by default and no sanitation or |
|
With Scipy sprints and the new release coming up I know this will get delayed for a bit, any recommendations on when I can bump again? I'm looking to do a Thanks :) |
|
Hi @ntjess I think the sprints, at least on Sunday, would be a great time to review this PR actually. @ixjlyons had an interest in revisiting the PR backlog, this issue, along w/ Nils's color palette one are some big PRs that would benefit from getting more eyes on IMO. Given many of us will be there, I think we can get some real-time feedback and hopefully merge 🤞🏻 |
examples/parametertree.py
Outdated
| global state | ||
| state = p.saveState() | ||
|
|
||
| QtCore.QTimer.singleShot(0, save) |
There was a problem hiding this comment.
Would you object to a safeSingleShot function in functions.py that spawns a QTimer this way, if the paradigm needs to be reused everywhere?
There was a problem hiding this comment.
Why is the delayed call to save() needed? You have the following right before pg.exec()
## test save/restore
state = p.saveState()
p.restoreState(state)There was a problem hiding this comment.
IIRC, there was an issue where the restored state didn't match the actual state before saving, so I delayed the initial save for things like the gradient editor's size to finalize. But testing it now, the singleShot seems unnecessary.
|
Rebased onto master, merge conflicts should be gone but the CI failure is still occurring. Is that linked to any of my changes? I can't reproduce locally on my windows machine so it's difficult for me to analyze |
|
with what appears to be a segfault, causes like this can be really tough to isolate; even worse when it only happens in CI but not locally... best you can hope for is it fails in CI consistently 😆 |
|
what a rollercoaster this one was.... A lot of thanks for this PR. Thank you @feketeimre for the original submission Squashing and merging this one! |
It's highly likely that I failed or missed something in this effort. The pull request is an attempted direct copy from @feketeimre's older one (#665), but that passes all current
mastertests. If they can confirm whether anything is missing, this should be much easier to merge into the current branch and we can close the very outdatedfeature3pull requestTODO:
formatoption); QDate has convenienttoStringmethodvaluefield, so I'm currently playing with always saving a black pen and setting options likecolor,width, etc. to compensate. Has the downside of functioning differently from every other parameter whose value is self-contained...Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet.
Progress bar: For indication things.
Slider: Easier way to set values that dont require precision.
Fonts: Picking font types. Next thing could be a Font dialog.
Calendar: For picking dates or intervals
Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too.
A PenSelectorDialog widget was created for the pen parameter item too.
Also added these parameter items to the example.