Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

thgconfig: add 'Set as default' button

Changeset 8465307f7850

Parent 9d864fae4837

by Yuki KODAMA

Changes to one file · Browse files at 8465307f7850 Showing diff from parent 9d864fae4837 Diff from another changeset...

 
618
619
620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
622
623
624
625
 
626
627
 
628
 
 
 
 
 
629
630
631
 
632
633
634
 
680
681
682
 
 
 
 
 
683
684
685
 
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
 
650
651
652
653
654
655
656
657
658
659
660
661
662
663
 
709
710
711
712
713
714
715
716
717
718
719
@@ -618,17 +618,46 @@
  dlg.run()   dlg.hide()   + def _default_path(self, *args): + selection = self.pathtree.get_selection() + if not selection.count_selected_rows(): + return + model, path = selection.get_selected() + if model[path][0] == 'default': + return + # collect rows has 'default' alias + rows = [row for row in model if row[0] == 'default'] + if len(rows) > 0: + ret = gdialog.Confirm(_('Confirm Overwrite'), [], self, + _("Overwirte existing 'default' path?")).run() + if ret != gtk.RESPONSE_YES: + return + # remove old default path + default_iter = rows[0].iter + del model[default_iter] + # set 'default' alias to selected path + model[path][0] = 'default' + self.refresh_path_list() + self.dirty_event() +   def _pathtree_changed(self, sel):   self.refresh_path_list()     def refresh_path_list(self):   """Update sensitivity of buttons""" + selection = self.pathtree.get_selection()   path_selected = (len(self.pathdata) > 0 - and self.pathtree.get_selection().count_selected_rows() > 0) + and selection.count_selected_rows() > 0)   repo_available = self.root is not None + if path_selected: + model, path = selection.get_selected() + default_path = model[path][0] == 'default' + else: + default_path = False   self._editpathbutton.set_sensitive(path_selected)   self._delpathbutton.set_sensitive(path_selected)   self._testpathbutton.set_sensitive(repo_available and path_selected) + self._defaultpathbutton.set_sensitive(not default_path and path_selected)     def fill_path_frame(self, frvbox):   frame = gtk.Frame(_('Remote repository paths')) @@ -680,6 +709,11 @@
  self._testpathbutton.connect('clicked', self._test_path)   buttonbox.pack_start(self._testpathbutton)   + self._defaultpathbutton = gtk.Button(_('Set as _default')) + self._defaultpathbutton.set_use_underline(True) + self._defaultpathbutton.connect('clicked', self._default_path) + buttonbox.pack_start(self._defaultpathbutton) +   vbox.pack_start(buttonbox, False, False, 4)     def set_help(self, widget, event, buffer, tooltip):