Browse Source

Some drawing mode notes

tb-init-ui-render
Taylor Bockman 5 years ago
parent
commit
aad68fb202
  1. 17
      clusterview/mode.py
  2. 13
      clusterview/opengl_widget.py

17
clusterview/mode.py

@ -23,11 +23,12 @@ def __handle_add_point(ctx, event):
representation, and adds it to the list.
"""
print("[ADD] GOT POINT: ({}, {})".format(event.x(), event.y()))
set_drawing_mode(Mode.ADD, event)
# Convert to our point representation and add to list widget
# Point representation is a class called Point with coordinates,
# and attributes (currently always None)
#
set_drawing_mode(Mode.ADD, event)
def __handle_edit_point(ctx, event):
# TODO: This function and delete definitely need to make sure they are
@ -43,15 +44,25 @@ def __handle_edit_point(ctx, event):
# applicable.
print("[EDIT] GOT POINT: ({}, {})".format(event.x(), event.y()))
# Store old x, y from event
set_drawing_mode(Mode.DELETE, event)
# after this remove the point from the list
def __handle_move_points(ctx, event):
# TODO: Should move the associated points in the list to the new location.
print("[MOVE] Pressed - NOTE NEED DRAG EVENT")
# Store list of old points that are captured
set_drawing_mode(Mode.MOVE, event)
# Find and move all points from the old list to their new locations
def __handle_delete_point(ctx, event):
# TODO: Needs to also delete the point from the list.
print("[DELETE] GOT POINT: ({}, {})".format(event.x(), event.y()))
set_drawing_mode(Mode.DELETE, event)
# Find the point from event and remove it from the list
# Simple dispatcher to make it easy to dispatch the right mode
# function when the OpenGL window is clicked.

13
clusterview/opengl_widget.py

@ -115,3 +115,16 @@ def draw_point(x, y, color):
glColor4f(ct[0], ct[1], ct[2], ct[3])
glVertex3f(x, y, 0.0) # Z is currently fixed to 0
glEnd()
def delete_point(x, y):
"""
Deletes a point.
The list deletion happens in the clusterview.mode module. This
function just overwrites the point color with the background.
@param x The x-coordinate.
@param y The y-coordinate.
"""
raise NotImplementedError("delete_point not implemented.")

Loading…
Cancel
Save