forked from M-Labs/artiq
gui/explorer: fix 'parent folder' on Windows
This commit is contained in:
parent
155c2ec2ef
commit
6973a9471b
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
from functools import partial
|
||||
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
@ -77,9 +78,12 @@ class _OpenFileDialog(QtWidgets.QDialog):
|
|||
if selected:
|
||||
selected = selected[0].text()
|
||||
if selected == "..":
|
||||
if (not self.explorer.current_directory
|
||||
or self.explorer.current_directory[-1] not in "\\/"):
|
||||
if not self.explorer.current_directory:
|
||||
return
|
||||
if re.fullmatch("[a-zA-Z]:\\\\",
|
||||
self.explorer.current_directory):
|
||||
self.explorer.current_directory = ""
|
||||
else:
|
||||
idx = None
|
||||
for sep in "\\/":
|
||||
try:
|
||||
|
@ -88,8 +92,6 @@ class _OpenFileDialog(QtWidgets.QDialog):
|
|||
pass
|
||||
else:
|
||||
break
|
||||
if idx is None:
|
||||
return
|
||||
self.explorer.current_directory = \
|
||||
self.explorer.current_directory[:idx+1]
|
||||
if self.explorer.current_directory == "/":
|
||||
|
|
Loading…
Reference in New Issue