src/eric7/Utilities/MimeTypes.py

branch
eric7
changeset 9559
34fc53e6159d
parent 9534
5ed8445f3b31
child 9563
8ee667840224
equal deleted inserted replaced
9558:6d6a0e5f65ca 9559:34fc53e6159d
20 @type str 20 @type str
21 @return flag indicating an editable file 21 @return flag indicating an editable file
22 @rtype bool 22 @rtype bool
23 """ 23 """
24 mimetype = mimetypes.guess_type(filename)[0] 24 mimetype = mimetypes.guess_type(filename)[0]
25 # TODO: add a dialog to ask if the file is a text file in case mimetype is None
26 # and option is not set
27 # TODO: add capability to define additional text file patterns for fnmatch test
25 return (mimetype is None and Preferences.getUI("LoadUnknownMimeTypeFiles")) or ( 28 return (mimetype is None and Preferences.getUI("LoadUnknownMimeTypeFiles")) or (
26 mimetype is not None 29 mimetype is not None
27 and ( 30 and (
28 mimetype.split("/")[0] == "text" 31 mimetype.split("/")[0] == "text"
29 or mimetype in Preferences.getUI("TextMimeTypes") 32 or mimetype in Preferences.getUI("TextMimeTypes")

eric ide

mercurial