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

fogcreek settings: add a browse button for the kbfiles system-wide cache path

Changeset 010ea6f7ef2c

Parent 6407690d1bfc

by David Golub

Changes to one file · Browse files at 010ea6f7ef2c Showing diff from parent 6407690d1bfc Diff from another changeset...

 
264
265
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
268
269
 
303
304
305
 
 
 
306
307
308
 
691
692
693
694
 
695
696
697
 
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
 
339
340
341
342
343
344
345
346
347
 
730
731
732
 
733
734
735
736
@@ -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')),   )),