From 731072e66f3d558329c2f6169aeaef7e33ef263c Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Tue, 19 Dec 2023 21:30:43 +0530 Subject: [PATCH 01/17] Added top/bottom for Tabs Bar in Tab Panel UI --- fury/ui/containers.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 1f5bc2021..b960d11a1 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -619,6 +619,7 @@ def __init__( inactive_color=(0.5, 0.5, 0.5), draggable=False, startup_tab_id=None, + tabBar_pos="top", ): """Init class instance. @@ -640,6 +641,8 @@ def __init__( startup_tab_id : int, optional Tab to be activated and uncollapsed on startup. by default None is activated/ all collapsed. + tabBar_post : str, optional + Position of the Tabs Bar in the panel """ self.tabs = [] self.nb_tabs = nb_tabs @@ -650,6 +653,7 @@ def __init__( self.inactive_color = inactive_color self.active_tab_idx = startup_tab_id self.collapsed = True + self.tabBar_pos = tabBar_pos super(TabUI, self).__init__() self.position = position @@ -715,8 +719,10 @@ def _get_size(self): def update_tabs(self): """Update position, size and callbacks for tab panels.""" self.tab_panel_size = (self.size[0] // self.nb_tabs, int(0.1 * self.size[1])) - - tab_panel_pos = [0.0, 0.9] + if self.tabBar_pos == "top": + tab_panel_pos = [0.0, 0.9] + elif self.tabBar_pos == "bottom": + tab_panel_pos = [0.0, 0.0] for tab_panel in self.tabs: tab_panel.resize(self.tab_panel_size) tab_panel.content_panel.position = self.position @@ -754,7 +760,10 @@ def update_tabs(self): tab_panel.content_panel.resize(self.content_size) self.parent_panel.add_element(tab_panel, tab_panel_pos) - self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.0)) + if self.tabBar_pos == "top": + self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.0)) + elif self.tabBar_pos == "bottom": + self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.1)) tab_panel_pos[0] += 1 / self.nb_tabs def select_tab_callback(self, iren, _obj, _tab_comp): From b0fdf4f072458588e0adad45c4d69469bdac3b72 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Tue, 19 Dec 2023 22:12:06 +0530 Subject: [PATCH 02/17] fixed typo in TabUI class docstring --- fury/ui/containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index b960d11a1..51646a1f5 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -641,7 +641,7 @@ def __init__( startup_tab_id : int, optional Tab to be activated and uncollapsed on startup. by default None is activated/ all collapsed. - tabBar_post : str, optional + tabBar_pos : str, optional Position of the Tabs Bar in the panel """ self.tabs = [] From 6372294dcd71559064473dbefc2b85ffd4e515d6 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Tue, 19 Dec 2023 22:16:16 +0530 Subject: [PATCH 03/17] fixed lint error --- fury/ui/containers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 51646a1f5..082dd186b 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -761,9 +761,11 @@ def update_tabs(self): tab_panel.content_panel.resize(self.content_size) self.parent_panel.add_element(tab_panel, tab_panel_pos) if self.tabBar_pos == "top": - self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.0)) + self.parent_panel.add_element(tab_panel.content_panel, + (0.0, 0.0)) elif self.tabBar_pos == "bottom": - self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.1)) + self.parent_panel.add_element(tab_panel.content_panel, + (0.0, 0.1)) tab_panel_pos[0] += 1 / self.nb_tabs def select_tab_callback(self, iren, _obj, _tab_comp): From 5cb5fcc1eed5d2a2ddda6ce11076d39498949839 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Wed, 20 Dec 2023 16:55:57 +0530 Subject: [PATCH 04/17] Added separate tests for Tabs Bar position at top and bottom --- fury/data/files/test_ui_tab_ui_bottom.json | 1 + fury/data/files/test_ui_tab_ui_bottom.log.gz | Bin 0 -> 7296 bytes fury/ui/tests/test_containers.py | 116 ++++++++++++++++++- 3 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 fury/data/files/test_ui_tab_ui_bottom.json create mode 100644 fury/data/files/test_ui_tab_ui_bottom.log.gz diff --git a/fury/data/files/test_ui_tab_ui_bottom.json b/fury/data/files/test_ui_tab_ui_bottom.json new file mode 100644 index 000000000..ef81dc540 --- /dev/null +++ b/fury/data/files/test_ui_tab_ui_bottom.json @@ -0,0 +1 @@ +{"CharEvent": 0, "MouseMoveEvent": 905, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 67, "LeftButtonReleaseEvent": 67, "RightButtonPressEvent": 16, "RightButtonReleaseEvent": 16, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0} \ No newline at end of file diff --git a/fury/data/files/test_ui_tab_ui_bottom.log.gz b/fury/data/files/test_ui_tab_ui_bottom.log.gz new file mode 100644 index 0000000000000000000000000000000000000000..d686931e1f160c2f42f09509868b904ebdff23a0 GIT binary patch literal 7296 zcmV-`9Dm~Fx8M-oE_wx3|yVF6sTh-~IIY+kgEqR=HTV zcR&8&*S~&!`@^q)dpioup@6tT1z-#Xm;)Vv9=DhPw0bei0F>##0KhMAr921vY8R{U z7Ja0PHM&Cew`dChe*^3AkZpNO4tUKrx&WF2iU}ZjQ+IgHI=rD8yhZg^wAujhzF-BO zq0Ge{rVMZD1h*(XU-E*lS(*cr0Dp@-2=FeKI|6pejo!l6CD%bfyX3M6@VB5|U9w++ z#zjf~44H1>&73neb@FG(={aD_Z$Tf+yxZqg3Frb$6ACPm#Tw&BedxVgkVL=)(Y4!dQu| zFX}1N=M5SPzFZe-g_tu64VKc{r50KN(!5k$WPJXvv(Pf-x1gqOK5teUQO&zc9g`N@ zG+eb!^f&LVqC>9Jz*NAvd5gcBf}h_0?d|8UPrwfyztn>`CZi|i$Ms!Z(O(%*SE%Y4ww*`7Hj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4FRQBpOKoQLjsu#LA+m7VY}3 zKoxbnX!9|ASAd0|uK=~ATf~DxgRa0j3(&st3Q$?D7~M3>U4g0qYACnX#u^Hk3RtfI a?@W&SAAkCfU%oy2?LPs4cIwg82>}4sB$h}3 literal 0 HcmV?d00001 diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 0f18d9853..a8cebf6c6 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -249,13 +249,13 @@ def test_ui_image_container_2d(interactive=False): show_manager.start() -def test_ui_tab_ui(interactive=False): +def test_ui_tab_ui_top(interactive=False): filename = 'test_ui_tab_ui' recording_filename = pjoin(DATA_DIR, filename + '.log.gz') expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True) + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tabBar_pos="top") tab_ui.tabs[0].title = 'Tab 1' tab_ui.tabs[1].title = 'Tab 2' @@ -360,3 +360,115 @@ def tab_change(tab_ui): npt.assert_equal(0, tab_ui.active_tab_idx) npt.assert_equal(11, next(changes)) npt.assert_equal(5, next(collapses)) + +def test_ui_tab_ui_bottom(interactive=False): + filename = 'test_ui_tab_ui_bottom' + recording_filename = pjoin(DATA_DIR, filename + '.log.gz') + expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') + + tab_ui = ui.TabUI( + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tabBar_pos="bottom") + + tab_ui.tabs[0].title = 'Tab 1' + tab_ui.tabs[1].title = 'Tab 2' + tab_ui.tabs[2].title = 'Tab 3' + + npt.assert_equal(tab_ui.tabs[0].title_bold, False) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, False) + + tab_ui.tabs[0].title_bold = True + tab_ui.tabs[1].title_bold = False + tab_ui.tabs[2].title_bold = True + + npt.assert_equal(tab_ui.tabs[0].title_bold, True) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, True) + + npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) + + tab_ui.tabs[0].title_color = (1, 0, 0) + tab_ui.tabs[1].title_color = (0, 1, 0) + tab_ui.tabs[2].title_color = (0, 0, 1) + + npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) + + npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) + + tab_ui.tabs[0].title_font_size = 10 + tab_ui.tabs[1].title_font_size = 20 + tab_ui.tabs[2].title_font_size = 30 + + npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) + + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, False) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) + + tab_ui.tabs[0].title_italic = False + tab_ui.tabs[1].title_italic = True + tab_ui.tabs[2].title_italic = False + + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, True) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) + + tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) + tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) + tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + + with npt.assert_raises(IndexError): + tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + + with npt.assert_raises(IndexError): + tab_ui.remove_element(3, ui.TextBlock2D()) + + with npt.assert_raises(IndexError): + tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + + npt.assert_equal('Tab 1', tab_ui.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui.tabs[2].title) + + npt.assert_equal(3, tab_ui.nb_tabs) + + collapses = itertools.count() + changes = itertools.count() + + def collapse(tab_ui): + if tab_ui.collapsed: + next(collapses) + + def tab_change(tab_ui): + next(changes) + + tab_ui.on_change = tab_change + tab_ui.on_collapse = collapse + + event_counter = EventCounter() + event_counter.monitor(tab_ui) + + current_size = (800, 800) + show_manager = window.ShowManager(size=current_size, title='Tab UI Test') + show_manager.scene.add(tab_ui) + + if interactive: + show_manager.record_events_to_file(recording_filename) + print(list(event_counter.events_counts.items())) + event_counter.save(expected_events_counts_filename) + else: + show_manager.play_events_from_file(recording_filename) + expected = EventCounter.load(expected_events_counts_filename) + event_counter.check_counts(expected) + + npt.assert_equal(0, tab_ui.active_tab_idx) + npt.assert_equal(11, next(changes)) + npt.assert_equal(4, next(collapses)) \ No newline at end of file From 6daeb3187501d3293870e11c36f953b8532db1cd Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Wed, 20 Dec 2023 17:02:19 +0530 Subject: [PATCH 05/17] fixed lint errors --- fury/ui/tests/test_containers.py | 57 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index a8cebf6c6..03b2b478a 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -255,56 +255,57 @@ def test_ui_tab_ui_top(interactive=False): expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tabBar_pos="top") + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, + tabBar_pos="top") tab_ui.tabs[0].title = 'Tab 1' tab_ui.tabs[1].title = 'Tab 2' tab_ui.tabs[2].title = 'Tab 3' - + npt.assert_equal(tab_ui.tabs[0].title_bold, False) npt.assert_equal(tab_ui.tabs[1].title_bold, False) npt.assert_equal(tab_ui.tabs[2].title_bold, False) - + tab_ui.tabs[0].title_bold = True tab_ui.tabs[1].title_bold = False tab_ui.tabs[2].title_bold = True - + npt.assert_equal(tab_ui.tabs[0].title_bold, True) npt.assert_equal(tab_ui.tabs[1].title_bold, False) npt.assert_equal(tab_ui.tabs[2].title_bold, True) - + npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) - + tab_ui.tabs[0].title_color = (1, 0, 0) tab_ui.tabs[1].title_color = (0, 1, 0) tab_ui.tabs[2].title_color = (0, 0, 1) - + npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) - + npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) - + tab_ui.tabs[0].title_font_size = 10 tab_ui.tabs[1].title_font_size = 20 tab_ui.tabs[2].title_font_size = 30 - + npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) - + npt.assert_equal(tab_ui.tabs[0].title_italic, False) npt.assert_equal(tab_ui.tabs[1].title_italic, False) npt.assert_equal(tab_ui.tabs[2].title_italic, False) - + tab_ui.tabs[0].title_italic = False tab_ui.tabs[1].title_italic = True tab_ui.tabs[2].title_italic = False - + npt.assert_equal(tab_ui.tabs[0].title_italic, False) npt.assert_equal(tab_ui.tabs[1].title_italic, True) npt.assert_equal(tab_ui.tabs[2].title_italic, False) @@ -361,62 +362,64 @@ def tab_change(tab_ui): npt.assert_equal(11, next(changes)) npt.assert_equal(5, next(collapses)) + def test_ui_tab_ui_bottom(interactive=False): filename = 'test_ui_tab_ui_bottom' recording_filename = pjoin(DATA_DIR, filename + '.log.gz') expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tabBar_pos="bottom") + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, + tabBar_pos="bottom") tab_ui.tabs[0].title = 'Tab 1' tab_ui.tabs[1].title = 'Tab 2' tab_ui.tabs[2].title = 'Tab 3' - + npt.assert_equal(tab_ui.tabs[0].title_bold, False) npt.assert_equal(tab_ui.tabs[1].title_bold, False) npt.assert_equal(tab_ui.tabs[2].title_bold, False) - + tab_ui.tabs[0].title_bold = True tab_ui.tabs[1].title_bold = False tab_ui.tabs[2].title_bold = True - + npt.assert_equal(tab_ui.tabs[0].title_bold, True) npt.assert_equal(tab_ui.tabs[1].title_bold, False) npt.assert_equal(tab_ui.tabs[2].title_bold, True) - + npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) - + tab_ui.tabs[0].title_color = (1, 0, 0) tab_ui.tabs[1].title_color = (0, 1, 0) tab_ui.tabs[2].title_color = (0, 0, 1) - + npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) - + npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) - + tab_ui.tabs[0].title_font_size = 10 tab_ui.tabs[1].title_font_size = 20 tab_ui.tabs[2].title_font_size = 30 - + npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) - + npt.assert_equal(tab_ui.tabs[0].title_italic, False) npt.assert_equal(tab_ui.tabs[1].title_italic, False) npt.assert_equal(tab_ui.tabs[2].title_italic, False) - + tab_ui.tabs[0].title_italic = False tab_ui.tabs[1].title_italic = True tab_ui.tabs[2].title_italic = False - + npt.assert_equal(tab_ui.tabs[0].title_italic, False) npt.assert_equal(tab_ui.tabs[1].title_italic, True) npt.assert_equal(tab_ui.tabs[2].title_italic, False) @@ -471,4 +474,4 @@ def tab_change(tab_ui): npt.assert_equal(0, tab_ui.active_tab_idx) npt.assert_equal(11, next(changes)) - npt.assert_equal(4, next(collapses)) \ No newline at end of file + npt.assert_equal(4, next(collapses)) From 9c1bc1febf2e7ee02c2b37e8b653d089739bae5b Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Thu, 21 Dec 2023 19:23:32 +0530 Subject: [PATCH 06/17] Combined the tests for top and bottom Tabs Bar in Tab UI --- fury/data/files/test_ui_tab_ui_bottom.json | 2 +- fury/data/files/test_ui_tab_ui_bottom.log.gz | Bin 7296 -> 5915 bytes ...ui_tab_ui.json => test_ui_tab_ui_top.json} | 0 ...ab_ui.log.gz => test_ui_tab_ui_top.log.gz} | Bin fury/ui/tests/test_containers.py | 284 ++++++------------ 5 files changed, 87 insertions(+), 199 deletions(-) rename fury/data/files/{test_ui_tab_ui.json => test_ui_tab_ui_top.json} (100%) rename fury/data/files/{test_ui_tab_ui.log.gz => test_ui_tab_ui_top.log.gz} (100%) diff --git a/fury/data/files/test_ui_tab_ui_bottom.json b/fury/data/files/test_ui_tab_ui_bottom.json index ef81dc540..0075b7d76 100644 --- a/fury/data/files/test_ui_tab_ui_bottom.json +++ b/fury/data/files/test_ui_tab_ui_bottom.json @@ -1 +1 @@ -{"CharEvent": 0, "MouseMoveEvent": 905, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 67, "LeftButtonReleaseEvent": 67, "RightButtonPressEvent": 16, "RightButtonReleaseEvent": 16, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0} \ No newline at end of file +{"CharEvent": 0, "MouseMoveEvent": 600, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 63, "LeftButtonReleaseEvent": 63, "RightButtonPressEvent": 10, "RightButtonReleaseEvent": 10, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0} \ No newline at end of file diff --git a/fury/data/files/test_ui_tab_ui_bottom.log.gz b/fury/data/files/test_ui_tab_ui_bottom.log.gz index d686931e1f160c2f42f09509868b904ebdff23a0..1f066afc4635ef56bc6eef65b89c076fe4113969 100644 GIT binary patch literal 5915 zcmV+$7v$(4iwFqrK!jxi|8!+@bYFF8Uvyz&Uv+6;VsCVGZ*4AYZ)X6#olT3ZNp42> z^D7d(HxW{NZVkPg0n-NW8+>gy*xk^5XYkLr6p7(hRpxoJ`n?`%8K?4%PlZBKDE{I0 zFJFKA^3#9+>zCht|M}NnZuKASPe1(f^~-NR{O!vxUvJaxHpi{}-`}79^6OuJ|MHh# z|Mulc`Hx?I`M1~qxr*|_<+g6CQF*^@r}A>Eg+5Tnt=2_=-KuQ@;uB7vDC<@mRWd4A zdm+FBfKQAapBV6ou@n%az(5o-(6#`)1yBK~0dyFPzOthx0MU!JcL2&{ppE_pqbU9nT0-K(NTqdq3+w> zRPMLksl42_L3z|}ZBaf&c^Bm_%CUa?Hn%9B-2N&0XSyh_Tt1d47vCS^_xl#*qWxWb zzc*3t-2a!$n%Pzy9*izkT`r_b1c` zIaF?odMUPMlrkZSYaJvBQ`pixJX`q%}sRF186aumigLh{)6F_YQcyv^yR>WY@zTqKsZBR!=9~kL- z7TcQP{vL9}Xn(ip0|ugr<|LhBYqCZQ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dW)hSa@+PQyCbRinj`{|`1o%3$;A;{0w~-kBZ?3W@4CDFIpEgt z{`AYA|ME!B1-KhQ7h%e4peZ1i3Vs>fbqZyPdtuI>*8d@wlX^cT>(u2!qaDa1)?3x zcFR&bgk^?Na8(2h?4SjVYS`zV7)KXDEL}ua7{-VAdO^WFIa-o>^;NH(Zeb=Q;r&Zy zI%4)#&X`T=e~*QM{2}KPk>Z=5-bobK9k}xRru?(-Ur^@0h73N5GrIvqqbzosG_SA5 z`tvyndHL+Ug5!R|Q$?YuIW|}r_E%NdUse4(%$PSAci97=RuLdYqjX0% zQdV9L*98{S2=54mvqU`vj*kqlK*Omdb3lxxqJX}O767m~bRYuNFoG(2G>3VGtR)TkbpsiZcwu2LrBhM4sUKGt>$;l2`-7l*Lsv)<6u< zjYI2#HF=CH$>eaAvMpeH?!~%5M#-&VMlz7QFj!)Fp#<9;3lsz1VMyXIR$0pNjdKz* zx|RsWj^0GcJwBu3?-A}r)_zn@qTjpNEyTi=v7RbhrO{I{%R2rZ^{4pvm{TYzD0XBR z^WS&rCzuboEL2Q5lwawW#{`laoB!QL=Ju!eHNleD1B&0nWGX2C&vxGwLCSf1`)GCv z%~!I~cRf3_sG87z3dap5*G8-*%WUN&^85V?qONo0`i7C@+-cL-{1%-i@~Ab*RT_N; z>a;9J*`ZEN-Mx=@E*fN)jmXqS95o!9W+358OfBenf{MlR4@{je*6a{4FRQBpOKoQLjsu#LA+m7VY}3 zKoxbnX!9|ASAd0|uK=~ATf~DxgRa0j3(&st3Q$?D7~M3>U4g0qYACnX#u^Hk3RtfI a?@W&SAAkCfU%oy2?LPs4cIwg82>}4sB$h}3 diff --git a/fury/data/files/test_ui_tab_ui.json b/fury/data/files/test_ui_tab_ui_top.json similarity index 100% rename from fury/data/files/test_ui_tab_ui.json rename to fury/data/files/test_ui_tab_ui_top.json diff --git a/fury/data/files/test_ui_tab_ui.log.gz b/fury/data/files/test_ui_tab_ui_top.log.gz similarity index 100% rename from fury/data/files/test_ui_tab_ui.log.gz rename to fury/data/files/test_ui_tab_ui_top.log.gz diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 03b2b478a..7629c7695 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -249,229 +249,117 @@ def test_ui_image_container_2d(interactive=False): show_manager.start() -def test_ui_tab_ui_top(interactive=False): - filename = 'test_ui_tab_ui' - recording_filename = pjoin(DATA_DIR, filename + '.log.gz') - expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') - - tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, - tabBar_pos="top") - - tab_ui.tabs[0].title = 'Tab 1' - tab_ui.tabs[1].title = 'Tab 2' - tab_ui.tabs[2].title = 'Tab 3' - - npt.assert_equal(tab_ui.tabs[0].title_bold, False) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, False) - - tab_ui.tabs[0].title_bold = True - tab_ui.tabs[1].title_bold = False - tab_ui.tabs[2].title_bold = True - - npt.assert_equal(tab_ui.tabs[0].title_bold, True) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, True) - - npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) - - tab_ui.tabs[0].title_color = (1, 0, 0) - tab_ui.tabs[1].title_color = (0, 1, 0) - tab_ui.tabs[2].title_color = (0, 0, 1) - - npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) - - npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) - - tab_ui.tabs[0].title_font_size = 10 - tab_ui.tabs[1].title_font_size = 20 - tab_ui.tabs[2].title_font_size = 30 - - npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) - - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, False) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) - - tab_ui.tabs[0].title_italic = False - tab_ui.tabs[1].title_italic = True - tab_ui.tabs[2].title_italic = False - - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, True) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) - - tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) - tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) - tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) - - with npt.assert_raises(IndexError): - tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - - with npt.assert_raises(IndexError): - tab_ui.remove_element(3, ui.TextBlock2D()) - - with npt.assert_raises(IndexError): - tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - - npt.assert_equal('Tab 1', tab_ui.tabs[0].title) - npt.assert_equal('Tab 2', tab_ui.tabs[1].title) - npt.assert_equal('Tab 3', tab_ui.tabs[2].title) - - npt.assert_equal(3, tab_ui.nb_tabs) - - collapses = itertools.count() - changes = itertools.count() - - def collapse(tab_ui): - if tab_ui.collapsed: - next(collapses) - - def tab_change(tab_ui): - next(changes) +def test_ui_tab_ui(interactive=False): + positions = ['top', 'bottom'] + for i in positions: + filename = 'test_ui_tab_ui' + '_' + i + recording_filename = pjoin(DATA_DIR, filename + '.log.gz') + expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') - tab_ui.on_change = tab_change - tab_ui.on_collapse = collapse + tab_ui = ui.TabUI( + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, + tabBar_pos=i) - event_counter = EventCounter() - event_counter.monitor(tab_ui) + tab_ui.tabs[0].title = 'Tab 1' + tab_ui.tabs[1].title = 'Tab 2' + tab_ui.tabs[2].title = 'Tab 3' - current_size = (800, 800) - show_manager = window.ShowManager(size=current_size, title='Tab UI Test') - show_manager.scene.add(tab_ui) + npt.assert_equal(tab_ui.tabs[0].title_bold, False) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, False) - if interactive: - show_manager.record_events_to_file(recording_filename) - print(list(event_counter.events_counts.items())) - event_counter.save(expected_events_counts_filename) - else: - show_manager.play_events_from_file(recording_filename) - expected = EventCounter.load(expected_events_counts_filename) - event_counter.check_counts(expected) - - npt.assert_equal(0, tab_ui.active_tab_idx) - npt.assert_equal(11, next(changes)) - npt.assert_equal(5, next(collapses)) - - -def test_ui_tab_ui_bottom(interactive=False): - filename = 'test_ui_tab_ui_bottom' - recording_filename = pjoin(DATA_DIR, filename + '.log.gz') - expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') + tab_ui.tabs[0].title_bold = True + tab_ui.tabs[1].title_bold = False + tab_ui.tabs[2].title_bold = True - tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, - tabBar_pos="bottom") + npt.assert_equal(tab_ui.tabs[0].title_bold, True) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, True) - tab_ui.tabs[0].title = 'Tab 1' - tab_ui.tabs[1].title = 'Tab 2' - tab_ui.tabs[2].title = 'Tab 3' + npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[0].title_bold, False) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, False) + tab_ui.tabs[0].title_color = (1, 0, 0) + tab_ui.tabs[1].title_color = (0, 1, 0) + tab_ui.tabs[2].title_color = (0, 0, 1) - tab_ui.tabs[0].title_bold = True - tab_ui.tabs[1].title_bold = False - tab_ui.tabs[2].title_bold = True + npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) - npt.assert_equal(tab_ui.tabs[0].title_bold, True) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, True) + npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) + tab_ui.tabs[0].title_font_size = 10 + tab_ui.tabs[1].title_font_size = 20 + tab_ui.tabs[2].title_font_size = 30 - tab_ui.tabs[0].title_color = (1, 0, 0) - tab_ui.tabs[1].title_color = (0, 1, 0) - tab_ui.tabs[2].title_color = (0, 0, 1) + npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) - npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, False) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) - npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) + tab_ui.tabs[0].title_italic = False + tab_ui.tabs[1].title_italic = True + tab_ui.tabs[2].title_italic = False - tab_ui.tabs[0].title_font_size = 10 - tab_ui.tabs[1].title_font_size = 20 - tab_ui.tabs[2].title_font_size = 30 + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, True) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) - npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) + tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) + tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) + tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, False) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) + with npt.assert_raises(IndexError): + tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - tab_ui.tabs[0].title_italic = False - tab_ui.tabs[1].title_italic = True - tab_ui.tabs[2].title_italic = False + with npt.assert_raises(IndexError): + tab_ui.remove_element(3, ui.TextBlock2D()) - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, True) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) + with npt.assert_raises(IndexError): + tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) - tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) - tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + npt.assert_equal('Tab 1', tab_ui.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui.tabs[2].title) - with npt.assert_raises(IndexError): - tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + npt.assert_equal(3, tab_ui.nb_tabs) - with npt.assert_raises(IndexError): - tab_ui.remove_element(3, ui.TextBlock2D()) + collapses = itertools.count() + changes = itertools.count() - with npt.assert_raises(IndexError): - tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + def collapse(tab_ui): + if tab_ui.collapsed: + next(collapses) - npt.assert_equal('Tab 1', tab_ui.tabs[0].title) - npt.assert_equal('Tab 2', tab_ui.tabs[1].title) - npt.assert_equal('Tab 3', tab_ui.tabs[2].title) + def tab_change(tab_ui): + next(changes) - npt.assert_equal(3, tab_ui.nb_tabs) + tab_ui.on_change = tab_change + tab_ui.on_collapse = collapse - collapses = itertools.count() - changes = itertools.count() + event_counter = EventCounter() + event_counter.monitor(tab_ui) - def collapse(tab_ui): - if tab_ui.collapsed: - next(collapses) + current_size = (800, 800) + show_manager = window.ShowManager(size=current_size, title='Tab UI Test') + show_manager.scene.add(tab_ui) - def tab_change(tab_ui): - next(changes) - - tab_ui.on_change = tab_change - tab_ui.on_collapse = collapse - - event_counter = EventCounter() - event_counter.monitor(tab_ui) - - current_size = (800, 800) - show_manager = window.ShowManager(size=current_size, title='Tab UI Test') - show_manager.scene.add(tab_ui) - - if interactive: - show_manager.record_events_to_file(recording_filename) - print(list(event_counter.events_counts.items())) - event_counter.save(expected_events_counts_filename) - else: - show_manager.play_events_from_file(recording_filename) - expected = EventCounter.load(expected_events_counts_filename) - event_counter.check_counts(expected) + if interactive: + show_manager.record_events_to_file(recording_filename) + print(list(event_counter.events_counts.items())) + event_counter.save(expected_events_counts_filename) + else: + show_manager.play_events_from_file(recording_filename) + expected = EventCounter.load(expected_events_counts_filename) + event_counter.check_counts(expected) - npt.assert_equal(0, tab_ui.active_tab_idx) - npt.assert_equal(11, next(changes)) - npt.assert_equal(4, next(collapses)) + npt.assert_equal(0, tab_ui.active_tab_idx) + npt.assert_equal(11, next(changes)) + npt.assert_equal(5, next(collapses)) From d2014da80cf8301c437c472bf2b3ca073736d760 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Thu, 21 Dec 2023 19:25:45 +0530 Subject: [PATCH 07/17] fixed lint errors --- fury/ui/tests/test_containers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 7629c7695..670094e50 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -312,7 +312,8 @@ def test_ui_tab_ui(interactive=False): npt.assert_equal(tab_ui.tabs[1].title_italic, True) npt.assert_equal(tab_ui.tabs[2].title_italic, False) - tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) + tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), + (0.5, 0.5)) tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -348,7 +349,8 @@ def tab_change(tab_ui): event_counter.monitor(tab_ui) current_size = (800, 800) - show_manager = window.ShowManager(size=current_size, title='Tab UI Test') + show_manager = window.ShowManager(size=current_size, + title='Tab UI Test') show_manager.scene.add(tab_ui) if interactive: From 430e357b395bd009cfeaa9f6b77fe9204214a516 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Tue, 26 Dec 2023 15:04:02 +0530 Subject: [PATCH 08/17] updated unit test and reverted the sprite test update. variable naming done according to snake_case --- fury/ui/containers.py | 12 +- fury/ui/tests/test_containers.py | 234 +++++++++++++++++++------------ 2 files changed, 153 insertions(+), 93 deletions(-) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 082dd186b..b4e536b46 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -619,7 +619,7 @@ def __init__( inactive_color=(0.5, 0.5, 0.5), draggable=False, startup_tab_id=None, - tabBar_pos="top", + tab_bar_pos="top", ): """Init class instance. @@ -653,7 +653,7 @@ def __init__( self.inactive_color = inactive_color self.active_tab_idx = startup_tab_id self.collapsed = True - self.tabBar_pos = tabBar_pos + self.tab_bar_pos = tab_bar_pos super(TabUI, self).__init__() self.position = position @@ -719,9 +719,9 @@ def _get_size(self): def update_tabs(self): """Update position, size and callbacks for tab panels.""" self.tab_panel_size = (self.size[0] // self.nb_tabs, int(0.1 * self.size[1])) - if self.tabBar_pos == "top": + if self.tab_bar_pos == "top": tab_panel_pos = [0.0, 0.9] - elif self.tabBar_pos == "bottom": + elif self.tab_bar_pos == "bottom": tab_panel_pos = [0.0, 0.0] for tab_panel in self.tabs: tab_panel.resize(self.tab_panel_size) @@ -760,10 +760,10 @@ def update_tabs(self): tab_panel.content_panel.resize(self.content_size) self.parent_panel.add_element(tab_panel, tab_panel_pos) - if self.tabBar_pos == "top": + if self.tab_bar_pos == "top": self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.0)) - elif self.tabBar_pos == "bottom": + elif self.tab_bar_pos == "bottom": self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.1)) tab_panel_pos[0] += 1 / self.nb_tabs diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 670094e50..f347127dd 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -250,118 +250,178 @@ def test_ui_image_container_2d(interactive=False): def test_ui_tab_ui(interactive=False): - positions = ['top', 'bottom'] - for i in positions: - filename = 'test_ui_tab_ui' + '_' + i - recording_filename = pjoin(DATA_DIR, filename + '.log.gz') - expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') + filename = 'test_ui_tab_ui_top' + recording_filename = pjoin(DATA_DIR, filename + '.log.gz') + expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') + + tab_ui_top = ui.TabUI( + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, + tab_bar_pos='top') + + tab_ui_top.tabs[0].title = 'Tab 1' + tab_ui_top.tabs[1].title = 'Tab 2' + tab_ui_top.tabs[2].title = 'Tab 3' + + npt.assert_equal(tab_ui_top.tabs[0].title_bold, False) + npt.assert_equal(tab_ui_top.tabs[1].title_bold, False) + npt.assert_equal(tab_ui_top.tabs[2].title_bold, False) + + tab_ui_top.tabs[0].title_bold = True + tab_ui_top.tabs[1].title_bold = False + tab_ui_top.tabs[2].title_bold = True - tab_ui = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, - tabBar_pos=i) + npt.assert_equal(tab_ui_top.tabs[0].title_bold, True) + npt.assert_equal(tab_ui_top.tabs[1].title_bold, False) + npt.assert_equal(tab_ui_top.tabs[2].title_bold, True) - tab_ui.tabs[0].title = 'Tab 1' - tab_ui.tabs[1].title = 'Tab 2' - tab_ui.tabs[2].title = 'Tab 3' + npt.assert_equal(tab_ui_top.tabs[0].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui_top.tabs[1].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui_top.tabs[2].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[0].title_bold, False) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, False) + tab_ui_top.tabs[0].title_color = (1, 0, 0) + tab_ui_top.tabs[1].title_color = (0, 1, 0) + tab_ui_top.tabs[2].title_color = (0, 0, 1) - tab_ui.tabs[0].title_bold = True - tab_ui.tabs[1].title_bold = False - tab_ui.tabs[2].title_bold = True + npt.assert_equal(tab_ui_top.tabs[0].title_color, (1., .0, .0)) + npt.assert_equal(tab_ui_top.tabs[1].title_color, (.0, 1., .0)) + npt.assert_equal(tab_ui_top.tabs[2].title_color, (.0, .0, 1.)) - npt.assert_equal(tab_ui.tabs[0].title_bold, True) - npt.assert_equal(tab_ui.tabs[1].title_bold, False) - npt.assert_equal(tab_ui.tabs[2].title_bold, True) + npt.assert_equal(tab_ui_top.tabs[0].title_font_size, 18) + npt.assert_equal(tab_ui_top.tabs[1].title_font_size, 18) + npt.assert_equal(tab_ui_top.tabs[2].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) + tab_ui_top.tabs[0].title_font_size = 10 + tab_ui_top.tabs[1].title_font_size = 20 + tab_ui_top.tabs[2].title_font_size = 30 - tab_ui.tabs[0].title_color = (1, 0, 0) - tab_ui.tabs[1].title_color = (0, 1, 0) - tab_ui.tabs[2].title_color = (0, 0, 1) + npt.assert_equal(tab_ui_top.tabs[0].title_font_size, 10) + npt.assert_equal(tab_ui_top.tabs[1].title_font_size, 20) + npt.assert_equal(tab_ui_top.tabs[2].title_font_size, 30) - npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) - npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) - npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) + npt.assert_equal(tab_ui_top.tabs[0].title_italic, False) + npt.assert_equal(tab_ui_top.tabs[1].title_italic, False) + npt.assert_equal(tab_ui_top.tabs[2].title_italic, False) - npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) + tab_ui_top.tabs[0].title_italic = False + tab_ui_top.tabs[1].title_italic = True + tab_ui_top.tabs[2].title_italic = False - tab_ui.tabs[0].title_font_size = 10 - tab_ui.tabs[1].title_font_size = 20 - tab_ui.tabs[2].title_font_size = 30 + npt.assert_equal(tab_ui_top.tabs[0].title_italic, False) + npt.assert_equal(tab_ui_top.tabs[1].title_italic, True) + npt.assert_equal(tab_ui_top.tabs[2].title_italic, False) - npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) - npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) - npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) + tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), + (0.5, 0.5)) + tab_ui_top.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) + tab_ui_top.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, False) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) + with npt.assert_raises(IndexError): + tab_ui_top.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - tab_ui.tabs[0].title_italic = False - tab_ui.tabs[1].title_italic = True - tab_ui.tabs[2].title_italic = False + with npt.assert_raises(IndexError): + tab_ui_top.remove_element(3, ui.TextBlock2D()) - npt.assert_equal(tab_ui.tabs[0].title_italic, False) - npt.assert_equal(tab_ui.tabs[1].title_italic, True) - npt.assert_equal(tab_ui.tabs[2].title_italic, False) + with npt.assert_raises(IndexError): + tab_ui_top.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) - tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) - tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + npt.assert_equal('Tab 1', tab_ui_top.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui_top.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui_top.tabs[2].title) - with npt.assert_raises(IndexError): - tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + npt.assert_equal(3, tab_ui_top.nb_tabs) - with npt.assert_raises(IndexError): - tab_ui.remove_element(3, ui.TextBlock2D()) + collapses = itertools.count() + changes = itertools.count() - with npt.assert_raises(IndexError): - tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + def collapse(tab_ui): + if tab_ui.collapsed: + next(collapses) - npt.assert_equal('Tab 1', tab_ui.tabs[0].title) - npt.assert_equal('Tab 2', tab_ui.tabs[1].title) - npt.assert_equal('Tab 3', tab_ui.tabs[2].title) + def tab_change(tab_ui): + next(changes) - npt.assert_equal(3, tab_ui.nb_tabs) + tab_ui_top.on_change = tab_change + tab_ui_top.on_collapse = collapse - collapses = itertools.count() - changes = itertools.count() + event_counter = EventCounter() + event_counter.monitor(tab_ui_top) + + current_size = (800, 800) + show_manager = window.ShowManager(size=current_size, + title='Tab UI Test') + show_manager.scene.add(tab_ui_top) + + if interactive: + show_manager.record_events_to_file(recording_filename) + print(list(event_counter.events_counts.items())) + event_counter.save(expected_events_counts_filename) + else: + show_manager.play_events_from_file(recording_filename) + expected = EventCounter.load(expected_events_counts_filename) + event_counter.check_counts(expected) - def collapse(tab_ui): - if tab_ui.collapsed: - next(collapses) + npt.assert_equal(0, tab_ui_top.active_tab_idx) + npt.assert_equal(11, next(changes)) + npt.assert_equal(5, next(collapses)) - def tab_change(tab_ui): - next(changes) + # Bottom - tab_ui.on_change = tab_change - tab_ui.on_collapse = collapse + filename = 'test_ui_tab_ui_bottom' + recording_filename = pjoin(DATA_DIR, filename + '.log.gz') + expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') - event_counter = EventCounter() - event_counter.monitor(tab_ui) + tab_ui_bottom = ui.TabUI( + position=(50,50), size=(300,300), nb_tabs=3, draggable=True, + tab_bar_pos='bottom' + ) - current_size = (800, 800) - show_manager = window.ShowManager(size=current_size, - title='Tab UI Test') - show_manager.scene.add(tab_ui) + tab_ui_bottom.tabs[0].title = 'Tab 1' + tab_ui_bottom.tabs[1].title = 'Tab 2' + tab_ui_bottom.tabs[2].title = 'Tab 3' - if interactive: - show_manager.record_events_to_file(recording_filename) - print(list(event_counter.events_counts.items())) - event_counter.save(expected_events_counts_filename) - else: - show_manager.play_events_from_file(recording_filename) - expected = EventCounter.load(expected_events_counts_filename) - event_counter.check_counts(expected) + tab_ui_bottom.tabs[0].title_color = (1, 0, 0) + tab_ui_bottom.tabs[1].title_color = (0, 1, 0) + tab_ui_bottom.tabs[2].title_color = (0, 0, 1) + + tab_ui_bottom.tabs[0].title_font_size = 10 + tab_ui_bottom.tabs[1].title_font_size = 20 + tab_ui_bottom.tabs[2].title_font_size = 30 + + tab_ui_bottom.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), + (0.5, 0.5)) + tab_ui_bottom.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) + tab_ui_bottom.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + + collapses = itertools.count() + changes = itertools.count() + + def collapse(tab_ui): + if tab_ui.collapsed: + next(collapses) + + def tab_change(tab_ui): + next(changes) + + tab_ui_bottom.on_change = tab_change + tab_ui_bottom.on_collapse = collapse + + event_counter = EventCounter() + event_counter.monitor(tab_ui_bottom) + + current_size = (800, 800) + show_manager = window.ShowManager(size=current_size, + title='Tab UI Test') + show_manager.scene.add(tab_ui_bottom) + + if interactive: + show_manager.record_events_to_file(recording_filename) + print(list(event_counter.events_counts.items())) + event_counter.save(expected_events_counts_filename) + else: + show_manager.play_events_from_file(recording_filename) + expected = EventCounter.load(expected_events_counts_filename) + event_counter.check_counts(expected) - npt.assert_equal(0, tab_ui.active_tab_idx) - npt.assert_equal(11, next(changes)) - npt.assert_equal(5, next(collapses)) + npt.assert_equal(0, tab_ui_top.active_tab_idx) + npt.assert_equal(11, next(changes)) + npt.assert_equal(5, next(collapses)) \ No newline at end of file From e171998845fa5d344780e3588d4d974409977ec8 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Wed, 27 Dec 2023 19:10:32 +0530 Subject: [PATCH 09/17] fixed lint errors --- fury/ui/tests/test_containers.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index f347127dd..36326c2d8 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -257,7 +257,7 @@ def test_ui_tab_ui(interactive=False): tab_ui_top = ui.TabUI( position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tab_bar_pos='top') - + tab_ui_top.tabs[0].title = 'Tab 1' tab_ui_top.tabs[1].title = 'Tab 2' tab_ui_top.tabs[2].title = 'Tab 3' @@ -311,7 +311,7 @@ def test_ui_tab_ui(interactive=False): npt.assert_equal(tab_ui_top.tabs[2].title_italic, False) tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui_top.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_top.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -348,7 +348,7 @@ def tab_change(tab_ui): current_size = (800, 800) show_manager = window.ShowManager(size=current_size, - title='Tab UI Test') + title='Tab UI Test') show_manager.scene.add(tab_ui_top) if interactive: @@ -371,7 +371,7 @@ def tab_change(tab_ui): expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') tab_ui_bottom = ui.TabUI( - position=(50,50), size=(300,300), nb_tabs=3, draggable=True, + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tab_bar_pos='bottom' ) @@ -388,7 +388,7 @@ def tab_change(tab_ui): tab_ui_bottom.tabs[2].title_font_size = 30 tab_ui_bottom.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui_bottom.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_bottom.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -410,7 +410,7 @@ def tab_change(tab_ui): current_size = (800, 800) show_manager = window.ShowManager(size=current_size, - title='Tab UI Test') + title='Tab UI Test') show_manager.scene.add(tab_ui_bottom) if interactive: @@ -424,4 +424,4 @@ def tab_change(tab_ui): npt.assert_equal(0, tab_ui_top.active_tab_idx) npt.assert_equal(11, next(changes)) - npt.assert_equal(5, next(collapses)) \ No newline at end of file + npt.assert_equal(5, next(collapses)) From c5dcd0cb7a0c96582cb212d13063eaaf77bac859 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Fri, 29 Dec 2023 19:45:06 +0530 Subject: [PATCH 10/17] Changed the Tab UI test to test bottom and top Changed Tab UI test to test for things affected by the addition of bottom position in the Tab Bar --- ...ui_tab_ui_top.json => test_ui_tab_ui.json} | 0 ...ab_ui_top.log.gz => test_ui_tab_ui.log.gz} | Bin fury/data/files/test_ui_tab_ui_bottom.json | 1 - fury/data/files/test_ui_tab_ui_bottom.log.gz | Bin 5915 -> 0 bytes fury/ui/containers.py | 12 +-- fury/ui/tests/test_containers.py | 89 ++++++------------ 6 files changed, 35 insertions(+), 67 deletions(-) rename fury/data/files/{test_ui_tab_ui_top.json => test_ui_tab_ui.json} (100%) rename fury/data/files/{test_ui_tab_ui_top.log.gz => test_ui_tab_ui.log.gz} (100%) delete mode 100644 fury/data/files/test_ui_tab_ui_bottom.json delete mode 100644 fury/data/files/test_ui_tab_ui_bottom.log.gz diff --git a/fury/data/files/test_ui_tab_ui_top.json b/fury/data/files/test_ui_tab_ui.json similarity index 100% rename from fury/data/files/test_ui_tab_ui_top.json rename to fury/data/files/test_ui_tab_ui.json diff --git a/fury/data/files/test_ui_tab_ui_top.log.gz b/fury/data/files/test_ui_tab_ui.log.gz similarity index 100% rename from fury/data/files/test_ui_tab_ui_top.log.gz rename to fury/data/files/test_ui_tab_ui.log.gz diff --git a/fury/data/files/test_ui_tab_ui_bottom.json b/fury/data/files/test_ui_tab_ui_bottom.json deleted file mode 100644 index 0075b7d76..000000000 --- a/fury/data/files/test_ui_tab_ui_bottom.json +++ /dev/null @@ -1 +0,0 @@ -{"CharEvent": 0, "MouseMoveEvent": 600, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 63, "LeftButtonReleaseEvent": 63, "RightButtonPressEvent": 10, "RightButtonReleaseEvent": 10, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0} \ No newline at end of file diff --git a/fury/data/files/test_ui_tab_ui_bottom.log.gz b/fury/data/files/test_ui_tab_ui_bottom.log.gz deleted file mode 100644 index 1f066afc4635ef56bc6eef65b89c076fe4113969..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5915 zcmV+$7v$(4iwFqrK!jxi|8!+@bYFF8Uvyz&Uv+6;VsCVGZ*4AYZ)X6#olT3ZNp42> z^D7d(HxW{NZVkPg0n-NW8+>gy*xk^5XYkLr6p7(hRpxoJ`n?`%8K?4%PlZBKDE{I0 zFJFKA^3#9+>zCht|M}NnZuKASPe1(f^~-NR{O!vxUvJaxHpi{}-`}79^6OuJ|MHh# z|Mulc`Hx?I`M1~qxr*|_<+g6CQF*^@r}A>Eg+5Tnt=2_=-KuQ@;uB7vDC<@mRWd4A zdm+FBfKQAapBV6ou@n%az(5o-(6#`)1yBK~0dyFPzOthx0MU!JcL2&{ppE_pqbU9nT0-K(NTqdq3+w> zRPMLksl42_L3z|}ZBaf&c^Bm_%CUa?Hn%9B-2N&0XSyh_Tt1d47vCS^_xl#*qWxWb zzc*3t-2a!$n%Pzy9*izkT`r_b1c` zIaF?odMUPMlrkZSYaJvBQ`pixJX`q%}sRF186aumigLh{)6F_YQcyv^yR>WY@zTqKsZBR!=9~kL- z7TcQP{vL9}Xn(ip0|ugr<|LhBYqCZQD^{fqTsTpOML^3rxp-~5(aMSnI;m1M1eg!n zgk#Y-?Xs40a>IPE`1wW?#^V=SL58<4>g1zzx>yipMHM|KK!M22^g;cT>(P@Qvpi>TXp#sql#No ztn$`r;)J3h0B4}?#g(kPa7WdZ&2(1TaO%|%Lye3&b>!@J-X0t2GHL0+HJTQmX5$ht zF9SP($r~)UBKv{V#?wU z`*2af5P&rSxcY?4Ur=@M`B~uMB6#6<){6?z2T=af1CuiAH?0cwrMXaFS{Ld|8$$Vr z|7P9dHGujd6px0MmiYNbz8K40dEkLDI*RNA76+6@mSJ1*3wQ>JvtXx_b)HE(S)4pJ z+)nesW4Jq+A3Zv%^Jy+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test_ui_tab_ui_top_position.json | 1 + .../files/test_ui_tab_ui_top_position.log.gz | Bin 0 -> 6547 bytes fury/ui/tests/test_containers.py | 228 ++++++++++++------ 3 files changed, 153 insertions(+), 76 deletions(-) create mode 100644 fury/data/files/test_ui_tab_ui_top_position.json create mode 100644 fury/data/files/test_ui_tab_ui_top_position.log.gz diff --git a/fury/data/files/test_ui_tab_ui_top_position.json b/fury/data/files/test_ui_tab_ui_top_position.json new file mode 100644 index 000000000..9934fd112 --- /dev/null +++ b/fury/data/files/test_ui_tab_ui_top_position.json @@ -0,0 +1 @@ +{"CharEvent": 0, "MouseMoveEvent": 1014, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 58, "LeftButtonReleaseEvent": 58, "RightButtonPressEvent": 10, "RightButtonReleaseEvent": 10, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0} \ No newline at end of file diff --git a/fury/data/files/test_ui_tab_ui_top_position.log.gz b/fury/data/files/test_ui_tab_ui_top_position.log.gz new file mode 100644 index 0000000000000000000000000000000000000000..e7aebcdd72a97b877549a7daa895003319a0a1d2 GIT binary patch literal 6547 zcmW+)cR1VM8_f{ZY-`t^EsEHbYFe#TvnZ_@tEgRH8Z{D|+FE-AMQWw?Cbd^>YSb3g z7OQ4|>F=-4bMNy$_qosKeb2e)9L|sAEP-j>g4(cu#@@xBfq+b%ITr7sJ&R*0*A?CF%n5GAJ~OTV#1v-j+io*qeJ{!1iF&2 zCa*{LFo97^Pxujnw=H{Z%`W@z+)Av4QtRb@_TNjw**a&y`H@;ccEIUep_o{9>qUQm zp;)YWA20qy?s|P;?|OeMJHY>}T_*r>M*im-KbBqg7oilw^$*_V>-u^A_!GP8TI?4h9mW*+N z79%v^Z@Ft&(5eXziWWmN4^wTBQh~LBJ`y;kN~5osdE$Ct7AJ_4qx!}nO>jov`ByPT z6(s2#wVP_=pVA4)$Rl7uo?!dMqY6LUWX!QtfGr3abm1nr(%zMP5(T<*r**{&)sa#tY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nv9tdGvTrrP{!#_^ zsTjK%W2%o75_$pMzn*e{hyFy07RJ+TgiHoE@8s>l{1)Fa-SF_{JZrsWKuem#=G5V+Kq3`(&qEEBwz_6}6`sxo>F*rwG)crq6EqE;d(#?~<)s zhia83NVg1)|7Mf58Z4G(JU@42VtO-|x|P|;*4p0ki^(XZEl~6VL@=0MYad2IvEmQ7 zH81ZHjvK~@z$LS@hF?vn2?B9M(-8iLHxd6=W$|~@ z^C_dpYllVwd2evsr{o9srjfyWOfA&vs4k!z7WW;dqysJhUdas0@p5HP5P408i-jwB z)`qI@7p{q#ic^Ktde1{zLf!GfO-c^L{X<3r?pYol+OIQhuVN3X6yWtAz3!ZwwQ~-c ze3l+OIH{g0kkV+U{jbC;YddFi7-2gdlFUy#|h(%)<5W1qPtf2h`6rXZ~S|H(64IymwMeQsL%Nl0Qet{ C0CV>M literal 0 HcmV?d00001 diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index a7bdd0225..7b9d51a13 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -254,89 +254,174 @@ def test_ui_tab_ui(interactive=False): recording_filename = pjoin(DATA_DIR, filename + '.log.gz') expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') - tab_ui_top = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, - tab_bar_pos='top') + tab_ui = ui.TabUI( + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True) - tab_ui_top.tabs[0].title = 'Tab 1' - tab_ui_top.tabs[1].title = 'Tab 2' - tab_ui_top.tabs[2].title = 'Tab 3' + tab_ui.tabs[0].title = 'Tab 1' + tab_ui.tabs[1].title = 'Tab 2' + tab_ui.tabs[2].title = 'Tab 3' - npt.assert_equal(tab_ui_top.tabs[0].title_bold, False) - npt.assert_equal(tab_ui_top.tabs[1].title_bold, False) - npt.assert_equal(tab_ui_top.tabs[2].title_bold, False) + npt.assert_equal(tab_ui.tabs[0].title_bold, False) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, False) - tab_ui_top.tabs[0].title_bold = True - tab_ui_top.tabs[1].title_bold = False - tab_ui_top.tabs[2].title_bold = True + tab_ui.tabs[0].title_bold = True + tab_ui.tabs[1].title_bold = False + tab_ui.tabs[2].title_bold = True - npt.assert_equal(tab_ui_top.tabs[0].title_bold, True) - npt.assert_equal(tab_ui_top.tabs[1].title_bold, False) - npt.assert_equal(tab_ui_top.tabs[2].title_bold, True) + npt.assert_equal(tab_ui.tabs[0].title_bold, True) + npt.assert_equal(tab_ui.tabs[1].title_bold, False) + npt.assert_equal(tab_ui.tabs[2].title_bold, True) - npt.assert_equal(tab_ui_top.tabs[0].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui_top.tabs[1].title_color, (.0, .0, .0)) - npt.assert_equal(tab_ui_top.tabs[2].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0)) - tab_ui_top.tabs[0].title_color = (1, 0, 0) - tab_ui_top.tabs[1].title_color = (0, 1, 0) - tab_ui_top.tabs[2].title_color = (0, 0, 1) + tab_ui.tabs[0].title_color = (1, 0, 0) + tab_ui.tabs[1].title_color = (0, 1, 0) + tab_ui.tabs[2].title_color = (0, 0, 1) - npt.assert_equal(tab_ui_top.tabs[0].title_color, (1., .0, .0)) - npt.assert_equal(tab_ui_top.tabs[1].title_color, (.0, 1., .0)) - npt.assert_equal(tab_ui_top.tabs[2].title_color, (.0, .0, 1.)) + npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0)) + npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0)) + npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.)) - npt.assert_equal(tab_ui_top.tabs[0].title_font_size, 18) - npt.assert_equal(tab_ui_top.tabs[1].title_font_size, 18) - npt.assert_equal(tab_ui_top.tabs[2].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[0].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 18) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 18) - tab_ui_top.tabs[0].title_font_size = 10 - tab_ui_top.tabs[1].title_font_size = 20 - tab_ui_top.tabs[2].title_font_size = 30 + tab_ui.tabs[0].title_font_size = 10 + tab_ui.tabs[1].title_font_size = 20 + tab_ui.tabs[2].title_font_size = 30 - npt.assert_equal(tab_ui_top.tabs[0].title_font_size, 10) - npt.assert_equal(tab_ui_top.tabs[1].title_font_size, 20) - npt.assert_equal(tab_ui_top.tabs[2].title_font_size, 30) + npt.assert_equal(tab_ui.tabs[0].title_font_size, 10) + npt.assert_equal(tab_ui.tabs[1].title_font_size, 20) + npt.assert_equal(tab_ui.tabs[2].title_font_size, 30) - npt.assert_equal(tab_ui_top.tabs[0].title_italic, False) - npt.assert_equal(tab_ui_top.tabs[1].title_italic, False) - npt.assert_equal(tab_ui_top.tabs[2].title_italic, False) + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, False) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) - tab_ui_top.tabs[0].title_italic = False - tab_ui_top.tabs[1].title_italic = True - tab_ui_top.tabs[2].title_italic = False + tab_ui.tabs[0].title_italic = False + tab_ui.tabs[1].title_italic = True + tab_ui.tabs[2].title_italic = False - npt.assert_equal(tab_ui_top.tabs[0].title_italic, False) - npt.assert_equal(tab_ui_top.tabs[1].title_italic, True) - npt.assert_equal(tab_ui_top.tabs[2].title_italic, False) + npt.assert_equal(tab_ui.tabs[0].title_italic, False) + npt.assert_equal(tab_ui.tabs[1].title_italic, True) + npt.assert_equal(tab_ui.tabs[2].title_italic, False) - tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), + tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5)) + tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) + tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + + with npt.assert_raises(IndexError): + tab_ui.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + + with npt.assert_raises(IndexError): + tab_ui.remove_element(3, ui.TextBlock2D()) + + with npt.assert_raises(IndexError): + tab_ui.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + + npt.assert_equal('Tab 1', tab_ui.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui.tabs[2].title) + + npt.assert_equal(3, tab_ui.nb_tabs) + + collapses = itertools.count() + changes = itertools.count() + + def collapse(tab_ui): + if tab_ui.collapsed: + next(collapses) + + def tab_change(tab_ui): + next(changes) + + tab_ui.on_change = tab_change + tab_ui.on_collapse = collapse + + event_counter = EventCounter() + event_counter.monitor(tab_ui) + + current_size = (800, 800) + show_manager = window.ShowManager(size=current_size, + title='Tab UI Test') + show_manager.scene.add(tab_ui) + + if interactive: + show_manager.record_events_to_file(recording_filename) + print(list(event_counter.events_counts.items())) + event_counter.save(expected_events_counts_filename) + else: + show_manager.play_events_from_file(recording_filename) + expected = EventCounter.load(expected_events_counts_filename) + event_counter.check_counts(expected) + + npt.assert_equal(0, tab_ui.active_tab_idx) + npt.assert_equal(11, next(changes)) + npt.assert_equal(5, next(collapses)) + + +def test_ui_tab_ui_position(interactive=False): + filename = 'test_ui_tab_ui_top_position' + recording_filename = pjoin(DATA_DIR, filename + '.log.gz') + expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json') + + tab_ui_top = ui.TabUI( + position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, + tab_bar_pos='top') + + tab_ui_top.tabs[0].title = 'Tab 1' + tab_ui_top.tabs[1].title = 'Tab 2' + tab_ui_top.tabs[2].title = 'Tab 3' + + tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), + (0.5, 0.5)) tab_ui_top.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_top.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + npt.assert_equal('Tab 1', tab_ui_top.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui_top.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui_top.tabs[2].title) + + npt.assert_equal(3, tab_ui_top.nb_tabs) + + npt.assert_equal((50,50),tab_ui_top.position) + npt.assert_equal((300,300),tab_ui_top.size) + + with npt.assert_raises(IndexError): + tab_ui_top.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + + with npt.assert_raises(IndexError): + tab_ui_top.remove_element(3, ui.TextBlock2D()) + + with npt.assert_raises(IndexError): + tab_ui_top.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) + tab_ui_bottom = ui.TabUI( - position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, - tab_bar_pos='bottom' - ) + position=(350, 50), size=(300, 300), nb_tabs=3, draggable=True, + tab_bar_pos='bottom') tab_ui_bottom.tabs[0].title = 'Tab 1' tab_ui_bottom.tabs[1].title = 'Tab 2' tab_ui_bottom.tabs[2].title = 'Tab 3' - tab_ui_bottom.tabs[0].title_color = (1, 0, 0) - tab_ui_bottom.tabs[1].title_color = (0, 1, 0) - tab_ui_bottom.tabs[2].title_color = (0, 0, 1) - - tab_ui_bottom.tabs[0].title_font_size = 10 - tab_ui_bottom.tabs[1].title_font_size = 20 - tab_ui_bottom.tabs[2].title_font_size = 30 - tab_ui_bottom.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui_bottom.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_bottom.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) + npt.assert_equal('Tab 1', tab_ui_bottom.tabs[0].title) + npt.assert_equal('Tab 2', tab_ui_bottom.tabs[1].title) + npt.assert_equal('Tab 3', tab_ui_bottom.tabs[2].title) + + npt.assert_equal(3, tab_ui_bottom.nb_tabs) + + npt.assert_equal((350,50),tab_ui_bottom.position) + npt.assert_equal((300,300),tab_ui_bottom.size) + with npt.assert_raises(IndexError): tab_ui_bottom.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) @@ -346,42 +431,32 @@ def test_ui_tab_ui(interactive=False): with npt.assert_raises(IndexError): tab_ui_bottom.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - with npt.assert_raises(IndexError): - tab_ui_top.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - - with npt.assert_raises(IndexError): - tab_ui_top.remove_element(3, ui.TextBlock2D()) - - with npt.assert_raises(IndexError): - tab_ui_top.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) - - npt.assert_equal('Tab 1', tab_ui_top.tabs[0].title) - npt.assert_equal('Tab 2', tab_ui_top.tabs[1].title) - npt.assert_equal('Tab 3', tab_ui_top.tabs[2].title) - - npt.assert_equal(3, tab_ui_top.nb_tabs) - collapses = itertools.count() changes = itertools.count() - def collapse(tab_ui): - if tab_ui.collapsed: + + def collapse(tab_ui_top): + if tab_ui_top.collapsed or tab_ui_bottom.collapsed: next(collapses) - def tab_change(tab_ui): + def tab_change(tab_ui_top): next(changes) tab_ui_top.on_change = tab_change tab_ui_top.on_collapse = collapse + tab_ui_bottom.on_change = tab_change + tab_ui_bottom.on_collapse = collapse + event_counter = EventCounter() event_counter.monitor(tab_ui_top) + event_counter.monitor(tab_ui_bottom) current_size = (800, 800) show_manager = window.ShowManager(size=current_size, - title='Tab UI Test') + title='Tab UI Test') show_manager.scene.add(tab_ui_top) - + show_manager.scene.add(tab_ui_bottom) if interactive: show_manager.record_events_to_file(recording_filename) print(list(event_counter.events_counts.items())) @@ -392,5 +467,6 @@ def tab_change(tab_ui): event_counter.check_counts(expected) npt.assert_equal(0, tab_ui_top.active_tab_idx) - npt.assert_equal(11, next(changes)) + npt.assert_equal(0, tab_ui_bottom.active_tab_idx) + npt.assert_equal(14, next(changes)) npt.assert_equal(5, next(collapses)) From 4d1d5f0116a57650c1ca6d66d9a3cd23fcf8cb58 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Sun, 7 Jan 2024 16:17:45 +0530 Subject: [PATCH 12/17] fixed lint errors in test_ui_tab_position function --- fury/ui/tests/test_containers.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 7b9d51a13..45bdfed2c 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -310,7 +310,7 @@ def test_ui_tab_ui(interactive=False): npt.assert_equal(tab_ui.tabs[2].title_italic, False) tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -372,13 +372,13 @@ def test_ui_tab_ui_position(interactive=False): tab_ui_top = ui.TabUI( position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True, tab_bar_pos='top') - + tab_ui_top.tabs[0].title = 'Tab 1' tab_ui_top.tabs[1].title = 'Tab 2' tab_ui_top.tabs[2].title = 'Tab 3' tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui_top.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_top.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -388,8 +388,8 @@ def test_ui_tab_ui_position(interactive=False): npt.assert_equal(3, tab_ui_top.nb_tabs) - npt.assert_equal((50,50),tab_ui_top.position) - npt.assert_equal((300,300),tab_ui_top.size) + npt.assert_equal((50, 50), tab_ui_top.position) + npt.assert_equal((300, 300), tab_ui_top.size) with npt.assert_raises(IndexError): tab_ui_top.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) @@ -409,7 +409,7 @@ def test_ui_tab_ui_position(interactive=False): tab_ui_bottom.tabs[2].title = 'Tab 3' tab_ui_bottom.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), - (0.5, 0.5)) + (0.5, 0.5)) tab_ui_bottom.add_element(1, ui.LineSlider2D(), (0.0, 0.5)) tab_ui_bottom.add_element(2, ui.TextBlock2D(), (0.5, 0.5)) @@ -419,9 +419,9 @@ def test_ui_tab_ui_position(interactive=False): npt.assert_equal(3, tab_ui_bottom.nb_tabs) - npt.assert_equal((350,50),tab_ui_bottom.position) - npt.assert_equal((300,300),tab_ui_bottom.size) - + npt.assert_equal((350, 50), tab_ui_bottom.position) + npt.assert_equal((300, 300), tab_ui_bottom.size) + with npt.assert_raises(IndexError): tab_ui_bottom.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5)) @@ -434,7 +434,6 @@ def test_ui_tab_ui_position(interactive=False): collapses = itertools.count() changes = itertools.count() - def collapse(tab_ui_top): if tab_ui_top.collapsed or tab_ui_bottom.collapsed: next(collapses) @@ -454,9 +453,10 @@ def tab_change(tab_ui_top): current_size = (800, 800) show_manager = window.ShowManager(size=current_size, - title='Tab UI Test') + title='Tab UI Test') show_manager.scene.add(tab_ui_top) show_manager.scene.add(tab_ui_bottom) + if interactive: show_manager.record_events_to_file(recording_filename) print(list(event_counter.events_counts.items())) From 3cbcc8bd0a85e992b7e5416a6e34d679f63faa34 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Sun, 7 Jan 2024 16:19:12 +0530 Subject: [PATCH 13/17] fixed lint error --- fury/ui/tests/test_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py index 45bdfed2c..79edcd4a0 100644 --- a/fury/ui/tests/test_containers.py +++ b/fury/ui/tests/test_containers.py @@ -456,7 +456,7 @@ def tab_change(tab_ui_top): title='Tab UI Test') show_manager.scene.add(tab_ui_top) show_manager.scene.add(tab_ui_bottom) - + if interactive: show_manager.record_events_to_file(recording_filename) print(list(event_counter.events_counts.items())) From 98be78d512f69d49ee3d82fbe3841b8e34886bd4 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Thu, 1 Feb 2024 16:15:59 +0530 Subject: [PATCH 14/17] updated viz_tab tutorial to include the feature --- docs/examples/viz_tab.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/examples/viz_tab.py b/docs/examples/viz_tab.py index adcfcbdc9..6cabf95b9 100644 --- a/docs/examples/viz_tab.py +++ b/docs/examples/viz_tab.py @@ -27,6 +27,12 @@ tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True) +############################################################################### +# We can also define the position of the Tab Bar. +# By default the Tab Bar is positioned at top + +tab_ui.tab_bar_pos = 'bottom' + ############################################################################### # Slider Controls for a Cube for Tab Index 0 # ========================================== From 6bd3e64d278a87c0b804a2160c5ffab45253e0d2 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Mon, 4 Mar 2024 13:04:02 +0530 Subject: [PATCH 15/17] added doc string for tab_bar_pos --- fury/ui/containers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 3e9e2de1a..0ac46a0c9 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -662,6 +662,8 @@ def __init__( startup_tab_id : int, optional Tab to be activated and uncollapsed on startup. by default None is activated/ all collapsed. + tab_bar_pos : str, optional + Position of the Tab Bar in the panel """ self.tabs = [] self.nb_tabs = nb_tabs From 9e7a9a1febb477b800286b48eb2467345eb30aba Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Sat, 23 Mar 2024 09:51:18 +0530 Subject: [PATCH 16/17] Added warning for tab_bar_pos value apart from top/bottom --- fury/ui/containers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 0ac46a0c9..962fc69c0 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -740,10 +740,15 @@ def _get_size(self): def update_tabs(self): """Update position, size and callbacks for tab panels.""" self.tab_panel_size = (self.size[0] // self.nb_tabs, int(0.1 * self.size[1])) + if self.tab_bar_pos.lower() not in ['top', 'bottom']: + print("WARNING: tab_bar_pos can only have value top/bottom") + self.tab_bar_pos = "top" + if self.tab_bar_pos.lower() == "top": tab_panel_pos = [0.0, 0.9] elif self.tab_bar_pos.lower() == "bottom": tab_panel_pos = [0.0, 0.0] + for tab_panel in self.tabs: tab_panel.resize(self.tab_panel_size) tab_panel.content_panel.position = self.position From 3d99a0e84298cececc3291133b3b192bc2b88b04 Mon Sep 17 00:00:00 2001 From: Ishan Kamboj Date: Mon, 25 Mar 2024 23:17:57 +0530 Subject: [PATCH 17/17] Warning added if tab_bar_pos is not top/bottom --- fury/ui/containers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fury/ui/containers.py b/fury/ui/containers.py index 962fc69c0..e28399cd9 100644 --- a/fury/ui/containers.py +++ b/fury/ui/containers.py @@ -18,7 +18,7 @@ ) from fury.ui.core import UI, Rectangle2D, TextBlock2D from fury.utils import rotate, set_input - +from warnings import warn class Panel2D(UI): """A 2D UI Panel. @@ -741,7 +741,7 @@ def update_tabs(self): """Update position, size and callbacks for tab panels.""" self.tab_panel_size = (self.size[0] // self.nb_tabs, int(0.1 * self.size[1])) if self.tab_bar_pos.lower() not in ['top', 'bottom']: - print("WARNING: tab_bar_pos can only have value top/bottom") + warn("tab_bar_pos can only have value top/bottom") self.tab_bar_pos = "top" if self.tab_bar_pos.lower() == "top":