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
Py3fy backend_qt5 + other cleanups to the backend. #11080
Conversation
Remove unused ToolbarQt._last. Deprecate error_msg_qt and exception_handler, which were added in 3e315fb (2005) and actually never used.
@@ -678,7 +675,7 @@ def destroy(self, *args): | |||
self.window.close() | |||
|
|||
def get_window_title(self): | |||
return six.text_type(self.window.windowTitle()) | |||
return self.window.windowTitle() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyQt type <-> python type:
Should this still be wrapped in a str()
? Otherwise we'll return a QString()
, which I don't think we want to leak out of the backend API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually returns a str (automatic conversion, see http://pyqt.sourceforge.net/Docs/PyQt5/gotchas.html#python-strings-qt-strings-and-unicode), try yourself plt.gcf().canvas.parent().windowTitle()
same comment applies throughout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works 😄. Not sure I understand why.
The docs on default conversions do only speak of "If Qt expects ...". For me that sounded like parameter conversion. Somehow the return type is converted as well?!? So I never would have the chance of getting the actual QString here? I should really learn about the changes in PyQt5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
We basically don't support the qt4v1 api (too many places where we already assume that we get native strings out of qt methods).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I learned something new. 😄
@@ -779,7 +776,7 @@ def edit_parameters(self): | |||
item, ok = QtWidgets.QInputDialog.getItem( | |||
self.parent, 'Customize', 'Select axes:', titles, 0, False) | |||
if ok: | |||
axes = allaxes[titles.index(six.text_type(item))] | |||
axes = allaxes[titles.index(item)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyQt type <-> python type?
try: | ||
self.canvas.figure.savefig(six.text_type(fname)) | ||
self.canvas.figure.savefig(fname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyQt type <-> python type:
can savefig handle a QString?
try: | ||
self.canvas.figure.savefig(six.text_type(fname)) | ||
self.canvas.figure.savefig(fname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyQt type <-> python type?
can savefig handle a QString?
@@ -931,7 +928,6 @@ def __init__(self, toolmanager, parent): | |||
QtWidgets.QToolBar.__init__(self, parent) | |||
self._toolitems = {} | |||
self._groups = {} | |||
self._last = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just never used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed.
Remove unused ToolbarQt._last. Deprecate error_msg_qt and
exception_handler, which were added in 3e315fb (2005) and actually never
used.
PR Summary
PR Checklist