From e520ee8fa9464dd15aa8c8087ced21233830b18e Mon Sep 17 00:00:00 2001
From: Daniel Francis <francis@sugarlabs.org>
Date: Sat, 2 Mar 2013 11:45:11 -0200
Subject: [PATCH Log] Add button to hide list
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
---
logviewer.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/logviewer.py b/logviewer.py
index 79a9648..d698bf0 100644
a
|
b
|
def _notify_response_cb(notify, response, activity): |
50 | 50 | activity.remove_alert(notify) |
51 | 51 | |
52 | 52 | |
53 | | class MultiLogView(Gtk.HPaned): |
| 53 | class MultiLogView(Gtk.Paned): |
54 | 54 | |
55 | 55 | def __init__(self, paths, extra_files): |
56 | 56 | GObject.GObject.__init__(self) |
| 57 | self.set_orientation(Gtk.Orientation.HORIZONTAL) |
57 | 58 | |
58 | 59 | self.paths = paths |
59 | 60 | self.extra_files = extra_files |
… |
… |
class MultiLogView(Gtk.HPaned): |
99 | 100 | if len(self.extra_files): |
100 | 101 | self.extra_iter = self._treemodel.append(None, [_('Other')]) |
101 | 102 | |
102 | | scroll = Gtk.ScrolledWindow() |
103 | | scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) |
104 | | scroll.add(self._treeview) |
105 | | scroll.set_size_request(Gdk.Screen.width() * 30 / 100, -1) |
| 103 | self.list_scroll = Gtk.ScrolledWindow() |
| 104 | self.list_scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) |
| 105 | self.list_scroll.add(self._treeview) |
| 106 | self.list_scroll.set_size_request(Gdk.Screen.width() * 30 / 100, -1) |
106 | 107 | |
107 | | self.add1(scroll) |
| 108 | self.add1(self.list_scroll) |
108 | 109 | |
109 | 110 | def _build_textview(self): |
110 | 111 | self._textview = Gtk.TextView() |
… |
… |
class LogActivity(activity.Activity): |
399 | 400 | |
400 | 401 | toolbar_box.toolbar.insert(activity_button, -1) |
401 | 402 | |
| 403 | show_list = ToggleToolButton('view-list') |
| 404 | show_list.set_active(True) |
| 405 | show_list.set_tooltip(_('Show Playlist')) |
| 406 | show_list.connect('toggled', self._list_toggled_cb) |
| 407 | toolbar_box.toolbar.insert(show_list, -1) |
| 408 | show_list.show() |
| 409 | |
402 | 410 | copy = CopyButton() |
403 | 411 | copy.connect('clicked', self.__copy_clicked_cb) |
404 | 412 | toolbar_box.toolbar.insert(copy, -1) |
… |
… |
class LogActivity(activity.Activity): |
453 | 461 | toolbar_box.show_all() |
454 | 462 | self.set_toolbar_box(toolbar_box) |
455 | 463 | |
| 464 | def _list_toggled_cb(self, widget): |
| 465 | if widget.get_active(): |
| 466 | self.viewer.list_scroll.show() |
| 467 | else: |
| 468 | self.viewer.list_scroll.hide() |
| 469 | |
456 | 470 | def __copy_clicked_cb(self, button): |
457 | 471 | if self.viewer.active_log: |
458 | 472 | self.viewer.active_log.copy_clipboard(self.clipboard) |