From dfd1037f5b4e91304ee044b36fbee5c449b711ae Mon Sep 17 00:00:00 2001 From: l_samenv Date: Fri, 31 Jul 2026 14:02:30 +0200 Subject: [PATCH] adjust layout and show ELOG page with relevant procedure --- flaskserver.py | 21 ++-- templates/common.css | 129 +++++++++++------------ templates/common.html | 22 ++-- templates/dil5.css | 82 --------------- templates/dil5.html | 230 ------------------------------------------ templates/dil5.svg | 16 +-- templates/secop.js | 3 +- 7 files changed, 103 insertions(+), 400 deletions(-) delete mode 100644 templates/dil5.css delete mode 100644 templates/dil5.html diff --git a/flaskserver.py b/flaskserver.py index 0418344..af0b14b 100755 --- a/flaskserver.py +++ b/flaskserver.py @@ -9,10 +9,15 @@ from flask import Flask, render_template, request, redirect, jsonify app = Flask(__name__) class Args: - def __init__(self, name, port='8050', webport='8051'): + def __init__(self, name, port='', wsport=''): if '.' in name: - name, port = name.split('.') - webport = str(int(port) + 1) + # when called with service argument %i + posargs = f'{name}..'.split('.') + name, port, wsport = posargs[:3] + if not port: + port = '8050' + if not wsport: + wsport = str(int(port) + 1) args = dict( html = 'common.html', svg = 'common.svg', @@ -31,21 +36,23 @@ class Args: if '.' not in hostname: hostname += '.psi.ch' self.hostname = hostname - self.webport = webport + self.wsport = wsport self.port = int(port) self.html = args.pop('html') + args['name'] = name self.args = args args = Args(*sys.argv[1:]) - +print(args) @app.route('/') def index(): if request.args.get('tunneled'): - wsaddr = f'127.0.0.1:{args.webport}' + wsaddr = f'127.0.0.1:{args.wsport}' else: - wsaddr = f'{args.hostname}:{args.webport}' + wsaddr = f'{args.hostname}:{args.wsport}' + print(wsaddr, args.port, args.html, args.args) return render_template(f'{args.html}', wsaddr=wsaddr, **args.args) if __name__ == '__main__': diff --git a/templates/common.css b/templates/common.css index b66b13c..3c0b31e 100644 --- a/templates/common.css +++ b/templates/common.css @@ -1,79 +1,80 @@ -body, html { - height: 100%; + body, html { margin: 0; padding: 0; - background-color: #f7f7f7; + font-family: system-ui, sans-serif; + background: #f5f5f5; + } + + .page { display: flex; -} - -.svg-container { - flex: 2; + align-items: stretch; /* right column stretches to match left column's natural height */ height: 100%; - position: relative; - display: flex; -} + } -#pump-svg { - width: 100%; - height: 100%; - display: block; - border-radius: 12px; -} - -.control-panel { - flex: 1; + /* LEFT COLUMN: a flex column whose width shrinks to fit its widest + child. Since align-items defaults to "stretch", the other two + divs will stretch to match whatever width the svg establishes. */ + .left { display: flex; flex-direction: column; - align-items: center; - justify-content: flex-start; - padding: 10px; - background-color: #B8EBE5; -} + width: fit-content; /* shrink-to-fit content, i.e. the svg's width */ + } -.control-panel p { - font-size: 20px; - font-family:verdana; -} + .left > div { + background: #fff; + border: 1px solid #ccc; + border-radius: 6px; + box-sizing: border-box; + } + .top { + padding: 0.75rem 1rem; + text-align: center; + } -.control-panel h { - font-size: 32px; - font-family:verdana; -} + /* No padding here: the textarea itself becomes the full-width/height + box, so its dimensions can match the svg's rendered size exactly. */ + .bottom { + padding: 0; + } -.button-container { - display: flex; - flex-direction: rows; - gap: 10px; - margin-bottom: 20px; - font-size: 20px; - font-family:verdana; -} - -.control-button { - padding: 10px; - background-color: #AFB0B1; - color: black; + .bottom textarea { + display: block; + width: 100%; /* matches .bottom's width, which the flex-stretch + already ties to the svg's width */ + box-sizing: border-box; border: none; - border-radius: 5px; - cursor: pointer; - width: 100px; - font-weight: bold; -} + border-radius: inherit; + padding: 0.75rem 1rem; + font: inherit; + resize: none; /* prevent the user from breaking the matched size */ + } -.control-button:hover { - background-color: #DADBDC; -} + .svg-wrap { + padding: 0; /* let the svg define the box exactly */ + line-height: 0; /* avoid extra inline-svg whitespace gap */ + } -#outputtext { - width: 100%; - height: 200px; - resize: none; -} + .svg-wrap svg { + display: block; + /* intrinsic size set via width/height attributes below */ + } -.content-container { - display: flex; - flex-direction: row; - gap: 10px; - margin-bottom: 20px; -} + /* RIGHT COLUMN: takes remaining horizontal space AND stretches to + match the left column's full height (via .page's align-items: stretch) */ + .right { + flex: 1; + display: flex; /* so the iframe can fill 100% of it */ + background: #fff; + border: 1px solid #ccc; + border-radius: 6px; + padding: 0; + overflow: hidden; /* keep the iframe's corners inside the rounded border */ + } + + .right iframe { + flex: 1; + width: 100%; + height: 100%; + border: none; + } diff --git a/templates/common.html b/templates/common.html index 2a7156d..14df7bd 100644 --- a/templates/common.html +++ b/templates/common.html @@ -9,16 +9,22 @@ -
- {% include svg %} -
-
+ +
+
+
view only ACTIVE -
-

Status messages

- -
+
+
+ {% include svg %} +
+
+ +
+
+
+
diff --git a/templates/dil5.css b/templates/dil5.css deleted file mode 100644 index 391537a..0000000 --- a/templates/dil5.css +++ /dev/null @@ -1,82 +0,0 @@ -body, html { - height: 100%; - margin: 0; - padding: 0; - background-color: lightgrey; - display: flex; -} - -.svg-container { - flex: 2; - height: 100%; - position: relative; - display: flex; -} - -#pump-svg { - width: 100%; - height: 100%; - display: block; - border-radius: 12px; -} - -.control-panel { - flex: 1; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; - padding: 10px; - background-color: #B8EBE5; - border-radius: 12px; -} - -.control-panel p { - font-size: 20px; - font-family:verdana; -} - - -.control-panel h { - font-size: 32px; - font-family:verdana; -} - -.button-container { - display: flex; - flex-direction: rows; - gap: 10px; - margin-bottom: 20px; - font-size: 20px; - font-family:verdana; -} - -.control-button { - padding: 10px; - background-color: #AFB0B1; - color: black; - border: none; - border-radius: 5px; - cursor: pointer; - width: 100px; - font-weight: bold; -} - -.control-button:hover { - background-color: #DADBDC; -} - -#outputtext { - width: 100%; - height: 200px; - resize: none; - border-radius: 12px; -} - -.content-container { - display: flex; - flex-direction: row; - gap: 10px; - margin-bottom: 20px; -} - diff --git a/templates/dil5.html b/templates/dil5.html deleted file mode 100644 index 7a22be5..0000000 --- a/templates/dil5.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - Pump Control - - - -
- {% include svg_ui %} -
-

DIL5 Control

-

States

-
- - - - - -
-

Status messages

- -
-
- - - - - - - diff --git a/templates/dil5.svg b/templates/dil5.svg index a655782..a0cb0bc 100644 --- a/templates/dil5.svg +++ b/templates/dil5.svg @@ -1227,7 +1227,7 @@ d="m 26.050418,106.41723 -0.0049,2.16024 -0.0049,2.16023 -1.699686,-1.08467 -1.699686,-1.08468 1.704571,-1.07556 z m -6.818286,4.30549 0.003,-2.16022 0.003,-2.16023 1.701493,1.08304 1.701493,1.08304 -1.704571,1.07718 z" /> * mbar * mbar * mbar * mbar * mbar speed: * Hz current: * %