|
|
|
@ -38,8 +38,6 @@ 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 |
|
|
|
@ -73,6 +71,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|
|
|
|
# Mode changers - these will be used to signal the action in the |
|
|
|
|
# OpenGL Widget. |
|
|
|
|
#----------------------------------------------------------------- |
|
|
|
|
def __off_mode(self): |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.ArrowCursor)) |
|
|
|
|
self.status_bar.showMessage("") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
def __add_points(self): |
|
|
|
|
self.__mode = Mode.ADD |
|
|
|
|
set_drawing_mode(self.__mode) |
|
|
|
@ -105,6 +109,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
def mode(self): |
|
|
|
|
""" |
|
|
|
|
Function designed to be used from a context |
|
|
|
|
to get the current mode. |
|
|
|
|
""" |
|
|
|
|
return self.__mode |
|
|
|
|
|
|
|
|
|
@mode.setter |
|
|
|
|
def mode(self, mode): |
|
|
|
|
self.__mode = mode |
|
|
|
|
|
|
|
|
|
@handle_exceptions |
|
|
|
|
def __solve_launcher(self): |
|
|
|
|
""" |
|
|
|
@ -130,3 +146,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|
|
|
|
# them to modify on screen widgets such as the QOpenGLWidget and |
|
|
|
|
# QListWidget. |
|
|
|
|
MODE_HANDLER_MAP[self.__mode](self, event) |
|
|
|
|
else: |
|
|
|
|
# Go back to the base state |
|
|
|
|
self.__off_mode() |
|
|
|
|