Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Import - QAbstractTableModel has no reset method - modelReset replacement #440

brownnrl opened this issue Jul 29, 2015 · 2 comments


Copy link

@brownnrl brownnrl commented Jul 29, 2015

Ran into the following traceback while importing a CSV file:

Application Name: moneyGuru
Version: 2.9.3

Traceback (most recent call last):
  File "/home/nelson/projects/moneyguru/qt/controller/", line 629, in importDocument
  File "/home/nelson/projects/moneyguru/core/gui/", line 479, in parse_file_for_import
  File "/home/nelson/projects/moneyguru/core/gui/", line 211, in show
  File "/home/nelson/projects/moneyguru/core/gui/", line 118, in _refresh_columns
  File "/home/nelson/projects/moneyguru/qt/controller/import_/", line 153, in refresh_columns
AttributeError: 'CSVOptionsTableModel' object has no attribute 'reset'

It turns out QAbstractItemModel (and it's inheritance chain) no longer supports the deprecated reset method in PyQt5. At a minimum, the following re-definition of the reset method is necessary in QAbstractItemModel subclasses for PyQt5.

class ChildTable(QAbstractTableModel):
   # [... other methods / members ...]

    def reset(self):
        # unnecessary call to actually clear data, but recommended by design guidance from Qt docs
        # left blank in preliminary testing

Will try to submit a PR against this ticket.

Copy link
Contributor Author

@brownnrl brownnrl commented Jul 29, 2015

Obviously, this is against the master and not maintenance branch. I should have mentioned that.

Copy link

@hsoft hsoft commented Jul 29, 2015

Thanks for the catch. I had made the same fix during the Qt5 transition of dupeGuru, but it seems that I forgot about it this time. I didn't bother redefining reset(). I simply replaced the reset call by these two calls. Example at

@hsoft hsoft added this to the v2.10 milestone Jul 31, 2015
@hsoft hsoft closed this in 69f1717 Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants