-
Notifications
You must be signed in to change notification settings - Fork 68
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
Toolbar layout fixes #1273
Merged
Merged
Toolbar layout fixes #1273
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c185855
Added toolbar display, open, and close tests
chaosphere2112 908c869
Added a sprinkling of assertions
chaosphere2112 98464ec
Fixed an issue where togglebuttons were doing waaay too much work
chaosphere2112 7f68b7a
Added test for get_text on toggle buttons
chaosphere2112 e33e312
Updated toolbar open/close to go through more of open/close process
chaosphere2112 03fd1af
Added toolbar_in_toolbar tests
chaosphere2112 01621d9
Fixed some layout bugs with toolbars
chaosphere2112 c979e41
Added tests to CMakeLists
chaosphere2112 2076acf
Added state_advance test for buttons
chaosphere2112 2c51812
Tabs -> spaces
chaosphere2112 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Test button state change | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_button_state_advance(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(100, 100) | ||
states = [vcs.vtk_ui.ButtonState(label="State %d" % i, fgcolor=(.1 * i + .5, .1 * i + .5, .1 * i + .5), bgcolor=(.5 - .1 * i,.5 - .1 * i,.5 - .1 * i)) for i in range(5)] | ||
|
||
b = vcs.vtk_ui.Button(self.inter, states=states, action=self.pass_me, left=0, top=0) | ||
b.show() | ||
|
||
b.set_state(1) | ||
b.repr.NextState() | ||
b.widget.InvokeEvent("StateChangedEvent") | ||
|
||
|
||
def pass_me(self, state): | ||
if state == 2: | ||
print "Button action executed" | ||
self.passed = 0 | ||
else: | ||
print state, "Action passed inaccurate state" | ||
from sys import exit | ||
sys.exit(1) | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_button_state_advance().test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
Test toggle_button get text | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toggle_button_get_text(vtk_ui_test): | ||
def do_test(self): | ||
b = vcs.vtk_ui.ToggleButton(self.inter, "Simple label") | ||
b.set_state(1) | ||
assert b.get_text() == "Simple label" | ||
b.set_state(0) | ||
assert b.get_text() == "Simple label" | ||
self.passed = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Test toolbar placement and basic appearance | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toolbar_close(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(200, 100) | ||
|
||
toolbar = vcs.vtk_ui.Toolbar(self.inter, "Test Bar") | ||
toolbar.add_button(["Test Button"]) | ||
toolbar.add_button(["Other Test"]) | ||
toolbar.label.__advance__(1) | ||
toolbar.label.__advance__(0) | ||
assert toolbar.open == False | ||
toolbar.show() | ||
|
||
self.test_file = "test_vtk_ui_toolbar_close.png" | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_toolbar_close().test() |
29 changes: 29 additions & 0 deletions
29
testing/vcs/vtk_ui/test_vtk_ui_toolbar_in_toolbar_closed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
Test toolbar placement inside toolbar | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toolbar_in_toolbar_closed(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(200, 250) | ||
|
||
toolbar = vcs.vtk_ui.Toolbar(self.inter, "Test Bar") | ||
tb = toolbar.add_toolbar("Sub-bar") | ||
tb.add_button(["first"]) | ||
tb.add_button(["second"]) | ||
toolbar.add_button(["Test Button"]) | ||
toolbar.add_button(["Other Test"]) | ||
toolbar.show() | ||
|
||
# Open both toolbars | ||
toolbar.label.__advance__(1) | ||
tb.label.__advance__(1) | ||
tb.label.__advance__(0) | ||
|
||
self.test_file = "test_vtk_ui_toolbar_in_toolbar_closed.png" | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_toolbar_in_toolbar_closed().test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Test toolbar placement inside toolbar | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toolbar_in_toolbar_open(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(200, 250) | ||
|
||
toolbar = vcs.vtk_ui.Toolbar(self.inter, "Test Bar") | ||
tb = toolbar.add_toolbar("Sub-bar") | ||
tb.add_button(["first"]) | ||
tb.add_button(["second"]) | ||
toolbar.add_button(["Test Button"]) | ||
toolbar.add_button(["Other Test"]) | ||
toolbar.show() | ||
|
||
# Open both toolbars | ||
toolbar.label.__advance__(1) | ||
tb.label.__advance__(1) | ||
|
||
self.test_file = "test_vtk_ui_toolbar_in_toolbar_open.png" | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_toolbar_in_toolbar_open().test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Test toolbar placement and basic appearance | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toolbar_label(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(200, 100) | ||
|
||
toolbar = vcs.vtk_ui.Toolbar(self.inter, "Test Bar") | ||
# Should default to closed; these will help make sure | ||
toolbar.add_button(["Test Button"]) | ||
toolbar.add_button(["Other Test"]) | ||
assert toolbar.open == False | ||
toolbar.show() | ||
|
||
self.test_file = "test_vtk_ui_toolbar_label.png" | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_toolbar_label().test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Test toolbar placement and basic appearance | ||
""" | ||
import vcs.vtk_ui | ||
|
||
|
||
from vtk_ui_test import vtk_ui_test | ||
|
||
class test_vtk_ui_toolbar_open(vtk_ui_test): | ||
def do_test(self): | ||
self.win.SetSize(200, 100) | ||
|
||
toolbar = vcs.vtk_ui.Toolbar(self.inter, "Test Bar") | ||
toolbar.add_button(["Test Button"]) | ||
toolbar.add_button(["Other Test"]) | ||
toolbar.label.__advance__(1) | ||
assert toolbar.open == True | ||
toolbar.show() | ||
|
||
|
||
self.test_file = "test_vtk_ui_toolbar_open.png" | ||
|
||
if __name__ == "__main__": | ||
test_vtk_ui_toolbar_open().test() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice comment :P
Strange. Looking at the C++, all this does is trigger a HighlightEvent (which, according to
git grep
doesn't seem to be handled anywhere internally by VTK, nor by uvcdat/vistrails), and calls Modified(), which you do above. Strange.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're telling me. I actually have a tendency to delve down into the C++ source when I find a weird hack like this, so I can ideally not have the weird hack anymore. This time I failed.