Having a separate controller class makes
it easy to add more interfaces, for instance a macro-language.
While this is quite an advanced topic, and one that merits a
chapter in itself (see Chapter 20), you can
see for yourself how powerful the current separation is. You
can easily create a completely separate script that creates a
document and modifies it:
Example 12-2. Scripting an application is easy
#
# Scripting a docview application
#
from docviewdoc import DocviewDoc
doc=DocviewDoc()
doc.slotModify()
You can handle your application's data not
only through a GUI interface, but also with scripts. Possible
extensions would be to expose the
DocviewDoc functionality through
interfaces like CORBA, DCOM, DCOP or SOAP - all very feasible,
since Python modules to create these interfaces are readily
available. Note however that only CORBA and SOAP are platform
independent: DCOM ties you to Windows and DCOP to KDE.
Integrating a macro extension in the application is covered in
Chapter 20