|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import os |
|
|
|
|
from enum import Enum |
|
|
|
|
from functools import partial |
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
from PyQt5.QtCore import Qt |
|
|
|
|
from PyQt5.QtGui import QCursor |
|
|
|
@ -7,8 +8,9 @@ from PyQt5 import QtWidgets, uic
|
|
|
|
|
|
|
|
|
|
from clusterview.exceptions import handle_exceptions, InvalidModeError |
|
|
|
|
from clusterview.mode import Mode |
|
|
|
|
from clusterview.mode_handlers import MODE_HANDLER_MAP |
|
|
|
|
from clusterview.opengl_widget import (initialize_gl, paint_gl, resize_gl, |
|
|
|
|
from clusterview.mode_handlers import MODE_HANDLER_MAP, ogl_keypress_handler |
|
|
|
|
from clusterview.opengl_widget import (clear_selection, initialize_gl, |
|
|
|
|
paint_gl, resize_gl, |
|
|
|
|
set_drawing_mode, set_drawing_context) |
|
|
|
|
from clusterview_ui import Ui_MainWindow |
|
|
|
|
|
|
|
|
@ -36,6 +38,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|
|
|
|
# tracked and fired properly. |
|
|
|
|
self.opengl_widget.setMouseTracking(True) |
|
|
|
|
|
|
|
|
|
# Enables us to handle key press events (used for checking |
|
|
|
|
# for and handling terminating selections with ESC). |
|
|
|
|
# Here we partially apply the key press handler with self to |
|
|
|
|
# create a new function that only expects the event `keyPressEvent` |
|
|
|
|
# expects. In this way, we've snuck the state of the opengl_widget |
|
|
|
|
# into the function so that we can modify it as we please. |
|
|
|
|
self.opengl_widget.keyPressEvent = partial(ogl_keypress_handler, self) |
|
|
|
|
|
|
|
|
|
#----------------------------------------------- |
|
|
|
|
# OpenGL Graphics Handlers are set |
|
|
|
|
# here and defined in clusterview.opengl_widget. |
|
|
|
@ -68,24 +78,32 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
|
self.status_bar.showMessage("ADD MODE") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
def __edit_points(self): |
|
|
|
|
self.__mode = Mode.EDIT |
|
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
|
self.status_bar.showMessage("EDIT MODE") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
def __delete_points(self): |
|
|
|
|
self.__mode = Mode.DELETE |
|
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) |
|
|
|
|
self.status_bar.showMessage("DELETE MODE") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
def __move_points(self): |
|
|
|
|
self.__mode = Mode.MOVE |
|
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.SizeAllCursor)) |
|
|
|
|
self.status_bar.showMessage("MOVE MODE") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
@handle_exceptions |
|
|
|
|
def __solve_launcher(self): |
|
|
|
|