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") |