[Thuban-devel] Re: RfD: Support for layer specific resources
Martin Schulze
joey at infodrom.org
Tue Sep 7 17:46:16 CEST 2004
Bernhard Herzog wrote:
> >> >> > And for Thuban.UI.classifier:
> >> >> >
> >> >> > add_properties_dialog(Layer, Classifier)
> >> >> > add_properties_dialog(RasterLayer, Classifier)
> >> >
> >> > I'm not sure how I am supposed to implement this since
> >> > classifier.py doesn't import mainwindow and I don't know if it
> >> > would be a good idea to do so.
> >>
> >> You could put that code into Thuban.UI.mainwindow which already depends
> >> on Thuban.UI.classifier because it currently refers to the dialogs in
> >> there directly. That would keep the module dependencies the same as
> >> now.
> >
> > Err???
>
> Now it's me going Err :)
*sigh*
> > Are you really sure you want this code appear in mainwindow.py?
>
> No, I'm not sure, and I don't have the time to find the perfect place
> for it. You didn't want it in Thuban.UI.classifier, though, and that
No, I wasn't sure how I am supposed to implement this in
classifier.py. I'm fine adding it there. In fact, on July 27th I
proposed to add this to classifier.py.
> was what I was replying to. classifier does not depend on mainwindow
> but would if you put the add_properties_dialog call there. That's how I
> understood your reply anyway. My suggestion, then, was that, since
> mainwindow currently depends on classifier, you could have the call in
> mainwindow and the depencies wouldn't change. FWIW, I don't see why
> putting the call into classifier would be a problem.
>
> Note: mainwindow is always the module Thuban.UI.mainwindow here, in case
> that wasn't clear from context which is sometimes hard to tell in
> conversations stretching over months :)
>
> > Similar code is required for other layers, too (e.g. currently WMS
> > layers). Should that code go into mainwindow as well?
>
> For layers in extensions definitely not.
Great, now we're discussing in a circle and can restart where we were
on Jul 27th 2004 already, nearly one and a half month ago.
So... let's restart this issue again:
Problem:
Different layer types require different properties dialogs.
Solution:
Set up a hash of layer classes and properties dialog classes.
Each layer class will register itself and the respective
properties dialoc class upon Thuban startup.
Advantage:
The solution is independent of the number of different layers
and can easily be enhanced in the future (i.e. just register
more layer:dialog class pairs.
Disadvantage
This solution requires:
a) a global variable (_properties_dialogs) for the ClassMapper
b) a globally available register function/method
c) the register function/method needs to access the global
variable and needs to be able to be imported into
potentially any .py file (currently only
Thuban/UI/classifier.py and Extensions/wms/wms.py).
Solved: a)
Not solved: b), c)
Proposal:
Add Thuban/UI/propdialgs.py (or any other name) with (as stated in
the July 27th mail):
a) the declaration of the global variable
b) the global register function
c) the access function to make it complete [optional]
Since in practice only mainwindow needs to look up the mapping,
this isn't required and can be done directly in mainwindow as
well, but it would break the modular concept a bit.
Would that be acceptable for you?
Regards,
Joey
--
The good thing about standards is that there are so many to choose from.
-- Andrew S. Tanenbaum
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)