Skip to content

Commit 2620922

Browse files
committed
Reinstate accidentally deleted code
1 parent b0ad594 commit 2620922

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/backends/qt4_editor/formlayout.py

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
STDERR = sys.stderr
5050

5151
from matplotlib.backends.qt4_compat import QtGui,QtCore
52+
from matplotlib.colors import rgb2hex
53+
5254
if not hasattr(QtGui,'QFormLayout'):
5355
raise ImportError, "Warning: formlayout requires PyQt4 >v4.3 or PySide"
5456

@@ -103,6 +105,10 @@ def set_color(self, color):
103105

104106
color = QtCore.Property("QColor", get_color, set_color)
105107

108+
def col2hex(color):
109+
"""Convert matplotlib color to hex before passing to Qt"""
110+
return rgb2hex(colorConverter.to_rgb(color))
111+
106112
def to_qcolor(color):
107113
"""Create a QColor from a matplotlib color"""
108114
qcolor = QtGui.QColor()

0 commit comments

Comments
 (0)