Skip to content
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

Add MainWindow variant on Container, and MainFunctionGui #110

Merged
merged 15 commits into from
Jan 22, 2021

Conversation

tlambert03
Copy link
Member

@HagaiHargil, here's a start. This adds a new MainWindow widget type, that has one (currently) new method: self.create_menu_item("Menu Name", "Menu Item Name", callback=some_callback_when_selected, shortcut='keyboard shortcut')

if you use magicgui(main_window=True) you get one with the docstring in the help menu. give it a try (see examples/widget_demo.py) and let me know if this general idea might work for you

@codecov
Copy link

codecov bot commented Jan 20, 2021

Codecov Report

Merging #110 (f45f82a) into master (4b64773) will increase coverage by 2.88%.
The diff coverage is 97.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
+ Coverage   87.35%   90.24%   +2.88%     
==========================================
  Files          25       25              
  Lines        2405     2420      +15     
==========================================
+ Hits         2101     2184      +83     
+ Misses        304      236      -68     
Impacted Files Coverage Δ
magicgui/backends/_qtpy/__init__.py 100.00% <ø> (ø)
magicgui/backends/_qtpy/widgets.py 84.93% <92.59%> (+2.14%) ⬆️
magicgui/_magicgui.py 100.00% <100.00%> (ø)
magicgui/widgets/__init__.py 100.00% <100.00%> (ø)
magicgui/widgets/_bases/__init__.py 100.00% <100.00%> (ø)
magicgui/widgets/_bases/container_widget.py 93.12% <100.00%> (+0.08%) ⬆️
magicgui/widgets/_bases/mixins.py 94.73% <100.00%> (+3.82%) ⬆️
magicgui/widgets/_concrete.py 82.30% <100.00%> (+0.56%) ⬆️
magicgui/widgets/_function_gui.py 95.23% <100.00%> (+0.97%) ⬆️
magicgui/widgets/_protocols.py 99.45% <100.00%> (+26.14%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b64773...209638e. Read the comment docs.

@HagaiHargil
Copy link
Contributor

This is awesome! Thank you so much. One quirk - for some reason I can edit the text of the "Documentation" pop up text box. But other than that it's perfect.

@tlambert03
Copy link
Member Author

ok great! Just wanted to make sure we're on the right track... Next I can make the documentation window look better, and un-editable.

I was thinking of perhaps parsing the docstrings and formatting as html, do you like that? Or shall we just leave as plaintext

@HagaiHargil
Copy link
Contributor

Well now that you mention it... :D
If an HTML document can be made out of the documentation then I can definitely see myself adding illustrations and images showing how this current GUI\tool should be used.

It will definitely be nice to have, but not a top priority.

@HagaiHargil
Copy link
Contributor

Very nice! I believe that the main docstring is in italics for some reason. Do you see it as well?

Also, would you like me to add examples, docs, use cases, whatever?

@tlambert03
Copy link
Member Author

Very nice! I believe that the main docstring is in italics for some reason. Do you see it as well?

fixed

Also, would you like me to add examples, docs, use cases, whatever?

that would be super helpful! Perhaps another example (I'm using widget_demo.py, but a more topic-specific demo would be great). And if you're up for it, a new doc page at either docs/usage/main_window.md or docs/examples/main_window.md would be great. You can use regular markdown (probably no need to mimic the jupytext stuff used in some of the other docs markdowns since we can't actually render the menu in the docs), so just regular fenced code examples would be great.

Maybe make a new PR for us to discuss it, though I'd like to add some more tests here before merging this one, is that ok?

@HagaiHargil
Copy link
Contributor

Sure thing.

@tlambert03 tlambert03 changed the title [WIP] add MainWindow variant on Container Add MainWindow variant on Container, and MainFunctionGui Jan 22, 2021
@tlambert03 tlambert03 merged commit 9e868da into pyapp-kit:master Jan 22, 2021
@tlambert03 tlambert03 deleted the mainwindow branch January 22, 2021 14:30
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.

None yet

2 participants