Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91e1b96

Browse filesBrowse files
committed
Unbreak formlayout for image edits.
As of master, the qt editor is broken when editing an axes that contains an image throws an error when clicking OK. This is because `self.data` needs to be modified *in-place* in FormWidget.setup, as FormWidget.get later checks some explicit types in there. This means, as a side note, that passing a tuple instead of a list to generate a QComboBox is broken (one can test that by modifying the example at the bottom of the module -- the results are different depending on whether 'list2' is a list or a tuple) but that's something we can deal with some other day...
1 parent 4d299c6 commit 91e1b96
Copy full SHA for 91e1b96

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎lib/matplotlib/backends/qt_editor/formlayout.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/qt_editor/formlayout.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,14 @@ def setup(self):
243243
elif isinstance(value, str):
244244
field = QtWidgets.QLineEdit(value, self)
245245
elif isinstance(value, (list, tuple)):
246+
if isinstance(value, tuple):
247+
value = list(value)
248+
# Note: get() below checks the type of value[0] in self.data so
249+
# it is essential that value gets modified in-place.
250+
# This means that the code is actually broken in the case where
251+
# value is a tuple, but fortunately we always pass a list...
252+
selindex = value.pop(0)
246253
field = QtWidgets.QComboBox(self)
247-
selindex, *value = value
248254
if isinstance(value[0], (list, tuple)):
249255
keys = [key for key, _val in value]
250256
value = [val for _key, val in value]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.