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

Marker deletion #1255

Merged
merged 4 commits into from
May 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Packages/vcs/Lib/editors/marker.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ def detach(self):
self.tooltip.detach()

def delete(self):
del self.marker.x[self.index]
del self.marker.y[self.index]
del self.marker.type[self.index]
del self.marker.color[self.index]
self.actor.SetVisibility(0)
self.configurator.deactivate(self)

Expand Down
1 change: 1 addition & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,4 @@ cdat_add_test(vcs_test_configurator_click_marker
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_configurator_click_marker.py
)
add_subdirectory(vtk_ui)
add_subdirectory(editors)
7 changes: 7 additions & 0 deletions testing/vcs/editors/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcs/editors")
set(TEST_DIR "${cdat_SOURCE_DIR}/testing/vcs/editors")

cdat_add_test(vcs_test_editor_marker_delete
"${PYTHON_EXECUTABLE}"
${TEST_DIR}/test_vcs_editor_marker_delete.py
)
57 changes: 57 additions & 0 deletions testing/vcs/editors/test_vcs_editor_marker_delete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import vcs
import sys

x = vcs.init()
x.open()

m = x.createmarker()
m.x = .1,
m.y = .1,

# enable the configurator
x.configure()

# plot in the background
dp = x.plot(m)

# Grab the initialized configurator
c = x.configurator

# Make sure the displays are current
c.update()

w, h = x.bgX, x.bgY

# Retrieve the actor at the specified point
c.interactor.SetEventInformation(int(.1 * w), int(.1 * h))
c.click(None, None)
c.release(None, None)

# Make sure we've got the correct editor
editor = c.target
if editor is None:
print "Did not activate an editor"
sys.exit(1)
print "Editor activated"
if type(editor) != vcs.editors.marker.MarkerEditor:
print "Did not activate a marker editor"
sys.exit(1)
print "Editor is a marker editor"
if editor.marker != m:
print "Did not activate the correct marker editor, expected", m.name, "received", editor.marker.name
sys.exit(1)
print "Marker editor is editing the correct marker"

# Simulate a right click on the marker
editor.right_release()

# Make sure the editor has been deactivated
if c.target == editor:
print "Did not deactivate editor"
sys.exit(1)
print "Marker editor deactivated"
# Make sure the marker was deleted
if len(m.x) != len(m.y) != len(m.type) != len(m.color) != 0:
print "Did not delete all attributes on marker"
sys.exit(1)
print "Deleted all attributes on marker"