- fixed bug in Gerber Editor in which the units conversion wasn't calculated correct

- fixed bug in Gerber Editor in which the QThread that is started on object edit was not stopped at clean up stage
- fixed bug in Gerber Editor that kept all the apertures (including the geometry) of a previously edited object that was not saved after edit
This commit is contained in:
Marius Stanciu 2020-05-02 04:54:09 +03:00 committed by Marius
parent bdf2192d00
commit 48b3f8d65a
18 changed files with 64 additions and 56 deletions

View File

@ -11,6 +11,9 @@ CHANGELOG for FlatCAM beta
- changed the icons for the grid snap in the status bar
- moved some of the methods from FlatCAMApp.App to flatcamGUI.FlatCAMGUI class
- fixed bug in Gerber Editor in which the units conversion wasn't calculated correct
- fixed bug in Gerber Editor in which the QThread that is started on object edit was not stopped at clean up stage
- fixed bug in Gerber Editor that kept all the apertures (including the geometry) of a previously edited object that was not saved after edit
01.05.2020

View File

@ -6940,7 +6940,6 @@ class App(QtCore.QObject):
else:
key_modifier = QtWidgets.QApplication.keyboardModifiers()
if key_modifier == QtCore.Qt.ShiftModifier:
mod_key = 'Shift'
elif key_modifier == QtCore.Qt.ControlModifier:
@ -6949,20 +6948,19 @@ class App(QtCore.QObject):
mod_key = None
try:
if mod_key == self.defaults["global_mselect_key"]:
if self.command_active is None:
# If the CTRL key is pressed when the LMB is clicked then if the object is selected it will
# deselect, and if it's not selected then it will be selected
# If there is no active command (self.command_active is None) then we check if we clicked
# on a object by checking the bounding limits against mouse click position
if self.command_active is None:
if mod_key == self.defaults["global_mselect_key"]:
self.select_objects(key='multisel')
self.delete_hover_shape()
else:
# If there is no active command (self.command_active is None) then we check if we clicked
# on a object by checking the bounding limits against mouse click position
if self.command_active is None:
else:
# If there is no active command (self.command_active is None) then we check if
# we clicked on a object by checking the bounding limits against mouse click position
self.select_objects()
self.delete_hover_shape()
self.delete_hover_shape()
except Exception as e:
log.warning("FlatCAMApp.on_mouse_click_release_over_plot() select click --> Error: %s" % str(e))
return
@ -8158,7 +8156,6 @@ class App(QtCore.QObject):
# ###############################################################################################################
# ### The following section has the functions that are displayed and call the Editor tab CNCJob Tab #############
# ###############################################################################################################
def init_code_editor(self, name):
self.text_editor_tab = TextEditor(app=self, plain_text=True)
@ -10820,21 +10817,6 @@ class App(QtCore.QObject):
# no_km)
# QtWidgets.qApp.sendEvent(self.shell._edit, f)
def on_toggle_shell_from_settings(self, state):
"""
Toggle shell: if is visible close it, if it is closed then open it
:return: None
"""
self.defaults.report_usage("on_toggle_shell_from_settings()")
if state is True:
if not self.ui.shell_dock.isVisible():
self.ui.shell_dock.show()
else:
if self.ui.shell_dock.isVisible():
self.ui.shell_dock.hide()
def shell_message(self, msg, show=False, error=False, warning=False, success=False, selected=False):
"""
Shows a message on the FlatCAM Shell

View File

@ -2837,7 +2837,7 @@ class FlatCAMExcEditor(QtCore.QObject):
# start with GRID toolbar activated
if self.app.ui.grid_snap_btn.isChecked() is False:
self.app.ui.grid_snap_btn.trigger()
self.app.on_grid_snap_triggered(state=True)
self.app.ui.on_grid_snap_triggered(state=True)
self.app.ui.popmenu_disable.setVisible(False)
self.app.ui.cmenu_newmenu.menuAction().setVisible(False)

View File

@ -4100,7 +4100,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
# start with GRID toolbar activated
if self.app.ui.grid_snap_btn.isChecked() is False:
self.app.ui.grid_snap_btn.trigger()
self.app.on_grid_snap_triggered(state=True)
self.app.ui.on_grid_snap_triggered(state=True)
def on_buffer_tool(self):
buff_tool = BufferSelectionTool(self.app, self)

View File

@ -3703,7 +3703,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# start with GRID toolbar activated
if self.app.ui.grid_snap_btn.isChecked() is False:
self.app.ui.grid_snap_btn.trigger()
self.app.on_grid_snap_triggered(state=True)
self.app.ui.on_grid_snap_triggered(state=True)
# adjust the visibility of some of the canvas context menu
self.app.ui.popmenu_edit.setVisible(False)
@ -3723,6 +3723,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
except Exception as e:
log.debug("FlatCAMGrbEditor.deactivate_grb_editor() --> %s" % str(e))
self.clear()
# adjust the status of the menu entries related to the editor
self.app.ui.menueditedit.setDisabled(False)
self.app.ui.menueditok.setDisabled(True)
@ -3731,7 +3733,6 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.app.ui.popmenu_save.setVisible(False)
self.disconnect_canvas_event_handlers()
self.clear()
self.app.ui.grb_edit_toolbar.setDisabled(True)
settings = QSettings("Open Source", "FlatCAM")
@ -3939,8 +3940,12 @@ class FlatCAMGrbEditor(QtCore.QObject):
pass
def clear(self):
self.thread.quit()
self.active_tool = None
self.selected = []
self.storage_dict.clear()
self.results.clear()
self.shapes.clear(update=True)
self.tool_shape.clear(update=True)
@ -3970,7 +3975,16 @@ class FlatCAMGrbEditor(QtCore.QObject):
file_units = self.gerber_obj.units if self.gerber_obj.units else 'IN'
app_units = self.app.defaults['units']
self.conversion_factor = 25.4 if file_units == 'IN' else (1 / 25.4) if file_units != app_units else 1
# self.conversion_factor = 25.4 if file_units == 'IN' else (1 / 25.4) if file_units != app_units else 1
if file_units == app_units:
self.conversion_factor = 1
else:
if file_units == 'IN':
self.conversion_factor = 25.4
else:
self.conversion_factor = 0.0393700787401575
# Hide original geometry
orig_grb_obj.visible = False
@ -4230,8 +4244,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
else:
new_grb_name = self.edited_obj_name + "_edit"
self.app.worker_task.emit({'fcn': self.new_edited_gerber,
'params': [new_grb_name, self.storage_dict]})
self.app.worker_task.emit({'fcn': self.new_edited_gerber, 'params': [new_grb_name, self.storage_dict]})
@staticmethod
def update_options(obj):

View File

@ -374,10 +374,25 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.splash_cb.stateChanged.connect(self.on_splash_changed)
# Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
self.shell_startup_cb.clicked.connect(self.on_toggle_shell_from_settings)
self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
def on_toggle_shell_from_settings(self, state):
"""
Toggle shell: if is visible close it, if it is closed then open it
:return: None
"""
self.app.defaults.report_usage("on_toggle_shell_from_settings()")
if state is True:
if not self.app.ui.shell_dock.isVisible():
self.app.ui.shell_dock.show()
else:
if self.app.ui.shell_dock.isVisible():
self.app.ui.shell_dock.hide()
@staticmethod
def on_splash_changed(state):
qsettings = QSettings("Open Source", "FlatCAM")

View File

@ -779,7 +779,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
self.app.connect_toolbar_signals()
self.app.ui.grid_snap_btn.setChecked(True)
self.app.on_grid_snap_triggered(state=True)
self.app.ui.on_grid_snap_triggered(state=True)
self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))

View File

@ -421,8 +421,7 @@ class PcbWizard(FlatCAMTool):
ret = excellon_obj.parse_file(file_obj=excellon_fileobj)
if ret == "fail":
app_obj.log.debug("Excellon parsing failed.")
app_obj.inform.emit('[ERROR_NOTCL] %s' %
_("This is not Excellon file."))
app_obj.inform.emit('[ERROR_NOTCL] %s' % _("This is not Excellon file."))
return "fail"
except IOError:
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Cannot parse file"), self.outname))
@ -443,8 +442,7 @@ class PcbWizard(FlatCAMTool):
for tool in excellon_obj.tools:
if excellon_obj.tools[tool]['solid_geometry']:
return
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("No geometry found in file"), name))
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("No geometry found in file"), name))
return "fail"
if excellon_fileobj is not None and excellon_fileobj != '':
@ -463,12 +461,9 @@ class PcbWizard(FlatCAMTool):
self.app.file_opened.emit("excellon", name)
# GUI feedback
self.app.inform.emit('[success] %s: %s' %
(_("Imported"), name))
self.app.inform.emit('[success] %s: %s' % (_("Imported"), name))
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
else:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_('Excellon merging is in progress. Please wait...'))
self.app.inform.emit('[WARNING_NOTCL] %s' % _('Excellon merging is in progress. Please wait...'))
else:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_('The imported Excellon file is None.'))
self.app.inform.emit('[ERROR_NOTCL] %s' % _('The imported Excellon file is empty.'))

View File

@ -16793,7 +16793,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Das Zusammenführen von Excellons ist im Gange. Warten Sie mal..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "Die importierte Excellon-Datei ist Keine."
#: flatcamTools/ToolProperties.py:131

View File

@ -16456,8 +16456,8 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Excellon merging is in progress. Please wait..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgstr "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "The imported Excellon file is empty."
#: flatcamTools/ToolProperties.py:131
msgid "Object Properties are displayed."

View File

@ -16717,7 +16717,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "La fusión de Excellon está en progreso. Por favor espera..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "El archivo Excellon importado es Ninguno."
#: flatcamTools/ToolProperties.py:131

View File

@ -16716,7 +16716,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Excellon fusion est en cours. S'il vous plaît, attendez..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "Le fichier Excellon importé est Aucun."
#: flatcamTools/ToolProperties.py:131

View File

@ -16458,8 +16458,8 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Excellon merging is in progress. Please wait..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgstr "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "The imported Excellon file is empty."
#: flatcamTools/ToolProperties.py:131
msgid "Object Properties are displayed."

View File

@ -13789,7 +13789,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr ""
#: flatcamTools/ToolPcbWizard.py:478
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr ""
#: flatcamTools/ToolProperties.py:119

View File

@ -16521,7 +16521,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "A união Excellon está em andamento. Por favor, espere..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "O arquivo Excellon importado está Vazio."
#: flatcamTools/ToolProperties.py:131

View File

@ -16728,7 +16728,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Fuziunea fisiere Excellon este in curs. Vă rugăm aşteptați ..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "Fişierul Excellon importat este gol."
#: flatcamTools/ToolProperties.py:131

View File

@ -16579,7 +16579,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr "Слияние Excellon продолжается. Пожалуйста, подождите..."
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr "Импортированный файл Excellon есть None."
#: flatcamTools/ToolProperties.py:131

View File

@ -14116,7 +14116,7 @@ msgid "Excellon merging is in progress. Please wait..."
msgstr ""
#: flatcamTools/ToolPcbWizard.py:474
msgid "The imported Excellon file is None."
msgid "The imported Excellon file is empty."
msgstr ""
#: flatcamTools/ToolProperties.py:131