Re: optional policy

[email protected] (Dallas Johnston) Sun, 17 Nov 2002 11:45:24 -0500
Newsgroups gmane.comp.python.anygui.devel
Message-ID <[email protected]>
Robin Becker <[email protected]> wrote:
>this may be true, but all the import analysers see it anyway and add it
>automatically whether it's needed or not. The frontends & dialogs are
>imported in __init__.py. Whether they get used or not is moot.

Ok, while this is true for the Dialogs it is definitely not the case for ComboBoxWapper. If you look at the code in ComboBoxes.py you will see the following:

def wrapperFactory(self):
        try:
            return backendModule().ComboBoxWrapper(self)
        except(AttributeError):
            return frontEndWrappers().ComboBoxWrapper(self)

Now what this is doing is using the frontend wrapper if, and only if, the backend version does not exist. Note also that "from anygui.ComboBoxes import ComboBox" just imports this code, wich calls back into __init__.py in both cases of the wrapperFactory() method.

>>I just didn't do the same with the anygui dialogs, as I thought that it would be 
>>good to have a consistant dialog interface for the file dialog, no matter what 
>>the widget toolkit provided (thus the original AnyguiOpenFileDlg name).
>>
>
>You might think that, but others not. It would surely be good to allow
>them to make the choice.

Well, that is why we could have _had_ Anygui*Dlg so that the authors _could_ make the choice. The "Anygui" part of the name did have a meaning for this very reason: to discern backend-independent dialogs from backend-specific implementations. Anygui app writers could thus choose their tool at coding time. (uniform look and behaviour vs. things of all shapes, sizes and sundry functionality)

>The TODO.txt file says "- Dialogs, including native dialogs (file dialog
>etc.)". I feel it would be good to make these imports very lazy indeed.
>One of the main criticisms of Tk (for a long while) was non-native look
>and feel.

And this could be done in just the same way as ComboBox is. There is no problem here.

>>that I want this, but if), then there is no need for the backend to write any 
>>code.
>It will if it gets imported and the backend already has native dialogs,
>then it's just excess.

But not all backends have native dialogs. This was really the whole point of writing them. For instance, is there an official generic About dialog in Tk, or generic Win32 About dialog (and i'm not talking about wizard generated MFC about dialogs here). I think not. It is in such cases that having a frontend AnyguiAboutDialog would save everyone from having to code one in the backend.

--Dallas

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html