From 57176b7e28a608474d6a75e5574dbe82792675a2 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 7 Apr 2019 03:43:58 +0300 Subject: [PATCH] - default values for Jump To function is jumping to origin (0, 0) --- FlatCAMApp.py | 5 +++-- README.md | 6 +++++- flatcamGUI/FlatCAMGUI.py | 8 -------- flatcamGUI/GUIElements.py | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 1e229712..8ee10335 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -4407,7 +4407,7 @@ class App(QtCore.QObject): self.plotcanvas.vis_connect('mouse_press', self.on_set_zero_click) - def on_jump_to(self, custom_location=None): + def on_jump_to(self, custom_location=None, fit_center=True): """ Jump to a location by setting the mouse cursor location :return: @@ -4433,7 +4433,8 @@ class App(QtCore.QObject): else: location = custom_location - self.plotcanvas.fit_center(loc=location) + if fit_center: + self.plotcanvas.fit_center(loc=location) cursor = QtGui.QCursor() diff --git a/README.md b/README.md index 0ee30bf7..fa5bc237 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing. ================================================= +7.04.2019 + +- default values for Jump To function is jumping to origin (0, 0) + 6.04.2019 - fixed bug in Geometry Editor in buffer_int() function that created an Circular Reference Error when applying buffer interior on a geometry. @@ -27,7 +31,7 @@ CAD program, and create G-Code for Isolation routing. - WIP in Gerber Editor - fixed bug in saving the maximized state - fixed bug in applying default language on first start -- on activating 'V' key shortcut (zoom fit) the mouse cursor is now jumping to origin (0, 0) +~~- on activating 'V' key shortcut (zoom fit) the mouse cursor is now jumping to origin (0, 0)~~ - fixed bug in saving toolbars state; the file was saved before setting the self.defaults['global_toolbar_view] 4.04.2019 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index ca41f790..edf16075 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2088,8 +2088,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # Zoom Fit if key == QtCore.Qt.Key_V: self.app.on_zoom_fit(None) - # and move mouse cursor to origin - self.app.on_jump_to(custom_location=(0, 0)) # Mirror on X the selected object(s) if key == QtCore.Qt.Key_X: @@ -2355,8 +2353,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_V or key == 'V': self.app.on_zoom_fit(None) - # and move mouse cursor to origin - self.app.on_jump_to(custom_location=(0, 0)) # Flip on X axis if key == QtCore.Qt.Key_X or key == 'X': @@ -2536,8 +2532,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_V or key == 'V': self.app.grb_editor.launched_from_shortcuts = True self.app.on_zoom_fit(None) - # and move mouse cursor to origin - self.app.on_jump_to(custom_location=(0, 0)) return # Propagate to tool @@ -2735,8 +2729,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_V or key == 'V': self.app.exc_editor.launched_from_shortcuts = True self.app.on_zoom_fit(None) - # and move mouse cursor to origin - self.app.on_jump_to(custom_location=(0, 0)) return # Propagate to tool diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py index 8c5542e4..e30a2f9b 100644 --- a/flatcamGUI/GUIElements.py +++ b/flatcamGUI/GUIElements.py @@ -1463,7 +1463,20 @@ class Dialog_box(QtWidgets.QWidget): dialog_box.setFixedWidth(290) self.setWindowIcon(icon) - self.location, self.ok = dialog_box.getText(self, title, label) + self.location, self.ok = dialog_box.getText(self, title, label, text="0, 0") + self.readyToEdit = True + + def mousePressEvent(self, e, parent=None): + super(Dialog_box, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.lineEdit().selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(Dialog_box, self).focusOutEvent(e) # required to remove cursor on focusOut + self.lineEdit().deselect() + self.readyToEdit = True + class _BrowserTextEdit(QTextEdit):