|
|
|
@ -65,10 +65,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
self.point_list_widget.itemClicked.connect(partial(item_click_handler, |
|
|
|
|
self)) |
|
|
|
|
|
|
|
|
|
#----------------------------------------------- |
|
|
|
|
self.choose_centroids_button.clicked.connect(self.__choose_centroids) |
|
|
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
|
|
|
# OpenGL Graphics Handlers are set |
|
|
|
|
# here and defined in clusterview.opengl_widget. |
|
|
|
|
#----------------------------------------------- |
|
|
|
|
# ----------------------------------------------- |
|
|
|
|
self.opengl_widget.initializeGL = initialize_gl |
|
|
|
|
self.opengl_widget.paintGL = paint_gl |
|
|
|
|
self.opengl_widget.resizeGL = resize_gl |
|
|
|
@ -97,10 +99,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
self.opengl_widget.mouseMoveEvent = self.__ogl_click_dispatcher |
|
|
|
|
self.opengl_widget.mouseReleaseEvent = self.__ogl_click_dispatcher |
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
|
|
|
|
# ----------------------------------------------------------------- |
|
|
|
|
# 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("") |
|
|
|
@ -123,7 +125,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
|
|
|
|
|
def __delete_points(self): |
|
|
|
|
self.__mode = Mode.DELETE |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) |
|
|
|
|
self.opengl_widget.setCursor(QCursor( |
|
|
|
|
Qt.CursorShape.PointingHandCursor)) |
|
|
|
|
self.status_bar.showMessage("DELETE MODE") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
@ -131,8 +134,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
def __move_points(self): |
|
|
|
|
self.__mode = Mode.MOVE |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.SizeAllCursor)) |
|
|
|
|
self.status_bar.showMessage("MOVE MODE - PRESS ESC OR SWITCH MODES TO "+ |
|
|
|
|
"CANCEL SELECTION") |
|
|
|
|
self.status_bar.showMessage("MOVE MODE - PRESS ESC OR SWITCH MODES" + |
|
|
|
|
"TO CANCEL SELECTION") |
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
|
def __choose_centroids(self): |
|
|
|
|
self.__mode = Mode.CHOOSE_CENTROIDS |
|
|
|
|
self.opengl_widget.setCursor(QCursor(Qt.CursorShape.CrossCursor)) |
|
|
|
|
self.status_bar.showMessage("CHOOSE CENTROIDS") |
|
|
|
|
|
|
|
|
|
clear_selection() |
|
|
|
|
self.opengl_widget.update() |
|
|
|
|
|
|
|
|
@ -167,10 +178,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
refresh_point_list(self) |
|
|
|
|
|
|
|
|
|
def __save_points_file(self): |
|
|
|
|
file_name, _ = QFileDialog.getSaveFileName(self, |
|
|
|
|
"Save Point Configuration", |
|
|
|
|
"", |
|
|
|
|
"JSON Files (*.json)") |
|
|
|
|
file_name, _ = (QFileDialog. |
|
|
|
|
getSaveFileName(self, |
|
|
|
|
"Save Point Configuration", |
|
|
|
|
"", |
|
|
|
|
"JSON Files (*.json)")) |
|
|
|
|
if file_name: |
|
|
|
|
PointManager.save(file_name) |
|
|
|
|
|
|
|
|
|