hide window, open file not folder
This commit is contained in:
parent
e0ba5ec2b2
commit
0e3794e6a3
2 changed files with 13 additions and 2 deletions
|
@ -61,6 +61,12 @@ def page(pdf, page):
|
|||
'-scale-to', '1024', '-cropbox',
|
||||
os.path.join(tmp, 'page')
|
||||
]
|
||||
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)
|
||||
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue