Procházet zdrojové kódy

- trying to fix reported bugs

Marius Stanciu před 6 roky
rodič
revize
cf8a277825

+ 14 - 20
FlatCAMApp.py

@@ -5555,9 +5555,9 @@ class App(QtCore.QObject):
 
 
     def grid_status(self):
     def grid_status(self):
         if self.ui.grid_snap_btn.isChecked():
         if self.ui.grid_snap_btn.isChecked():
-            return 1
+            return True
         else:
         else:
-            return 0
+            return False
 
 
     def populate_cmenu_grids(self):
     def populate_cmenu_grids(self):
         units = self.ui.general_defaults_form.general_app_group.units_radio.get_value().lower()
         units = self.ui.general_defaults_form.general_app_group.units_radio.get_value().lower()
@@ -5567,7 +5567,7 @@ class App(QtCore.QObject):
 
 
         grid_toggle = self.ui.cmenu_gridmenu.addAction(QtGui.QIcon('share/grid32_menu.png'), _("Grid On/Off"))
         grid_toggle = self.ui.cmenu_gridmenu.addAction(QtGui.QIcon('share/grid32_menu.png'), _("Grid On/Off"))
         grid_toggle.setCheckable(True)
         grid_toggle.setCheckable(True)
-        if self.grid_status():
+        if self.grid_status() == True:
             grid_toggle.setChecked(True)
             grid_toggle.setChecked(True)
         else:
         else:
             grid_toggle.setChecked(False)
             grid_toggle.setChecked(False)
@@ -5701,12 +5701,13 @@ class App(QtCore.QObject):
         self.plotcanvas.vispy_canvas.view.camera.pan_button_setting = self.defaults['global_pan_button']
         self.plotcanvas.vispy_canvas.view.camera.pan_button_setting = self.defaults['global_pan_button']
 
 
         self.pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
         self.pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
-        self.pos = (self.pos_canvas[0], self.pos_canvas[1])
-        self.app_cursor.enabled = False
 
 
-        if self.grid_status():
+        if self.grid_status() == True:
             self.pos = self.geo_editor.snap(self.pos_canvas[0], self.pos_canvas[1])
             self.pos = self.geo_editor.snap(self.pos_canvas[0], self.pos_canvas[1])
             self.app_cursor.enabled = True
             self.app_cursor.enabled = True
+        else:
+            self.pos = (self.pos_canvas[0], self.pos_canvas[1])
+            self.app_cursor.enabled = False
 
 
         try:
         try:
             modifiers = QtWidgets.QApplication.keyboardModifiers()
             modifiers = QtWidgets.QApplication.keyboardModifiers()
@@ -5831,26 +5832,20 @@ class App(QtCore.QObject):
         :param event: contains information about the event.
         :param event: contains information about the event.
         :return:
         :return:
         """
         """
-
+        pos = 0, 0
         pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
         pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
-        if self.grid_status():
+        if self.grid_status() == True:
             pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
             pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
         else:
         else:
             pos = (pos_canvas[0], pos_canvas[1])
             pos = (pos_canvas[0], pos_canvas[1])
 
 
         # if the released mouse button was RMB then test if it was a panning motion or not, if not it was a context
         # if the released mouse button was RMB then test if it was a panning motion or not, if not it was a context
         # canvas menu
         # canvas menu
-        try:
-            if event.button == 2:  # right click
-                if self.ui.popMenu.mouse_is_panning is False:
-
-                    self.cursor = QtGui.QCursor()
-                    self.populate_cmenu_grids()
-                    self.ui.popMenu.popup(self.cursor.pos())
-
-        except Exception as e:
-            log.warning("Error: %s" % str(e))
-            return
+        if event.button == 2:  # right click
+            if self.ui.popMenu.mouse_is_panning is False:
+                self.cursor = QtGui.QCursor()
+                self.populate_cmenu_grids()
+                self.ui.popMenu.popup(self.cursor.pos())
 
 
         # if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
         # if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
         # selection and then select a type of selection ("enclosing" or "touching")
         # selection and then select a type of selection ("enclosing" or "touching")
@@ -5866,7 +5861,6 @@ class App(QtCore.QObject):
                         # delete the selection shape(S) as it may be in the way
                         # delete the selection shape(S) as it may be in the way
                         self.delete_selection_shape()
                         self.delete_selection_shape()
                         self.delete_hover_shape()
                         self.delete_hover_shape()
-
                 else:
                 else:
                     if self.selection_type is not None:
                     if self.selection_type is not None:
                         self.selection_area_handler(self.pos, pos, self.selection_type)
                         self.selection_area_handler(self.pos, pos, self.selection_type)

+ 2 - 2
FlatCAMObj.py

@@ -894,8 +894,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
                     return 'fail'
                     return 'fail'
             return geom
             return geom
 
 
-        if float(self.options["isotooldia"]) < 0:
-            self.options["isotooldia"] = -self.options["isotooldia"]
+        # if float(self.options["isotooldia"]) < 0:
+        #     self.options["isotooldia"] = -self.options["isotooldia"]
 
 
         if combine:
         if combine:
             if self.iso_type == 0:
             if self.iso_type == 0:

+ 1 - 0
README.md

@@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
 11.08.2019
 11.08.2019
 
 
 - small changes regarding the Project Title
 - small changes regarding the Project Title
+- trying to fix reported bugs
 
 
 10.08.2019
 10.08.2019
 
 

+ 3 - 3
camlib.py

@@ -560,7 +560,7 @@ class Geometry(object):
                         for el in self.solid_geometry:
                         for el in self.solid_geometry:
                             geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4)))
                             geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4)))
                     except TypeError:
                     except TypeError:
-                        geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4))
+                        geo_iso = [self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4))]
                 else:
                 else:
                     try:
                     try:
                         __ = iter(self.solid_geometry)
                         __ = iter(self.solid_geometry)
@@ -568,8 +568,8 @@ class Geometry(object):
                             geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
                             geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
                                                      join_style=corner))
                                                      join_style=corner))
                     except TypeError:
                     except TypeError:
-                        geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
-                                                             join_style=corner)
+                        geo_iso = [self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
+                                                              join_style=corner)]
 
 
         # end of replaced block
         # end of replaced block
         if follow:
         if follow:

+ 3 - 3
flatcamEditors/FlatCAMExcEditor.py

@@ -2169,7 +2169,7 @@ class FlatCAMExcEditor(QtCore.QObject):
 
 
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
 
 
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             self.pos  = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.pos  = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor
@@ -2300,7 +2300,7 @@ class FlatCAMExcEditor(QtCore.QObject):
         self.modifiers = QtWidgets.QApplication.keyboardModifiers()
         self.modifiers = QtWidgets.QApplication.keyboardModifiers()
 
 
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
             pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
         else:
         else:
             pos = (pos_canvas[0], pos_canvas[1])
             pos = (pos_canvas[0], pos_canvas[1])
@@ -2432,7 +2432,7 @@ class FlatCAMExcEditor(QtCore.QObject):
             return
             return
 
 
         # ## Snap coordinates
         # ## Snap coordinates
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             x, y = self.app.geo_editor.snap(x, y)
             x, y = self.app.geo_editor.snap(x, y)
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor

+ 4 - 17
flatcamEditors/FlatCAMGeoEditor.py

@@ -3497,7 +3497,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
 
 
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
 
 
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor
@@ -3507,7 +3507,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
             self.pos = (self.pos[0], self.pos[1])
             self.pos = (self.pos[0], self.pos[1])
             self.app.app_cursor.enabled = False
             self.app.app_cursor.enabled = False
 
 
-        if event.button is 1:
+        if event.button == 1:
             self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
             self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
                                                    "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (0, 0))
                                                    "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (0, 0))
 
 
@@ -3573,7 +3573,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
             return
             return
 
 
         # # ## Snap coordinates
         # # ## Snap coordinates
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             x, y = self.snap(x, y)
             x, y = self.snap(x, y)
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor
@@ -3625,7 +3625,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
     def on_geo_click_release(self, event):
     def on_geo_click_release(self, event):
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
 
 
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             pos = self.snap(pos_canvas[0], pos_canvas[1])
             pos = self.snap(pos_canvas[0], pos_canvas[1])
         else:
         else:
             pos = (pos_canvas[0], pos_canvas[1])
             pos = (pos_canvas[0], pos_canvas[1])
@@ -3662,19 +3662,6 @@ class FlatCAMGeoEditor(QtCore.QObject):
                                 self.app.inform.emit(_("[success] Done."))
                                 self.app.inform.emit(_("[success] Done."))
                                 self.select_tool(self.active_tool.name)
                                 self.select_tool(self.active_tool.name)
 
 
-                                # MS: always return to the Select Tool if modifier key is not pressed
-                                # else return to the current tool
-                                # key_modifier = QtWidgets.QApplication.keyboardModifiers()
-                                # if self.app.defaults["global_mselect_key"] == 'Control':
-                                #     modifier_to_use = Qt.ControlModifier
-                                # else:
-                                #     modifier_to_use = Qt.ShiftModifier
-                                #
-                                # if key_modifier == modifier_to_use:
-                                #     self.select_tool(self.active_tool.name)
-                                # else:
-                                #     self.select_tool("select")
-
         except Exception as e:
         except Exception as e:
             log.warning("Error: %s" % str(e))
             log.warning("Error: %s" % str(e))
             return
             return

+ 3 - 3
flatcamEditors/FlatCAMGrbEditor.py

@@ -3986,7 +3986,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
 
 
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
         self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
 
 
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor
@@ -4048,7 +4048,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
         self.modifiers = QtWidgets.QApplication.keyboardModifiers()
         self.modifiers = QtWidgets.QApplication.keyboardModifiers()
 
 
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
         pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
             pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
         else:
         else:
             pos = (pos_canvas[0], pos_canvas[1])
             pos = (pos_canvas[0], pos_canvas[1])
@@ -4201,7 +4201,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
             return
             return
 
 
         # # ## Snap coordinates
         # # ## Snap coordinates
-        if self.app.grid_status():
+        if self.app.grid_status() == True:
             x, y = self.app.geo_editor.snap(x, y)
             x, y = self.app.geo_editor.snap(x, y)
             self.app.app_cursor.enabled = True
             self.app.app_cursor.enabled = True
             # Update cursor
             # Update cursor

+ 2 - 2
flatcamTools/ToolMeasurement.py

@@ -249,7 +249,7 @@ class Measurement(FlatCAMTool):
         if event.button == 1:
         if event.button == 1:
             pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
             pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
             # if GRID is active we need to get the snapped positions
             # if GRID is active we need to get the snapped positions
-            if self.app.grid_status():
+            if self.app.grid_status() == True:
                 pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
                 pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
             else:
             else:
                 pos = pos_canvas[0], pos_canvas[1]
                 pos = pos_canvas[0], pos_canvas[1]
@@ -287,7 +287,7 @@ class Measurement(FlatCAMTool):
     def on_mouse_move_meas(self, event):
     def on_mouse_move_meas(self, event):
         try:  # May fail in case mouse not within axes
         try:  # May fail in case mouse not within axes
             pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
             pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
-            if self.app.grid_status():
+            if self.app.grid_status() == True:
                 pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
                 pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
                 self.app.app_cursor.enabled = True
                 self.app.app_cursor.enabled = True
                 # Update cursor
                 # Update cursor

+ 4 - 4
flatcamTools/ToolPaint.py

@@ -807,7 +807,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                     self.app.plotcanvas.vis_disconnect('mouse_press', doit)
                     self.app.plotcanvas.vis_disconnect('mouse_press', doit)
 
 
                     pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
                     pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
-                    if self.app.grid_status():
+                    if self.app.grid_status() == True:
                         pos = self.app.geo_editor.snap(pos[0], pos[1])
                         pos = self.app.geo_editor.snap(pos[0], pos[1])
 
 
                     self.paint_poly(self.paint_obj,
                     self.paint_poly(self.paint_obj,
@@ -836,7 +836,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                         self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
                         self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
 
 
                         self.cursor_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
                         self.cursor_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
-                        if self.app.grid_status():
+                        if self.app.grid_status() == True:
                             self.cursor_pos = self.app.geo_editor.snap(self.cursor_pos[0], self.cursor_pos[1])
                             self.cursor_pos = self.app.geo_editor.snap(self.cursor_pos[0], self.cursor_pos[1])
                     else:
                     else:
                         self.app.inform.emit(_("Done."))
                         self.app.inform.emit(_("Done."))
@@ -844,7 +844,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                         self.app.delete_selection_shape()
                         self.app.delete_selection_shape()
 
 
                         curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
                         curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
-                        if self.app.grid_status():
+                        if self.app.grid_status() == True:
                             curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])
                             curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])
 
 
                         x0, y0 = self.cursor_pos[0], self.cursor_pos[1]
                         x0, y0 = self.cursor_pos[0], self.cursor_pos[1]
@@ -874,7 +874,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                 curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
                 curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
                 self.app.app_cursor.enabled = False
                 self.app.app_cursor.enabled = False
 
 
-                if self.app.grid_status():
+                if self.app.grid_status() == True:
                     self.app.app_cursor.enabled = True
                     self.app.app_cursor.enabled = True
                     # Update cursor
                     # Update cursor
                     curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])
                     curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])