-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add toolbar to array editor (Variable Explorer) #21317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice, thanks @jitseniesen! Besides my suggestions, I'd like to see the 3D additional widgets (i.e. Axis
, Shape
, Index
and Slicing
) appear in the same row as the Save and close
/Close
buttons.
Before it made sense to show them in a different row because there were buttons below them. But since you removed them in this PR, the layout looks odd now.
index = self.currentIndex() | ||
if index.isValid(): | ||
self.edit(index) | ||
|
||
|
||
class ArrayEditorWidget(QWidget): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this widget inherit from SpyderWidgetMixin
to use its API instead of building the new toolbar with low level functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the widget inherit from SpyderWidgetMixin
but I don't think I understand how to use its API to build the toolbar. I saw the .create_toolbar()
function which looks promising from its name but it creates a QToolBar
instead of a SpyderToolbar
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that's something we need to think better for that mixin. Perhaps adding create_spyder_toolbar
and renaming create_toolbar
to create_qtoolbar
would do the job, but that's not something for this PR.
Done. Now it looks like this for a 3d array: |
9efdde4
to
bcc6605
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
bcc6605
to
9efdde4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jitseniesen for your work on this! Last suggestions for you then it should be ready.
Also, please merge with master or rebase to get the fixes to our tests merged last week.
df841e5
to
c31afd4
Compare
Fine with me, so done, though I don't see the advantage of the
Done. |
You don't need to import the lower level |
Replace icon_manager.icon() by SpyderWidgetMixin.create_icon() Co-authored-by: Carlos Cordoba <[email protected]>
c31afd4
to
62a48dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @jitseniesen!
Description of Changes
This PR adds a toolbar to the array editor with five buttons: Edit, Copy, Format, Resize and Toggle Background. The last three are buttons currently at the bottom of the array editor, which are removed in this PR. The result looks as follows:
For 3d arrays, it's possible to save some space at the bottom by putting everything on one line; let me know if you would prefer that.
Here is a video showing the toolbar buttons in action:
2023-09-08.21-11-33.mp4
Issue(s) Resolved
Fixes #21315
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: Jitse Niesen