[QGIS-Developer] Issue with global variables don't get assigned
Adam Borczyk
adam.borczyk at gis-support.pl
Thu Apr 19 04:26:16 PDT 2018
Hi everyone,
I recently sent an e-mail here about JSON string variables messing up my
globals in QGIS 2.18. Today I experienced another bug (?) - very simple
global variable just does not get loaded. The code is:
# Inside SocketIO worker class:
def get_srid(self):
# socket request to the server, returning EPSG code as integer
self.emit('srid', {}, lambda data: self.assign_srid(data))
def assign_srid(self, data):
QgsExpressionContextUtils.setGlobalVariable('srid', str(data))
QgsMessageLog.logMessage('Assigned SRID: %d' % data , 'myPlugin')
The result of calling get_srid() is correct "Assigned SRID: 4326" in Log
Messages Panel, but in Properties the variable "SRID" is still empty.
Sometimes it works though, after some random number of tries. It also
worked after I purged ~/.config/QGIS/QGIS2.conf file, but it'll possibly
happen again.
Is there anything I have to take special care of?
Best regards
*Adam Borczyk*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180419/fd250651/attachment.html>
More information about the QGIS-Developer
mailing list