Skip to content

File Dialog UI component - #294

Closed
Nibba2018 wants to merge 23 commits into
fury-gl:masterfrom
Nibba2018:file_dialog
Closed

File Dialog UI component#294
Nibba2018 wants to merge 23 commits into
fury-gl:masterfrom
Nibba2018:file_dialog

Conversation

@Nibba2018

Copy link
Copy Markdown
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

pep8speaks commented Aug 19, 2020

Copy link
Copy Markdown

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

codecov Bot commented Aug 19, 2020

Copy link
Copy Markdown

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

Nibba2018 commented Aug 20, 2020

Copy link
Copy Markdown
Member Author

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.

@skoudoro skoudoro left a comment

Copy link
Copy Markdown
Contributor

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
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
@Nibba2018

Copy link
Copy Markdown
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

@skoudoro skoudoro left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/ui.py Outdated
Comment thread fury/tests/test2.py Outdated

@antrikshmisri antrikshmisri left a comment

Copy link
Copy Markdown
Member

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.

Comment thread fury/ui.py
multiselection: bool, optional
{True, False}
Whether multiple values can be selected at once.
reverse_scrolling: bool

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

, optional

Comment thread fury/tests/test_ui.py
dialog_type="Open")

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

Copy link
Copy Markdown
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.

Comment thread fury/ui.py
self.dialog_size = size
self.directory_contents = []

self.bg_color = bg_color

Copy link
Copy Markdown
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)

Comment thread fury/ui.py
self.directory_contents = []

self.bg_color = bg_color
self.text_color = text_color

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as above

Comment thread fury/ui.py

self.bg_color = bg_color
self.text_color = text_color
self.selected_color = selected_color

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as above

Comment thread fury/ui.py
self.bg_color = bg_color
self.text_color = text_color
self.selected_color = selected_color
self.unselected_color = unselected_color

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as above

Comment thread fury/ui.py
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
Copy Markdown
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
Copy Markdown
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