Skip to contentSkip to conversation

Small UI patches

PATCH Applied Joshua Lock 2 participants 4 messages Aug 27, 2011 – Aug 29, 2011 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Small UI patches

Most interesting is the second patch to add a Copy item to the right-click menu for logs in RunningBuildTreeView.

This means users of hob and goggle can copy/paste the log contents right from the GUI as well as submitting the log contents to pastebin.

The following changes since commit 0423587db09f6f28cf9d801f5657a84157f42dbe:

hob: disable some menu entries whilst build is in progress (2011-08-24 19:32:42 -0700)

are available in the git repository at:
git://github.com/incandescant/bitbake hob
https://github.com/incandescant/bitbake/tree/hob

Joshua Lock (2):
ui/crumbs/tasklistmodel: don't add same item to binb column more than
once
ui/crumbs/runningbuild: add a 'Copy' item to the messages right-click
menu

 lib/bb/ui/crumbs/runningbuild.py  |   36 +++++++++++++++++++++++++++---------
 lib/bb/ui/crumbs/tasklistmodel.py |    5 +++--
 2 files changed, 30 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/2 ui/crumbs/tasklistmodel: don't add same item to binb column more than once

---
 lib/bb/ui/crumbs/tasklistmodel.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +3 -2
index 5ff1f5a..cf9fc59 100644
@@ -441,8 +441,9 @@ class TaskListModel(gtk.ListStore):
             self[item_path][self.COL_INC] = True
 
         bin = self[item_path][self.COL_BINB].split(', ')
-        bin.append(binb)
-        self[item_path][self.COL_BINB] = ', '.join(bin).lstrip(', ')
+        if not binb in bin:
+            bin.append(binb)
+            self[item_path][self.COL_BINB] = ', '.join(bin).lstrip(', ')
 
         # We want to do some magic with things which are brought in by the
         # base image so tag them as so
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/2 ui/crumbs/runningbuild: add a 'Copy' item to the messages right-click menu

In reply to Joshua Lock

Add another item to the right-click menu enabled for log messages to copy the message to the clipboard.

---
 lib/bb/ui/crumbs/runningbuild.py |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)
lib/bb/ui/crumbs/runningbuild.py +27 -9
index d9e9f26..97d1ebd 100644
@@ -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)
Signature · 1 line
1.7.6
#3 lore raw
In reply to Joshua Lock
Quoted 14 lines · Joshua Lock

Most interesting is the second patch to add a Copy item to the right-click menu for logs in RunningBuildTreeView.

This means users of hob and goggle can copy/paste the log contents right from the GUI as well as submitting the log contents to pastebin.

The following changes since commit 0423587db09f6f28cf9d801f5657a84157f42dbe:

hob: disable some menu entries whilst build is in progress (2011-08-24 19:32:42 -0700)

are available in the git repository at:
git://github.com/incandescant/bitbake hob
https://github.com/incandescant/bitbake/tree/hob

Quoted 5 lines

Joshua Lock (2):
ui/crumbs/tasklistmodel: don't add same item to binb column more than
once
ui/crumbs/runningbuild: add a 'Copy' item to the messages right-click
menu

Merged to master, thanks.

Richard