diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dd0711..2d360edb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 9c6cab82..9a8a32f8 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -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.") # ############################################################################################################ diff --git a/appObjects/ObjectCollection.py b/appObjects/ObjectCollection.py index 98b82877..bb0886ba 100644 --- a/appObjects/ObjectCollection.py +++ b/appObjects/ObjectCollection.py @@ -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 diff --git a/app_Main.py b/app_Main.py index 566ad54b..62117c37 100644 --- a/app_Main.py +++ b/app_Main.py @@ -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: