Re: [Qgis-developer] Building plugin for Print Composer
Le 08/08/2015 11:19, Nyall Dawson a écrit : On 7 Aug 2015 6:58 pm, Vincent Mora vincent.m...@oslandia.com mailto:vincent.m...@oslandia.com wrote: Hi all, I need to add graphs generated by a plugin to compositions. I'm considering to develop a PluginComposerItem in the same spirit as PluginLayers, adding/removing a button in the toolbar when the plugin is registered/removed. Hi Nyall, Just a warning that similar work is already underway - adding a composer item type registry so that plugins can register their own custom item types. Thanks for the warning. Are you referring to QEP#9 or to something else ? What is the status of the work that is underway ? What is the planned time-frame ? Is there a branch somewhere that I can base my work on / contribute to ? We need a composer plugin item for a customer project with a deadline in November. We have planned a few days of dev to contribute that and we'd rather put those efforts in a long term solution. It's an extensive work though, because composer has a lot of hard coded handling of all the existing item types (checkout all the item specific methods in QgsComposition/QgsComposerView). That's why this work is tied up with the layouts/reporting framework refactor. I've seen that, and I'm not sure I see why it prevents the introduction of a plugin item (+registry) that would be used as a base class for python objects to draw in a frame that is part of a composition. V. Nyall Is that what was needed in your cases, or was a more general approach required (like the qgis plugin mechanism, being able to access the interface) ? V. Le 22/06/2015 18:05, G. Allegri a écrit : The suggestion from John is exactly what we did too. And we also built a chart composer... It would be great to have the means to know what other teams are working to. It would save a lor of time and money and, probably, get better software from a shared effort ;) giovanni Il 22/giu/2015 19:31, John Gitau gka...@gmail.com mailto:gka...@gmail.com ha scritto: Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: custom_composer = self.iface.createNewComposer(My Composer) Then get a reference to the main window in the composer view: main_window = custom_composer.composerWindow() Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com mailto:gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com mailto:jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org mailto:Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org mailto:Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org mailto:Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org mailto:Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org mailto:Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
On 14 Aug 2015 23:41, Vincent Mora vincent.m...@oslandia.com wrote: Le 08/08/2015 11:19, Nyall Dawson a écrit : On 7 Aug 2015 6:58 pm, Vincent Mora vincent.m...@oslandia.com wrote: Hi all, I need to add graphs generated by a plugin to compositions. I'm considering to develop a PluginComposerItem in the same spirit as PluginLayers, adding/removing a button in the toolbar when the plugin is registered/removed. Hi Nyall, Just a warning that similar work is already underway - adding a composer item type registry so that plugins can register their own custom item types. Thanks for the warning. Are you referring to QEP#9 or to something else ? What is the status of the work that is underway ? What is the planned time-frame ? Is there a branch somewhere that I can base my work on / contribute to ? We need a composer plugin item for a customer project with a deadline in November. We have planned a few days of dev to contribute that and we'd rather put those efforts in a long term solution. Sorry Vincent, I've been a bit swamped over the last week and haven't had a chance to respond yet. I'll put down a detailed email sometime over the next couple of days outlining the situation. Nyall It's an extensive work though, because composer has a lot of hard coded handling of all the existing item types (checkout all the item specific methods in QgsComposition/QgsComposerView). That's why this work is tied up with the layouts/reporting framework refactor. I've seen that, and I'm not sure I see why it prevents the introduction of a plugin item (+registry) that would be used as a base class for python objects to draw in a frame that is part of a composition. V. Nyall Is that what was needed in your cases, or was a more general approach required (like the qgis plugin mechanism, being able to access the interface) ? V. Le 22/06/2015 18:05, G. Allegri a écrit : The suggestion from John is exactly what we did too. And we also built a chart composer... It would be great to have the means to know what other teams are working to. It would save a lor of time and money and, probably, get better software from a shared effort ;) giovanni Il 22/giu/2015 19:31, John Gitau gka...@gmail.com ha scritto: Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: custom_composer = self.iface.createNewComposer(My Composer) Then get a reference to the main window in the composer view: main_window = custom_composer.composerWindow() Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
We have talked a lot with Nyall about this. It was a requirement for a work I was developing some months ago (it's what I was describing some emails ago in this thead). I suppose the work Nyall is talking about is the deep refactoring of the Composer which will converge in the Report engine (QGIS 3.x), is it right? giovanni 2015-08-08 11:19 GMT+02:00 Nyall Dawson nyall.daw...@gmail.com: On 7 Aug 2015 6:58 pm, Vincent Mora vincent.m...@oslandia.com wrote: Hi all, I need to add graphs generated by a plugin to compositions. I'm considering to develop a PluginComposerItem in the same spirit as PluginLayers, adding/removing a button in the toolbar when the plugin is registered/removed. Just a warning that similar work is already underway - adding a composer item type registry so that plugins can register their own custom item types. It's an extensive work though, because composer has a lot of hard coded handling of all the existing item types (checkout all the item specific methods in QgsComposition/QgsComposerView). That's why this work is tied up with the layouts/reporting framework refactor. Nyall Is that what was needed in your cases, or was a more general approach required (like the qgis plugin mechanism, being able to access the interface) ? V. Le 22/06/2015 18:05, G. Allegri a écrit : The suggestion from John is exactly what we did too. And we also built a chart composer... It would be great to have the means to know what other teams are working to. It would save a lor of time and money and, probably, get better software from a shared effort ;) giovanni Il 22/giu/2015 19:31, John Gitau gka...@gmail.com ha scritto: Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: custom_composer = self.iface.createNewComposer(My Composer) Then get a reference to the main window in the composer view: main_window = custom_composer.composerWindow() Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- Giovanni Allegri http://about.me/giovanniallegri Gis3W - http://gis3w.it Ikare - http://ikare.it Twitter: https://twitter.com/_giohappy_ blog: http://blog.spaziogis.it GEO+ geomatica in Italia http://bit.ly/GEOplus ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
On 7 Aug 2015 6:58 pm, Vincent Mora vincent.m...@oslandia.com wrote: Hi all, I need to add graphs generated by a plugin to compositions. I'm considering to develop a PluginComposerItem in the same spirit as PluginLayers, adding/removing a button in the toolbar when the plugin is registered/removed. Just a warning that similar work is already underway - adding a composer item type registry so that plugins can register their own custom item types. It's an extensive work though, because composer has a lot of hard coded handling of all the existing item types (checkout all the item specific methods in QgsComposition/QgsComposerView). That's why this work is tied up with the layouts/reporting framework refactor. Nyall Is that what was needed in your cases, or was a more general approach required (like the qgis plugin mechanism, being able to access the interface) ? V. Le 22/06/2015 18:05, G. Allegri a écrit : The suggestion from John is exactly what we did too. And we also built a chart composer... It would be great to have the means to know what other teams are working to. It would save a lor of time and money and, probably, get better software from a shared effort ;) giovanni Il 22/giu/2015 19:31, John Gitau gka...@gmail.com ha scritto: Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: custom_composer = self.iface.createNewComposer(My Composer) Then get a reference to the main window in the composer view: main_window = custom_composer.composerWindow() Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
The suggestion from John is exactly what we did too. And we also built a chart composer... It would be great to have the means to know what other teams are working to. It would save a lor of time and money and, probably, get better software from a shared effort ;) giovanni Il 22/giu/2015 19:31, John Gitau gka...@gmail.com ha scritto: Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: *custom_composer = self.iface.createNewComposer(My Composer)* Then get a reference to the main window in the composer view: *main_window = custom_composer.composerWindow()* Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
Hi Jacob. For the moment it isn't possible to extend the Composer with custom plugins. It's sonething that will be discussed for the next Report Engine (QGIS 3.0) I've built a Python plugin that uses the composer widgets (composition, items, etc.) within a custom interface but you can only use the building blocks by yourself. E.g. you can open/create abd manage a composition inside your own widget and add items to it. In your case they could be text or html items, for header and footer. giovanni Il 22/giu/2015 15:18, Jakob Lanstorp jlanst...@gmail.com ha scritto: Is it possibly to build a Python plugin minded for the print composer alone? -Need to build a plugin with a new button inside print composer that lists all labels in the composer in a new dialog for editing. This would be a tool for easy handling of complex header and footers in the layout for the novice user. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Building plugin for Print Composer
Hi Jakob, A workaround would be to have a plugin that creates a new composer view object: *custom_composer = self.iface.createNewComposer(My Composer)* Then get a reference to the main window in the composer view: *main_window = custom_composer.composerWindow()* Then you can either add a new toolbar (and required actions) or append an action to the main toolbar. Have a look at the ComposerWrapper class for something similar we implemented for designing charts in the composer: https://gist.github.com/gkahiu/06a43a589f9441736397 Hope this is helpful. Cheers, John On Mon, Jun 22, 2015 at 2:07 PM, G. Allegri gioha...@gmail.com wrote: You can act on it but you can't custom gui widgets to the Composer interface. I cannot check the code right know. I listen to a specific (existing) composition opening but if I remember correctly you can watch the Composer opening too. Il 22/giu/2015 17:19, Jakob Lanstorp jlanst...@gmail.com ha scritto: Hi Giovanni, thanks for the update. Another solution would be to catch the event when a user starts an existing print composer. Cannot in doc for the pyqgis API find anything for this. Anyone who know is one can listens for a print composer to startup by the user and act on it. - Jakob Lanstorp -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Building-plugin-for-Print-Composer-tp5212187p5212221.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer