Re: [Qgis-developer] Composer Management
Hi, > From: lar...@dakotacarto.com > Subject: Re: [Qgis-developer] Composer Management > > Ok, I've added these (excepting deletePrintComposers) to iface [0]. > So you can now do the following: > > cv = iface.createNewComposer('test') > cv2 = iface.duplicateComposer(cv, 'test2') > > for c in iface.activeComposers(): > iface.deleteComposer(c) > Great News, this will make things much neater. > I've added New from Template to the Composer menu [1]. I think the > distinction between the actions is very clear now. Btw, Composer > Manager also only adds templates to new composers, but with no clear > indication on where those templates are located. They are in > QgsApplication::pkgDataPath()/composer_templates/ (inside bundled app > on Mac) instead of under say ~/.qgis/composer_templates/. I think that > needs adjusted. At the moment I'm using the current location to my advantage. Loading templates from pkgDataPath allows template distribution on a per-machine rather than a per-user basis. It might be desirable to support both options much like the current situation with two locations for python plugins. I'm thinking it would be nice to have the composer titles exposed directly. Currently I believe python code would only have indirect access like this: iface.activeComposers()[0].composerWindow().windowTitle() Regards, Kelly thomas ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Composer Management
Hello, I am building a python plugin for QGIS 1.8 and am trying to manipulate the map composers. The goal is to load a template, customise a few elements, and then leave the composer window up for the user to modify / print / etc. I know that current composers can be listed by calling qgis.utils.iface.activeComposers(). However I have been unable to create or destroy composer windows without resorting to spoofing user input to the composer manager dialog! Is there a technique by which I can add/remove composers programmatically? Thanks, Kelly Thomas ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Adding a WMS layer via python
> From: nyall.daw...@gmail.com > Subject: [Qgis-developer] Adding a WMS layer via python > I'm wondering if someone can help me out here - I'm trying to add a > WMS layer via a python plugin, but I'm having trouble with two > settings I need: > > 1: setting a username and password to use for the layer > 2: setting a tilesize for the layer >> One thing I've noticed is that the uri.encodedUri output looks strange: > > crs=EPSG:3111&format=image/jpeg&height=512&layers=AERIAL_MELBOURNE_2009JAN03_AIR_VIS_35CM_VG94&styles=&url=http://images.land.vic.gov.au/ecwp/ecw_wms.dll?&width=512 > > Any ideas what I'm doing wrong on this one? Hi Nyall, I haven't had need to tweak the tile size so I can't offer any advice there.However I have had success adding authenticated WMS layers to 1.8 with this code: if len(self.user) > 0 : connectionString = "username=" + self.user + ",password=" + self.password + ",url=" + self.urlelse: connectionString = self.url crs = self.iface.mapCanvas().mapRenderer().destinationCrs().authid() layer = QgsRasterLayer(0, connectionString, self.title, "wms",[self.layername], ["default"], "image/png", crs) if layer.isValid(): QgsMapLayerRegistry.instance().addMapLayer(layer) This code manually adds the username, and password parameters to the connection string, you may want to try something similar with your URI. Regards,Kelly Thomas ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS, Python and Threads
>Another gotcha to be aware of is that any python errors that occur in the >other thread will be displayed in the Message>Log, I find it useful to have >this as a floating window during development. I think it's an indenting error.It looks like your code is indented with tabs, while the other code is indented with spaces. This happens to me all the time if I mix code from different sources. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS, Python and Threads
Hi Matthias, I had a similar problem a couple of weeks back. While I was unable to identify why my first attempt was failing I was able to produce a functioning implementation on the second attempt. I posted my problem (and later a working solution) over here. [1] Another gotcha to be aware of is that any python errors that occur in the other thread will be displayed in the Message Log, I find it useful to have this as a floating window during development. [1] http://gis.stackexchange.com/questions/45514/how-do-i-maintain-a-resposive-gui-using-qthread-with-pyqgis Good Luck,Kelly Thomas > Date: Tue, 22 Jan 2013 10:33:16 +0100 > From: kaot...@gmx.de > Hello, > I try to write a plugin in python. The plugin will be part of a complex > plugin and will make a longer running numpy> calculation. I want the GUI to > be responsive during the calculation. As a basis I used Aaron > > Racicots(http://svn.reprojected.com/qgisplugins/trunk/threading_demo/) > threading example and modified the run code (the > calculation is only an > example). Unfortunately it does not what I want it to do...it hangs during > calculation. Did I missed a >thing? ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QgsLegendInterface binding updates, or QgsLegend overhaul?
> Date: Wed, 28 Nov 2012 13:11:50 -0700 > From: lar...@dakotacarto.com > To: qgis-developer@lists.osgeo.org > Subject: [Qgis-developer] QgsLegendInterface binding updates, or QgsLegend > overhaul? > > Hi, > > I added to QgsLegendInterface today [0] and noticed how lacking the > Python binding is when working with the legend, compared to the number > of methods that could be exposed from QgsLegend. Looks like > QgsLegendInterface really hasn't been updated since QGIS 1.5. > > Users/plugin devs have asked for better means of working with the > legend, so my questions are: > > * Should there be an effort to bring many of the reasonable-to-expose > methods from QgsLegend to QgsLegendInterface for 2.0 release? > > * OR, should QgsLegend be overhauled first (as there has been talk about)? > > [0] > https://github.com/qgis/Quantum-GIS/commit/8260eab94ba52ecd9faea59632c61070c2aea70c > , http://gis.stackexchange.com/questions/36937 > > Regards, > > Larry > ___ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-developer I'm new to this and have missed the talk of a QgsLegend overhaul so I have no knowledge ofthe scope/reasons of the proposed changes. To provide further context I am developing a python plugin for use in a corporate environment where I can only target stable releases (1.8/2.0). Generally providing access to an appropriate API will reduce the need for hackish code. The change you have made will negate the current need to query the QTreeView to determineif the active layer is the only selected layer. I would also find value in gaining access to groupSelectedLayers. In the long term I also feel that control of sub-groups is essential (part of the overhaul?). In summary I support exposing further legend controls before 2.0 Regards,Kelly ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer