- for all Editors now there is a shortcut key (key "C") that will toggle the cursor data in case the cursor data is in the way

- Geometry Editor: the Path tool now has a new behavior: when key modifier SHIFT is pressed and the Grid is OFF, when the line is drawn and it is near the 0, 45 and 90 degrees, in each quadrant, then the drawn line will follow the nearest target angle (0 or 45 or 90 degrees) allowing the drawing of straight lines.
This commit is contained in:
Marius Stanciu
2023-05-24 17:46:25 +03:00
parent e5dd294576
commit 7fda555fc0
4 changed files with 224 additions and 3 deletions

View File

@@ -57,6 +57,8 @@ class PadEditorGrb(ShapeToolEditorGrb):
self.app = self.draw_app.app
self.dont_execute = False
self.cursor_data_control = True
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
@@ -290,6 +292,10 @@ class PadEditorGrb(ShapeToolEditorGrb):
self.draw_app.app.inform.emit('[success] %s' % _("Done."))
def draw_cursor_data(self, pos=None, delete=False):
if self.cursor_data_control is False:
self.draw_app.app.plotcanvas.text_cursor.text = ""
return
if pos is None:
pos = self.draw_app.snap_x, self.draw_app.snap_y
@@ -393,6 +399,8 @@ class PadEditorGrb(ShapeToolEditorGrb):
self.draw_app.app.inform.emit(msg)
# self.interpolate_length = ''
# return "Click on next point or hit ENTER to complete ..."
if key == 'C' or key == QtCore.Qt.Key.Key_C:
self.cursor_data_control = not self.cursor_data_control
def clean_up(self):
self.draw_app.selected = []
@@ -421,6 +429,8 @@ class PadArrayEditorGrb(ShapeToolEditorGrb):
self.app = self.draw_app.app
self.dont_execute = False
self.cursor_data_control = True
try:
self.radius = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['size']) / 2
except KeyError:
@@ -883,6 +893,10 @@ class PadArrayEditorGrb(ShapeToolEditorGrb):
pass
def draw_cursor_data(self, pos=None, delete=False):
if self.cursor_data_control is False:
self.draw_app.app.plotcanvas.text_cursor.text = ""
return
if pos is None:
pos = self.draw_app.snap_x, self.draw_app.snap_y
@@ -957,6 +971,9 @@ class PadArrayEditorGrb(ShapeToolEditorGrb):
# ## Utility geometry (animated)
self.draw_app.update_utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y))
elif key == 'C' or key == QtCore.Qt.Key.Key_C:
self.cursor_data_control = not self.cursor_data_control
def add_pad_array(self, array_pos):
self.radius = self.ui.radius_entry.get_value()
self.array_type = self.ui.array_type_radio.get_value()
@@ -1141,6 +1158,8 @@ class RegionEditorGrb(ShapeToolEditorGrb):
# this will store the inflexion point in the geometry
self.inter_point = None
self.cursor_data_control = True
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
@@ -1409,6 +1428,10 @@ class RegionEditorGrb(ShapeToolEditorGrb):
self.draw_app.app.inform.emit('[success] %s' % _("Done."))
def draw_cursor_data(self, pos=None, delete=False):
if self.cursor_data_control is False:
self.draw_app.app.plotcanvas.text_cursor.text = ""
return
if pos is None:
pos = self.draw_app.snap_x, self.draw_app.snap_y
@@ -1459,6 +1482,9 @@ class RegionEditorGrb(ShapeToolEditorGrb):
self.draw_app.app.plotcanvas.text_cursor.parent = self.draw_app.app.plotcanvas.view.scene
def on_key(self, key):
if key == 'C' or key == QtCore.Qt.Key.Key_C:
self.cursor_data_control = not self.cursor_data_control
# Jump to coords
if key == QtCore.Qt.Key.Key_J or key == 'J':
self.draw_app.app.on_jump_to()
@@ -1622,6 +1648,9 @@ class TrackEditorGrb(ShapeToolEditorGrb):
self.current_point = None
self.final_click = False
self.cursor_data_control = True
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
@@ -1813,6 +1842,10 @@ class TrackEditorGrb(ShapeToolEditorGrb):
self.draw_app.app.inform.emit('[success] %s' % _("Done."))
def draw_cursor_data(self, pos=None, delete=False):
if self.cursor_data_control is False:
self.draw_app.app.plotcanvas.text_cursor.text = ""
return
if pos is None:
pos = self.draw_app.snap_x, self.draw_app.snap_y
@@ -1876,6 +1909,9 @@ class TrackEditorGrb(ShapeToolEditorGrb):
self.draw_app.draw_utility_geometry(geo_shape=geo)
return _("Backtracked one point ...")
if key == 'C' or key == QtCore.Qt.Key.Key_C:
self.cursor_data_control = not self.cursor_data_control
# Jump to coords
if key == QtCore.Qt.Key.Key_G or key == 'G':
self.draw_app.app.ui.grid_snap_btn.trigger()