Re: Question about map sources.



Ah, sorry, late as always...

On Thu, May 17, 2012 at 6:09 PM, Robert Park <rbpark exolucere ca> wrote:
> On Thu, May 17, 2012 at 10:53 AM, Robert Park <rbpark exolucere ca> wrote:
>> On Thu, May 17, 2012 at 8:26 AM, Jiří Techet <techet gmail com> wrote:
>>> Or you can completely skip the factory and put the sources into python
>>> list or dict and iterate over it.
>>
>> Well, I also have bound the map-source property to a GSettings key,
>> and that depends upon calling source_get_id() whenever the map-source
>> property changes (to store the id in GSettings) and then also calling
>> factory_create_cached_source(id) whenever the gsettings key changes
>> (ie, at app launch, so it always remembers the last used source). So
>> I'll need to register() the custom source in order for that to keep
>> working.
>
> Just playing with this now finally, if I understand correctly the
> procedure to register with the factory looks like this:
>
> 1. make a MapSourceDesc
> 2. pass that to factory.register()
> 3. then factory.create_cached_source() will create it by id on demand?
>
> Well champlain_map_source_desc_new_full doesn't seem to be
> introspected properly because I can't call it, and if I try to just
> instantiate the class directly (ie, desc = Champlain.MapSourceDesc(id,
> name, etc...)) it says __init__ takes 0 arguments, 9 given.
>
> Can you confirm? Or am I just doing something wrong?

Exactly what I expected - the map source API was created before we had
introspection support and not everything is introspectable (on the
other hand, layers, markers, paths, etc. should be fully
introspectable). The problem with MapSourceDesc is that it contains a
C pointer to constructor which is not introspectable. I plan to go
through all the code to make sure everything can be introspected and
change the API when necessary.

The factory is just a utility class and it's no problem to implement
basically the same functionality so you did the right thing in your
code.

Jiri


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]