fix windows select folder

This commit is contained in:
j 2019-01-31 19:11:13 +05:30
commit ca35c413fe
4 changed files with 43 additions and 31 deletions

View file

@ -13,6 +13,7 @@ from oxtornado import actions
import item.api
import user.api
import update
import utils
import logging
logger = logging.getLogger(__name__)
@ -20,8 +21,8 @@ logger = logging.getLogger(__name__)
def win32_ui(type):
base = normpath(dirname(dirname(dirname(abspath(__file__)))))
cmd = [
join(base, 'platform_win32', 'python.exe'),
join(base, 'openmediablirary', 'oml', 'ui.py'), type
join('..', 'platform_win32', 'pythonw.exe'),
join('oml', 'ui.py'), type
]
return cmd
@ -31,14 +32,7 @@ def selectFolder(data):
path
}
'''
cmd = ['./ctl', 'ui', 'folder']
if sys.platform == 'win32':
cmd = win32_ui('folder')
if 'base' in data:
cmd += [data['base']]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
stdout, stderr = p.communicate()
path = stdout.decode('utf-8').strip()
path = utils.ctl_output('ui', 'folder')
if path == 'None':
path = None
return {
@ -53,14 +47,7 @@ def selectFile(data):
path
}
'''
cmd = ['./ctl', 'ui', 'file']
if sys.platform == 'win32':
cmd = win32_ui('file')
if 'base' in data:
cmd += [data['base']]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
path = stdout.decode('utf-8').strip()
path = utils.ctl_output('ui', 'file')
if path == 'None':
path = None
return {