Changeset 010ea6f7ef2c…
Parent 6407690d1bfc…
by
Changes to one file · Browse files at 010ea6f7ef2c Showing diff from parent 6407690d1bfc Diff from another changeset...
@@ -264,6 +264,42 @@ return self.value() != self.curvalue
+class PathBrowser(QWidget):
+ def __init__(self, parent=None, **opts):
+ QWidget.__init__(self, parent, toolTip=opts['tooltip'])
+ self.opts = opts
+
+ self.lineEdit = QLineEdit()
+ self.browseButton = QPushButton(_('&Browse...'))
+ self.browseButton.clicked.connect(self.browse)
+
+ layout = QHBoxLayout()
+ layout.setContentsMargins(0, 0, 0, 0)
+ layout.addWidget(self.lineEdit)
+ layout.addWidget(self.browseButton)
+ self.setLayout(layout)
+
+ def browse(self):
+ dir = QFileDialog.getExistingDirectory(self, directory=self.lineEdit.text(),
+ options=QFileDialog.ShowDirsOnly)
+ if dir:
+ self.lineEdit.setText(dir)
+
+ ## common APIs for all edit widgets
+ def setValue(self, curvalue):
+ self.curvalue = curvalue
+ if curvalue:
+ self.lineEdit.setText(hglib.tounicode(curvalue))
+ else:
+ self.lineEdit.setText('')
+
+ def value(self):
+ utext = self.lineEdit.text()
+ return utext and hglib.fromunicode(utext) or None
+
+ def isDirty(self):
+ return self.value() != self.curvalue
+
def genEditCombo(opts, defaults=[]):
opts['canedit'] = True
opts['defaults'] = defaults
@@ -303,6 +339,9 @@def genBugTraqEdit(opts):
return BugTraqConfigureEntry(**opts)
+def genPathBrowser(opts):
+ return PathBrowser(**opts)
+
def findIssueTrackerPlugins():
plugins = bugtraq.get_issue_plugins_with_names()
names = [("%s %s" % (key[0], key[1])) for key in plugins]
@@ -691,7 +730,7 @@ 'added as bfiles')),
_fi(_('Size'), 'kilnbfiles.size', genEditCombo,
_('Files of at least the specified size (in megabytes) will be added as bfiles')),
- _fi(_('System Cache'), 'kilnbfiles.systemcache', genEditCombo,
+ _fi(_('System Cache'), 'kilnbfiles.systemcache', genPathBrowser,
_('Path to the directory where a system-wide cache of bfiles will be stored')),
)),
|
Loading...