- trying to fix reported bugs

This commit is contained in:
Marius Stanciu 2019-08-11 02:18:32 +03:00
parent 377a811810
commit cf8a277825
9 changed files with 36 additions and 54 deletions

View File

@ -5555,9 +5555,9 @@ class App(QtCore.QObject):
def grid_status(self):
if self.ui.grid_snap_btn.isChecked():
return 1
return True
else:
return 0
return False
def populate_cmenu_grids(self):
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.setCheckable(True)
if self.grid_status():
if self.grid_status() == True:
grid_toggle.setChecked(True)
else:
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.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.app_cursor.enabled = True
else:
self.pos = (self.pos_canvas[0], self.pos_canvas[1])
self.app_cursor.enabled = False
try:
modifiers = QtWidgets.QApplication.keyboardModifiers()
@ -5831,26 +5832,20 @@ class App(QtCore.QObject):
:param event: contains information about the event.
:return:
"""
pos = 0, 0
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])
else:
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
# 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
# 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
self.delete_selection_shape()
self.delete_hover_shape()
else:
if self.selection_type is not None:
self.selection_area_handler(self.pos, pos, self.selection_type)

View File

@ -894,8 +894,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
return 'fail'
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 self.iso_type == 0:

View File

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

View File

@ -560,7 +560,7 @@ class Geometry(object):
for el in self.solid_geometry:
geo_iso.append(el.buffer(offset, int(int(self.geo_steps_per_circle) / 4)))
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:
try:
__ = 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),
join_style=corner))
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
if follow:

View File

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

View File

@ -3497,7 +3497,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
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.app.app_cursor.enabled = True
# Update cursor
@ -3507,7 +3507,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.pos = (self.pos[0], self.pos[1])
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>: "
"%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (0, 0))
@ -3573,7 +3573,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
return
# # ## Snap coordinates
if self.app.grid_status():
if self.app.grid_status() == True:
x, y = self.snap(x, y)
self.app.app_cursor.enabled = True
# Update cursor
@ -3625,7 +3625,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
def on_geo_click_release(self, event):
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])
else:
pos = (pos_canvas[0], pos_canvas[1])
@ -3662,19 +3662,6 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.inform.emit(_("[success] Done."))
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:
log.warning("Error: %s" % str(e))
return

View File

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

View File

@ -249,7 +249,7 @@ class Measurement(FlatCAMTool):
if event.button == 1:
pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
# 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])
else:
pos = pos_canvas[0], pos_canvas[1]
@ -287,7 +287,7 @@ class Measurement(FlatCAMTool):
def on_mouse_move_meas(self, event):
try: # May fail in case mouse not within axes
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])
self.app.app_cursor.enabled = True
# Update cursor

View File

@ -807,7 +807,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.app.plotcanvas.vis_disconnect('mouse_press', doit)
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])
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.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])
else:
self.app.inform.emit(_("Done."))
@ -844,7 +844,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.app.delete_selection_shape()
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])
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)
self.app.app_cursor.enabled = False
if self.app.grid_status():
if self.app.grid_status() == True:
self.app.app_cursor.enabled = True
# Update cursor
curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])