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

stable history: add a combo box to filter text entry

This allows the user to quickly retrieve previous filtered views.

Fixes #748

Changeset 1e86a65248c8

Parent c4a0211f303b

by Steve Borho

Changes to one file · Browse files at 1e86a65248c8 Showing diff from parent c4a0211f303b Diff from another changeset...

 
353
354
355
 
 
 
 
 
 
 
 
 
356
357
358
359
360
361
362
 
 
 
 
 
 
 
 
 
 
 
363
364
365
 
443
444
445
 
 
 
446
 
 
447
448
449
450
451
 
 
452
453
454
455
456
457
458
459
460
 
461
462
463
 
1043
1044
1045
1046
 
 
 
 
 
 
 
 
1047
 
 
1048
1049
 
1050
1051
1052
 
353
354
355
356
357
358
359
360
361
362
363
364
365
366
 
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
 
462
463
464
465
466
467
468
469
470
471
472
473
 
 
474
475
476
477
478
479
480
481
 
 
 
482
483
484
485
 
1065
1066
1067
 
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
 
1080
1081
1082
1083
@@ -353,13 +353,32 @@
  if reload:   self.reload_log()   + def filter_entry_changed(self, entrycombo, filtercombo): + row = entrycombo.get_active() + if row < 0: + return + mode, text, display = entrycombo.get_model()[row] + filtercombo.set_active(mode) + entrycombo.child.set_text(text) + self.activate_filter(text, mode) +   def filter_entry_activated(self, entry, combo):   'User pressed enter in the filter entry' - opts = {}   mode = combo.get_active()   text = entry.get_text()   if not text:   return + row = [mode, text, combo.get_active_text()] + model = self.entrycombo.get_model() + for r in model: + if r[0] == row[0] and r[1] == row[1]: + break + else: + self.entrycombo.get_model().append( row ) + self.activate_filter(text, mode) + + def activate_filter(self, text, mode): + opts = {}   if mode == 0: # Rev Range   try:   opts['revlist'] = cmdutil.revrange(self.repo, [text]) @@ -443,21 +462,24 @@
  self.pats = []     opts = self.opts + if 'bundle' in opts: + self.set_bundlefile(opts['bundle']) + self.bundle_autoreject = True   if opts['filehist']: + file = opts['filehist'] + opts['pats'] = [file]   self.custombutton.set_active(True)   self.filter = 'custom'   self.filtercombo.set_active(1) - self.filterentry.set_text(opts['filehist']) - opts['pats'] = [opts['filehist']] + self.filterentry.set_text(file) + self.filter_entry_activated(self.filterentry, self.filtercombo)   elif self.pats:   self.custombutton.set_active(True)   self.filter = 'custom'   self.filtercombo.set_active(1)   self.filterentry.set_text(', '.join(self.pats))   opts['pats'] = self.pats - if 'bundle' in opts: - self.set_bundlefile(opts['bundle']) - self.bundle_autoreject = True + self.filter_entry_activated(self.filterentry, self.filtercombo)   else:   self.reload_log(**opts)   @@ -1043,10 +1065,19 @@
  self.filtercombo = filtercombo   filterbox.append_widget(filtercombo, padding=0)   - entry = gtk.Entry() + searchlist = gtk.ListStore(int, # filtercombo value + str, # search string (utf-8) + str) # mode string (utf-8) + entrycombo = gtk.ComboBoxEntry(searchlist, 1) + cell = gtk.CellRendererText() + entrycombo.pack_end(cell, False) + entrycombo.add_attribute(cell, 'text', 2) + entry = entrycombo.child   entry.connect('activate', self.filter_entry_activated, filtercombo) + entrycombo.connect('changed', self.filter_entry_changed, filtercombo) + self.entrycombo = entrycombo   self.filterentry = entry - filterbox.append_widget(entry, expand=True, padding=0) + filterbox.append_widget(entrycombo, expand=True, padding=0)     midpane = gtk.VBox()   midpane.pack_start(syncbox, False)