Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

stable csinfo: add option to pass custom functions and use preset

Changeset 35c2f3bcc583

Parent b91879ee9ce2

by Yuki KODAMA

Changes to one file · Browse files at 35c2f3bcc583 Showing diff from parent b91879ee9ce2 Diff from another changeset...

 
196
197
198
199
200
 
 
201
202
203
 
260
261
262
263
 
264
265
266
 
271
272
273
274
 
275
276
277
 
279
280
281
282
 
283
284
285
 
290
291
292
293
 
294
295
296
 
317
318
319
320
 
321
322
323
 
384
385
386
387
388
 
 
389
390
391
 
 
392
393
394
 
 
395
396
397
 
196
197
198
 
 
199
200
201
202
203
 
260
261
262
 
263
264
265
266
 
271
272
273
 
274
275
276
277
 
279
280
281
 
282
283
284
285
 
290
291
292
 
293
294
295
296
 
317
318
319
 
320
321
322
323
 
384
385
386
 
 
387
388
389
 
 
390
391
392
 
 
393
394
395
396
397
@@ -196,8 +196,8 @@
  def __init__(self):   pass   - def get_data(self, item, *args): - widget, ctx, custom = args + def get_data(self, item, widget, ctx, custom, **kargs): + args = (widget, ctx, custom)   def default_func(widget, item, ctx):   return None   def preset_func(widget, item, ctx): @@ -260,7 +260,7 @@
  elif item == 'ishead':   return len(ctx.children()) == 0   raise UnknownItem(item) - if custom.has_key('data'): + if custom.has_key('data') and not kargs.get('usepreset', False):   try:   return custom['data'](widget, item, ctx)   except UnknownItem: @@ -271,7 +271,7 @@
  pass   return default_func(widget, item, ctx)   - def get_label(self, item, widget, ctx, custom): + def get_label(self, item, widget, ctx, custom, **kargs):   def default_func(widget, item):   return ''   def preset_func(widget, item): @@ -279,7 +279,7 @@
  return self.LABELS[item]   except KeyError:   raise UnknownItem(item) - if custom.has_key('label'): + if custom.has_key('label') and not kargs.get('usepreset', False):   try:   return custom['label'](widget, item)   except UnknownItem: @@ -290,7 +290,7 @@
  pass   return default_func(widget, item)   - def get_markup(self, item, widget, ctx, custom): + def get_markup(self, item, widget, ctx, custom, **kargs):   args = (widget, ctx, custom)   mono = dict(face='monospace', size='9000')   def default_func(widget, item, value): @@ -317,7 +317,7 @@
  value = self.get_data(item, *args)   if value is None:   return None - if custom.has_key('markup'): + if custom.has_key('markup') and not kargs.get('usepreset', False):   try:   return custom['markup'](widget, item, value)   except UnknownItem: @@ -384,14 +384,14 @@
  self.info = info   self.ctx = create_context(repo, self.target)   - def get_data(self, item): - return self.info.get_data(item, self, self.ctx, self.custom) + def get_data(self, item, **kargs): + return self.info.get_data(item, self, self.ctx, self.custom, **kargs)   - def get_label(self, item): - return self.info.get_label(item, self, self.ctx, self.custom) + def get_label(self, item, **kargs): + return self.info.get_label(item, self, self.ctx, self.custom, **kargs)   - def get_markup(self, item): - return self.info.get_markup(item, self, self.ctx, self.custom) + def get_markup(self, item, **kargs): + return self.info.get_markup(item, self, self.ctx, self.custom, **kargs)     def update(self, target=None, custom=None, repo=None):   if target is None: