forked from M-Labs/artiq
applets: also accept '/' as dataset path separator for completion
This commit is contained in:
parent
e91961fbae
commit
063639662e
|
@ -206,11 +206,8 @@ class _AutoCompleteEdit(QtWidgets.QLineEdit):
|
||||||
|
|
||||||
def _insert_completion(self, completion):
|
def _insert_completion(self, completion):
|
||||||
parents = self._completer.completionPrefix()
|
parents = self._completer.completionPrefix()
|
||||||
try:
|
idx = max(parents.rfind("."), parents.rfind("/"))
|
||||||
idx = parents.rindex(".")
|
if idx >= 0:
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
parents = parents[:idx+1]
|
parents = parents[:idx+1]
|
||||||
completion = parents + completion
|
completion = parents + completion
|
||||||
|
|
||||||
|
@ -256,7 +253,7 @@ class _AutoCompleteEdit(QtWidgets.QLineEdit):
|
||||||
class _CompleterDelegate(QtWidgets.QStyledItemDelegate):
|
class _CompleterDelegate(QtWidgets.QStyledItemDelegate):
|
||||||
def createEditor(self, parent, option, index):
|
def createEditor(self, parent, option, index):
|
||||||
completer = QtWidgets.QCompleter()
|
completer = QtWidgets.QCompleter()
|
||||||
completer.splitPath = lambda path: path.split(".")
|
completer.splitPath = lambda path: path.replace("/", ".").split(".")
|
||||||
completer.setModelSorting(
|
completer.setModelSorting(
|
||||||
QtWidgets.QCompleter.CaseSensitivelySortedModel)
|
QtWidgets.QCompleter.CaseSensitivelySortedModel)
|
||||||
completer.setCompletionRole(QtCore.Qt.DisplayRole)
|
completer.setCompletionRole(QtCore.Qt.DisplayRole)
|
||||||
|
|
Loading…
Reference in New Issue