Hi Thomas,
for compatibility between PyQt4 and PySide I always used this expression:
filename = QtGui.QFileDialog.getSaveFileName( ...)
if isinstance(filename, tuple):
filename = filename[0]
if filename == '':
...
That should work here, too.
Cheers
Sebastian
Am Freitag, 31. März 2017 10:20:11 UTC+2 schrieb Thomas Schultz:
>
> The save method in TableWidget.py is not compatible with PyQt5,
> because QtGui.QFileDialog.getSaveFileName returns a tuple.
> This can be fixed by modifying the save method (see snippet below). Is
> there a way to have simultaneous compatibility with PyQt4 and PyQt5?
>
> class MyTableWidget(pyqtgraph.TableWidget):
>
> def save(self, data):
> """ Overload save routine to make it PyQt5 compatible. """
> fileName, _ = QtGui.QFileDialog.getSaveFileName(self, "Save As..",
> "", "Tab-separated values (*.tsv)")
> if fileName == '':
> return
> open(fileName, 'w').write(data)
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/5e852c43-8479-4fb2-8d3e-8d72edc0ae99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.