-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDeveloping.html
More file actions
65 lines (64 loc) · 3.53 KB
/
Copy pathDeveloping.html
File metadata and controls
65 lines (64 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Developing Webware</title>
<link rel="stylesheet" href="../../Docs/Doc.css" type="text/css" />
</head>
<body>
<div class="document" id="developing-webware">
<h1 class="title">Developing Webware</h1>
<p>This document should outline the details you need to understand
Webware and WebKit internals, and assist in becoming a more advanced
Webware programmer.</p>
<div class="section" id="style-guidelines">
<h1>Style Guidelines</h1>
<p>Webware developers are requested to observe the rules defined
in the <a class="reference external" href="../../Docs/StyleGuidelines.html">Webware Style Guidelines</a>.</p>
</div>
<div class="section" id="creating-plugins">
<h1>Creating Plugins</h1>
<p>Each plugin is a Python Package. WebKit finds plugins using the
<span class="docutils literal">PlugIns</span> and <span class="docutils literal">PluginDirs</span> -- see <a class="reference external" href="Configuration.html#appserver-config">Configuration</a>. See also the
<a class="reference external" href="http://www.python.org/doc/current/tut/node8.html#SECTION008400000000000000000">Python tutorial on packages</a> and the <span class="docutils literal">PlugIn.py</span> doc string.</p>
<p>A plug-in must have <span class="docutils literal">__init__.py</span> and <span class="docutils literal">Properties.py</span> files.
You can disable a specific plug-in by placing a <span class="docutils literal">dontload</span> file in it.</p>
<p><span class="docutils literal">__init.py__</span> must contain a function like:</p>
<pre class="literal-block">def InstallInWebKit(appServer):
pass</pre>
<p>The function doesn't need to do anything, but this gives it the
opportunity to do something with the AppServer -- for instance, the
PSP plugin uses AppServer.addServletFactory to add a handler for <span class="docutils literal">.psp</span>
files.</p>
<p>The <span class="docutils literal">Properties.py</span> file should contain a number of assignments:</p>
<pre class="literal-block">name = "Plugin name"
version = (1, 0, 0)
docs = [{'name': 'Quick Start Guide', 'file': 'QuickStart.html'},
{'name': 'Reference Guide, 'file': 'Reference.html'}]
status = 'beta'
requiredPyVersion = (2, 6, 0)
requiredOpSys = 'posix'
synopsis = """A paragraph-long description of the plugin"""
WebKitConfig = {
'examplePages': [
'Example1',
'ComplexExample',
]
}
def willRunFunc():
if softwareNotInstalled:
return "some message to that effect"
else:
return None</pre>
<p>The documents (e.g. <span class="docutils literal">QuickStart.html</span>) should be located in a <span class="docutils literal">Docs/</span>
subdirectory. The example pages go in an <span class="docutils literal">Examples/</span> subdirectory.</p>
<p>A plugin who's <span class="docutils literal">requiredPyVersion</span> or <span class="docutils literal">requiredOpSys</span> aren't satisfied will
simply be ignored. <span class="docutils literal">requiredOpSys</span> should be something returned by
<span class="docutils literal">os.name</span>, like <span class="docutils literal">posix</span> or <span class="docutils literal">nt</span>. Or you can define a function
<span class="docutils literal">willRunFunc</span> to test. If there aren't requirements you can leave these
variables and functions out.</p>
</div>
</div>
</body>
</html>