Simplify FilenamePrompt._insert_text
This commit is contained in:
parent
5b33978259
commit
60c6b7f0ab
@ -573,16 +573,11 @@ class FilenamePrompt(_BasePrompt):
|
|||||||
index: The QModelIndex of the selected element.
|
index: The QModelIndex of the selected element.
|
||||||
clicked: Whether the element was clicked.
|
clicked: Whether the element was clicked.
|
||||||
"""
|
"""
|
||||||
parts = []
|
path = os.path.normpath(self._file_model.filePath(index))
|
||||||
cur = index
|
|
||||||
while cur.isValid():
|
|
||||||
parts.append(cur.data())
|
|
||||||
cur = cur.parent()
|
|
||||||
path = os.path.normpath(os.path.join(*reversed(parts)))
|
|
||||||
if clicked:
|
if clicked:
|
||||||
path += os.sep
|
path += os.sep
|
||||||
|
|
||||||
log.prompt.debug('Clicked {!r} -> {}'.format(parts, path))
|
log.prompt.debug('Inserting path {}'.format(path))
|
||||||
self._lineedit.setText(path)
|
self._lineedit.setText(path)
|
||||||
self._lineedit.setFocus()
|
self._lineedit.setFocus()
|
||||||
if clicked:
|
if clicked:
|
||||||
|
Loading…
Reference in New Issue
Block a user