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

settings: drop combobox to select "global" or "repo" scope

It's superseded by tab widget.
Now we don't need to refresh() changes on tab switch, because no values
forgotten.

Changeset 1cce2086d902

Parent 42ce4bfb9436

by Yuya Nishihara

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

 
449
450
451
452
453
454
455
456
457
458
459
460
461
462
 
464
465
466
467
 
468
469
470
471
472
473
 
484
485
486
487
488
489
490
491
492
493
 
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
 
 
 
517
518
519
520
521
522
523
 
 
524
525
526
 
530
531
532
533
534
535
536
 
 
537
538
539
 
 
540
541
542
 
449
450
451
 
 
 
 
 
 
 
 
452
453
454
 
456
457
458
 
459
460
461
 
462
463
464
 
475
476
477
 
 
 
 
478
479
480
 
482
483
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
486
487
488
489
490
491
492
 
 
493
494
495
496
497
 
501
502
503
 
 
504
 
505
506
507
508
 
509
510
511
512
513
@@ -449,14 +449,6 @@
  tophbox = QHBoxLayout()   layout.addLayout(tophbox)   - combo = QComboBox() - combo.addItem(_('User global settings')) - if repo: - combo.addItem(_('%s repository settings') % hglib.tounicode(name)) - else: - combo.setEnabled(False) - self.confcombo = combo -   # TODO: edit/reload button will be in tab widget   edit = QPushButton(_('Edit File'))   edit.clicked.connect(lambda: self.settingsform.editClicked()) # FIXME @@ -464,10 +456,9 @@
  reload = QPushButton(_('Reload'))   reload.clicked.connect(lambda: self.settingsform.reloadClicked()) # FIXME   self.reloadbtn = reload - tophbox.addWidget(combo) + tophbox.addStretch()   tophbox.addWidget(edit)   tophbox.addWidget(reload) - tophbox.addStretch(1)     s = QSettings()   self.settings = s @@ -484,10 +475,6 @@
  focus=focus, parent=self),   _('%s repository settings') % hglib.tounicode(name))   - # FIXME: workaround to sync tabs with combo; remove this later - self.confcombo.currentIndexChanged.connect(self.conftabs.setCurrentIndex) - self.conftabs.currentChanged.connect(self.confcombo.setCurrentIndex) -   BB = QDialogButtonBox   bb = QDialogButtonBox(BB.Ok|BB.Cancel)   self.connect(bb, SIGNAL("accepted()"), self, SLOT("accept()")) @@ -495,32 +482,16 @@
  layout.addWidget(bb)   self.bb = bb   - combo.setCurrentIndex(configrepo and CONF_REPO or CONF_GLOBAL) - combo.currentIndexChanged.connect(self.fileselect) - self.refresh() - - def fileselect(self, newindex): - 'select another hgrc file' - combo = self.confcombo - if self.isDirty(): - ret = qtlib.CustomPrompt(_('Confirm Switch'), - _('Switch after saving changes?'), self, - (_('&Save'), _('&Discard'), _('&Cancel')), - default=2, esc=2).run() - if ret == 2: - repo = newindex == CONF_GLOBAL - combo.setCurrentIndex(repo and CONF_REPO or CONF_GLOBAL) - return - elif ret == 0: - self.applyChanges() - self.refresh() + self.conftabs.setCurrentIndex(configrepo and CONF_REPO or CONF_GLOBAL) + self.conftabs.currentChanged.connect(self.refreshtitle) + self.refreshtitle()     @property   def settingsform(self): # FIXME: temporarily added; remove this later   return self.conftabs.currentWidget()   - def refresh(self, *args): - if self.confcombo.currentIndex() == CONF_REPO: + def refreshtitle(self, *args): + if self.conftabs.currentIndex() == CONF_REPO:   repo = hg.repository(ui.ui(), self.root)   name = hglib.get_reponame(repo)   self.setWindowTitle(_('TortoiseHg Configure Repository - ') + \ @@ -530,13 +501,13 @@
  self.setWindowTitle(_('TortoiseHg Configure User-Global Settings'))   #set_tortoise_icon(self, 'settings_user.ico')   - return self.settingsform.refresh() # FIXME -   def isDirty(self): - return self.settingsform.isDirty() # FIXME + return util.any(self.conftabs.widget(i).isDirty() + for i in xrange(self.conftabs.count()))     def applyChanges(self): - return self.settingsform.applyChanges() # FIXME + for i in xrange(self.conftabs.count()): + self.conftabs.widget(i).applyChanges()     def canExit(self):   if self.isDirty():