Just for the sake of documenting things, when running qgis 2to3 on a plugin I encountered a tricky situation regarding signals.
|
MYQGISDIR/scripts/2to3 -f signals -w my/plugin/path |
The original code:
|
extra_arg = "my test argument" QObject.connect( action, SIGNAL( "triggered()"), lambda extra_arg=my_arg: show_extra_arg(extra_arg)) def do_load_project(extra_arg): print extra_arg # "my test argument" |
The generated code:
|
extra_arg = "test_arg" action.triggered.connect( lambda extra_arg=my_arg: show_extra_arg(extra_arg)) def do_load_project(extra_arg): print extra_arg # False |
so in do_load_project we get False instead of “my test…
See more ›