PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 961 - QColor.__repr__/__str__ should be more pythonic
: QColor.__repr__/__str__ should be more pythonic
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.6
: All All
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-08-07 11:06 EEST by Farsmo
Modified: 2011-08-23 00:35 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Farsmo 2011-08-07 11:06:54 EEST
This was already mentioned in bug 593. QColor.__repr__ should have the same
behavior as

def __repr__(self):
    ctor, tuple = self.__reduce__()
    return "%s%r"%(ctor.full_name, tuple)
__str__ = __repr__
Comment 1 Farsmo 2011-08-11 10:04:06 EEST
By the way a naive repr(tuple) would not be a very good idea because of
floating point precision: we only need 6 digits precision as the internal state
of QColor is 16-bit fixed point.
Comment 2 renato filho 2011-08-16 20:41:20 EEST
fixed on pyside commit:

commit 6cdd438491ad7b127cc42151d2323b1bdf7db51d
Author: Renato Filho <renato.filho@openbossa.org>
Date:   Tue Aug 16 13:47:42 2011 -0300
Comment 3 Farsmo 2011-08-17 10:20:00 EEST
That was fast :-) There's a small typo that would result in a bug similar to
#960:

%CPPSELF.getHsvF(&amp;h, &amp;s, &amp;l, &amp;a);

should be

%CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);

You probably want to add extra tests to make absolutely sure HSV/CMYK/HSL works
properly.
Comment 4 renato filho 2011-08-17 23:50:35 EEST
I had fixed this on commit: 6cdd438491ad7b127cc42151d2323b1bdf7db51d
Comment 5 renato filho 2011-08-23 00:35:38 EEST
Released on PySide 1.0.6