Exercise

Create a dialog-style application for adding, editing, and deleting records in a reference table, like the one shown in Figure 15.7. The application should create the reference.db database the first time it is run, with a single, empty table:

CREATE TABLE reference (

id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, category VARCHAR(30) NOT NULL, shortdesc VARCHAR(20) NOT NULL, longdesc VARCHAR(80))

In addition to offering Add and Delete buttons, provide a Sort button that has a pop-up menu with three sort order options: by ID, by category, and by short description. All three could be connected to a single method using lambda or functools.partial. To make any new sort (or filter) take effect, you must call select() on the model. Use a QDialogButtonBox for all the buttons.

Category

Short Desc.

Long Desc.

1

Actions 1

Wait

Wait for Information

2

Actions 1

Progress

Progress to Next Stage

El

Actions

iscalate

Send to Supervisor

h

Add

Delete

Sort Close

Figure 15.7 The Reference Data dialog

Figure 15.7 The Reference Data dialog

If the user clicks Delete, pop up a yes/no message box, and delete only if they click the Yes button. The application is similar to the ReferenceDataDlg from the Asset Manager application, and can be written in about 130 lines.

A solution is provided in chap15/referencedata.pyw.

Was this article helpful?

0 0
Tuberminator

Tuberminator

The main focus of this report is to show how to get involved in video marketing on the run, how to rank quickly on YouTube and Google using FREE semi-automatic tools and services. QUICKLY AND FREE. I will show methods and techniques I use to rank my videos, as well as free resources and tools to make video clips, to get backlinks and free traffic.

Get My Free Ebook


Post a comment