MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / ColorLayout

Class ColorLayout

lib/matplotlib/backends/qt_editor/_formlayout.py:106–129  ·  view source on GitHub ↗

Color-specialized QLineEdit layout

Source from the content-addressed store, hash-verified

104
105
106class ColorLayout(QtWidgets.QHBoxLayout):
107 """Color-specialized QLineEdit layout"""
108 def __init__(self, color, parent=None):
109 super().__init__()
110 assert isinstance(color, QtGui.QColor)
111 self.lineedit = QtWidgets.QLineEdit(
112 mcolors.to_hex(color.getRgbF(), keep_alpha=True), parent)
113 self.lineedit.editingFinished.connect(self.update_color)
114 self.addWidget(self.lineedit)
115 self.colorbtn = ColorButton(parent)
116 self.colorbtn.color = color
117 self.colorbtn.colorChanged.connect(self.update_text)
118 self.addWidget(self.colorbtn)
119
120 def update_color(self):
121 color = self.text()
122 qcolor = to_qcolor(color) # defaults to black if not qcolor.isValid()
123 self.colorbtn.color = qcolor
124
125 def update_text(self, color):
126 self.lineedit.setText(mcolors.to_hex(color.getRgbF(), keep_alpha=True))
127
128 def text(self):
129 return self.lineedit.text()
130
131
132def font_is_installed(font):

Callers 1

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…