diff options
author | Cortland Setlow <cortland.setlow@gmail.com> | 2008-09-14 21:54:50 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2008-09-14 21:54:50 (GMT) |
commit | f330e843a221932632ef8593432e9c9f41ecd2a5 (patch) | |
tree | 8430d43c514d9cbca5b55f2ad636ca1b1307d83a | |
parent | 9852f4366fb15b170389558889f13ecd27904649 (diff) |
Add drop support to Terminal
-rw-r--r-- | terminal.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/terminal.py b/terminal.py index d239bc5..d737e59 100644 --- a/terminal.py +++ b/terminal.py @@ -114,10 +114,22 @@ class VTE(vte.Terminal): def __init__(self): vte.Terminal.__init__(self) self._configure_vte() - + self.drag_dest_set(gtk.DEST_DEFAULT_MOTION| + gtk.DEST_DEFAULT_DROP, + [('text/plain', 0, 0), + ('STRING', 0, 1)], + gtk.gdk.ACTION_DEFAULT| + gtk.gdk.ACTION_COPY) + self.connect('drag_data_received', self.data_cb) + os.chdir(os.environ["HOME"]) self.fork_command() - + + def data_cb(self, widget, context, x, y, selection, target, time): + self.feed_child(selection.data) + context.finish(True, False, time) + return True + def _configure_vte(self): conf = ConfigParser.ConfigParser() conf_file = os.path.join(env.get_profile_path(), 'terminalrc') |