Enhancement to matplotlib's PyQt4 backend

Hi Pierre,

Are you still maintaining the qt4 plot editor dialog? It doesn't
appear to be working properly: setting the marker and linestyle
options does not effect the plot (tested on Ubuntu Natty alpha, with
the v1.0.x branch on python-2.7 and PyQt4-4.8.3). I have a really hard
time following the code. Also, the dialog makes the qt4 backend
unusable with PyQt4's API v2, which does not provide a QString object.

Darren

Hi Pierre,

Are you still maintaining the qt4 plot editor dialog? It doesn't
appear to be working properly: setting the marker and linestyle
options does not effect the plot (tested on Ubuntu Natty alpha, with
the v1.0.x branch on python-2.7 and PyQt4-4.8.3).

Sorry, I think this was a mistake on my part...

I have a really hard
time following the code.

... but I do have a really hard time understanding the code.

Also, the dialog makes the qt4 backend
unusable with PyQt4's API v2, which does not provide a QString object.

This can be addressed with the following change, which I just

@@ -56,9 +56,9 @@ from PyQt4.QtGui import (QWidget, QLineEdit, QComboBox, QLabel
                          QPixmap, QTabWidget, QApplication, QStackedWidget,
                          QDateEdit, QDateTimeEdit, QFont, QFontComboBox,
                          QFontDatabase, QGridLayout)
-from PyQt4.QtCore import (Qt, SIGNAL, SLOT, QSize, QString,
+from PyQt4.QtCore import (Qt, SIGNAL, SLOT, QObject, QSize,
                           pyqtSignature, pyqtProperty)
import datetime

class ColorButton(QPushButton):
@@ -102,7 +102,8 @@ def text_to_qcolor(text):
     Avoid warning from Qt when an invalid QColor is instantiated
     """
     color = QColor()
- if isinstance(text, QString):
+ if isinstance(text, QObject):
+ # actually a QString, which is not provided by the new PyQt4 API:
         text = str(text)
     if not isinstance(text, (unicode, str)):
         return color

···

On Sun, Feb 27, 2011 at 3:27 PM, Darren Dale <dsdale24@...149...> wrote:

Hi Darren,

-----Message d'origine-----
De : Darren Dale [mailto:dsdale24@…149…]
Envoyé : dimanche 27 février 2011 22:02
À : Pierre Raybaut
Cc : matplotlib-devel
Objet : Re: [matplotlib-devel] Enhancement to matplotlib's
PyQt4 backend

> Hi Pierre,
>
> Are you still maintaining the qt4 plot editor dialog? It doesn't
> appear to be working properly: setting the marker and linestyle
> options does not effect the plot (tested on Ubuntu Natty
alpha, with
> the v1.0.x branch on python-2.7 and PyQt4-4.8.3).

Sorry, I think this was a mistake on my part...

> I have a really hard
> time following the code.

... but I do have a really hard time understanding the code.

Well it seems quite self-explanatory to me (especially the 'formlayout'
module which is very OO which tends to hide code complexity), hence the lack
of comments. But hey, I wrote it so I guess it's easier for me to read it.
Anyway, please don't hesitate to ask questions about the part of the code
that seems unclear.

> Also, the dialog makes the qt4 backend unusable with
PyQt4's API v2,
> which does not provide a QString object.

This can be addressed with the following change, which I just

@@ -56,9 +56,9 @@ from PyQt4.QtGui import (QWidget,
QLineEdit, QComboBox, QLabel
                          QPixmap, QTabWidget, QApplication,
QStackedWidget,
                          QDateEdit, QDateTimeEdit, QFont,
QFontComboBox,
                          QFontDatabase, QGridLayout) -from
PyQt4.QtCore import (Qt, SIGNAL, SLOT, QSize, QString,
+from PyQt4.QtCore import (Qt, SIGNAL, SLOT, QObject, QSize,
                           pyqtSignature, pyqtProperty)
import datetime

class ColorButton(QPushButton):
@@ -102,7 +102,8 @@ def text_to_qcolor(text):
     Avoid warning from Qt when an invalid QColor is instantiated
     """
     color = QColor()
- if isinstance(text, QString):
+ if isinstance(text, QObject):
+ # actually a QString, which is not provided by the
new PyQt4 API:
         text = str(text)
     if not isinstance(text, (unicode, str)):
         return color

This seems ok to me.

Cheers,
Pierre

···

On Sun, Feb 27, 2011 at 3:27 PM, Darren Dale > <dsdale24@...149...> wrote: