diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-08-26 17:19:58 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-08-29 13:57:51 +0100 |
commit | 85cf4de96c686446b79a8f0c47e6343eb76aca3b (patch) | |
tree | 8569ce8f3f9290af8659964a448c16b5af33233c | |
parent | cd51ea63e63778a635cf30cee981dcaae1e0f5ac (diff) | |
download | ast2050-yocto-poky-85cf4de96c686446b79a8f0c47e6343eb76aca3b.zip ast2050-yocto-poky-85cf4de96c686446b79a8f0c47e6343eb76aca3b.tar.gz |
ui/crumbs/runningbuild: add a 'Copy' item to the messages right-click menu
Add another item to the right-click menu enabled for log messages to copy
the message to the clipboard.
(Bitbake rev: 419b52e832f506504778d4d5957d1e77477bb513)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index d9e9f26..97d1ebd 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py @@ -306,31 +306,49 @@ class RunningBuildTreeView (gtk.TreeView): if event.button == 3: selection = super(RunningBuildTreeView, self).get_selection() - (model, iter) = selection.get_selected() - if iter is not None: - can_paste = model.get(iter, model.COL_LOG)[0] + (model, it) = selection.get_selected() + if it is not None: + can_paste = model.get(it, model.COL_LOG)[0] if can_paste == 'pastebin': # build a simple menu with a pastebin option menu = gtk.Menu() + menuitem = gtk.MenuItem("Copy") + menu.append(menuitem) + menuitem.connect("activate", self.copy_handler, (model, it)) + menuitem.show() menuitem = gtk.MenuItem("Send log to pastebin") menu.append(menuitem) - menuitem.connect("activate", self.pastebin_handler, (model, iter)) + menuitem.connect("activate", self.pastebin_handler, (model, it)) menuitem.show() menu.show() menu.popup(None, None, None, event.button, event.time) + def _add_to_clipboard(self, clipping): + """ + Add the contents of clipping to the system clipboard. + """ + clipboard = gtk.clipboard_get() + clipboard.set_text(clipping) + clipboard.store() + def pastebin_handler(self, widget, data): """ Send the log data to pastebin, then add the new paste url to the clipboard. """ - (model, iter) = data - paste_url = do_pastebin(model.get(iter, model.COL_MESSAGE)[0]) + (model, it) = data + paste_url = do_pastebin(model.get(it, model.COL_MESSAGE)[0]) # @todo Provide visual feedback to the user that it is done and that # it worked. print paste_url - clipboard = gtk.clipboard_get() - clipboard.set_text(paste_url) - clipboard.store() + self._add_to_clipboard(paste_url) + + def clipboard_handler(self, widget, data): + """ + """ + (model, it) = data + message = model.get(it, model.COL_MESSAGE)[0] + + self._add_to_clipboard(message) |