diff --git a/CHANGELOG.md b/CHANGELOG.md index 191eb1b4..af9b95e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta ================================================= +28.03.2022 + +- in Distance Plugin added the ability to use a big cursor; not finished: when the grid is off it is not displayed + 27.03.2022 - trying to make loading a project an easier task for the application diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 3935d771..5323095d 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -3744,7 +3744,7 @@ class AppGeoEditor(QtCore.QObject): self.app.ui.snap_max_dist_entry.textChanged.connect( lambda: self.entry2option("snap_max", self.app.ui.snap_max_dist_entry)) - self.app.ui.grid_snap_btn.triggered.connect(self.on_grid_toggled) + self.app.ui.grid_snap_btn.triggered.connect(lambda: self.on_grid_toggled()) self.app.ui.corner_snap_btn.setCheckable(True) self.app.ui.corner_snap_btn.triggered.connect(lambda: self.toolbar_tool_toggle("corner_snap")) @@ -4662,8 +4662,8 @@ class AppGeoEditor(QtCore.QObject): self.app.app_cursor.enabled = True else: self.app.options['global_grid_snap'] = False - self.app.app_cursor.enabled = False self.app.inform[str, bool].emit(_("Grid Snap disabled."), False) + self.app.app_cursor.enabled = False def on_canvas_click(self, event): """ diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 07d712bf..eb62d354 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -4181,6 +4181,8 @@ class MainGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() + if self.app.distance_tool.ui.big_cursor_cb.get_value(): + self.app.app_cursor.enabled = True return # Jump to coords diff --git a/appMain.py b/appMain.py index d7b78b06..f79740bd 100644 --- a/appMain.py +++ b/appMain.py @@ -5084,10 +5084,11 @@ class App(QtCore.QObject): subprocess.Popen(['xdg-open', self.log_path()]) self.inform.emit('[success] %s' % _("FlatCAM log opened.")) - def on_cursor_type(self, val): + def on_cursor_type(self, val, control_cursor=True): """ - :param val: type of mouse cursor, set in Preferences ('small' or 'big') + :param val: type of mouse cursor, set in Preferences ('small' or 'big') + :param control_cursor: if True, it is enabled only if the grid snap is active :return: None """ self.app_cursor.enabled = False @@ -5101,10 +5102,13 @@ class App(QtCore.QObject): self.ui.general_pref_form.general_app_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 + if control_cursor is True: + if self.ui.grid_snap_btn.isChecked(): + self.app_cursor.enabled = True + else: + self.app_cursor.enabled = False else: - self.app_cursor.enabled = False + self.app_cursor.enabled = True def on_tool_add_keypress(self): # ## Current application units in Upper Case diff --git a/appPlugins/ToolDistance.py b/appPlugins/ToolDistance.py index db092e4f..69235244 100644 --- a/appPlugins/ToolDistance.py +++ b/appPlugins/ToolDistance.py @@ -79,6 +79,9 @@ class Distance(AppTool): self.mouse_is_dragging = False + # store the current cursor type to be restored after manual geo + self.old_cursor_type = self.app.options["global_cursor_type"] + # VisPy visuals if self.app.use_3d_engine: self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1) @@ -89,6 +92,7 @@ class Distance(AppTool): # Signals self.ui.measure_btn.clicked.connect(self.on_start_measuring) self.ui.multipoint_cb.stateChanged.connect(self.on_multipoint_measurement_changed) + self.ui.big_cursor_cb.stateChanged.connect(self.on_cursor_change) def run(self, toggle=False): @@ -103,6 +107,8 @@ class Distance(AppTool): if toggle: pass + self.old_cursor_type = self.app.options["global_cursor_type"] + self.on_start_measuring() if self.active is False else self.on_exit() def init_plugin(self): @@ -154,6 +160,7 @@ class Distance(AppTool): self.app.command_active = "Distance" self.ui.snap_center_cb.set_value(self.app.options['tools_dist_snap_center']) + self.ui.big_cursor_cb.set_value(self.app.options['tools_dist_big_cursor']) # snap center works only for Gerber and Execellon Editor's if self.original_call_source == 'exc_editor' or self.original_call_source == 'grb_editor': @@ -179,6 +186,10 @@ class Distance(AppTool): # initial view of the layout self.initial_view() + + if self.ui.big_cursor_cb.get_value(): + self.app.on_cursor_type(val="big", control_cursor=True) + self.app.call_source = 'measurement' def initial_view(self): @@ -196,6 +207,9 @@ class Distance(AppTool): if self.app.ui.grid_snap_btn.isChecked(): self.app.ui.grid_snap_btn.trigger() + if self.ui.big_cursor_cb.get_value(): + self.app.on_cursor_type(val="big", control_cursor=True) + def on_start_measuring(self): # ENABLE the Measuring TOOL self.active = True @@ -209,8 +223,8 @@ class Distance(AppTool): self.units = self.app.app_units.lower() self.ui_connect() - self.set_tool_ui() + self.app.inform.emit(_("MEASURING: Click on the Start point ...")) def ui_connect(self): @@ -312,6 +326,9 @@ class Distance(AppTool): # delete the measuring line self.delete_all_shapes() + # restore cursor + self.app.on_cursor_type(val=self.old_cursor_type, control_cursor=False) + # restore the grid status if (self.app.ui.grid_snap_btn.isChecked() and self.grid_status_memory is False) or \ (not self.app.ui.grid_snap_btn.isChecked() and self.grid_status_memory is True): @@ -502,6 +519,14 @@ class Distance(AppTool): self.ui.angle_label.setDisabled(False) self.ui.angle_entry.setDisabled(False) + def on_cursor_change(self, val): + if val: + self.app.options['tools_dist_big_cursor'] = True + self.app.on_cursor_type(val="big", control_cursor=True) + else: + self.app.options['tools_dist_big_cursor'] = False + self.app.on_cursor_type(val="small", control_cursor=True) + def on_mouse_move(self, event): multipoint = self.ui.multipoint_cb.get_value() @@ -520,16 +545,28 @@ class Distance(AppTool): pos_canvas = self.app.plotcanvas.translate_coords((x, y)) - if self.app.grid_status(): - pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1]) - + big_cursor_state = self.ui.big_cursor_cb.get_value() + grid_snap_state = self.app.grid_status() + if big_cursor_state is False: + if grid_snap_state: + pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1]) + # Update cursor + self.app.app_cursor.set_data(np.asarray([(pos[0], pos[1])]), + symbol='++', edge_color=self.app.cursor_color_3D, + edge_width=self.app.options["global_cursor_width"], + size=self.app.options["global_cursor_size"]) + else: + pos = (pos_canvas[0], pos_canvas[1]) + else: + if grid_snap_state: + pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1]) + else: + pos = (pos_canvas[0], pos_canvas[1]) # Update cursor self.app.app_cursor.set_data(np.asarray([(pos[0], pos[1])]), symbol='++', edge_color=self.app.cursor_color_3D, edge_width=self.app.options["global_cursor_width"], size=self.app.options["global_cursor_size"]) - else: - pos = (pos_canvas[0], pos_canvas[1]) self.app.ui.update_location_labels(dx=None, dy=None, x=pos[0], y=pos[1]) self.app.plotcanvas.on_update_text_hud('0.0', '0.0', pos[0], pos[1]) @@ -718,6 +755,12 @@ class DistanceUI: ) param_grid.addWidget(self.multipoint_cb, 2, 0, 1, 2) + # Big Cursor + self.big_cursor_cb = FCCheckBox('%s' % _("Big cursor")) + self.big_cursor_cb.setToolTip( + _("Use a big cursor.")) + param_grid.addWidget(self.big_cursor_cb, 4, 0, 1, 2) + # ############################################################################################################# # Coordinates Frame # ############################################################################################################# diff --git a/defaults.py b/defaults.py index f48de803..2617aa26 100644 --- a/defaults.py +++ b/defaults.py @@ -664,6 +664,7 @@ class AppDefaults: # Distance Tool "tools_dist_snap_center": False, + "tools_dist_big_cursor": True, # Markers Tool "tools_markers_thickness": 0.1,