Take list of supported image formats mime types from GdkPixbuf - SL #3845
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
parent
1334cd5768
commit
40a3b2ece1
@ -25,6 +25,8 @@ import os
|
||||
import logging
|
||||
import gettext
|
||||
|
||||
from gi.repository import GdkPixbuf
|
||||
|
||||
from sugar3 import _sugarbaseext
|
||||
|
||||
_ = lambda msg: gettext.dgettext('sugar-base', msg)
|
||||
@ -35,6 +37,14 @@ GENERIC_TYPE_AUDIO = 'Audio'
|
||||
GENERIC_TYPE_VIDEO = 'Video'
|
||||
GENERIC_TYPE_LINK = 'Link'
|
||||
|
||||
|
||||
def _get_supported_image_mime_types():
|
||||
mime_types = []
|
||||
for image_format in GdkPixbuf.Pixbuf.get_formats():
|
||||
mime_types.extend(image_format.get_mime_types())
|
||||
return mime_types
|
||||
|
||||
|
||||
_extensions = {}
|
||||
_globs_timestamps = []
|
||||
_generic_types = [
|
||||
@ -51,7 +61,7 @@ _generic_types = [
|
||||
'id': GENERIC_TYPE_IMAGE,
|
||||
'name': _('Image'),
|
||||
'icon': 'image-x-generic',
|
||||
'types': ['image/png', 'image/gif', 'image/jpeg'],
|
||||
'types': _get_supported_image_mime_types(),
|
||||
},
|
||||
{
|
||||
'id': GENERIC_TYPE_AUDIO,
|
||||
|
Loading…
Reference in New Issue
Block a user