Initial commit for finalisation web interface
This commit is contained in:
1 parent
b295f871a7
commit
c36642e8de
33 files changed
+2745
-138
No files matched your search
@@ -0,0 +1,33 @@
|
||||
"""Optional browser workflow; all existing finalisation commands stay available."""
|
||||
from pathlib import Path
|
||||
import time
|
||||
import webbrowser
|
||||
|
||||
from copienator import evaluation_parser
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
parser = evaluation_parser('Open the local finalisation workspace')
|
||||
parser.add_argument('--annotation-dir', choices=('BGnot', 'Bnot'), default='BGnot')
|
||||
parser.add_argument('--no-browser', action='store_true')
|
||||
args = parser.parse_args(argv)
|
||||
from copienator.finalisation_server import WebSession
|
||||
session = None
|
||||
try:
|
||||
session = WebSession(Path(args.evaluation).resolve(), args.annotation_dir)
|
||||
print(session.url, flush=True)
|
||||
if not args.no_browser:
|
||||
webbrowser.open(session.url)
|
||||
while session.alive:
|
||||
time.sleep(.2)
|
||||
except KeyboardInterrupt:
|
||||
if session:
|
||||
print('Fermeture après la fin du traitement en cours…', flush=True)
|
||||
while session.service.job['running']:
|
||||
time.sleep(.2)
|
||||
session.request_stop()
|
||||
session.thread.join()
|
||||
except Exception as exc:
|
||||
print(f'Erreur : {exc}', flush=True)
|
||||
return 1
|
||||
return 0
|
||||
Reference in new issue
Block a user