Просмотр исходного кода

- default values for Jump To function is jumping to origin (0, 0)

Marius Stanciu 6 лет назад
Родитель
Сommit
57176b7e28
4 измененных файлов с 22 добавлено и 12 удалено
  1. 3 2
      FlatCAMApp.py
  2. 5 1
      README.md
  3. 0 8
      flatcamGUI/FlatCAMGUI.py
  4. 14 1
      flatcamGUI/GUIElements.py

+ 3 - 2
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()
 

+ 5 - 1
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

+ 0 - 8
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

+ 14 - 1
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):