Friday, 26. May 2006 17:02.Just an idea: I could extend lino.forms so that it can replace lino.gendoc...
Rename the methods that are used during Form.setupForm() to add components to the form:
To avoid name collisions, move those methods to a Document instance. The document of a Form provides these methods and holds the components (elements) that they create during Form.setupForm(). It is responsible for the Form's layout. It is the same as a Gendoc document. It provides also the Gendoc methods who are more used for printed forms (par(), pre(), memo(), ul(), ol(), report()...) report() is in fact the same as the old addDataGrid()
Rename Form.setupForm() to Form.layout() because I prefer to use simple names for often used things.
A fragment from forms1.py before and after the planned change:
def setupForm(self): self.addLabel("""Please enter your personal data. Don't worry about your privacy. You can trust us. """) self.firstName = self.addEntry(label="First name") self.name = self.addEntry(label="Name") self.addOkButton() self.addCancelButton()
def layout(self,doc): doc.label("""Please enter your personal data. Don't worry about your privacy. You can trust us. """) self.firstName = doc.entry(label="First name") self.name = doc.entry(label="Name") doc.okButton() doc.cancelButton()
I can then create a new HTML toolkit.
- 35427.05.06 (code changes 27.05.06) — No, I won't merge the two modules. But I understood their similarities and made first changes. more