- fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear

This commit is contained in:
Marius Stanciu 2019-03-08 16:28:55 +02:00
parent 6ba037fd83
commit 4422aee5df
2 changed files with 45 additions and 42 deletions

View File

@ -1918,56 +1918,58 @@ class App(QtCore.QObject):
"""
self.report_usage("editor2object()")
# adjust the visibility of some of the canvas context menu
self.ui.popmenu_edit.setVisible(True)
self.ui.popmenu_save.setVisible(False)
# do not update a geometry or excellon object unless it comes out of an editor
if self.call_source != 'app':
# adjust the visibility of some of the canvas context menu
self.ui.popmenu_edit.setVisible(True)
self.ui.popmenu_save.setVisible(False)
edited_obj = self.collection.get_active()
obj_type = ""
edited_obj = self.collection.get_active()
obj_type = ""
if isinstance(edited_obj, FlatCAMGeometry):
obj_type = "Geometry"
self.geo_editor.update_fcgeometry(edited_obj)
self.geo_editor.update_options(edited_obj)
self.geo_editor.deactivate()
if isinstance(edited_obj, FlatCAMGeometry):
obj_type = "Geometry"
self.geo_editor.update_fcgeometry(edited_obj)
self.geo_editor.update_options(edited_obj)
self.geo_editor.deactivate()
# update the geo object options so it is including the bounding box values
try:
xmin, ymin, xmax, ymax = edited_obj.bounds()
edited_obj.options['xmin'] = xmin
edited_obj.options['ymin'] = ymin
edited_obj.options['xmax'] = xmax
edited_obj.options['ymax'] = ymax
except AttributeError:
self.inform.emit(_tr("[WARNING] Object empty after edit."))
# update the geo object options so it is including the bounding box values
try:
xmin, ymin, xmax, ymax = edited_obj.bounds()
edited_obj.options['xmin'] = xmin
edited_obj.options['ymin'] = ymin
edited_obj.options['xmax'] = xmax
edited_obj.options['ymax'] = ymax
except AttributeError:
self.inform.emit(_tr("[WARNING] Object empty after edit."))
elif isinstance(edited_obj, FlatCAMExcellon):
obj_type = "Excellon"
self.exc_editor.update_fcexcellon(edited_obj)
self.exc_editor.update_options(edited_obj)
self.exc_editor.deactivate()
elif isinstance(edited_obj, FlatCAMExcellon):
obj_type = "Excellon"
self.exc_editor.update_fcexcellon(edited_obj)
self.exc_editor.update_options(edited_obj)
self.exc_editor.deactivate()
else:
self.inform.emit(_tr("[WARNING_NOTCL]Select a Geometry or Excellon Object to update."))
return
else:
self.inform.emit(_tr("[WARNING_NOTCL]Select a Geometry or Excellon Object to update."))
return
# if notebook is hidden we show it
if self.ui.splitter.sizes()[0] == 0:
self.ui.splitter.setSizes([1, 1])
# if notebook is hidden we show it
if self.ui.splitter.sizes()[0] == 0:
self.ui.splitter.setSizes([1, 1])
# restore the call_source to app
self.call_source = 'app'
# restore the call_source to app
self.call_source = 'app'
edited_obj.plot()
self.ui.plot_tab_area.setTabText(0, "Plot Area")
self.ui.plot_tab_area.protectTab(0)
self.inform.emit(_tr("[selected] %s is updated, returning to App...") % obj_type)
edited_obj.plot()
self.ui.plot_tab_area.setTabText(0, "Plot Area")
self.ui.plot_tab_area.protectTab(0)
self.inform.emit(_tr("[selected] %s is updated, returning to App...") % obj_type)
# reset the Object UI to original settings
# edited_obj.set_ui(edited_obj.ui_type())
# edited_obj.build_ui()
# make sure that we reenable the selection on Project Tab after returning from Editor Mode:
self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
# reset the Object UI to original settings
# edited_obj.set_ui(edited_obj.ui_type())
# edited_obj.build_ui()
# make sure that we reenable the selection on Project Tab after returning from Editor Mode:
self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
def get_last_folder(self):

View File

@ -13,7 +13,8 @@ CAD program, and create G-Code for Isolation routing.
- fixed issue when doing th CTRL (or SHIFT) + LMB, the focus is automatically moved to Project Tab
- further work in internationalization, added a fallback to English language in case there is no translation for a string
-
- fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear
-
7.03.2019