summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-08-26 17:19:58 -0700
committerJoshua Lock <josh@linux.intel.com>2011-08-26 17:29:59 -0700
commit419b52e832f506504778d4d5957d1e77477bb513 (patch)
tree3fadd2b70622047bf19c18eff4cfddc8513f0fb7
parent5e95098be1c1f92c2d72fb371c94bab31c46cf83 (diff)
downloadbitbake-419b52e832f506504778d4d5957d1e77477bb513.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. Signed-off-by: Joshua Lock <josh@linux.intel.com>
-rw-r--r--lib/bb/ui/crumbs/runningbuild.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/bb/ui/crumbs/runningbuild.py b/lib/bb/ui/crumbs/runningbuild.py
index d9e9f26f1..97d1ebdd6 100644
--- a/lib/bb/ui/crumbs/runningbuild.py
+++ b/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)