Error on Tool Db delete

Issue #491 new
paolo.ferlini created an issue


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)

  1. go to options->tools database
  2. create 3 tools from scratch
  3. save DB
  4. delete second tool
  5. save db
  6. export (for verify)
  7. quit & reopen FlatCAM
  8. go to options->tools database
  9. try to delete the last tool
  10. the program crash with error (see above)
  11. 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\", line 1678, in on_list_selection_change
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.


before delete an element:

  1. export DB to file
  2. edit the file changing the JSON number of sequence avoiding gaps (starting from 1 to ….)
  3. save the file
  4. reimport DB
  5. save DB
  6. 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)

  1. paolo.ferlini reporter


    this kind of error happen also in another form.

    WARNING: Traceback (most recent call last):
    File "E:\Portable\FlatCam-8.999_beta\", line 2079, in on_tool_delete
    File "E:\Portable\FlatCam-8.999_beta\", line 1779, in build_db_ui
    KeyError: '1'

  2. Marius Stanciu

    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,

  3. paolo.ferlini 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.


  4. Marius Stanciu

    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.


  5. Log in to comment