Last but not least, we get to the code. PyMailGUI consists of the nine new modules listed at the start of this chapter; the source code for these modules is listed in this section.
Besides the code here, PyMailGUI also gets a lot of mileage out of reusing modules we
wrote earlier and won’t repeat here:
mailtools for mail loads, composition,
parsing, and delete operations;
threadtools for managing server and local
file access threads; the GUI section’s
TextEditor for displaying and editing mail
message text; and so on.
In addition, standard Python modules and packages such as
library module also implements GUI components in a portable
As mentioned earlier, PyMailGUI applies code factoring and OOP to leverage code reuse. For instance, list view windows are implemented as a common superclass that codes most actions, along with one subclass for the server inbox list window and one for local save-file list windows. The subclasses customize the common superclass for their specific mail media.
This design reflects the operation of the GUI itself—server list windows load mail over POP, and save-file list windows load from local files. The basic operation of list window layout and actions, though, is similar for both and is shared in the common superclass to avoid redundancy ...