Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.2 and tip

stable settings: provide radio buttons for Boolean options

Changeset 3758eb51979c

Parent 437a4f0708db

by David Golub

Changes to one file · Browse files at 3758eb51979c Showing diff from parent 437a4f0708db Diff from another changeset...

 
102
103
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
106
107
 
299
300
301
302
 
303
304
305
306
 
307
308
309
 
407
408
409
410
 
411
412
413
414
415
416
 
417
418
419
 
420
421
422
 
423
424
425
 
441
442
443
444
 
445
446
447
 
451
452
453
454
 
455
456
457
 
490
491
492
493
 
494
495
496
 
505
506
507
508
 
509
510
511
 
530
531
532
533
 
534
535
536
 
596
597
598
599
 
600
601
602
 
616
617
618
619
 
620
621
622
 
625
626
627
628
 
629
630
631
 
632
633
634
 
635
636
637
 
638
639
640
 
641
642
643
 
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
 
336
337
338
 
339
340
 
 
 
341
342
343
344
 
442
443
444
 
445
446
447
448
449
450
 
451
452
453
 
454
455
456
 
457
458
459
460
 
476
477
478
 
479
480
481
482
 
486
487
488
 
489
490
491
492
 
525
526
527
 
528
529
530
531
 
540
541
542
 
543
544
545
546
 
565
566
567
 
568
569
570
571
 
631
632
633
 
634
635
636
637
 
651
652
653
 
654
655
656
657
 
660
661
662
 
663
664
665
 
666
667
668
 
669
670
671
 
672
673
674
 
675
676
677
678
@@ -102,6 +102,43 @@
  def isDirty(self):   return self.value() != self.curvalue   +class BoolRBGroup(QWidget): + def __init__(self, parent=None, **opts): + QWidget.__init__(self, parent, toolTip=opts['tooltip']) + self.opts = opts + self.curvalue = None + + self.trueRB = QRadioButton(_('&True')) + self.falseRB = QRadioButton(_('&False')) + self.unspecRB = QRadioButton(_('&Unspecified')) + + layout = QHBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self.trueRB) + layout.addWidget(self.falseRB) + layout.addWidget(self.unspecRB) + self.setLayout(layout) + + ## common APIs for all edit widgets + def setValue(self, curvalue): + self.curvalue = curvalue + if curvalue == 'True': + self.trueRB.setChecked(True) + elif curvalue == 'False': + self.falseRB.setChecked(True) + else: + self.unspecRB.setChecked(True) + + def value(self): + if self.trueRB.isChecked(): + return 'True' + elif self.falseRB.isChecked(): + return 'False' + else: + return None + + def isDirty(self): + return self.value() != self.curvalue    class PasswordEntry(QLineEdit):   def __init__(self, parent=None, **opts): @@ -299,11 +336,9 @@
  opts['nohist'] = True   return SettingsCombo(**opts)   -def genBoolCombo(opts): +def genBoolRBGroup(opts):   'true, false, unspecified' - opts['defaults'] = ['True', 'False'] - opts['nohist'] = True - return SettingsCombo(**opts) + return BoolRBGroup(**opts)    def genDeferredCombo(opts, func):   'Values retrieved from a function at popup time' @@ -407,19 +442,19 @@
  _('Specify the number of spaces that tabs expand to in various '   'TortoiseHg windows. '   'Default: 0, Not expanded')), - _fi(_('Force Repo Tab'), 'tortoisehg.forcerepotab', genBoolCombo, + _fi(_('Force Repo Tab'), 'tortoisehg.forcerepotab', genBoolRBGroup,   _('Always show repo tabs, even for a single repo. Default: False')),   _fi(_('Max Diff Size'), 'tortoisehg.maxdiff', genIntEditCombo,   _('The maximum size file (in KB) that TortoiseHg will '   'show changes for in the changelog, status, and commit windows. '   'A value of zero implies no limit. Default: 1024 (1MB)')), - _fi(_('Fork GUI'), 'tortoisehg.guifork', genBoolCombo, + _fi(_('Fork GUI'), 'tortoisehg.guifork', genBoolRBGroup,   _('When running from the command line, fork a background '   'process to run graphical dialogs. Default: True')), - _fi(_('Full Path Title'), 'tortoisehg.fullpath', genBoolCombo, + _fi(_('Full Path Title'), 'tortoisehg.fullpath', genBoolRBGroup,   _('Show a full directory path of the repository in the dialog title '   'instead of just the root directory name. Default: False')), - _fi(_('Auto-resolve merges'), 'tortoisehg.autoresolve', genBoolCombo, + _fi(_('Auto-resolve merges'), 'tortoisehg.autoresolve', genBoolRBGroup,   _('Indicates whether TortoiseHg should attempt to automatically '   'resolve changes from both sides to the same file, and only report '   'merge conflicts when this is not possible. When False, all files ' @@ -441,7 +476,7 @@
  'repository. You can select the "current" (i.e. the working directory '   'parent), the current "tip" or the working directory ("workingdir"). '   'Default: current')), - _fi(_('Author Coloring'), 'tortoisehg.authorcolor', genBoolCombo, + _fi(_('Author Coloring'), 'tortoisehg.authorcolor', genBoolRBGroup,   _('Color changesets by author name. If not enabled, '   'the changes are colored green for merge, red for '   'non-trivial parents, black for normal. ' @@ -451,7 +486,7 @@
  _('Show tabs along the side of the bottom half of each repo '   'widget allowing one to switch task tabs without using the toolbar. '   'Default: off')), - _fi(_('Long Summary'), 'tortoisehg.longsummary', genBoolCombo, + _fi(_('Long Summary'), 'tortoisehg.longsummary', genBoolRBGroup,   _('If true, concatenate multiple lines of changeset summary '   'until they reach 80 characters. '   'Default: False')), @@ -490,7 +525,7 @@
  _('Suggested length of commit message lines. A red vertical '   'line will mark this length. CTRL-E will reflow the current '   'paragraph to the specified line length. Default: 80')), - _fi(_('Close After Commit'), 'tortoisehg.closeci', genBoolCombo, + _fi(_('Close After Commit'), 'tortoisehg.closeci', genBoolRBGroup,   _('Close the commit tool after every successful '   'commit. Default: False')),   _fi(_('Push After Commit'), 'tortoisehg.cipushafter', (genEditCombo, @@ -505,7 +540,7 @@
  _('Comma separated list of files that are automatically unchecked '   'when the status, and commit dialogs are opened. '   'Default: None (leave blank)')), - _fi(_('English Messages'), 'tortoisehg.engmsg', genBoolCombo, + _fi(_('English Messages'), 'tortoisehg.engmsg', genBoolRBGroup,   _('Generate English commit messages even if LANGUAGE or LANG '   'environment variables are set to a non-English language. '   'This setting is used by the Merge, Tag and Backout dialogs. ' @@ -530,7 +565,7 @@
  _('Comma separated list of archive formats allowed for '   'downloading')),   _fi(_('Port'), 'web.port', genIntEditCombo, _('Port to listen on')), - _fi(_('Push Requires SSL'), 'web.push_ssl', genBoolCombo, + _fi(_('Push Requires SSL'), 'web.push_ssl', genBoolRBGroup,   _('Whether to require that inbound pushes be transported '   'over SSL to prevent password sniffing.')),   _fi(_('Stripes'), 'web.stripes', genIntEditCombo, @@ -596,7 +631,7 @@
  _fi(_('SMTP Port'), 'smtp.port', genIntEditCombo,   _('Port to connect to on mail server. '   'Default: 25')), - _fi(_('SMTP TLS'), 'smtp.tls', genBoolCombo, + _fi(_('SMTP TLS'), 'smtp.tls', genBoolRBGroup,   _('Connect to mail server using TLS. '   'Default: False')),   _fi(_('SMTP Username'), 'smtp.username', genEditCombo, @@ -616,7 +651,7 @@
  'crlf. Strict does no normalization. Auto does per-file '   'detection, and is the recommended setting. '   'Default: strict')), - _fi(_('Git Format'), 'diff.git', genBoolCombo, + _fi(_('Git Format'), 'diff.git', genBoolRBGroup,   _('Use git extended diff header format. '   'Default: False')),   _fi(_('MQ Git Format'), 'mq.git', (genDefaultCombo, @@ -625,19 +660,19 @@
  " preserving existing git patches upon qrefresh. If set to 'yes' or"   " 'no', mq will override the [diff] section and always generate git or"   " regular patches, possibly losing data in the second case.")), - _fi(_('No Dates'), 'diff.nodates', genBoolCombo, + _fi(_('No Dates'), 'diff.nodates', genBoolRBGroup,   _('Do not include modification dates in diff headers. '   'Default: False')), - _fi(_('Show Function'), 'diff.showfunc', genBoolCombo, + _fi(_('Show Function'), 'diff.showfunc', genBoolRBGroup,   _('Show which function each change is in. '   'Default: False')), - _fi(_('Ignore White Space'), 'diff.ignorews', genBoolCombo, + _fi(_('Ignore White Space'), 'diff.ignorews', genBoolRBGroup,   _('Ignore white space when comparing lines. '   'Default: False')), - _fi(_('Ignore WS Amount'), 'diff.ignorewsamount', genBoolCombo, + _fi(_('Ignore WS Amount'), 'diff.ignorewsamount', genBoolRBGroup,   _('Ignore changes in the amount of white space. '   'Default: False')), - _fi(_('Ignore Blank Lines'), 'diff.ignoreblanklines', genBoolCombo, + _fi(_('Ignore Blank Lines'), 'diff.ignoreblanklines', genBoolRBGroup,   _('Ignore changes whose lines are all blank. '   'Default: False')),   )),