summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-08-26 17:19:58 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-29 13:57:51 +0100
commit85cf4de96c686446b79a8f0c47e6343eb76aca3b (patch)
tree8569ce8f3f9290af8659964a448c16b5af33233c /bitbake
parentcd51ea63e63778a635cf30cee981dcaae1e0f5ac (diff)
downloadpoky-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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/runningbuild.py36
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 d9e9f26f19..97d1ebdd6f 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):
306 306
307 if event.button == 3: 307 if event.button == 3:
308 selection = super(RunningBuildTreeView, self).get_selection() 308 selection = super(RunningBuildTreeView, self).get_selection()
309 (model, iter) = selection.get_selected() 309 (model, it) = selection.get_selected()
310 if iter is not None: 310 if it is not None:
311 can_paste = model.get(iter, model.COL_LOG)[0] 311 can_paste = model.get(it, model.COL_LOG)[0]
312 if can_paste == 'pastebin': 312 if can_paste == 'pastebin':
313 # build a simple menu with a pastebin option 313 # build a simple menu with a pastebin option
314 menu = gtk.Menu() 314 menu = gtk.Menu()
315 menuitem = gtk.MenuItem("Copy")
316 menu.append(menuitem)
317 menuitem.connect("activate", self.copy_handler, (model, it))
318 menuitem.show()
315 menuitem = gtk.MenuItem("Send log to pastebin") 319 menuitem = gtk.MenuItem("Send log to pastebin")
316 menu.append(menuitem) 320 menu.append(menuitem)
317 menuitem.connect("activate", self.pastebin_handler, (model, iter)) 321 menuitem.connect("activate", self.pastebin_handler, (model, it))
318 menuitem.show() 322 menuitem.show()
319 menu.show() 323 menu.show()
320 menu.popup(None, None, None, event.button, event.time) 324 menu.popup(None, None, None, event.button, event.time)
321 325
326 def _add_to_clipboard(self, clipping):
327 """
328 Add the contents of clipping to the system clipboard.
329 """
330 clipboard = gtk.clipboard_get()
331 clipboard.set_text(clipping)
332 clipboard.store()
333
322 def pastebin_handler(self, widget, data): 334 def pastebin_handler(self, widget, data):
323 """ 335 """
324 Send the log data to pastebin, then add the new paste url to the 336 Send the log data to pastebin, then add the new paste url to the
325 clipboard. 337 clipboard.
326 """ 338 """
327 (model, iter) = data 339 (model, it) = data
328 paste_url = do_pastebin(model.get(iter, model.COL_MESSAGE)[0]) 340 paste_url = do_pastebin(model.get(it, model.COL_MESSAGE)[0])
329 341
330 # @todo Provide visual feedback to the user that it is done and that 342 # @todo Provide visual feedback to the user that it is done and that
331 # it worked. 343 # it worked.
332 print paste_url 344 print paste_url
333 345
334 clipboard = gtk.clipboard_get() 346 self._add_to_clipboard(paste_url)
335 clipboard.set_text(paste_url) 347
336 clipboard.store() 348 def clipboard_handler(self, widget, data):
349 """
350 """
351 (model, it) = data
352 message = model.get(it, model.COL_MESSAGE)[0]
353
354 self._add_to_clipboard(message)