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

UI Bug fixes for Horizon #863

Merged
merged 4 commits into from
Feb 26, 2024
Merged

Conversation

maharshi-gor
Copy link
Contributor

@maharshi-gor maharshi-gor commented Feb 20, 2024

This PR solves the issues for the UI bugs that appear for Horizon.

Following is fixed in this PR

  1. Solution for disks not appearing in the right position.
  2. Combo Box being out of the bounds of the tabs and with a huge size down button.

Methodology Used

  1. The _set_position (Initial position set method used by panel (TabUI)) method was setting the coordinates of the handles differently than the set_position method invoked when slider is moved. Making them consistent solved the issue.
  2. Combo Box was calculating its location from end of the drop_down_menu instead of the selected text. While passing the values in _set_position method. We just subtracted the y coordinate with the size of dropdown menu

Experiment results

Intital opening
Screenshot from 2024-02-20 09-57-34

Opened Combo Box
Screenshot from 2024-02-20 09-57-44

Selected Combo Box
Screenshot from 2024-02-20 09-57-55

Code to experiment

from fury import ui, window

# Create scene
scene = window.Scene()

# Create show manager
show_m = window.ShowManager(
    scene,
    size=(1200, 900),
    reset_camera=False
)

d_slider = ui.LineDoubleSlider2D(
    min_value=-100,
    max_value=100,
    line_width=3,
    length=450,
    outer_radius=8,
    font_size=16
)
slider = ui.LineSlider2D(
    min_value=-100,
    max_value=100,
    line_width=3,
    length=450,
    outer_radius=8,
    font_size=16
)

d_slider.default_color = (1., .5, .0)
d_slider.track.color = (.8, .3, .0)
d_slider.active_color = (.9, .4, .0)

slider.default_color = (1., .5, .0)
slider.track.color = (.8, .3, .0)
slider.active_color = (.9, .4, .0)

d_slider.handles[0].color = (1., .5, .0)
d_slider.handles[1].color = (1., .5, .0)

slider.handle.color = (1., .5, .0)


c_box = ui.ComboBox2D(
    items=['red', 'green', 'blue', 'pink', 'white', 'orange'],
    selection_bg_color=(0, 0, 0),
    selection_text_color=(0.7, 0.7, 0.7), draggable=False,
    position=(200, 200))

tab_ui = ui.TabUI(
        position=(5, 5), size=(1000, 240), nb_tabs=1,
        active_color=(1, 1, 1), inactive_color=(0.5, 0.5, 0.5),
        draggable=True)

tab_ui.add_element(0, d_slider, (.52, .35))
tab_ui.add_element(0, slider, (.52, .65))
tab_ui.add_element(0, c_box, (.52, .85))

scene.add(tab_ui)
# scene.add(d_slider)
# scene.add(c_box)

show_m.render()
show_m.start()

@skoudoro
Copy link
Contributor

Hi @maharshi-gor,

Thank you for this, Can you also update the unittests? thanks !

@skoudoro
Copy link
Contributor

There is still some tests failing. Can you rebase your PR. I fixed main so you will be able to see the issue

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.

Tests are still failing. To check more deeply

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.37%. Comparing base (b24a274) to head (1357fc8).
Report is 44 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #863      +/-   ##
==========================================
- Coverage   84.49%   84.37%   -0.13%     
==========================================
  Files          44       44              
  Lines       10454    10455       +1     
  Branches     1411     1411              
==========================================
- Hits         8833     8821      -12     
- Misses       1252     1265      +13     
  Partials      369      369              
Files Coverage Δ
fury/ui/elements.py 89.76% <100.00%> (-0.44%) ⬇️

... and 1 file with indirect coverage changes

@Garyfallidis Garyfallidis merged commit 6f7f3b0 into fury-gl:master Feb 26, 2024
24 of 30 checks passed
@Garyfallidis
Copy link
Contributor

Thank you @maharshi-gor !

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.

3 participants