copy and paste in diamond tree produces different behaviour when object being pasted to is active or not

Bug #812348 reported by Cian Wilson
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Fraser Waters

Bug Description

NOTE: all of the above is with the released package of diamond (not any of the bugfix branches on which behaviour may have changed).

 - Take the attached schema and options file (dummy.rng and dummy.dml) and open them in diamond.
 - Copy the field "Something" (doesn't seem to matter if this is done using CTRL+C or using right-click).
 - Activate a new field.
 - Paste into the new field and all works well (the modified attribute gets set, the field information appears copied, you can save an reopen and all is well with the world).

Now, repeat but this time don't activate a new field, just paste to an inactive field. With both CTRL+C and right-click I get the terminal error:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/diamond/", line 680, in on_paste
  File "/usr/lib/python2.7/dist-packages/diamond/", line 1267, in expand_tree
    new_tree = parent_tree.add_inactive_instance(choice_or_tree)
  File "/usr/lib/python2.7/dist-packages/diamond/", line 323, in add_inactive_instance
    self.children.insert(self.children.index(tree)+1, new_tree)
ValueError: <diamond.tree.Tree instance at 0x1933998> is not in list

The new field is sort of activated (in that the plus has turned into a minus) but it appears blue (incomplete) and doesn't allow you to drop down the options beneath it. No modified attribute is set and closing doesn't prompt a save and doesn't modify the file.

If you force a save and close and reopen the file then the field now appears to have been copied successfully.

Related branches

Revision history for this message
Cian Wilson (cwilson) wrote :
Revision history for this message
Fraser Waters (fraser-waters08) wrote :

This is very odd. The paste code calls the same method as if clicking the + button before doing doing any of it's paste business.

Revision history for this message
Fraser Waters (fraser-waters08) wrote :

In light of paste generally behaving badly I've disabled the ability to paste into an inactive node. That counts as a fix doesn't it?
Once I've worked out exactly 'why' paste fails on inactive nodes I'll fix it but this is too minor to worry about.

Changed in spud:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → Fraser Waters (fraser-waters08)
Revision history for this message
Patrick Farrell (pefarrell) wrote :

OK. Cian's bug about the data saved not being correct still applied if it was pasted onto an active node, though.

Changed in spud:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.