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

Filter QObject/QWidget inherited methods as tab completion options on MantidPlot objects #9055

Closed
mantid-builder opened this issue Oct 24, 2013 · 1 comment
Milestone

Comments

@mantid-builder
Copy link
Collaborator

Original Reporter: Russell Taylor

http://trac.mantidproject.org/mantid/ticket/4311 fixed the issue of missing tab-completion options on our wrapped _qti objects in MantidPlot. By modifying dir to return relevant methods from the wrapped object you see those methods instead of the methods of the proxy object (QtProxyObject).

However, the methods that we've defined are rather swamped by the inherited QObject/QWidget ones and it would be nice to filter those out as users should very rarely need them. Code something like this would filter the list:

heldobjectmethods = dir(self._getHeldObject())
qwidgetmethods = dir(QtGui.QWidget)
return [m for m in heldobjectmethods if m not in qwidgetmethods]

However, this doesn't completely work because IPython explicitly goes looking for base class methods and adds them to its completions options. In this case, it adds all the QObject methods as this is the base of QtProxyObject.

There is a possibility to have IPython look at the all attribute for the completion options - and in this case it would not add base class methods. This requires adjusting the IPython configuration programmatically. In doing so, we would not want to prevent the user from being able to configure their IPython options themselves.


Keywords: IPython

@mantid-builder
Copy link
Collaborator Author

This issue was originally trac ticket 8210

@mantid-builder mantid-builder added this to the Release 3.2 milestone Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant