fury-gl / fury

FURY - Free Unified Rendering in pYthon.
https://fury.gl
Other
230 stars 163 forks source link

Clicking the tab of a ComboBox2D opens dropdown without changing icon #731

Closed P3rcy-8685 closed 1 year ago

P3rcy-8685 commented 1 year ago

Description

Basically, when in the below code, I click on the colors title bar while my drop down is closed, it opens the menu without changing the icon. This leads to the icons getting flipped (i.e. closed icon corresponding to an open menu, and vice versa)

Way to reproduce

from fury import ui, window, actor
import numpy as np
from fury.data import fetch_viz_icons

fetch_viz_icons()

colors = {
    "Violet": (0.6, 0, 0.8),
    "Indigo": (0.3, 0, 0.5),
    "Blue": (0, 0, 1),
    "Green": (0, 1, 0),
    "Yellow": (1, 1, 0),
    "Orange": (1, 0.5, 0),
    "Red": (1, 0, 0)
}

tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=1 , draggable=True)
color_combobox = ui.ComboBox2D(items=list(colors.keys()),
                               placeholder="Choose Text Color",
                               size=(250, 150), draggable=True)

tab_ui.add_element(0, color_combobox, (0.1, 0.3))
label = ui.TextBlock2D(
    position=(600, 300), font_size=40, color=(1, 0.5, 0),
    justification="center", vertical_justification="top",
    text="FURY rocks!!!")                               

def change_color(combobox):
    label.color = colors[combobox.selected_text]

tab_ui.tabs[0].title = "Colors"
color_combobox.on_change = change_color
sm = window.ShowManager(size=(800, 500), title="Viz Tab")
sm.scene.add(tab_ui,label)
interactive = True

if interactive:
    sm.start()

image

{'fury_version': '0.8.0.post1454+g3771685a', 'pkg_path': '/home/percy/fury/fury', 'commit_hash': '3771685aa1f84f71ef9568b4731295dfaf707de4', 'sys_version': '3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]', 'sys_executable': '/usr/bin/python3', 'sys_platform': 'linux', 'numpy_version': '1.24.1', 'scipy_version': '1.10.0', 'vtk_version': '9.2.5', 'matplotlib_version': '3.6.3'}

P3rcy-8685 commented 1 year ago

I'll take up this issue, if it's fine...

skoudoro commented 1 year ago

duplicate of #562

PR open to check: https://github.com/fury-gl/fury/pull/576