/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 viz/branchwin.py

  • Committer: Daniel Schierbeck
  • Date: 2007-11-04 22:11:35 UTC
  • mto: (330.5.1 bzr-gtk-0.92.0)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: daniel.schierbeck@gmail.com-20071104221135-nsl6b5kxv73xdqlk
Support persistence of compact view option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from bzrlib.plugins.gtk.window import Window
18
18
from bzrlib.osutils import format_date
 
19
from bzrlib.config import GlobalConfig
19
20
 
20
21
from linegraph import linegraph, same_branch
21
22
from graphcell import CellRendererGraph
44
45
        self.branch      = branch
45
46
        self.start       = start
46
47
        self.maxnum      = maxnum
47
 
        self.brokenlines = 32
 
48
        self.config      = GlobalConfig()
 
49
 
 
50
        if self.config.get_user_option('viz-compact-view') == 'yes':
 
51
            self.compact_view = True
 
52
        else:
 
53
            self.compact_view = False
48
54
 
49
55
        self.set_title(branch.nick + " - revision history")
50
56
 
105
111
    def construct_top(self):
106
112
        """Construct the top-half of the window."""
107
113
        # FIXME: Make broken_line_length configurable
108
 
        self.treeview = TreeView(self.branch, self.start, self.maxnum, self.brokenlines)
 
114
        if self.compact_view:
 
115
            brokenlines = 32
 
116
        else:
 
117
            brokenlines = None
 
118
 
 
119
        self.treeview = TreeView(self.branch, self.start, self.maxnum, brokenlines)
109
120
 
110
121
        self.treeview.connect("revision-selected",
111
122
                self._treeselection_changed_cb)
140
151
 
141
152
        brokenlines_button = gtk.ToggleToolButton()
142
153
        brokenlines_button.set_label("Compact View")
143
 
        brokenlines_button.set_active(True)
 
154
        brokenlines_button.set_active(self.compact_view)
144
155
        brokenlines_button.set_is_important(True)
145
156
        brokenlines_button.connect('toggled', self._brokenlines_toggled_cb)
146
157
        self.toolbar.insert(brokenlines_button, -1)
194
205
        self.treeview.grab_focus()
195
206
 
196
207
    def _brokenlines_toggled_cb(self, button):
197
 
        if button.get_active():
198
 
            self.brokenlines = 32
 
208
        self.compact_view = button.get_active()
 
209
 
 
210
        if self.compact_view:
 
211
            option = 'yes'
199
212
        else:
200
 
            self.brokenlines = None
 
213
            option = 'no'
 
214
 
 
215
        self.config.set_user_option('viz-compact-view', option)
201
216
 
202
217
        revision = self.treeview.get_revision()
203
218