Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

cslist: introduce item selection feature

Changeset 61ad9d3469fd

Parent 9fd82fea6342

by Yuki KODAMA

Changes to one file · Browse files at 61ad9d3469fd Showing diff from parent 9fd82fea6342 Diff from another changeset...

 
32
33
34
 
35
36
37
 
165
166
167
168
169
 
 
170
171
 
 
 
 
 
 
 
 
 
 
172
173
 
174
175
176
 
230
231
232
 
233
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
236
237
 
259
260
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
263
264
 
32
33
34
35
36
37
38
 
166
167
168
 
 
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
 
184
185
186
187
 
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
 
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
@@ -32,6 +32,7 @@
  self.set_shadow_type(gtk.SHADOW_IN)     self.limit = 20 + self.sel_enable = False     # dnd variables   self.dnd_enable = False @@ -165,12 +166,22 @@
  style = compactview and self.lstyle or self.pstyle   factory = csinfo.factory(repo, withupdate=True)   - def add_csinfo(rev): - info = factory(rev, style) + def add_csinfo(item): + info = factory(item, style)   if info.parent:   info.parent.remove(info) + if self.sel_enable: + check = gtk.CheckButton() + check.set_active(True) + self.chkmap[item] = check + align = gtk.Alignment(0.5, 0) + align.add(check) + hbox = gtk.HBox() + hbox.pack_start(align, False, False) + hbox.pack_start(info, False, False) + info = hbox   self.csbox.pack_start(info, False, False, 2) - self.itemmap[rev] = info + self.itemmap[item] = info   def add_sep(show, *keys):   sep = FixedHSeparator(visible=show)   self.csbox.pack_start(sep, False, False) @@ -230,8 +241,24 @@
  self.currepo = None   self.timeout_queue = []   self.itemmap = {} + self.chkmap = {}   self.sepmap = {}   + def get_items(self, sel=False): + """ + Return a list of items or tuples contained 2 values: + 'item' (String) and 'selection state' (Boolean). + If cslist lists no items, it returns an empty list. + + sel: If True, it returns a list of tuples. Default: False. + """ + if self.curitems: + items = self.curitems + if not sel: + return items + return [(item, self.chkmap[item].get_active()) for item in items] + return [] +   def get_list_limit(self):   """ Return number of changesets to limit to display """   return self.limit @@ -259,6 +286,21 @@
  """   self.dnd_enable = enable   + def get_checkbox_enable(self): + """ Return whether the selection feature is enabled """ + return self.sel_enable + + def set_checkbox_enable(self, enable): + """ + Set whether the selection feature is enabled. + When it's enabled, checboxes will be shown in the left of + changeset panels. + + enable: Boolean, if True, the selection feature will be enabled. + Default: False. + """ + self.sel_enable = enable +   def has_limit(self):   """   Return whether the list shows all changesets.