olivierdalang / CadInput

CadInput QGIS plugin
10 stars 1 forks source link

RuntimeError: no access to protected functions or signals for objects not created from Python #3

Closed timlinux closed 10 years ago

timlinux commented 10 years ago

Just testing out the plugin, when it is enabled in plugin manager I get this:

An error has occured while executing Python code:

Traceback (most recent call last):
  File "/Users/timlinux/.qgis2/python/plugins/CadInput/CadGhostWidget.py", line 168, in mouseMoveEvent
    self.iface.mapCanvas().mouseMoveEvent(event)
RuntimeError: no access to protected functions or signals for objects not created from Python

Python version:
2.7.5 (default, Aug 25 2013, 00:04:04) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

QGIS version:
2.1.0-Master Master, 

Python path: ['/usr/local/Cellar/qgis-20/HEAD/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing', '/usr/local/Cellar/qgis-20/HEAD/QGIS.app/Contents/MacOS/../Resources/python', u'/Users/timlinux/.qgis2/python', u'/Users/timlinux/.qgis2/python/plugins', '/usr/local/Cellar/qgis-20/HEAD/QGIS.app/Contents/MacOS/../Resources/python/plugins', '/Library/Python/2.7/site-packages/pip-1.5-py2.7.egg', '/Library/Python/2.7/site-packages/psycopg2-2.5.2-py2.7-macosx-10.9-intel.egg', '/Library/Python/2.7/site-packages/setuptools-2.1-py2.7.egg', '/usr/local/lib/python2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/usr/local/lib/python2.7/site-packages/wx-3.0-osx_cocoa', '/Users/timlinux/.qgis2/python/plugins/inasafe-dev', '/Users/timlinux/.qgis2/python/plugins/inasafe-dev/third_party', '/usr/local/Cellar/qgis-20/HEAD/QGIS.app/Contents/Resources/python/plugins/fTools/tools']

Tested with 960ac8c3f6aa4cab823d37145b43db12617746ac Tested using QGIS Master

olivierdalang commented 10 years ago

Here I don't get this error (under Windows 7)... Maybe it's a mac-only problem ?

I'm not really sure on how to workaround this problem without modifying the core (having public methods for mouseMoveEvents). Anyone on this ?

mach0 commented 10 years ago

Confirmed the same error on Linux (LinuxMint Debian Edition) QGIS master qgis/QGIS@d0d5581

An error has occured while executing Python code:

Traceback (most recent call last): File "/home/macho/.qgis2/python/plugins/CadInput/CadGhostWidget.py", line 168, in mouseMoveEvent self.iface.mapCanvas().mouseMoveEvent(event) RuntimeError: no access to protected functions or signals for objects not created from Python

Python version: 2.7.6 (default, Jan 11 2014, 14:36:30) [GCC 4.8.2]

QGIS version: 2.1.0-Master Master, d0d5581

Python path: ['/home/macho/.qgis2/python/plugins/processing', '/opt/qgismaster/share/qgis/python', u'/home/macho/.qgis2/python', u'/home/macho/.qgis2/python/plugins', '/opt/qgismaster/share/qgis/python/plugins', '/opt/qgismaster/share/qgis/python', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/home/macho/.qgis2/python/plugins/mmqgis/forms', '/home/macho/.qgis2/python/plugins/DigitizingTools/tools', '/opt/qgismaster/share/qgis/python/plugins/fTools/tools', '~/.qgis/python', '/home/macho']

olivierdalang commented 10 years ago

I'm not able to reproduce here under Ubuntu 12.04 in QGIS dev... That's strange !

A possible workaround may be using QtCore.QCoreApplication.postEvent(self, mouseMoveEvent ).

Does the problem occur all the time and prevent using the plugin, or does it still work afterwards ?

timlinux commented 10 years ago

Hi

On Mon, Jan 27, 2014 at 6:36 PM, olivierdalang notifications@github.comwrote:

I'm not able to reproduce here under Ubuntu 12.04 in QGIS dev... That's strange !

A possible workaround may be using QtCore.QCoreApplication.postEvent(self, mouseMoveEvent ).

Does the problem occur all the time and prevent using the plugin, or does it still work afterwards ?

Yes it basically makes QGIS unusable as every time you move the mouse the message appears.

Regards

Tim

— Reply to this email directly or view it on GitHubhttps://github.com/olivierdalang/CadInput/issues/3#issuecomment-33385714 .

Tim Sutton - QGIS Project Steering Committee Member

Visit http://linfiniti.com to find out about:

olivierdalang commented 10 years ago

@timlinux @mach0

Ok I found a better way to do this... Before I change too many things, can you please test the branch testWithEventFilter ?

If it works, you should see red dots appearing at random in front of the mapCanvas, all mouse inputs will be shaky (but except that work as normal) and more importantly no Runtime error...

Thanks !!

timlinux commented 10 years ago

Hi

That resolves the exception but I am getting an orange circle flashing on the map as I move the cursor around.

Regards

Tim

On Tue, Jan 28, 2014 at 9:12 PM, olivierdalang notifications@github.comwrote:

@timlinux https://github.com/timlinux @mach0 https://github.com/mach0

Ok I found a better way to do this... Before I change too many things, can you please test the branch testWithEventFilter ?

If it works, you should see red dots appearing at random in front of the mapCanvas and more importantly no Runtime error...

Thanks !!

Reply to this email directly or view it on GitHubhttps://github.com/olivierdalang/CadInput/issues/3#issuecomment-33512852 .

Tim Sutton - QGIS Project Steering Committee Member

Visit http://linfiniti.com to find out about:

olivierdalang commented 10 years ago

@timlinux

I am getting an orange circle flashing on the map as I move the cursor around.

Ok that was expected, maybe it was a bit too artistic for a simple debug run ;)

@mach0 @timlinux I've rewritten the mouseEvent part, the problem should be solved (along with other small improvements) in master. Can you try it again ?