[Qgis-developer] Re : getting list of available QgsComposer
Victor Olaya
volayaf at gmail.com
Sun Aug 2 09:23:56 PDT 2015
Yes, that was what I was expecting to have, but couldn't find any
method to get it, so I assumed the composition was not storing the
name.
2015-08-02 12:22 GMT+02:00 Nyall Dawson <nyall.dawson at gmail.com>:
> On 2 August 2015 at 19:40, Junior <delazj at gmail.com> wrote:
>> Hi Victor,
>> for cview in iface.activeComposers() :# will retrieve list of composers
>> print cview.composerWindow().windowTitle() # To print their name
>>
>
> That's the best current approach, but unfortunately it's pretty ugly.
> With the layouts rewrite I'm hoping to fix this by having a composer
> registry attached to the project and moving the name of a composition
> to sit as a property within the composition itself.
>
> Nyall
>
>
>> HTH,
>> DelazJ
>>
>> ----- Reply message -----
>> De : "Victor Olaya" <volayaf at gmail.com>
>> Pour : "qgis-developer" <qgis-developer at lists.osgeo.org>
>> Objet : [Qgis-developer] getting list of available QgsComposer
>> Date : dim., août 2, 2015 08:41
>>
>> Hi all,
>>
>> Can anyone tell me how to get the list of the current composers in a
>> project?
>>
>> there is a activeCompositions() method in the QgsInterface class, but
>> it returns a list of QgsComposerView. The problem with that is that
>> those views do not seem to have a name (the constructor of the class
>> actually gets a name, but it is not used...)
>>
>> I need the name to list the composers as part of a plugin, so I guess
>> i would need the QgsComposer object instead. I could just get the name
>> from the menu items, but I am sure there must be a cleaner solution...
>>
>> There seems to be a printComposers() method in the QgisApp class...but
>> that class is not available from Python.
>>
>> Any idea?
>>
>> Thanks in advance!
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list