Hi Stefan On Sat, Jul 24, 2010 at 8:16 PM, Ziegler Stefan <[email protected]> wrote: > Hi > > I'm trying to access the print composer with python: > > self.iface.actionPrintComposer().trigger() > composerList = self.iface.activeComposers() > composerView = composerList[composerList.index(max(composerList))] > > composition = composerView.composition() > composer = composerView.composerWindow() > composition.setPaperSize(float(width), float(height)) > composer.show() > > > This works twice but the third time two windows will open: one with the > standard papersize and one with my custom papersize.
I think the problem is that composers within QGIS are stored in a QSet (and not in QList data structure) which makes the ordering of composers different from the order how new composers are added. So the new composer you trigger will not always be the last one you retrieve in the list. You could work this around by checking activeComposers() before and after triggering a new composer and finding out which composer is the new one. Not optimal, but probably sufficient. Regards Martin _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
