- fixed the on_delete() method in the App class; sometime it will delete all files that have similar names

- made sure that on creation of new objects the adding of the names to the auto-complete list is done properly
This commit is contained in:
Marius Stanciu
2020-12-09 19:13:06 +02:00
committed by Marius
parent c1fdf2d8e8
commit d6c34f97ef
4 changed files with 16 additions and 9 deletions

View File

@@ -11,6 +11,8 @@ CHANGELOG for FlatCAM beta
- simplifying the UI for the Milling Tool when in 'Beginner' mode
- Milling UI - clicking the 'Beginner/Advanced' top button will switch the application mode for the current tool(this change need to be propagated everywhere a 'Beginner' mode is needed)
- fixed the on_delete() method in the App class; sometime it will delete all files that have similar names
- made sure that on creation of new objects the adding of the names to the auto-complete list is done properly
8.12.2020

View File

@@ -204,11 +204,6 @@ class AppObject(QtCore.QObject):
log.warning("AppObject.new_object() -> The object has no bounds properties. %s" % str(e))
return "fail"
# ############################################################################################################
# update the KeyWords list with the name of the file
# ############################################################################################################
self.app.myKeywords.append(obj.options['name'])
log.debug("Moving new object back to main thread.")
# ############################################################################################################

View File

@@ -577,6 +577,11 @@ class ObjectCollection(QtCore.QAbstractItemModel):
name += "_1"
obj.options["name"] = name
# ############################################################################################################
# update the KeyWords list with the name of the file
# ############################################################################################################
self.app.myKeywords.append(name)
obj.set_ui(obj.ui_type(app=self.app))
# a way to signal that the object was fully loaded
obj.load_complete = True

View File

@@ -4856,8 +4856,8 @@ class App(QtCore.QObject):
"App.on_delete() --> delete annotations on a FlatCAMCNCJob object. %s" % str(e)
)
while self.collection.get_selected():
self.delete_first_selected()
for ob in self.collection.get_selected():
self.delete_first_selected(ob)
# make sure that the selection shape is deleted, too
self.delete_selection_shape()
@@ -4870,10 +4870,15 @@ class App(QtCore.QObject):
else:
self.inform.emit(_("Save the work in Editor and try again ..."))
def delete_first_selected(self):
def delete_first_selected(self, del_obj=None):
# Keep this for later
try:
sel_obj = self.collection.get_active()
if del_obj is not None:
sel_obj = del_obj
else:
sel_obj = self.collection.get_active()
name = sel_obj.options["name"]
isPlotted = sel_obj.options["plot"]
except AttributeError: