From 3daf1636c1b24826f88cda324949c958a71750fa Mon Sep 17 00:00:00 2001 From: C. Scott Ananian Date: Thu, 27 Dec 2007 06:06:31 +0000 Subject: Support copy, paste, & drop in generated activities. Support drop on VTE in Pippy. --- (limited to 'pippy_app.py') diff --git a/pippy_app.py b/pippy_app.py index b311c0a..15d13b0 100644 --- a/pippy_app.py +++ b/pippy_app.py @@ -31,7 +31,7 @@ from gettext import gettext as _ from dbus.service import method, signal from dbus.gobject_service import ExportedGObject -from activity import ViewSourceActivity +from activity import ViewSourceActivity, TARGET_TYPE_TEXT from sugar.activity.activity import ActivityToolbox, \ get_bundle_path, get_bundle_name from sugar.presence import presenceservice @@ -183,6 +183,10 @@ class PippyActivity(ViewSourceActivity): []) self._vte.connect('child_exited', self.child_exited_cb) self._child_exited_handler = None + self._vte.drag_dest_set(gtk.DEST_DEFAULT_ALL, + [ ( "text/plain", 0, TARGET_TYPE_TEXT ) ], + gtk.gdk.ACTION_COPY) + self._vte.connect('drag_data_received', self.vte_drop_cb) outbox.pack_start(self._vte) outsb = gtk.VScrollbar(self._vte.get_adjustment()) @@ -224,6 +228,9 @@ class PippyActivity(ViewSourceActivity): # we've already joined self._joined_cb() + def vte_drop_cb(self, widget, context, x, y, selection, targetType, time): + if targetType == TARGET_TYPE_TEXT: + self._vte.feed_child(selection.data) def selection_cb(self, column): self.save() model, _iter = column.get_selected() -- cgit v0.9.1