Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc1, 0.4rc2, and 0.4rc3

hggtk/synch: save recently accessed remote paths

Changeset 334a659ba5e0

Parent 80aac712a85d

by TK Soh

Changes to one file · Browse files at 334a659ba5e0 Showing diff from parent 80aac712a85d Diff from another changeset...

Change 1 of 4 Show Entire File hggtk/​synch.py Stacked
 
20
21
22
23
 
24
25
26
 
28
29
30
31
 
32
33
34
35
 
 
 
 
 
 
 
36
37
38
 
123
124
125
 
 
 
126
127
128
 
413
414
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
417
418
 
20
21
22
 
23
24
25
26
 
28
29
30
 
31
32
33
34
 
35
36
37
38
39
40
41
42
43
44
 
129
130
131
132
133
134
135
136
137
 
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
@@ -20,7 +20,7 @@
 from mercurial import hg, ui, util  from dialog import error_dialog, question_dialog  from hglib import HgThread -from shlib import set_tortoise_icon +import shlib  import gtklib    class SynchDialog(gtk.Window): @@ -28,11 +28,17 @@
  """ Initialize the Dialog. """   gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)   - set_tortoise_icon(self, 'menusynch.ico') + shlib.set_tortoise_icon(self, 'menusynch.ico')   self.root = root   self.cwd = cwd   self.selected_path = None - + + # persistent app data + self._settings = shlib.Settings('synch') + if not 'src_paths' in self._settings: + self._settings['src_paths'] = [] + self.recent_paths = self._settings['src_paths'] +   self.set_default_size(610, 400)     self.paths = self._get_paths() @@ -123,6 +129,9 @@
  elif defpushrow is not None:   self._pathbox.set_active(defpushrow)   + for p in self.recent_paths: + self.pathlist.append([p]) +   # create checkbox to disable proxy   self._use_proxy = gtk.CheckButton("use proxy server")   if ui.ui().config('http_proxy', 'host', ''): @@ -413,6 +422,27 @@
  self.stbar.begin()   self.stbar.set_status_text('hg ' + ' '.join(cmd + [remote_path]))   + self._add_src_to_recent(remote_path) + + def _add_src_to_recent(self, src): + if os.path.exists(src): + src = os.path.abspath(src) + + srclist = [x[0] for x in self.pathlist] + if src in srclist: + return + + # update drop-down list + srclist.append(src) + srclist.sort() + self.pathlist.clear() + for p in srclist: + self.pathlist.append([p]) + + # save path to recent list in history + self.recent_paths.append(src) + self._settings.write() +   def write(self, msg, append=True):   msg = unicode(msg, 'iso-8859-1')   if append: