dual text + button input
This commit is contained in:
parent
cbe5d30f44
commit
de67f202a8
2 changed files with 39 additions and 14 deletions
11
oml/api.py
11
oml/api.py
|
|
@ -40,6 +40,8 @@ def selectFolder(data):
|
|||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
|
||||
stdout, stderr = p.communicate()
|
||||
path = stdout.decode('utf-8').strip()
|
||||
if path == 'None':
|
||||
path = None
|
||||
return {
|
||||
'path': path
|
||||
}
|
||||
|
|
@ -60,12 +62,18 @@ def selectFile(data):
|
|||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
path = stdout.decode('utf-8').strip()
|
||||
if path == 'None':
|
||||
path = None
|
||||
return {
|
||||
'path': path
|
||||
}
|
||||
actions.register(selectFile, cache=False)
|
||||
|
||||
|
||||
def short_home(path):
|
||||
home = os.path.expanduser('~')
|
||||
if path and path.startswith(home):
|
||||
path = path.replace(home, '~')
|
||||
return path
|
||||
|
||||
def autocompleteFolder(data):
|
||||
'''
|
||||
|
|
@ -92,6 +100,7 @@ def autocompleteFolder(data):
|
|||
folders = [path] + folders
|
||||
else:
|
||||
folders = []
|
||||
folders = [short_home(f) for f in folders]
|
||||
return {
|
||||
'items': ox.sorted_strings(folders)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue