Hi Peter In addition to Matthias' advice perhaps try using QNetworkAccessManager[1] and related classes in order to deal with your http requests asynchronously. This should fix the UI blocking issues.
Best regards [1] - http://pyqt.sourceforge.net/Docs/PyQt4/qnetworkaccessmanager.html#details Em 05/10/2017 15:18, "Matthias Kuhn" <matth...@opengis.ch> escreveu: Hi Peter, Have a look at this answer here, which explains how you can trigger the same behavior without using the print and relying on side-effects of the console open. It also outlines the risks involved in using this kind of approach. https://gis.stackexchange.com/a/257016 Cheers Matthias On 10/05/2017 03:25 PM, Peter Devoy wrote: > Just a little update; it is the fact I am using print() to output > debug information upon each request which is allowing the UI to > repaint. Also, it seems that opening and closing the Python console > once is enough. > > Peter > > 3XE > P: 01326 567155 > M: 07770 693662 > A: 3XE Ltd > Tremough Innovation Centre > PENRYN > TR10 9TA > 3XE Ltd · Registered in England and Wales · 9356871 > > > On 4 October 2017 at 20:53, Peter Devoy <pe...@3xe.co.uk> wrote: > >> Hi all >> >> In my plugin I have extended QAbstractListModel to create a list of >> objects; each object in the list has a 'url' property containing the >> URL of an API resource. When the user selects a feature in main QGIS >> interface, each object in the list makes a HTTP request to its URL and >> updates its properties from the response data. >> >> Changes in the objects' properties are reflected in a QListView. E.g. >> a property 'status' is set to 'WARN' if the HTTP request fails -- >> this is reflected in the QListView by the respective list item's icon >> turning yellow. >> >> If I have the Python console open in QGIS the QListView items update >> as the ListModel's objects update. However, if the Python console is >> not open, the plugin's UI thread appears to be blocked until each item >> in the list has completed its changes and all the items update at >> once; please can anyone recommend a way to avoid this? >> >> I have been developing on QGIS 2.1X. >> >> Kind regards >> >> >> Peter >> > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > _______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer