[QGIS-Developer] Python slots don't get called when they're instance methods

G. Allegri giohappy at gmail.com
Thu Nov 29 09:19:32 PST 2018


I don't know what happened but now everything works fine. I didn't change
anything, the same example run in console now works. Maybe something
strange within the QGIS session yesterday...
Anyway I confirm the signals connect corectly also on Windows :)

Giovanni

Il giorno gio 29 nov 2018 alle ore 00:51 G. Allegri <giohappy at gmail.com> ha
scritto:

> So it seems something related to an old issue
> https://issues.qgis.org/issues/6573
>
> In effect I've always used old style signals and slots because new style
> ones always gave me some problems (on Windows).
>
> I will have to dig into others' plugins to verify.
> Anyway it's curious to see that also Processing seems to use a workaround
> in its PointTool: it emits its own signal instead of using the
> QgsMapToolEmitPoint.canvasClicked signal. I've done the same to circumvent
> the issue... But it doesn't apply to all the situations
>
> https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/PointMapTool.py
>
> Giovanni
>
> Il giorno gio 29 nov 2018, 00:39 Nyall Dawson <nyall.dawson at gmail.com> ha
> scritto:
>
>> On Thu, 29 Nov 2018 at 09:32, G. Allegri <giohappy at gmail.com> wrote:
>> >
>> > During the porting of a plugin to QGIS 3.x I'm facing the following
>> when using Qgs* objects' signals (it doesn't happen with Qt widgets, etc.).
>> > I'm using QGIS 3.4 on Window 10.
>> >
>> > If I have a Python class like the following:
>> >
>> > >class Foo():
>> > >  def __init__(self):
>> > >    QgsProject.instance().writeProject.connect(self.written)
>> > >
>> > >  def written(self, dom):
>> > >    (do something)
>> >
>>
>> Hmm - this code works fine for me!
>>
>> class Foo():
>>   def __init__(self):
>>     QgsProject.instance().writeProject.connect(self.written)
>>
>>   def written(self, dom):
>>     print('bah')
>>
>> f=Foo()
>>
>> This is on Linux (Fedora).
>>
>> Nyall
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20181129/67e22485/attachment-0001.html>


More information about the QGIS-Developer mailing list