- marked as minor
Error on Tool Db delete
Hi,
i experienced a bug in the Tools DB.
This bug is on “Delete Tool from DB” and coming with a mismatch between the numbering in the gui and the tool saved on the db.
to reproduce (with beta 8.994 and 8.995)
- go to options->tools database
- create 3 tools from scratch
- save DB
- delete second tool
- save db
- export (for verify)
- quit & reopen FlatCAM
- go to options->tools database
- try to delete the last tool
- the program crash with error (see above)
- open the saved file and you will see a wrong numbering in the json structure
[DEBUG][MainThread] Finished connecting Signals.
[DEBUG][MainThread] END of constructor. Releasing control.
WARNING: QLayout::addChildLayout: layout "" already has a parent
WARNING: Traceback (most recent call last):
File "E:\Portable\FlatCam-8.999_beta\appDatabase.py", line 1678, in on_list_selection_change
self.storage_to_form(self.db_tool_dict[current.text(0)])
KeyError: '7'
I have a 9 tools data base and the problem appears on deleting the 7th. but it will be the same deleting one of the others except the last.
WORK AROUND
before delete an element:
- export DB to file
- edit the file changing the JSON number of sequence avoiding gaps (starting from 1 to ….)
- save the file
- reimport DB
- save DB
- continue
attached files:
- FlatCAM_Tools_Database_20210109_082551.TXT ← saved file after the first delete and before experiencing the problem
- FlatCAM_Tools_Database_4_test.TXT ← fixed filed after understanding the problem
- FlatCAM_Tools_Database_after_import_and_delete_last.TXT ← saved file as verification of the problem (really i deleted the last-1 element)
- FlatCAM - Tools Database 2021-01-09 085140.jpg ← image of the gui tools db
- json numbering 2021-01-09 090006.jpg ← image of json’s elements collapsed.
Comments (5)
-
reporter -
reporter Hi,
this kind of error happen also in another form.
WARNING: Traceback (most recent call last):
File "E:\Portable\FlatCam-8.999_beta\appDatabase.py", line 2079, in on_tool_delete
self.build_db_ui()
File "E:\Portable\FlatCam-8.999_beta\appDatabase.py", line 1779, in build_db_ui
self.storage_to_form(self.db_tool_dict['1'])
KeyError: '1'
-
Hi Paolo,
This has been fixed a while back, after the release of 8.994. I will publish the changes when the new version will be ready.
Best regards,
Marius -
reporter Hi Marius,
can i suggest a little improvement ?
It will be usefull if the DB form list only the tools needed for the function.
For example if i’m in isolation tool and select import from db, it will be nice to see only the “isolation” tools and so on.
Paolo
-
Hi Paolo,
I know, there are a lot of things to improve but good enough is good enough. I will try to have the app in working order and then other people may start improve on it.
Because of that you need to make a new issue, mark it as improvement and in the title of it put a reference that is about FlatCAM Beta.Thanks,
Marius - Log in to comment