[Thuban-devel] Re: RfD: Support for layer specific resources

Bernhard Herzog bh at intevation.de
Wed May 19 18:55:33 CEST 2004


Martin Schulze <joey at infodrom.org> writes:

> Looking at the current code:
>
> MainWindow.OpenLayerProperties():
>     dialog = self.get_open_dialog(name)
>     if dialog is None:
>         dialog = Classifier(self, name, self.Map(), layer, group)
>         self.add_dialog(name, dialog)
>         dialog.Show()
>     else
>         dialog.Raise()
>
> Classifier is a specialisation of NonModalNonParentDialog
>
> So what you would like to see is something like
>
> class GeneralPropertiesDialogs (NonModalNonParentDialog)
>     ...
> class Classifier (GeneralPropertiesDialog)
>     ...
> class wmsPropertiesDialog (GeneralPropertiesDialog)

Yes

>     ...
>
> and
>
> BaseLayer.propertiesDialog of class PropertiesDialog, or rather one
> of the specialisations of it (i.e. Classifier or wmsPropertiesDialog).
>
> MainWindow.OpenLayerProperties would then contain code like
>
>   if current_layer.has_properties():
>     name = ...
>     dialog = self.get_open_dialog(name)
>     if dialog is None:
>         dialog = current_layer.properties_dialog(..)
>         self.add_dialog(name, dialog)
>         dialog.Show()
>     else
>         dialog.Raise()

No.  The code outside of Thuban.UI should not depend on the GUI.

I'd prefer a solution like the one used for the renderer extensions in
baserenderer.py.  It basically means that there's a mapping between
layer classes and property dialog classes.  This mapping should be in a
new module, I think, together with the GeneralPropertiesDialog class.
The OpenLayerProperties method would call a function in that module
which returns the dialog class for a given layer.


   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)