tallforasmurf / PPQT

A post-processing tool for PGDP written in Python, PyQt4, and Qt
GNU General Public License v3.0
4 stars 2 forks source link

Multiple document interface #179

Open tallforasmurf opened 10 years ago

tallforasmurf commented 10 years ago

For v2, implement a multiple document interface as follows.

First: identify all values now in the IMC and held by the edit widget that are unique to the document. For example, good words, bad words, page table, primary dictionary, vocabulary and charset censii. Footnotes? Emplace all of these into a new portmanteau object, BookDocument class. This includes a plain text editor.

BookDocument offers methods to loadBookNew( book file, goodwords file, badwords file) and loadBookMeta( book file, metadata file), and saveBookTo(book file, meta file, bin file).

The left-hand pane is no longer a single widget, an editor. Instead it is a tabset. Initially populated by just one widget, a document object in New condition. But it can have other BookDocument objects added to it as tabs. What's the tab name and how set?

At any time, one of the book tabs is frontmost. (There must be a signal when that happens?) A reference to that frontmost BookDocument object is in the IMC. When you click an action button on any right-hand pane e.g. Find, or Pages, it goes to the frontmost BookDocument for its data and into the frontmost BookDocument to scan or modify text. Note that time-consuming things like the Words panel do not clear themselves just because a different book has come to the front. Make the user click Refresh to see the data from that book. Or: do we make the Words, Chars, Pages and Footnotes table objects properties of the book, and swap them into the panel when the panel gets the focus?

On File > New, create a new empty BookDocument and add it to the left tabset.

On File > Open, create a new empty BookDocument, add to the left tabset, and call its loadBookNew or loadBookMeta method as necessary.

On File > Close, check the frontmost BookDocument for dirty condition, then just remove it from the left tabset and let it go out of scope.

On File > Save, set up the files and call the frontmost BookDocument.saveBookTo() method.