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 logging
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
|
|
||||||
from sugar3 import _sugarbaseext
|
from sugar3 import _sugarbaseext
|
||||||
|
|
||||||
_ = lambda msg: gettext.dgettext('sugar-base', msg)
|
_ = lambda msg: gettext.dgettext('sugar-base', msg)
|
||||||
@ -35,6 +37,14 @@ GENERIC_TYPE_AUDIO = 'Audio'
|
|||||||
GENERIC_TYPE_VIDEO = 'Video'
|
GENERIC_TYPE_VIDEO = 'Video'
|
||||||
GENERIC_TYPE_LINK = 'Link'
|
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 = {}
|
_extensions = {}
|
||||||
_globs_timestamps = []
|
_globs_timestamps = []
|
||||||
_generic_types = [
|
_generic_types = [
|
||||||
@ -51,7 +61,7 @@ _generic_types = [
|
|||||||
'id': GENERIC_TYPE_IMAGE,
|
'id': GENERIC_TYPE_IMAGE,
|
||||||
'name': _('Image'),
|
'name': _('Image'),
|
||||||
'icon': 'image-x-generic',
|
'icon': 'image-x-generic',
|
||||||
'types': ['image/png', 'image/gif', 'image/jpeg'],
|
'types': _get_supported_image_mime_types(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': GENERIC_TYPE_AUDIO,
|
'id': GENERIC_TYPE_AUDIO,
|
||||||
|
Loading…
Reference in New Issue
Block a user