fix in doc file openning

This commit is contained in:
shrlnm 2023-02-12 12:37:57 +03:00
parent bf14602dae
commit a5f2720497

8
pyren3/mod_utils.py Executable file → Normal file
View File

@ -482,17 +482,17 @@ def kill_server():
os.kill(mod_globals.doc_server_proc.pid, signal.SIGTERM) os.kill(mod_globals.doc_server_proc.pid, signal.SIGTERM)
def show_doc( addr, id ): def show_doc( addr, id ):
if mod_globals.vin == '': if mod_globals.vin == '' and not mod_globals.opt_sd:
return return
if mod_globals.doc_server_proc == None: if mod_globals.doc_server_proc == None:
mod_globals.doc_server_proc = subprocess.Popen(["python", "-m", "SimpleHTTPServer", "59152"]) mod_globals.doc_server_proc = subprocess.Popen(["python", "-m", "SimpleHTTPServer", "59152"])
atexit.register(kill_server) atexit.register(kill_server)
if mod_globals.opt_sd: if mod_globals.opt_sd and id != '':
url = 'http://localhost:59152/doc/' + id[1:] + '.htm' url = 'http://127.0.0.1:59152/doc/' + id[1:] + '.htm'
else: else:
url = 'http://localhost:59152/doc/'+mod_globals.vin+'.htm'+id url = 'http://127.0.0.1:59152/doc/'+mod_globals.vin+'.htm'+id
webbrowser.open(url, new=0) webbrowser.open(url, new=0)