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

File Dialog UI component #294

Closed
wants to merge 23 commits into from
Closed

Conversation

Nibba2018
Copy link
Member

This PR will add a UI component to choose a file from the file system. The overall design will be similar to the following:
File Dialog

@pep8speaks
Copy link

pep8speaks commented Aug 19, 2020

Hello @Nibba2018! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-06-15 20:26:53 UTC

@Nibba2018 Nibba2018 added 🚀 🐍 GSOC 2020 idea /discussion/ question for GSOC 2020 type:New Feature labels Aug 19, 2020
@Nibba2018 Nibba2018 marked this pull request as draft August 19, 2020 21:01
@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #294 (32f8de5) into master (904aee6) will decrease coverage by 0.22%.
The diff coverage is 94.64%.

❗ Current head 32f8de5 differs from pull request most recent head f06f105. Consider uploading reports for the commit f06f105 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
- Coverage   89.03%   88.80%   -0.23%     
==========================================
  Files          23       21       -2     
  Lines        5419     5183     -236     
  Branches      702      665      -37     
==========================================
- Hits         4825     4603     -222     
+ Misses        409      406       -3     
+ Partials      185      174      -11     
Impacted Files Coverage Δ
fury/ui.py 88.76% <94.64%> (+0.22%) ⬆️
fury/layout.py 71.05% <0.00%> (-28.95%) ⬇️
fury/convert.py 73.33% <0.00%> (-6.67%) ⬇️
fury/primitive.py 89.39% <0.00%> (-2.39%) ⬇️
fury/utils.py 85.86% <0.00%> (-0.69%) ⬇️
fury/shaders/base.py 90.90% <0.00%> (-0.48%) ⬇️
fury/io.py 78.12% <0.00%> (-0.45%) ⬇️
fury/window.py 78.42% <0.00%> (-0.33%) ⬇️
fury/actor.py 92.81% <0.00%> (-0.18%) ⬇️
... and 7 more

@Nibba2018
Copy link
Member Author

Nibba2018 commented Aug 20, 2020

Hello @skoudoro , can you have a look at this skeletal implementation and let me know what else to add? You can run fury/tests/test2.py for a quick example.

Copy link
Contributor

@skoudoro skoudoro left a comment

Choose a reason for hiding this comment

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

Looks good, I like the simplicity @Nibba2018. you can continue in this direction.

  • Concerning design, you should emphasize a bit more each element (like you did on your sketch by showing the border of each element).
  • We should define at the init the filedialog type (save or open)
  • Can you explain why you choose a TextBlock2D for accept and reject button instead of a button2D ?

@skoudoro skoudoro added this to the v0.7.0 milestone Aug 22, 2020
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
@Nibba2018
Copy link
Member Author

Hello @skoudoro , thank you for the review. Here are some of my questions.

  • By showing more emphasis do you mean adding more gap between the elements? I could set the color of the parent panel to be the same as that of the background of FileMenu2D to make it more seamless.
  • I wasn't sure how to display text on top of a button, so I chose TextBlock2D for demonstration purposes first.

@Nibba2018 Nibba2018 marked this pull request as ready for review August 28, 2020 10:55
@skoudoro skoudoro modified the milestones: v0.7.0, v0.8.0 Mar 22, 2021
Copy link
Contributor

@skoudoro skoudoro left a comment

Choose a reason for hiding this comment

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

Hi @Nibba2018,

Thank you for the update @Nibba2018

By showing more emphasis do you mean adding more gap between the elements? I could set the color of the parent panel to be the same as that of the background of FileMenu2D to make it more seamless.

I meant border, but we might need to do that for all widgets, specially panel

I wasn't sure how to display text on top of a button, so I chose TextBlock2D for demonstration purposes first.

2 solutions:

  • We need to improve button2D to accept text ( you can make a new PR for this)
  • We need to improve text2D to allow a border (@antrikshmisri is working on this)

In any case, this PR will need some other PR before merging it. It also needs to be rebased.

Thank @Nibba2018

fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/ui.py Outdated Show resolved Hide resolved
fury/tests/test2.py Outdated Show resolved Hide resolved
Copy link
Member

@antrikshmisri antrikshmisri left a comment

Choose a reason for hiding this comment

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

Hey @Nibba2018, here's a quick overview of the PR. I'll have to test some things out first to provide a in depth review.

multiselection: bool, optional
{True, False}
Whether multiple values can be selected at once.
reverse_scrolling: bool
Copy link
Member

Choose a reason for hiding this comment

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

, optional

dialog_type="Open")

# Create temporary directory and files
os.mkdir(os.path.join(os.getcwd(), "testdir"))
Copy link
Member

Choose a reason for hiding this comment

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

You could use something like TemporaryDirectory from tempfile to create temporary directory. That way it will automatically delete the temporary folder and files created under the temporary directory. Nothing critical.

self.dialog_size = size
self.directory_contents = []

self.bg_color = bg_color
Copy link
Member

Choose a reason for hiding this comment

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

You could use np.clip to clip the individual color values between (0, 1)

self.directory_contents = []

self.bg_color = bg_color
self.text_color = text_color
Copy link
Member

Choose a reason for hiding this comment

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

Same as above


self.bg_color = bg_color
self.text_color = text_color
self.selected_color = selected_color
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

self.bg_color = bg_color
self.text_color = text_color
self.selected_color = selected_color
self.unselected_color = unselected_color
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

self.text_color = text_color
self.selected_color = selected_color
self.unselected_color = unselected_color
self.scroll_bar_active_color = scroll_bar_active_color
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@ganimtron-10
Copy link
Contributor

Superseeding with PR #832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: UI 🚀 🐍 GSOC 2020 idea /discussion/ question for GSOC 2020 type:New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants