- made the mouse cursor (big, small) change in real time for both graphic engines
This commit is contained in:
@@ -6428,13 +6428,21 @@ class App(QtCore.QObject):
|
|||||||
:param val: type of mouse cursor, set in Preferences ('small' or 'big')
|
:param val: type of mouse cursor, set in Preferences ('small' or 'big')
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
self.app_cursor.enabled = False
|
||||||
|
|
||||||
if val == 'small':
|
if val == 'small':
|
||||||
self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry.setDisabled(False)
|
self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry.setDisabled(False)
|
||||||
self.ui.general_defaults_form.general_gui_set_group.cursor_size_lbl.setDisabled(False)
|
self.ui.general_defaults_form.general_gui_set_group.cursor_size_lbl.setDisabled(False)
|
||||||
|
self.app_cursor = self.plotcanvas.new_cursor()
|
||||||
else:
|
else:
|
||||||
self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry.setDisabled(True)
|
self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry.setDisabled(True)
|
||||||
self.ui.general_defaults_form.general_gui_set_group.cursor_size_lbl.setDisabled(True)
|
self.ui.general_defaults_form.general_gui_set_group.cursor_size_lbl.setDisabled(True)
|
||||||
|
self.app_cursor = self.plotcanvas.new_cursor(big=True)
|
||||||
|
|
||||||
|
if self.ui.grid_snap_btn.isChecked():
|
||||||
|
self.app_cursor.enabled = True
|
||||||
|
else:
|
||||||
|
self.app_cursor.enabled = False
|
||||||
|
|
||||||
def on_cnc_custom_parameters(self, signal_text):
|
def on_cnc_custom_parameters(self, signal_text):
|
||||||
if signal_text == 'Parameters':
|
if signal_text == 'Parameters':
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- removed the line that remove the spaces from the path parameter in the Tcl commands that open something (Gerber, Gcode, Excellon)
|
- removed the line that remove the spaces from the path parameter in the Tcl commands that open something (Gerber, Gcode, Excellon)
|
||||||
- fixed issue with the old SysTray icon not hidden when the application is restarted programmatically
|
- fixed issue with the old SysTray icon not hidden when the application is restarted programmatically
|
||||||
- if an object is edited but the result is not saved, the app will reload the edited object UI and set the Selected tab as active
|
- if an object is edited but the result is not saved, the app will reload the edited object UI and set the Selected tab as active
|
||||||
|
- made the mouse cursor (big, small) change in real time for both graphic engines
|
||||||
|
|
||||||
27.09.2019
|
27.09.2019
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||||||
a3l_in = np.array([(0, 0), (16.5, 0), (16.5, 11.7), (0, 11.7)])
|
a3l_in = np.array([(0, 0), (16.5, 0), (16.5, 11.7), (0, 11.7)])
|
||||||
|
|
||||||
a4p_mm = np.array([(0, 0), (210, 0), (210, 297), (0, 297)])
|
a4p_mm = np.array([(0, 0), (210, 0), (210, 297), (0, 297)])
|
||||||
a4l_mm = np.array([(0, 0), (297, 0), (297,210), (0, 210)])
|
a4l_mm = np.array([(0, 0), (297, 0), (297, 210), (0, 210)])
|
||||||
a3p_mm = np.array([(0, 0), (297, 0), (297, 420), (0, 420)])
|
a3p_mm = np.array([(0, 0), (297, 0), (297, 420), (0, 420)])
|
||||||
a3l_mm = np.array([(0, 0), (420, 0), (420, 297), (0, 297)])
|
a3l_mm = np.array([(0, 0), (420, 0), (420, 297), (0, 297)])
|
||||||
|
|
||||||
@@ -130,14 +130,14 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||||||
self.delete_workspace()
|
self.delete_workspace()
|
||||||
|
|
||||||
self.b_line = Line(pos=a[0:2], color=(0.70, 0.3, 0.3, 1.0),
|
self.b_line = Line(pos=a[0:2], color=(0.70, 0.3, 0.3, 1.0),
|
||||||
antialias= True, method='agg', parent=self.view.scene)
|
antialias=True, method='agg', parent=self.view.scene)
|
||||||
self.r_line = Line(pos=a[1:3], color=(0.70, 0.3, 0.3, 1.0),
|
self.r_line = Line(pos=a[1:3], color=(0.70, 0.3, 0.3, 1.0),
|
||||||
antialias= True, method='agg', parent=self.view.scene)
|
antialias=True, method='agg', parent=self.view.scene)
|
||||||
|
|
||||||
self.t_line = Line(pos=a[2:4], color=(0.70, 0.3, 0.3, 1.0),
|
self.t_line = Line(pos=a[2:4], color=(0.70, 0.3, 0.3, 1.0),
|
||||||
antialias= True, method='agg', parent=self.view.scene)
|
antialias=True, method='agg', parent=self.view.scene)
|
||||||
self.l_line = Line(pos=np.array((a[0], a[3])), color=(0.70, 0.3, 0.3, 1.0),
|
self.l_line = Line(pos=np.array((a[0], a[3])), color=(0.70, 0.3, 0.3, 1.0),
|
||||||
antialias= True, method='agg', parent=self.view.scene)
|
antialias=True, method='agg', parent=self.view.scene)
|
||||||
|
|
||||||
if self.fcapp.defaults['global_workspace'] is False:
|
if self.fcapp.defaults['global_workspace'] is False:
|
||||||
self.delete_workspace()
|
self.delete_workspace()
|
||||||
@@ -196,13 +196,31 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||||||
return ShapeCollection(parent=self.view.scene, pool=self.fcapp.pool, **kwargs)
|
return ShapeCollection(parent=self.view.scene, pool=self.fcapp.pool, **kwargs)
|
||||||
|
|
||||||
def new_cursor(self, big=None):
|
def new_cursor(self, big=None):
|
||||||
|
"""
|
||||||
|
Will create a mouse cursor pointer on canvas
|
||||||
|
|
||||||
|
:param big: if True will create a mouse cursor made out of infinite lines
|
||||||
|
:return: the mouse cursor object
|
||||||
|
"""
|
||||||
if big is True:
|
if big is True:
|
||||||
self.c = CursorBig()
|
self.c = CursorBig()
|
||||||
|
|
||||||
|
# in case there are multiple new_cursor calls, best to disconnect first the signals
|
||||||
|
try:
|
||||||
|
self.c.mouse_state_updated.disconnect(self.on_mouse_state)
|
||||||
|
except (TypeError, AttributeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
self.c.mouse_position_updated.disconnect(self.on_mouse_position)
|
||||||
|
except (TypeError, AttributeError):
|
||||||
|
pass
|
||||||
|
|
||||||
self.c.mouse_state_updated.connect(self.on_mouse_state)
|
self.c.mouse_state_updated.connect(self.on_mouse_state)
|
||||||
self.c.mouse_position_updated.connect(self.on_mouse_position)
|
self.c.mouse_position_updated.connect(self.on_mouse_position)
|
||||||
else:
|
else:
|
||||||
self.c = Cursor(pos=np.empty((0, 2)), parent=self.view.scene)
|
self.c = Cursor(pos=np.empty((0, 2)), parent=self.view.scene)
|
||||||
self.c.antialias = 0
|
self.c.antialias = 0
|
||||||
|
|
||||||
return self.c
|
return self.c
|
||||||
|
|
||||||
def on_mouse_state(self, state):
|
def on_mouse_state(self, state):
|
||||||
|
|||||||
@@ -264,10 +264,13 @@ class PlotCanvasLegacy(QtCore.QObject):
|
|||||||
# else:
|
# else:
|
||||||
# c = MplCursor(axes=axes, color='black', linewidth=1)
|
# c = MplCursor(axes=axes, color='black', linewidth=1)
|
||||||
|
|
||||||
if big is True:
|
if big is True:
|
||||||
self.big_cursor = True
|
self.big_cursor = True
|
||||||
self.ch_line = self.axes.axhline(color=(0.0, 0.0, 0.0), linewidth=1)
|
self.ch_line = self.axes.axhline(color=(0.0, 0.0, 0.0), linewidth=1)
|
||||||
self.cv_line = self.axes.axvline(color=(0.0, 0.0, 0.0), linewidth=1)
|
self.cv_line = self.axes.axvline(color=(0.0, 0.0, 0.0), linewidth=1)
|
||||||
|
else:
|
||||||
|
self.big_cursor = False
|
||||||
|
|
||||||
c = FakeCursor()
|
c = FakeCursor()
|
||||||
c.mouse_state_updated.connect(self.clear_cursor)
|
c.mouse_state_updated.connect(self.clear_cursor)
|
||||||
|
|
||||||
@@ -311,6 +314,11 @@ class PlotCanvasLegacy(QtCore.QObject):
|
|||||||
if state is True:
|
if state is True:
|
||||||
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
|
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
|
||||||
else:
|
else:
|
||||||
|
if self.big_cursor is True:
|
||||||
|
self.ch_line.remove()
|
||||||
|
self.cv_line.remove()
|
||||||
|
self.canvas.draw_idle()
|
||||||
|
|
||||||
self.canvas.restore_region(self.background)
|
self.canvas.restore_region(self.background)
|
||||||
self.canvas.blit(self.axes.bbox)
|
self.canvas.blit(self.axes.bbox)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user