diff --git a/API/utils.py b/API/utils.py index dd266b3..8aa0522 100644 --- a/API/utils.py +++ b/API/utils.py @@ -34,10 +34,6 @@ def restart_soffice() -> None: """ clean_temp_files() - subprocess.call( - f'xvfb-run -s="-ac" libreoffice --accept="socket,host={cnx.host},port={cnx.port};urp;StarOffice.ServiceManager" &', - shell=True - ) sleep(2) try: cnx.restart() diff --git a/docker-compose.yml b/docker-compose.yml index b71296c..d8809e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,6 @@ services: environment: - SECRET_KEY=$SECRET_KEY #command: "gunicorn -w 4 -b 0.0.0.0:8000 app:app" - #command: "supervisord -c /etc/supervisord.conf" - #command: "sleep 100000" - command: bash -c "gunicorn -D -w 4 -b 0.0.0.0:8000 app:app;/app/docker/office.sh" + #command: "supervisord -c /etc/supevisord/supervisord.conf" + command: "sleep 100000" + #command: bash -c "gunicorn -D -w 4 -b 0.0.0.0:8000 app:app;/app/docker/office.sh" diff --git a/docker/conf/supervisor/lotemplate.conf b/docker/conf/supervisor/lotemplate.conf new file mode 100644 index 0000000..a8e8de0 --- /dev/null +++ b/docker/conf/supervisor/lotemplate.conf @@ -0,0 +1,11 @@ +[program:lotemplate] +command=/app/bin/gunicorn -w 4 -b 0.0.0.0:8000 app:app +user = python +autostart=true +autorestart=false +startsecs=200 +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + + diff --git a/docker/conf/supervisor/office.conf b/docker/conf/supervisor/office.conf new file mode 100644 index 0000000..5309c3d --- /dev/null +++ b/docker/conf/supervisor/office.conf @@ -0,0 +1,11 @@ +[program:office] +command=/usr/bin/xvfb-run -a -s "-ac" libreoffice --display :99 --invisible --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" +user = python +autostart=true +autorestart=false +startsecs=20 +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + + diff --git a/docker/office.sh b/docker/office.sh index f0d4316..9d268ba 100755 --- a/docker/office.sh +++ b/docker/office.sh @@ -1,2 +1,5 @@ #!/bin/bash -/usr/bin/xvfb-run -a -s "-ac" libreoffice --display :99 --nologo --norestore --invisible --accept='socket,host=localhost,port=2002;urp;StarOffice.ServiceManager' +echo " libreoffice --display :99 --nologo --norestore --invisible --accept='socket,host=localhost,port=2002;urp;StarOffice.ServiceManager'" > /tmp/aa +env >> /tmp/aa + +libreoffice --display :99 --nologo --norestore --invisible --accept=\'socket,host=localhost,port=2002\;urp\;StarOffice.ServiceManager\' diff --git a/lotemplate/classes.py b/lotemplate/classes.py index 994274e..594ab3b 100644 --- a/lotemplate/classes.py +++ b/lotemplate/classes.py @@ -347,7 +347,11 @@ def text_fill(doc, variable: str, value: str) -> None: ] cursor = doc.CurrentController.ViewCursor - + print(os.environ) + oClip = self.cnx.ctx.getServiceManager().createInstanceWithContext("com.sun.star.datatransfer.clipboard.SystemClipboard", self.cnx.ctx) + print("################") + print(oClip.getContents()) + print(oClip.getContents()) for var_occurrence in var_occurrences: cursor.gotoRange(var_occurrence, False) self.cnx.dispatcher.executeDispatch(