moved some functionality from method 'export' to new method (#390)
* moved some functionality from method 'export' to new method 'getSupportedFormats' making it accessible from outside
This commit is contained in:
parent
245d89033e
commit
68b8dbac1a
@ -44,15 +44,20 @@ class ImageExporter(Exporter):
|
||||
|
||||
def parameters(self):
|
||||
return self.params
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getSupportedImageFormats():
|
||||
filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
preferred = ['*.png', '*.tif', '*.jpg']
|
||||
for p in preferred[::-1]:
|
||||
if p in filter:
|
||||
filter.remove(p)
|
||||
filter.insert(0, p)
|
||||
return filter
|
||||
|
||||
def export(self, fileName=None, toBytes=False, copy=False):
|
||||
if fileName is None and not toBytes and not copy:
|
||||
filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
preferred = ['*.png', '*.tif', '*.jpg']
|
||||
for p in preferred[::-1]:
|
||||
if p in filter:
|
||||
filter.remove(p)
|
||||
filter.insert(0, p)
|
||||
filter = self.getSupportedImageFormats()
|
||||
self.fileSaveDialog(filter=filter)
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user