-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1273 from chaosphere2112/toolbar_layout_fixes
Toolbar layout fixes
- Loading branch information
Showing
10 changed files
with
247 additions
and
15 deletions.
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() |