|
|
@ -13,11 +13,12 @@ from clusterview.mode_handlers import (MODE_HANDLER_MAP, ogl_keypress_handler, |
|
|
|
refresh_point_list) |
|
|
|
refresh_point_list) |
|
|
|
from clusterview.opengl_widget import (clear_selection, initialize_gl, |
|
|
|
from clusterview.opengl_widget import (clear_selection, initialize_gl, |
|
|
|
mouse_leave, paint_gl, resize_gl, |
|
|
|
mouse_leave, paint_gl, resize_gl, |
|
|
|
set_drawing_mode, set_drawing_context) |
|
|
|
set_drawing_context) |
|
|
|
from clusterview.point_manager import PointManager |
|
|
|
from clusterview.point_manager import PointManager |
|
|
|
from clusterview.point_list_widget import item_click_handler |
|
|
|
from clusterview.point_list_widget import item_click_handler |
|
|
|
from clusterview_ui import Ui_MainWindow |
|
|
|
from clusterview_ui import Ui_MainWindow |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
""" |
|
|
|
""" |
|
|
|
A wrapper class for handling creating a window based |
|
|
|
A wrapper class for handling creating a window based |
|
|
@ -38,7 +39,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
# If we allow resizing of the window, the context must be updated |
|
|
|
# If we allow resizing of the window, the context must be updated |
|
|
|
# each resize so that coordinates are converted from screen (x, y) |
|
|
|
# each resize so that coordinates are converted from screen (x, y) |
|
|
|
# to OpenGL coordinates properly. |
|
|
|
# to OpenGL coordinates properly. |
|
|
|
set_drawing_context(self.opengl_widget) |
|
|
|
set_drawing_context(self) |
|
|
|
|
|
|
|
|
|
|
|
# Enables mouse tracking on the viewport so mouseMoveEvents are |
|
|
|
# Enables mouse tracking on the viewport so mouseMoveEvents are |
|
|
|
# tracked and fired properly. |
|
|
|
# tracked and fired properly. |
|
|
@ -100,7 +101,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
|
|
|
|
|
|
|
|
def __add_points(self): |
|
|
|
def __add_points(self): |
|
|
|
self.__mode = Mode.ADD |
|
|
|
self.__mode = Mode.ADD |
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
self.status_bar.showMessage("ADD MODE") |
|
|
|
self.status_bar.showMessage("ADD MODE") |
|
|
|
clear_selection() |
|
|
|
clear_selection() |
|
|
@ -108,7 +108,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
|
|
|
|
|
|
|
|
def __edit_points(self): |
|
|
|
def __edit_points(self): |
|
|
|
self.__mode = Mode.EDIT |
|
|
|
self.__mode = Mode.EDIT |
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
self.status_bar.showMessage("EDIT MODE") |
|
|
|
self.status_bar.showMessage("EDIT MODE") |
|
|
|
clear_selection() |
|
|
|
clear_selection() |
|
|
@ -116,7 +115,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
|
|
|
|
|
|
|
|
def __delete_points(self): |
|
|
|
def __delete_points(self): |
|
|
|
self.__mode = Mode.DELETE |
|
|
|
self.__mode = Mode.DELETE |
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) |
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) |
|
|
|
self.status_bar.showMessage("DELETE MODE") |
|
|
|
self.status_bar.showMessage("DELETE MODE") |
|
|
|
clear_selection() |
|
|
|
clear_selection() |
|
|
@ -124,7 +122,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
|
|
|
|
|
|
|
|
def __move_points(self): |
|
|
|
def __move_points(self): |
|
|
|
self.__mode = Mode.MOVE |
|
|
|
self.__mode = Mode.MOVE |
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.SizeAllCursor)) |
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.SizeAllCursor)) |
|
|
|
self.status_bar.showMessage("MOVE MODE - PRESS ESC OR SWITCH MODES TO "+ |
|
|
|
self.status_bar.showMessage("MOVE MODE - PRESS ESC OR SWITCH MODES TO "+ |
|
|
|
"CANCEL SELECTION") |
|
|
|
"CANCEL SELECTION") |
|
|
@ -153,7 +150,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): |
|
|
|
"", |
|
|
|
"", |
|
|
|
"JSON files (*.json)") |
|
|
|
"JSON files (*.json)") |
|
|
|
if ofile: |
|
|
|
if ofile: |
|
|
|
set_drawing_mode(Mode.LOADED) |
|
|
|
|
|
|
|
self.__mode = Mode.LOADED |
|
|
|
self.__mode = Mode.LOADED |
|
|
|
|
|
|
|
|
|
|
|
PointManager.load(ofile) |
|
|
|
PointManager.load(ofile) |
|
|
|