1 """Look up or launch the handler for a URI. URIs are in the form scheme:other
2 and the handler for a given scheme is <Choices>.rox.sourceforge.net/URI/scheme
4 To open up a web page in the user's prefered web browser:
8 pid=rox.uri_handler.launch('http://rox.sourceforge.net/')
11 pid=os.spawnlp(os.P_NOWAIT, 'firefox', 'firefox',
12 'http://rox.sourceforge.net/')
21 from rox
import basedir
24 """Return the handler for URI's of the named scheme (e.g. http, file, ftp,
25 etc.) The handler for file is always rox, otherwise it obtained from
26 the configuration directory rox.sourceforge.net/URI. None is returned if
27 no handler is defined.
29 The returned string may contain %s in which case it should be replaced
30 with the URI, otherwise append the URI (after a space).
36 path
=basedir
.load_first_config('rox.sourceforge.net', 'URI', scheme
)
40 if rox
.isappdir(path
):
41 path
=os
.path
.join(path
, 'AppRun')
46 """For a given URI pass it to the appropriate launcher.
47 rox.uri_handler.get() is used to look up the launcher command which is
48 executed. The process id of the command is returned (see os.wait()), or
49 None if no launcher is defined for that URI."""
50 comp
=urlparse
.urlparse(uri
)
60 return os
.spawnlp(os
.P_NOWAIT
, 'sh', 'sh', '-c', cmd
)
62 if __name__
=='__main__':
69 launch('http://rox.sf.net/')