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
@ -45,14 +45,19 @@ class ImageExporter(Exporter):
|
|||||||
def parameters(self):
|
def parameters(self):
|
||||||
return self.params
|
return self.params
|
||||||
|
|
||||||
def export(self, fileName=None, toBytes=False, copy=False):
|
@staticmethod
|
||||||
if fileName is None and not toBytes and not copy:
|
def getSupportedImageFormats():
|
||||||
filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||||
preferred = ['*.png', '*.tif', '*.jpg']
|
preferred = ['*.png', '*.tif', '*.jpg']
|
||||||
for p in preferred[::-1]:
|
for p in preferred[::-1]:
|
||||||
if p in filter:
|
if p in filter:
|
||||||
filter.remove(p)
|
filter.remove(p)
|
||||||
filter.insert(0, 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 = self.getSupportedImageFormats()
|
||||||
self.fileSaveDialog(filter=filter)
|
self.fileSaveDialog(filter=filter)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user