| 1 | NOTE: This guide is a rough reference, and will always mostly be incomplete.
|
|---|
| 2 |
|
|---|
| 3 | Abstract:
|
|---|
| 4 |
|
|---|
| 5 | Itaka was developed in a purely Object Oriented fashion. It is designed to
|
|---|
| 6 | be completely modular and each component was made so that it is independent
|
|---|
| 7 | of the other to a certain extent. First there is the core loader
|
|---|
| 8 | 'itaka.py', which in turn loads the Console and Configuration handlers
|
|---|
| 9 | ('console.py' and 'configuration.py'). The configuration is read and
|
|---|
| 10 | loaded, and the passed to the new instance of our Console handler.
|
|---|
| 11 |
|
|---|
| 12 | After that, the main GTK+ GUI 'uigtk.py' is loaded, it is totally
|
|---|
| 13 | independent from any other modules, as are the Console and Configuration
|
|---|
| 14 | handlers. The main GTK+ GUI only relies on the Twisted GUI reactor to
|
|---|
| 15 | handle the multi threading for simultaneous running of a GTK loop and a
|
|---|
| 16 | Twisted server reactor.
|
|---|
| 17 |
|
|---|
| 18 | The GTK+ GUI then calls on the Itaka Twisted Web Server engine 'server.py'.
|
|---|
| 19 | Although the base Twisted server is completely independent of any other
|
|---|
| 20 | modules through its base class 'BaseHTTPServer', the classes used by the
|
|---|
| 21 | GUI are not.
|
|---|
| 22 |
|
|---|
| 23 | This is because or ScreenshotServer needs instances of our Gui,
|
|---|
| 24 | Configuration and Console engines. This expandability is a prime
|
|---|
| 25 | example of the Object Oriented nature of Itaka. It was designed from
|
|---|
| 26 | the ground up to be modular and easily expandable through inheritance.
|
|---|
| 27 |
|
|---|
| 28 | Such modularity allows for users to develop different GUIs in other
|
|---|
| 29 | toolkits such as PyObjC (Cocoa) or PyQT. In turn, those GUIs can adapt
|
|---|
| 30 | BaseHTTPServer to their needs.
|
|---|
| 31 |
|
|---|
| 32 | The HTTP server creates a resource called '/screenshot' (URL Path), which
|
|---|
| 33 | in turn takes the screenshot on request. This URL path is referenced on
|
|---|
| 34 | the HTML base code in the configuration as an <img>. The screenshot
|
|---|
| 35 | resource has a special render_GET() method that initiates the screenshot
|
|---|
| 36 | engine 'screenshot.py'.
|
|---|
| 37 |
|
|---|
| 38 | The screenshot engine is done entirely on GTK+ and does depend on it. It
|
|---|
| 39 | has not been yet modularized, but it would not take long to implement a
|
|---|
| 40 | totally different GUI for Itaka.
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | Technichal standards:
|
|---|
| 44 | * Inter-class communication: it is done by passing instances of one class
|
|---|
| 45 | to the child object that needs it. For example, the
|
|---|
| 46 | HTTP server needs an instance of the GUI for widget manipulation (Logging,
|
|---|
| 47 | etc.), and instance of the configuration class and an instance of the
|
|---|
| 48 | Console class. Since our main Itaka core 'itaka.py' passed the main
|
|---|
| 49 | instance of those classes to the GTK+ GUI, the only thing needed to do is
|
|---|
| 50 | to pass an instance of the GUI class to the child-objects that need it.
|
|---|
| 51 |
|
|---|
| 52 | * Exceptions: Itaka's exception definitions are stored in 'error.py'.
|
|---|
| 53 | Inheritance should be used widely.
|
|---|
| 54 |
|
|---|
| 55 | * Encapsulation: All of Twisted's exceptions and exceptions of
|
|---|
| 56 | screenshooting code should be encapsulated with equivalent Itaka
|
|---|
| 57 | exceptions.
|
|---|
| 58 |
|
|---|
| 59 | * Documentation: Use Epytext Markup Language.
|
|---|
| 60 |
|
|---|
| 61 | * Private methods: Methods that are _never_ going to be called outside the
|
|---|
| 62 | class should be prefixed with an underscore (_).
|
|---|
| 63 |
|
|---|
| 64 | Generating Documentation:
|
|---|
| 65 |
|
|---|
| 66 | Itaka is fully documented with Epydoc.
|
|---|
| 67 |
|
|---|
| 68 | You can ownload epydoc from http://epydoc.sourceforge.net/
|
|---|
| 69 |
|
|---|
| 70 | You can generate documentation using epydoc.
|
|---|
| 71 |
|
|---|
| 72 | mkdir doc
|
|---|
| 73 | epydoc --html -o doc -n Itaka -u "http://itaka.jardinpresente.com.ar" *.py
|
|---|
| 74 |
|
|---|