ncc tool AttributeError: 'NoneType' object has no attribute 'text'

Issue #321 resolved
Антон Ставинский created an issue

Hello again. Software works better everyday but I can’t still use ncc tool.

It fails on click to generate cnc data button.

WARNING: Traceback (most recent call last):
  File "/Users/stavinsky/temp/flatcam/FlatCAMObj.py", line 4533, in on_generatecnc_button_click
    self.mtool_gen_cncjob()
  File "/Users/stavinsky/temp/flatcam/FlatCAMObj.py", line 4577, in mtool_gen_cncjob
    tools_in_use = tools_in_use if tools_in_use is not None else self.get_selected_tools_table_items()
  File "/Users/stavinsky/temp/flatcam/FlatCAMObj.py", line 4430, in get_selected_tools_table_items
    for column in range(0, self.ui.geo_tools_table.columnCount())])
  File "/Users/stavinsky/temp/flatcam/FlatCAMObj.py", line 4430, in <listcomp>
    for column in range(0, self.ui.geo_tools_table.columnCount())])
AttributeError: 'NoneType' object has no attribute 'text'

Actually not only ncc tool doesn’t work .

It looks like it doesn’t see any tools. They are exists.

On load any project file I see next message:

[DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
[DEBUG] Tool missing in ui_update_v_shape(). Add a tool in Geo Tool Table. 'NoneType' object has no attribute 'text'

Comments (20)

  1. Антон Ставинский reporter

    I’ve tried to printout rows in tools table and I see that columns 2, 3, 4 and 6 are None.

    0 0
    <PyQt5.QtWidgets.QTableWidgetItem object at 0x1308b82d0>
    1
    0 1
    <PyQt5.QtWidgets.QTableWidgetItem object at 0x1308b8230>
    0.20
    0 2
    None
    0 3
    None
    0 4
    None
    0 5
    <PyQt5.QtWidgets.QTableWidgetItem object at 0x1308b8eb0>
    1
    0 6
    None
    

  2. Антон Ставинский reporter

    I can use full geo if i will not check “combine paths“ or if I select only 1 pass. I guess it will help. Thanks

  3. Антон Ставинский reporter

    And finally it works if I switch to advanced mode and remove and add tool every time before building cnc code)

  4. Marius Stanciu

    HI Anton,
    Thanks for the help but I think that this issue is the same as #319 which I already solved and will be available in the next build (which is almost ready).
    Have a nice week,
    Marius

  5. Антон Ставинский reporter

    I use latest commit from Beta branch. So looks like it is not solved.

  6. Marius Stanciu

    I don’t post every modification I do on this repository. I can’t make everything at once and finish in one go, therefore in between things are broken. If I did that then there will be a lot peoples around crying that things are not working. So, the changes are on another repository where I do most of the “cooking”. This is why I said that the solution will be available in the next build.

  7. Антон Ставинский reporter

    Ok. Now I understand. This is very uncommon for git flow. Usually people create new branches for every task and if every small task is finished it will be merged to common branch like Beta. This is why I didn’t imaging you have another repo. By the way, thank you for your great job. I will wait for ”next release”.

  8. Marius Stanciu

    I don’t do software programming for a living, this is just a hobby for me. So the way I do things is how I feel it is best.

    And I am also a guest here on this repository (have some rights provided by JP), I prefer to expand as little as possible.

  9. Антон Ставинский reporter

    I completely respect and understand you. )

    I was thinking… may be me also can be joined to the project. I love flatcam, I have experience in python (except pyqt) more than 6 years. I like clean understandable code and PEP8.

  10. Marius Stanciu

    That would be awesome!
    JP contacted me a few days back and wants to revive the FlatCAM from master, he asked me for my help in bringing up-to-date the master. Unfortunately for myself I don’t think this is doable (I thought about that and I don’t feel up to start from ground zero again, bar the translations which is an awful amount of work).
    He most surely will be happy for any help he can get. And this is a chance to shape what FlatCAM will be.

    Or, if you want to contribute to what is FlatCAM beta which now I think it will stay “beta”, you are welcome too … I encourage creativity in FlatCAM beta, so whatever crazy idea you have, it will find it’s place here 🙂

  11. Антон Ставинский reporter

    I’m OS X user. And it is little bit complicated to have pyqt4 and pyqt5 simultaneously, this is why I’m using “Beta”.

    My first crazy idea is to rewrite the code for compatibility with PEP8. And split to smaller files. Now it looks like a nightmare for programmer. I believe you understand what I mean.

    Second thing that I would like to do is add mypy checks and type hinting. We can solve a lot of problems in that way.

  12. Marius Stanciu

    First you can use the environment’s and this should solve the problem with pyqt4 and pyqt5 coexistence. But I guess you know about that.

    Regarding the FlatCAM beta.
    I also modified heavily the code to comply with some of the PEP8 rules. So it should not be such a great task. I agree with smaller files. Started to just do that a while back. Including in the current working copy, I’ve just split the camlib.py and created a ParseGerber and ParseExcellon classes (into their files). 🙂

    Regarding the type hinting. I was reading yesterday an article about that, and I did not like the way it looked. Yet … it looks good for a bigger project perhaps but here it will make development harder after a while because you have to start thinking in a statically typed way while Python let you do it right now without much headaches, dynamically. You know? Duck typing … and rely on try - except.
    A compromise will be to add the doc header to all the methods. I’m also working on that, too 🙂

  13. Антон Ставинский reporter

    Yes you are right mypy gives not only answers but a new questions. But sometimes it save a lot of time. And I didn’t look all the code. But I think more test is always good idea

  14. Marius Stanciu

    Hi Anton,

    I've updated the repository, beta branch. It's another big update so if you spot any bugs please let me know.

  15. Log in to comment