/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to revbrowser.py

Add options to viz treeview to not show the line graph, and to only show the main line.
Set the revision browser to use these options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from gi.repository import Gtk
18
 
 
 
17
import time
 
18
 
 
19
try:
 
20
    import pygtk
 
21
    pygtk.require("2.0")
 
22
except:
 
23
    pass
 
24
 
 
25
import gobject
 
26
import gtk
 
27
 
 
28
from bzrlib.osutils import format_date
19
29
from bzrlib.plugins.gtk.branchview.treeview import TreeView
20
 
from bzrlib.plugins.gtk.i18n import _i18n
21
 
 
22
 
 
23
 
class RevisionBrowser(Gtk.Dialog):
 
30
 
 
31
 
 
32
class RevisionBrowser(gtk.Dialog):
24
33
    """ Revision Browser main window. """
25
34
    def __init__(self, branch, parent=None):
26
 
        super(RevisionBrowser, self).__init__(
27
 
            title="Revision Browser - Olive", parent=parent,
28
 
            flags=Gtk.DialogFlags.MODAL,
29
 
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
30
 
 
 
35
        gtk.Dialog.__init__(self, title="Revision Browser - Olive",
 
36
                                  parent=parent,
 
37
                                  flags=gtk.DIALOG_MODAL,
 
38
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
 
39
    
31
40
        # Get arguments
32
41
        self.branch = branch
33
 
 
 
42
        
34
43
        # Create the widgets
35
 
        self._button_select = Gtk.Button(_i18n("_Select"), use_underline=True)
36
 
        start_revs = [branch.last_revision(),]
37
 
        self.treeview = TreeView(branch, start_revs, None)
38
 
 
 
44
        self._button_select = gtk.Button(_("_Select"), use_underline=True)
 
45
        self.treeview = TreeView(branch,branch.last_revision(), None)
 
46
        
39
47
        # Set callbacks
40
48
        self._button_select.connect('clicked', self._on_select_clicked)
41
49
        self.treeview.connect('revision-activated',
42
50
                               self._on_treeview_revision_activated)
43
 
 
 
51
        
44
52
        # Set properties
45
53
        self.set_default_size(600, 400)
46
 
        self.get_content_area().set_spacing(3)
 
54
        self.vbox.set_spacing(3)
47
55
        self.treeview.set_property('graph-column-visible', False)
48
56
        self.treeview.set_property('date-column-visible', True)
49
57
        self.treeview.set_property('mainline-only', True)
50
 
 
 
58
        
51
59
        # Construct the dialog
52
 
        self.action_area.pack_end(self._button_select, False, False, 0)
53
 
 
54
 
        self.get_content_area().pack_start(self.treeview, True, True, 0)
 
60
        self.action_area.pack_end(self._button_select)
 
61
        
 
62
        self.vbox.pack_start(self.treeview, True, True)
55
63
 
56
64
        # Show the dialog
57
65
        self.show_all()
58
66
 
59
 
 
 
67
    
60
68
    def _on_treeview_revision_activated(self, treeview, path, column):
61
69
        """ Double-click on a row should also select a revision. """
62
70
        self._on_select_clicked(treeview)
63
 
 
 
71
    
64
72
    def _on_select_clicked(self, widget):
65
73
        """ Select button clicked handler. """
66
 
 
 
74
        
67
75
        self.selected_revno = self.treeview.get_property('revision-number')
68
76
        self.selected_revid = \
69
77
                    self.treeview.get_property('revision').revision_id
70
 
        self.response(Gtk.ResponseType.OK)
 
78
        self.response(gtk.RESPONSE_OK)