Module gmMimeLib
source code
This module encapsulates mime operations.
http://www.dwheeler.com/essays/open-files-urls.html
Author:
Karsten Hilbert <Karsten.Hilbert@gmx.net>
License:
GPL
|
|
|
get_viewer_cmd(aMimeType=None,
aFileName=None,
aToken=None)
Return command for viewer for this mime type complete with this file |
source code
|
|
|
get_editor_cmd(mimetype=None,
filename=None) |
source code
|
|
|
guess_ext_by_mimetype(mimetype='
' )
Return file extension based on what the OS thinks a file of this
mimetype should end in. |
source code
|
|
|
|
|
|
|
convert_file(filename=None,
target_mime=None,
target_filename=None,
target_extension=None)
Convert file from one format into another. |
source code
|
|
|
|
|
|
|
|
|
open_cmds = { ' cmd.exe ' : ' cmd.exe /c "%s" ' , ' exo-open ' : ' exo-op ...
|
|
__package__ = ' Gnumed.pycommon '
|
Imports:
sys,
os,
mailcap,
mimetypes,
subprocess,
shutil,
logging,
io,
gmShellAPI,
gmTools,
gmCfg2,
gmWorkerThread
Guess mime type of arbitrary file.
filenames are supposed to be in Unicode
|
convert_file(filename=None,
target_mime=None,
target_filename=None,
target_extension=None)
| source code
|
Convert file from one format into another.
target_mime: a mime type
|
call_viewer_on_file(aFile=None,
block=None)
| source code
|
Try to find an appropriate viewer with all tricks and call it.
block: try to detach from viewer or not, None means to use mailcap
default
|
call_editor_on_file(filename=None,
block=True)
| source code
|
Try to find an appropriate editor with all tricks and call it.
block: try to detach from editor or not, None means to use mailcap
default.
|
open_cmds
- Value:
{ ' cmd.exe ' : ' cmd.exe /c "%s" ' ,
' exo-open ' : ' exo-open "%s" ' ,
' gnome-open ' : ' gnome-open "%s" ' ,
' kfmclient ' : ' kfmclient exec "%s" ' ,
' op ' : ' op "%s" ' ,
' open ' : ' open "%s" ' ,
' xdg-open ' : ' xdg-open "%s" ' }
|
|