Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

settings: pass rcpath to SettingsForm

Dropped dependency to parent.confcombo and parent.root from SettingsForm.

Changeset 42ce4bfb9436

Parent 0b5e1d4edfa2

by Yuya Nishihara

Changes to one file · Browse files at 42ce4bfb9436 Showing diff from parent 0b5e1d4edfa2 Diff from another changeset...

 
475
476
477
478
 
 
479
480
481
 
 
 
482
483
484
 
566
567
568
569
 
570
571
 
 
 
 
 
572
573
574
 
591
592
593
594
595
596
597
598
 
625
626
627
628
629
630
631
632
633
634
635
636
637
 
475
476
477
 
478
479
480
481
 
482
483
484
485
486
487
 
569
570
571
 
572
573
574
575
576
577
578
579
580
581
582
 
599
600
601
 
 
602
603
604
 
631
632
633
 
 
 
 
 
 
 
634
635
636
@@ -475,10 +475,13 @@
    self.conftabs = QTabWidget()   layout.addWidget(self.conftabs) - self.conftabs.addTab(SettingsForm(focus=focus, parent=self), + self.conftabs.addTab(SettingsForm(rcpath=util.user_rcpath(), + focus=focus, parent=self),   _('User global settings'))   if repo: - self.conftabs.addTab(SettingsForm(focus=focus, parent=self), + reporcpath = os.sep.join([repo.root, '.hg', 'hgrc']) + self.conftabs.addTab(SettingsForm(rcpath=reporcpath, + focus=focus, parent=self),   _('%s repository settings') % hglib.tounicode(name))     # FIXME: workaround to sync tabs with combo; remove this later @@ -566,9 +569,14 @@
 class SettingsForm(QWidget):   """Widget for each settings file"""   - def __init__(self, focus=None, parent=None): + def __init__(self, rcpath, focus=None, parent=None):   super(SettingsForm, self).__init__(parent)   + if isinstance(rcpath, (list, tuple)): + self.rcpath = rcpath + else: + self.rcpath = [rcpath] +   layout = QVBoxLayout()   self.setLayout(layout)   @@ -591,8 +599,6 @@
    self.settings = parent.settings # FIXME   self.readonly = parent.readonly # FIXME - self.confcombo = parent.confcombo # FIXME - self.root = parent.root # FIXME     # add page items to treeview   for meta, info in INFO: @@ -625,13 +631,6 @@
  self.refresh()     def refresh(self, *args): - # determine target config file - if self.confcombo.currentIndex() == CONF_REPO: - repo = hg.repository(ui.ui(), self.root) - self.rcpath = [os.sep.join([repo.root, '.hg', 'hgrc'])] - else: - self.rcpath = util.user_rcpath() -   # refresh config values   self.ini = self.loadIniFile(self.rcpath)   for info, widgets in self.pages.values():