PlotPyStack / guiqwt

Efficient 2D plotting Python library based on PythonQwt
https://pypi.python.org/pypi/guiqwt
Other
80 stars 20 forks source link

Documentation: add transition guide "Porting code from guiqwt 2 to guiqwt 3" #8

Closed picca closed 8 years ago

picca commented 9 years ago

Hello,

I am testing on of our application with the new guiqwt, but I get this error message.

Using experimental 'pure Python' qwt API Traceback (most recent call last): File "/home/experiences/sixs/com-sixs/Fitnxs/Fitnxs3.2.py", line 21, in from guiqwt.signals import (SIG_ACTIVE_ITEM_CHANGED,SIG_START_TRACKING, ImportError: cannot import name SIG_ACTIVE_ITEM_CHANGED

picca commented 9 years ago

so it seems that all these signales moved from guiqwt.signals to guiqwt.baseplot.

So I just need to do

but it does not work

Using experimental 'pure Python' qwt API Traceback (most recent call last): File "/home/experiences/sixs/com-sixs/Fitnxs/Fitnxs3.2.py", line 21, in from guiqwt.baseplot import (SIG_ACTIVE_ITEM_CHANGED,SIG_START_TRACKING, ImportError: cannot import name SIG_ACTIVE_ITEM_CHANGED

what is the right way to use the signals now ?

PierreRaybaut commented 9 years ago

The transition from guiqwt 2.3 to 2.4 will have to be documented and it will state that supporting PyQt5 forced me to switch from PyQt API 1 to API 2. So the old-style signals/slots (from PyQt4.QtCore import SIGNAL, SLOT) are no longer supported in guiqwt 2.4.

In other words, you have to switch to the new-style signals and slots: http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html#old-style-signals-and-slots

So, to make it work, you have to do something like this (it's actuall simpler because you have nothing to import): plot.SIG_ACTIVE_ITEM_CHANGED.connect(func_name) # where plot is the BasePlot instance and func_name the slot function

I'll close this issue as soon as this change is well documented.

picca commented 9 years ago

thanks for your help :)

PierreRaybaut commented 8 years ago

Done.

See here: http://pythonhosted.org/guiqwt/migrating_from_v2_to_v3.html