[QGIS-Developer] Issue with global variables don't get assigned

Adam Borczyk adam.borczyk at gis-support.pl
Thu Apr 19 04:31:56 PDT 2018


I discovered, that my old Config file was ~ 10MB of size. Each time I was
assigning globals, they were appended into the file with their values,
instead of being replaced. Is it correct behaviour?

*Adam Borczyk*

*---------------------------------*
*GIS Support Sp. z o.o.*
DobrzaƄskiego 3,
<https://maps.google.com/?q=Dobrza%C5%84skiego+3,%C2%A0Lublin+20-262&entry=gmail&source=g>Lublin
20-262
<https://maps.google.com/?q=Dobrza%C5%84skiego+3,%C2%A0Lublin+20-262&entry=gmail&source=g>
tel. 814511490, NIP: 9462641761,
*www.gis-support.pl <http://www.gis-support.pl>*
info at gis-support.pl

On 19 April 2018 at 13:26, Adam Borczyk <adam.borczyk at gis-support.pl> wrote:

> 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/2c115047/attachment.html>


More information about the QGIS-Developer mailing list