Changeset 3758eb51979c…
Parent 437a4f0708db…
by
Changes to one file · Browse files at 3758eb51979c Showing diff from parent 437a4f0708db Diff from another changeset...
|
|
@@ -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')),
)),
|
Loading...