Hi, I’ve done some more checks and decided that the error can be replicated outside of my plugin so I think it might be a more general bug relating to QgsProcessingParameterPoint.
I’ve created a script that you should be able to load to see if you can replicate the issue and it can be found at Example Process - Pastebin.com<https://pastebin.com/UaS4rWFW> I’m on Windows 10 1909 and using QGIS version 3.16.0-Hannover (64bit). Would someone be able to try loading the script for me and let me know if you can replicate the issue? Thanks, Paul From: Paul Wittle Sent: 22 April 2021 09:57 To: [email protected]; [email protected] Subject: RE: [QGIS-Developer] Odd error Hi, I’ve been thinking about this a bit more and I think the issue may relate specifically to the following lines: dialog = processing.createAlgorithmDialog("script:atobroute",{}) dialog.show() I think the issue is that the dialog.show() opens the script dialog but that dialog then has interactive options where you can select a point from the map canvas. It is when you try to select the coordinates that QGIS crashes. I think I tried using .exec_ instead of .show but of course the dialog opens and closes straight away. I think the issue may be that my plugin is waiting for the user to dismiss the dialog but is unhappy when it is hidden by the select from canvas tool. I’ve slept since I wrote the script but I think the select from map is default functionality and the fields are defined as self.addParameter(QgsProcessingParameterPoint(self.ORIG, 'Origin coordinates',None,True)) Is there a better way to open a script from a button on the toolbar. Ideally I want to simply replicate the behaviour of just double clicking the script from the processing toolbox. Thanks, Paul From: Paul Wittle Sent: 21 April 2021 09:16 To: [email protected]<mailto:[email protected]> Subject: RE: [QGIS-Developer] Odd error Hi, Yes I used plugin builder as a base for the plugin. Here is the code in question: #Create the routing toolbar self.routebar = self.iface.addToolBar("Routing Tools") self.routebar.setObjectName(u'Routing Tools') text = QLabel( QCoreApplication.translate('CouncilPlugin', 'Routing Tools:') ) #No action to connect to this! self.routebar.addWidget(text) route1 = QAction( QIcon(':/plugins/council_plugin/AtoB.png'), QCoreApplication.translate('CouncilPlugin', 'Route from A to B'), self.iface.mainWindow() ) route1.triggered.connect(self.AtoB) self.routebar.addAction(route1) #Routing Tools def AtoB(self): self.CheckRoutingTools() #Always check the scripts are up to date first dialog = processing.createAlgorithmDialog("script:atobroute",{}) dialog.show() I don’t think it gives an error message. QGIS just disappears and you have to re-open it. Thanks, Paul From: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> Sent: 21 April 2021 09:11 To: Paul Wittle <[email protected]<mailto:[email protected]>> Subject: Re: [QGIS-Developer] Odd error Hei! Have you bilt the plugin using "plugin builder? Could you send the error message? Cheers, Robert On Wed, Apr 21, 2021 at 10:00 AM, Paul Wittle <[email protected]<mailto:[email protected]>> wrote: Hi, I have a python script that I wrote which routes from point A to B using the default tools in QGIS. If I go to the processing toolbox and open the dialog it runs fine and everything is great. I also have a python plugin and I put a button in a toolbar to open the same script. It loads the dialog but when you try to run it the whole thing crashes out and QGIS disables my plugin. Does anyone have any suggestions as to what I might have done wrong? I’m assuming the issue is related to how I’m calling the script from my plugin rather than the script itself as it runs independently from the processing toolbox fine 😊 Any suggestions would be appreciated. Paul Wittle [cid:[email protected]]<https://www.dorsetcouncil.gov.uk/> Business Solutions Analyst (GIS) ICT Operations Dorset Council 01305 228473 dorsetcouncil.gov.uk<https://www.dorsetcouncil.gov.uk> [cid:[email protected]]<https://www.facebook.com/DorsetCouncilUK> [cid:[email protected]]<https://instagram.com/DorsetCouncilUK> [cid:[email protected]]<https://twitter.com/DorsetCouncilUK> This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/data-protection<http://www.dorsetcouncil.gov.uk/data-protection> _______________________________________________ QGIS-Developer mailing list [email protected]<mailto:[email protected]> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/data-protection
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
