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
fix early crash on python3 + PyQt5 #589
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,12 @@ | |
|
||
try: | ||
# pylint: disable=bytes-builtin | ||
bstr = bytes | ||
bytes() | ||
if PY3: | ||
def bstr(x): | ||
return bytes(x, encoding='latin1') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is starting to look suspiciously like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it for human-readable strings? If so, definitely. |
||
else: | ||
bstr = bytes | ||
except NameError: | ||
# Python <= 2.5 | ||
bstr = str | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import time | ||
|
||
import qtpy | ||
from qtpy import QtCore | ||
from qtpy import QtGui | ||
from qtpy import QtWidgets | ||
|
@@ -128,9 +129,12 @@ def apply_state(self, state): | |
if windowstate is None: | ||
result = False | ||
else: | ||
windowstate = str(windowstate) | ||
if qtpy.PYQT5: | ||
windowstate = str.encode(windowstate, encoding='us-ascii') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should probably use |
||
from_base64 = QtCore.QByteArray.fromBase64 | ||
result = self.restoreState( | ||
from_base64(str(windowstate)), | ||
from_base64(windowstate), | ||
self.widget_version) and result | ||
self.lock_layout = state.get('lock_layout', self.lock_layout) | ||
self.update_dockwidget_lock_state() | ||
|
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 should work sans the
()
.... could even dob = bytes