py3 fixes

This commit is contained in:
Luke Campagnola 2020-07-05 22:52:15 -07:00
parent da15f09479
commit ac417a6567
8 changed files with 9 additions and 9 deletions

View File

@ -224,9 +224,9 @@ class SRTTransform3D(Transform3D):
raise Exception("Argument 'nd' must be 2 or 3")
if __name__ == '__main__':
import widgets
from . import widgets
import GraphicsView
from functions import *
from .functions import *
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
win.show()

View File

@ -23,7 +23,7 @@ def restoreSplitter(w, s):
if type(s) is list:
w.setSizes(s)
elif type(s) is str:
w.restoreState(QtCore.QByteArray.fromPercentEncoding(s))
w.restoreState(QtCore.QByteArray.fromPercentEncoding(s.encode()))
else:
print("Can't configure QSplitter using object of type", type(s))
if w.count() > 0: ## make sure at least one item is not collapsed

View File

@ -24,7 +24,7 @@ class ParseError(Exception):
def __init__(self, message, lineNum, line, fileName=None):
self.lineNum = lineNum
self.line = line
#self.message = message
self.message = message
self.fileName = fileName
Exception.__init__(self, message)

View File

@ -16,7 +16,6 @@ from .python2_3 import asUnicode, basestring
from .Qt import QtGui, QtCore, QT_LIB
from . import getConfigOption, setConfigOptions
from . import debug, reload
from .reload import getPreviousVersion
from .metaarray import MetaArray

View File

@ -33,7 +33,7 @@ def addGradientListToDocstring():
"""Decorator to add list of current pre-defined gradients to the end of a function docstring."""
def dec(fn):
if fn.__doc__ is not None:
fn.__doc__ = fn.__doc__ + str(Gradients.keys()).strip('[').strip(']')
fn.__doc__ = fn.__doc__ + str(list(Gradients.keys())).strip('[').strip(']')
return fn
return dec

View File

@ -1,3 +1,4 @@
from functools import reduce
from ..Qt import QtGui, QtCore, isQObjectAlive
from ..GraphicsScene import GraphicsScene
from ..Point import Point

View File

@ -79,7 +79,7 @@ class ColorMapParameter(ptree.types.GroupParameter):
return item
def fieldNames(self):
return self.fields.keys()
return list(self.fields.keys())
def setFields(self, fields):
"""

View File

@ -64,7 +64,7 @@ class TableWidget(QtGui.QTableWidget):
self.setSortingEnabled(kwds.pop('sortable'))
if len(kwds) > 0:
raise TypeError("Invalid keyword arguments '%s'" % kwds.keys())
raise TypeError("Invalid keyword arguments '%s'" % list(kwds.keys()))
self._sorting = None # used when temporarily disabling sorting