hide window, open file not folder

This commit is contained in:
j 2016-02-01 00:49:25 +05:30
parent e0ba5ec2b2
commit 0e3794e6a3
2 changed files with 13 additions and 2 deletions

View file

@ -61,7 +61,13 @@ def page(pdf, page):
'-scale-to', '1024', '-cropbox',
os.path.join(tmp, 'page')
]
p = subprocess.Popen(cmd, close_fds=True)
if sys.platform == 'win32':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
p = subprocess.Popen(cmd, close_fds=True, startupinfo=startupinfo)
else:
p = subprocess.Popen(cmd, close_fds=True)
p.wait()
image = glob('%s/*' % tmp)
if image:
@ -229,6 +235,11 @@ def extract_text(pdf):
if sys.platform == 'win32':
pdf = get_short_path_name(pdf)
cmd = ['pdftotext', pdf, '-']
if sys.platform == 'win32':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
stdout = stdout.decode()

View file

@ -368,7 +368,7 @@ def open_folder(folder=None, path=None):
elif sys.platform.startswith('linux'):
cmd += ['xdg-open', folder]
elif sys.platform == 'win32':
path = '\\'.join(folder.split('/'))
path = '\\'.join(path.split('/'))
os.system('explorer.exe /select,"%s"' % path)
cmd = []
else: