fix windows select folder
This commit is contained in:
parent
0062191db4
commit
ca35c413fe
4 changed files with 43 additions and 31 deletions
18
oml/utils.py
18
oml/utils.py
|
|
@ -409,6 +409,24 @@ def ctl(*args):
|
|||
subprocess.Popen([os.path.join(settings.base_dir, 'ctl')] + list(args),
|
||||
close_fds=True, start_new_session=True)
|
||||
|
||||
def ctl_output(*args):
|
||||
import settings
|
||||
if sys.platform == 'win32':
|
||||
platform_win32 = os.path.join('..', 'platform_win32')
|
||||
python = os.path.join(platform_win32, 'python.exe')
|
||||
cmd = [python, 'oml'] + list(args)
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||
p = subprocess.Popen(cmd, cwd=settings.base_dir, startupinfo=startupinfo,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
p = subprocess.Popen([os.path.join(settings.base_dir, 'ctl')] + list(args),
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
logger.debug('ctl_output%s -> %s [%s]', args, stdout, stderr)
|
||||
return stdout.decode('utf-8').strip()
|
||||
|
||||
def user_sort_key(u):
|
||||
return ox.sort_string(str(u.get('index', '')) + 'Z' + (u.get('name') or ''))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue