def get_method(path=None, mtype=None): """Look up the program for generating a thumbnail. Specify either a path to a file or a MIME type. This returns False if there is no defined method to generate the thumbnail, True if the thumbnail would be generated internally using GdkPixbuf, or a string giving the full path to a program called to generate the thumbnail.""" if path: mtype = rox.mime.get_type(path) if isinstance(mtype, basestring): mtype = rox.mime.lookup(mtype) if not mtype: return False mthd = rox.basedir.load_first_config( 'rox.sourceforge.net', 'MIME-thumb', '%s_%s' % (mtype.media, mtype.subtype)) if mthd: if rox.isappdir(mthd): return os.path.join(mthd, 'AppRun') return mthd for fmt in rox.g.gdk.pixbuf_get_formats(): for t in fmt['mime_types']: if t == str(mtype): return True return False
def get_method(path=None, mtype=None): """Look up the program for generating a thumbnail. Specify either a path to a file or a MIME type. This returns False if there is no defined method to generate the thumbnail, True if the thumbnail would be generated internally using GdkPixbuf, or a string giving the full path to a program called to generate the thumbnail.""" if path: mtype=rox.mime.get_type(path) if isinstance(mtype, basestring): mtype=rox.mime.lookup(mtype) if not mtype: return False mthd=rox.basedir.load_first_config('rox.sourceforge.net', 'MIME-thumb', '%s_%s' %(mtype.media, mtype.subtype)) if mthd: if rox.isappdir(mthd): return os.path.join(mthd, 'AppRun') return mthd for fmt in rox.g.gdk.pixbuf_get_formats(): for t in fmt['mime_types']: if t==str(mtype): return True return False
def get(scheme): """Return the handler for URI's of the named scheme (e.g. http, file, ftp, etc.) The handler for file is always rox, otherwise it obtained from the configuration directory rox.sourceforge.net/URI. None is returned if no handler is defined. The returned string may contain %s in which case it should be replaced with the URI, otherwise append the URI (after a space). """ if scheme == 'file': return 'rox -U "%s"' path = basedir.load_first_config('rox.sourceforge.net', 'URI', scheme) if not path: return if rox.isappdir(path): path = os.path.join(path, 'AppRun') return path
def get(scheme): """Return the handler for URI's of the named scheme (e.g. http, file, ftp, etc.) The handler for file is always rox, otherwise it obtained from the configuration directory rox.sourceforge.net/URI. None is returned if no handler is defined. The returned string may contain %s in which case it should be replaced with the URI, otherwise append the URI (after a space). """ if scheme=='file': return 'rox -U "%s"' path=basedir.load_first_config('rox.sourceforge.net', 'URI', scheme) if not path: return if rox.isappdir(path): path=os.path.join(path, 'AppRun') return path