Chapter 17. Creating Application Functionality

Table of Contents
Introduction
The view
The document
Saving and loading documents
Undo, redo and other editing functions
Conclusion

Introduction

In the last few chapters, we have built a useful framework for a file-oriented application. In this chapter we add some real functionality to the document and view modules.

As an example application, I propose to develop a reasonably full-featured editor, using the standard PyQt multi-line editor widget. This will give us a chance to explore some outlying regions of the Qt library without having to handle the complexity of a custom created widget (as we would have to do if we were to create, for example, a paint application). Not that PyQt isn't capable of this, or of nice games — you can make those, too, if you want. Later, we will have occasion to look at the versatile canvas widget, which has been used for many things, including web browsers, games, and the eric debugger that is part of PyQt.

We will extend our project with an input method for Unicode text, which will give us a chance to work with QCanvas, search and replace, and macros. Additionally, there are some fun items that we can add, such as a rolling chart that keeps track of how fast you type.

Giving the project a name

Before starting out, we should decide upon a name for this project. I rather like kalam — a word which means pen or pencil, and which is derived from the Latin calamus. I have snapshotted the version we have at the end of each chapter so you can follow the development of this project. I didn't print the complete code of every class in every chapter, as that would be too tedious for words!