Merge lp:~spud/spud/copy-paste-fix into lp:spud

Proposed by Fraser Waters
Status: Merged
Merged at revision: 417
Proposed branch: lp:~spud/spud/copy-paste-fix
Merge into: lp:spud
Diff against target: 37 lines (+20/-0)
1 file modified
diamond/diamond/interface.py (+20/-0)
To merge this branch: bzr merge lp:~spud/spud/copy-paste-fix
Reviewer Review Type Date Requested Status
Stephan Kramer Approve
Review via email: mp+67851@code.launchpad.net

Description of the change

Copy paste signals were being swallowed by treeview and not going to other controls. This branch fixes that so the focused control gets copy paste signals.

To post a comment you must log in.
Revision history for this message
Stephan Kramer (s-kramer) wrote :

Just tried out your fix. Everything works again as expected. Thanks

Revision history for this message
Stephan Kramer (s-kramer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'diamond/diamond/interface.py'
--- diamond/diamond/interface.py 2011-07-11 11:11:00 +0000
+++ diamond/diamond/interface.py 2011-07-13 15:52:44 +0000
@@ -644,7 +644,21 @@
644 clipboard.set_text(name)644 clipboard.set_text(name)
645 clipboard.store()645 clipboard.store()
646646
647 def _get_focus_widget(self, parent):
648 """Gets the widget that is a child of parent with the focus."""
649 focus = parent.get_focus_child()
650 if focus is None or (focus.flags() & gtk.HAS_FOCUS):
651 return focus
652 else:
653 return self._get_focus_widget(focus)
654
647 def on_copy(self, widget=None):655 def on_copy(self, widget=None):
656
657 widget = self._get_focus_widget(self.main_window)
658 if widget is not self.treeview and gobject.signal_lookup("copy-clipboard", widget):
659 widget.emit("copy-clipboard")
660 return
661
648 if isinstance(self.selected_node, MixedTree):662 if isinstance(self.selected_node, MixedTree):
649 node = self.selected_node.parent663 node = self.selected_node.parent
650 else:664 else:
@@ -662,6 +676,12 @@
662 return676 return
663677
664 def on_paste(self, widget=None):678 def on_paste(self, widget=None):
679
680 widget = self._get_focus_widget(self.main_window)
681 if widget is not self.treeview and gobject.signal_lookup("paste-clipboard", widget):
682 widget.emit("paste-clipboard")
683 return
684
665 clipboard = gtk.clipboard_get()685 clipboard = gtk.clipboard_get()
666 ios = StringIO.StringIO(clipboard.wait_for_text())686 ios = StringIO.StringIO(clipboard.wait_for_text())
667 687

Subscribers

People subscribed via source and target branches