Debian Codegraph @

modules/web/examples/content/pwg.html

raw
1 <html><head>
2 <meta http-equiv="Pragma" content="no-cache"/>
3 <meta http-equiv="Cache-Control" content="no-cache"/>
4 <meta http-equiv="Expires" content="0" />
5 <title>PyMOL Web Services</title>
6 </head>
7 <body>
8
9 <h3>PyMOL Web GUI (PWG) Files</h3>
10
11 <p>We have invented PyMOL Web GUI (PWG) files in order to enable users
12 to automatically launch PyMOL on their desktop when they click a link
13 or open a web page with a frame referencing a PWG file.</p>
14
15 <p>PWG files are associated with a new MIME type (application/x-pymol)
16 which binds the PyMOL desktop application to the (.pwg) file
17 extension. This approach works much like other web helper
18 applications, such as binding Acrobat Reader for opening .pdf files
19 (via the application/x-pdf MIME type). </p>
20
21 <p>Using PyMOL Web GUI files provides a simple way of firing up a
22 PyMOL instance for use with the web-based GUI. This can be done via a
23 PWG file stored on the desktop, or via a PWG file linked on a
24 web-page.</p>
25
26 <p>Normally, the first time a user clicks to download a .pwg file, a
27 standard popup appears asking the which application should be
28 associated with this file type. On some platforms (Windows &amp; Mac)
29 .pwg files should pre-associated with PyMOL, and thus, the user may
30 simply need to confirm this choice (or perhaps choose which copy of
31 PyMOL to open). Once the association has been made, subsequent PWG
32 files linked from web pages should automatically start PyMOL.</p>
33
34 <p>Using Firefox on Windows, the "Opening start.pwg" popup appears,
35 with the "Choose Helper Application" popup appearing after selecting
36 "Open with" and "Other..." from the pull down. You will probably also
37 want to select "Do this automatically from now on."
38 <br>
39 <IMG SRC=mime1.jpg>
40 <br>
41 After clicking OK on the "Choose Helper Application" popup, the following popup remains.
42 Clicking OK causes PyMOL to open properly using the contents of the PWG file.
43 <br>
44 <IMG SRC=mime2.jpg>
45 </p>
46
47 <p>PWG files contain only the minimal amount of information necessary
48 for the server to launch and successfully connect with a web browser.</p>
49
50 <p>For example, the PWG file which launches Sample11 is merely:</p>
51 <pre>
52 port 8081
53 </pre>
54 <p>which tells PyMOL to launch its PyMOL web server on port 8081.
55 This assumption in such a scerario is that the current web page will
56 direct content to that PyMOL server (and thus, will be subject to the
57 browser's multi-origin security restrictions).</p>
58
59 <p>In contrast, the PWG file which launches the Sample 01 application is:</p>
60 <pre>
61 root $PYMOL_PATH/modules/web/examples/sample01/htdocs
62 browser
63 </pre>
64
65 <p>which tells PyMOL to (1) launch its internal web server on a
66 dynamically assigned port with a root content directory of
67 $PYMOL_PATH/modules/web/examples/sample01/htdocs and (2) open
68 up a local browser window pointing at that server instance. The
69 assumption in this scenario is that this newly-opened web page will be
70 responsible for sending requests to the PyMOL server (and thus, will
71 not be subject to the browser's multi-origin security
72 restrictions).</p>
73
74 <h4>Commands</h4>
75
76 <table>
77 <tr><td><code>port &lt;number&gt;</td><td>Web server port</td>
78 <tr><td><code>root &lt;directory&gt;</td><td>Web server document root</td>
79 <tr><td><code>header add &lt;key&gt; &lt;value&gt;</td><td>Add a HTTP response header (e.g.: <code>Access-Control-Allow-Origin *</code>)
80 <i>New in PyMOL 2.4</i></td>
81 <tr><td><code>options &lt;pymol-launch-options&gt;</td><td>PyMOL launch options (e.g.: <code>-q -W 250</code>)</td>
82 <tr><td><code>browser</td><td>Open a web browser for <code>http://localhost:port</code></td>
83 <tr><td><code>launch &lt;module&gt;</td><td>Import Python module and call <code>module.__launch__(cmd)</code></td>
84 <tr><td><code>report &lt;url&gt;</td><td>Make a request to <code>url + port</code></td>
85 <tr><td><code>delete</td><td>Delete the PWG file after processing</td>
86 <tr><td><code>logging &lt;0/1&gt;</td><td>Can suppress <code>BaseHTTPRequestHandler.log_message</code></td>
87 <tr><td><code>wrap_native_return_types</td><td>Return <code>result</code> instead of <code>{'status': status, 'result': result}</code></td>
88 </table>
89
90 </body>
91 </html>
92