[GUI Design] How to achieve short comm paths between controls?

F. GEIGER fgeiger at datec.at
Wed Aug 27 15:29:34 EDT 2003


+--------------------------------------------------------------+
|                                                              |
+--------------------------------------------------------------+
| +--------+                                                   |
| | Page 1 |                                                   |
|-+        +---------------------------------------------------|
|                          | +- Group ------------------------+|
|                          # |                                ||
|    lhs pane              | |                                || rhs pane
|                          | |                                ||
|                          | |                                ||
| +----------------------+ | |                                ||
| |A control,            | | |          Editor object         ||
| |which properties      | | |                                ||
| |have to be edited     | | |                                ||
| |with the editor in the| | |                                ||
| |rhs pane              | | |                                ||
| +----------------------+ | |                                ||
|                          | +--------------------------------+|
+--------------------------------------------------------------+

When I click on the control within the lhs pane, I want to display the
appropriate editor, which displays the control's properties. To do so I need
the group box in the rhs pane as the editor's parent. Therefore the text
control tells the MainFrame (module variable as a singleton) to display the
right editor. So this path is short.

But now, down the path, I get into troubles: The MainFrame does not know
about the group box in the rhs pane of the active page of the notebook
within the MainFrame. See?

So the path is: MainFrame ---displayEditor()-->
NoteBook ---displayEditor()--> Currently selected page. The nesting down
stops here, because the page knows about the group box within the pane,
because it created them.

I'm in doubt that this is a design pattern issue. I guess it's about
organizing all the controls of a GUI.

Should I create a dict with control name/object pairs, held by the
MainFrame?

Or should the rhs group box a globally accessible singleton or Borg?

Any other hint? How do you handle such situations?

I sketched the app both with wxPython and PMW/Tkinter. Is this what PyQt's
slots are for? Can I connect the lhs control with the rhs group box? It'S
hard for me to see how this would solve the problem, because the distance
between the controls remains. Well, I guess the dict mentioned above is not
the worst here, is it?

Any hint welcome.

Regards
Franz GEIGER







More information about the Python-list mailing list