Ver código fonte

- added a toggle button in Preferences to toggle on/off the display of the selection box on canvas when the user is clicking an object or selecting it by mouse dragging.

Marius Stanciu 6 anos atrás
pai
commit
ac3833f746
3 arquivos alterados com 26 adições e 8 exclusões
  1. 14 7
      FlatCAMApp.py
  2. 1 1
      README.md
  3. 11 0
      flatcamGUI/FlatCAMGUI.py

+ 14 - 7
FlatCAMApp.py

@@ -345,7 +345,7 @@ class App(QtCore.QObject):
             # General GUI Settings
             "global_layout": self.ui.general_defaults_form.general_gui_set_group.layout_combo,
             "global_hover": self.ui.general_defaults_form.general_gui_set_group.hover_cb,
-
+            "global_selection_shape": self.ui.general_defaults_form.general_gui_set_group.selection_cb,
             # Gerber General
             "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
             "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
@@ -649,6 +649,7 @@ class App(QtCore.QObject):
 
             # General GUI Settings
             "global_hover": True,
+            "global_selection_shape": True,
             "global_layout": "compact",
             # Gerber General
             "gerber_plot": True,
@@ -4691,7 +4692,8 @@ class App(QtCore.QObject):
             self.collection.set_active(name)
             curr_sel_obj = self.collection.get_by_name(name)
             # create the selection box around the selected object
-            self.draw_selection_shape(curr_sel_obj)
+            if self.defaults['global_selection_shape'] is True:
+                self.draw_selection_shape(curr_sel_obj)
 
     def on_preferences(self):
 
@@ -5305,12 +5307,14 @@ class App(QtCore.QObject):
                     if sel_type is True:
                         if poly_obj.within(poly_selection):
                             # create the selection box around the selected object
-                            self.draw_selection_shape(obj)
+                            if self.defaults['global_selection_shape'] is True:
+                                self.draw_selection_shape(obj)
                             self.collection.set_active(obj.options['name'])
                     else:
                         if poly_selection.intersects(poly_obj):
                             # create the selection box around the selected object
-                            self.draw_selection_shape(obj)
+                            if self.defaults['global_selection_shape'] is True:
+                                self.draw_selection_shape(obj)
                             self.collection.set_active(obj.options['name'])
             except:
                 # the Exception here will happen if we try to select on screen and we have an newly (and empty)
@@ -5360,7 +5364,8 @@ class App(QtCore.QObject):
                         self.collection.set_active(objects_under_the_click_list[0])
                         # create the selection box around the selected object
                         curr_sel_obj = self.collection.get_active()
-                        self.draw_selection_shape(curr_sel_obj)
+                        if self.defaults['global_selection_shape'] is True:
+                            self.draw_selection_shape(curr_sel_obj)
 
                         # self.inform.emit('[selected] %s: %s selected' %
                         #                  (str(curr_sel_obj.kind).capitalize(), str(curr_sel_obj.options['name'])))
@@ -5383,7 +5388,8 @@ class App(QtCore.QObject):
                         self.collection.set_active(objects_under_the_click_list[0])
                         # create the selection box around the selected object
                         curr_sel_obj = self.collection.get_active()
-                        self.draw_selection_shape(curr_sel_obj)
+                        if self.defaults['global_selection_shape'] is True:
+                            self.draw_selection_shape(curr_sel_obj)
 
                         # self.inform.emit('[selected] %s: %s selected' %
                         #                  (str(curr_sel_obj.kind).capitalize(), str(curr_sel_obj.options['name'])))
@@ -5431,7 +5437,8 @@ class App(QtCore.QObject):
                     # delete the possible selection box around a possible selected object
                     self.delete_selection_shape()
                     # create the selection box around the selected object
-                    self.draw_selection_shape(curr_sel_obj)
+                    if self.defaults['global_selection_shape'] is True:
+                        self.draw_selection_shape(curr_sel_obj)
 
                     # self.inform.emit('[selected] %s: %s selected' %
                     #                  (str(curr_sel_obj.kind).capitalize(), str(curr_sel_obj.options['name'])))

+ 1 - 1
README.md

@@ -16,7 +16,7 @@ CAD program, and create G-Code for Isolation routing.
 - for all objects, if in Selected the object name is changed to the same name, the rename is not done (because there is nothing changed)
 - fixed Edit -> Copy as Geom function handler to work for Excellon objects, too
 - made sure that the mouse pointer is restored to default on Editor exit
--
+- added a toggle button in Preferences to toggle on/off the display of the selection box on canvas when the user is clicking an object or selecting it by mouse dragging.
 
 24.04.2019
 

+ 11 - 0
flatcamGUI/FlatCAMGUI.py

@@ -3603,6 +3603,16 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
         )
         self.hover_cb = FCCheckBox()
 
+        # Enable Selection box
+        self.selection_label = QtWidgets.QLabel(_('Sel. Shape:'))
+        self.selection_label.setToolTip(
+            _("Enable the display of a selection shape for FlatCAM objects.\n"
+              "It is displayed whenever the mouse selects an object\n"
+              "either by clicking or dragging mouse from left to right or\n"
+              "right to left.")
+        )
+        self.selection_cb = FCCheckBox()
+
         # Just to add empty rows
         self.spacelabel = QtWidgets.QLabel('')
 
@@ -3614,6 +3624,7 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
         self.form_box.addRow(self.hdpi_label, self.hdpi_cb)
         self.form_box.addRow(self.clear_label, self.clear_btn)
         self.form_box.addRow(self.hover_label, self.hover_cb)
+        self.form_box.addRow(self.selection_label, self.selection_cb)
 
         # Add the QFormLayout that holds the Application general defaults
         # to the main layout of this TAB