qt4_editor broken: `TransformNode instances can not be copied` #1714

Closed
mspacek opened this Issue Jan 28, 2013 · 5 comments

2 participants

@mspacek

I keep finding more bugs when clicking on the "Edit curves line and axes parameter" button in a figure (see #1690). Plotting with this:

x = np.arange(0, 1, 0.1)
plot(x, sin(x))
plot(x, cos(x))

and then clicking the button raises a NotImplementedError:

Traceback (most recent call last):
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/backend_qt4.py", line 577, in edit_parameters
    figureoptions.figure_edit(axes, self)
    icon=get_icon('qt4_editor_options.svg'), apply=apply_callback)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 514, in fedit
    dialog = FormDialog(data, title, comment, icon, parent, apply)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 420, in __init__
    parent=self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 396, in __init__
    widget = FormWidget(data, comment=comment, parent=self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 235, in __init__
    self.data = deepcopy(data)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 230, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 174, in deepcopy
    y = copier(memo)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/transforms.py", line 119, in __copy__
    "Consider using frozen() instead.")
NotImplementedError: TransformNode instances can not be copied. Consider using frozen() instead.

A quick search using "transform" and "NotImplementedError" brought up PR #1579 from 2 months ago.

@efiring
Matplotlib Developers member

What version of mpl are you using? I can't reproduce this problem with 1.2.x.

@mspacek

I'm running off of master, so 1.3.x I guess. Qt4 backend on Ubuntu 12.10, Python 2.7.

@mspacek

Things seem to be getting worse. I just updated from master, and now even a simple single line plot raises the same error:

Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylab import *
>>> plot(range(10))
[<matplotlib.lines.Line2D object at 0x295dc90>]
>>> Traceback (most recent call last):
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/backend_qt4.py", line 586, in edit_parameters
    figureoptions.figure_edit(axes, self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py", line 134, in figure_edit
    icon=get_icon('qt4_editor_options.svg'), apply=apply_callback)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 514, in fedit
    dialog = FormDialog(data, title, comment, icon, parent, apply)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 420, in __init__
    parent=self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 396, in __init__
    widget = FormWidget(data, comment=comment, parent=self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 235, in __init__
    self.data = deepcopy(data)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 230, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 174, in deepcopy
    y = copier(memo)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/transforms.py", line 119, in __copy__
    "Consider using frozen() instead.")
NotImplementedError: TransformNode instances can not be copied. Consider using frozen() instead.

Other than for an empty figure, I can't find a case when clicking on the edit parameters button works any more. Even just calling plot() and clicking the button raises the same error. Can anyone else reproduce this?

@mspacek

This was caused by #1644. Changing axes.get_title() to axes.get_title().get_text() around line 49 in figureoptions.py fixes it. Seems a bit ridiculous to me.

@efiring
Matplotlib Developers member

Fixed by #1832

@efiring efiring closed this Mar 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment