/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/treeview.py

  • Committer: Daniel Schierbeck
  • Date: 2007-11-22 00:21:46 UTC
  • mto: This revision was merged to the branch mainline in revision 402.
  • Revision ID: daniel.schierbeck@gmail.com-20071122002146-0fplvawfgl2ul1xo
Made the compact view toggling cleaner.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
                                 'Date',
59
59
                                 'Show date column',
60
60
                                 False,
61
 
                                 gobject.PARAM_READWRITE)
 
61
                                 gobject.PARAM_READWRITE),
 
62
 
 
63
        'compact': (gobject.TYPE_BOOLEAN,
 
64
                    'Compact view',
 
65
                    'Break ancestry lines to save space',
 
66
                    True,
 
67
                    gobject.PARAM_CONSTRUCT | gobject.PARAM_READWRITE)
62
68
 
63
69
    }
64
70
 
71
77
                              ())
72
78
    }
73
79
 
74
 
    def __init__(self, branch, start, maxnum, broken_line_length=None):
 
80
    def __init__(self, branch, start, maxnum, compact=True):
75
81
        """Create a new TreeView.
76
82
 
77
83
        :param branch: Branch object for branch to show.
93
99
 
94
100
        self.start = start
95
101
        self.maxnum = maxnum
96
 
        self.broken_line_length = broken_line_length
 
102
        self.compact = compact
97
103
 
98
104
        gobject.idle_add(self.populate)
99
105
 
104
110
            return self.revno_column.get_visible()
105
111
        elif property.name == 'date-column-visible':
106
112
            return self.date_column.get_visible()
 
113
        elif property.name == 'compact':
 
114
            return self.compact
107
115
        elif property.name == 'branch':
108
116
            return self.branch
109
117
        elif property.name == 'revision':
122
130
            self.revno_column.set_visible(value)
123
131
        elif property.name == 'date-column-visible':
124
132
            self.date_column.set_visible(value)
 
133
        elif property.name == 'compact':
 
134
            self.compact = value
125
135
        elif property.name == 'branch':
126
136
            self.branch = value
127
137
        elif property.name == 'revision':
200
210
        :param broken_line_length: After how much lines branches \
201
211
                       should be broken.
202
212
        """
 
213
 
 
214
        if self.compact:
 
215
            broken_line_length = 32
 
216
        else:
 
217
            broken_line_length = None
 
218
 
203
219
        self.branch.lock_read()
204
220
        (linegraphdata, index, columns_len) = linegraph(self.branch.repository,
205
221
                                                        self.start,
206
222
                                                        self.maxnum, 
207
 
                                                        self.broken_line_length)
 
223
                                                        broken_line_length)
208
224
 
209
225
        self.model = TreeModel(self.branch.repository, linegraphdata)
210
226
        self.graph_cell.columns_len = columns_len