fixes not concerning graphics
- default is no graphics - use send_file instead of response (proper mimetype) - fix issues with parameter blocks
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
<span class="start-text-wrapper">select instrument</span>
|
||||
</div>
|
||||
<div class="start-content">
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8850/SEAWebClient.html")>DMC</div>
|
||||
<!-- div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8850/SEAWebClient.html") -->
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8851/SEAWebClient.html")>HRPT</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8852/SEAWebClient.html")>ZEBRA</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8853/SEAWebClient.html")>POLDI</div>
|
||||
@ -27,7 +27,7 @@
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8856/SEAWebClient.html")>RITA2</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8857/SEAWebClient.html")>EIGER</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8858/SEAWebClient.html")>SANS 1</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8859/SEAWebClient.html")>SANS 2</div>
|
||||
<!-- div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8859/SEAWebClient.html") -->
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8860/SEAWebClient.html")>AMOR</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8861/SEAWebClient.html")>BOA</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8849/SEAWebClient.html")>PREP0</div>
|
||||
@ -40,6 +40,10 @@
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8807/SEAWebClient.html")>PREP7</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8808/SEAWebClient.html")>PREP8</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8809/SEAWebClient.html")>PREP9</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8821/SEAWebClient.html")>PREPA</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8822/SEAWebClient.html")>PREPB</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8823/SEAWebClient.html")>PREPC</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8824/SEAWebClient.html")>PREPD</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8810/SEAWebClient.html")>LAB0</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8811/SEAWebClient.html")>LAB1</div>
|
||||
<div class="start-row-links start-link" tabindex = 0 onclick = followLink("http://samenv.psi.ch:8812/SEAWebClient.html")>LAB2</div>
|
||||
|
@ -224,7 +224,7 @@ function updateValues(message, src) {
|
||||
} else if (type == "checkbox") {
|
||||
var row = matches[j].parentNode.parentNode;
|
||||
row.style.backgroundColor = "white";
|
||||
console.log('CBX', matches[j].name, message, Boolean(value && value != 'false'));
|
||||
// console.log('CBX', matches[j].name, message, Boolean(value && value != 'false'));
|
||||
matches[j].checked = Boolean(value && value != 'false');
|
||||
} else if (type == "enum") {
|
||||
matches[j].style.display = "block";
|
||||
@ -287,15 +287,18 @@ function successHandler(s, message) {
|
||||
insertSlide(2, "", "parameters", createContent(2, {components:[]}));
|
||||
} else {
|
||||
if (s < 0) { // redraw: check for slides in all swiper instances
|
||||
// not used any more?
|
||||
for (var isw = 0; isw < MAXBLOCK; isw ++) {
|
||||
var isl = findSlide(isw, message.path);
|
||||
var slide = swiper[isl].slides[i];
|
||||
if (isl !== null) {
|
||||
var slide = swiper[isw].slides[isl];
|
||||
if (slide) {
|
||||
console.log("redraw", isw);
|
||||
console.log("redraw", isw, isl);
|
||||
replaceSlideContent(slide, message.title,
|
||||
createContent(isw, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// insertSlide(s, message.title, message.path, createContent(s, message));
|
||||
let sLocal = paramSlider[s];
|
||||
|
@ -798,6 +798,7 @@ let graphs = (function (){
|
||||
}
|
||||
|
||||
function resizeHandler() {
|
||||
if (blocks) { // prevent error when graphics are not used
|
||||
createGraphs();
|
||||
adjustLegends();
|
||||
if (cursorLinePos) {
|
||||
@ -806,6 +807,7 @@ let graphs = (function (){
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener('resize', resizeHandler);
|
||||
|
||||
let frontLegend = null;
|
||||
|
@ -75,7 +75,7 @@ function create_group_row(s, component) {
|
||||
slideNames[s] = component.name;
|
||||
document.title = "SEA "+ clientTitle + " " + slideNames.join(" ");
|
||||
history.pushState({func: "gotoGroups", funarg: slideNames.join("%20")}, document.title, "#" + slideNames.join("%20"));
|
||||
getGroup(s, name);
|
||||
getGroup(s, component.name);
|
||||
}
|
||||
|
||||
if (title === "console" || title === "device config") {
|
||||
@ -139,7 +139,6 @@ function create_pushbutton_row(s, component) {
|
||||
var name = component.name;
|
||||
var command = component.command;
|
||||
var left = createTitle(component);
|
||||
console.log(info);
|
||||
|
||||
left.id = component.name;
|
||||
left.name = component.title;
|
||||
@ -187,7 +186,7 @@ function create_input_row(s, component) {
|
||||
var name = component.name;
|
||||
var command = component.command;
|
||||
|
||||
if (info) {
|
||||
if (component.info) {
|
||||
var infoBox = createInfo(component);
|
||||
}
|
||||
var left = createTitle(component);
|
||||
|
@ -75,7 +75,7 @@ new Settings()
|
||||
.treat("showMain", "sm", to_bool, true)
|
||||
.treat("showConsole", "sc", to_bool, true)
|
||||
.treat("showOverview", "so", to_bool, true)
|
||||
.treat("showGraphics", "sg", to_bool, true)
|
||||
.treat("showGraphics", "sg", to_bool, false)
|
||||
.treat("showAsync", "sa", to_bool, false)
|
||||
|
||||
function loadFirstBlocks() {
|
||||
|
@ -171,7 +171,7 @@ function getSlideNames() {
|
||||
for (var s=0; s<MAXBLOCK; s++) {
|
||||
var sw = swiper[s];
|
||||
var name = "";
|
||||
if (sw.activeIndex != defaultSlidePos(s)) {
|
||||
if (sw.activeIndex != defaultSlidePos(s) && sw.slides.length > 0) {
|
||||
name = sw.slides[sw.activeIndex].slideType;
|
||||
}
|
||||
names.push();
|
||||
|
28
seaweb.py
Normal file → Executable file
28
seaweb.py
Normal file → Executable file
@ -37,6 +37,7 @@ def guess_mimetype(filename):
|
||||
mimetype = 'text/css'
|
||||
elif filename.endswith('.ico'):
|
||||
mimetype = 'image/x-icon'
|
||||
print('mimetype', mimetype)
|
||||
else:
|
||||
mimetype = 'text/html'
|
||||
return mimetype
|
||||
@ -141,12 +142,7 @@ def reply():
|
||||
@app.route('/test/<file>')
|
||||
def subdir_test_file(file):
|
||||
gevent.sleep(2)
|
||||
try:
|
||||
with open("client/test/"+file, 'r') as content_file:
|
||||
content = content_file.read()
|
||||
except IOError:
|
||||
flask.abort(404)
|
||||
resp = flask.Response(content, mimetype=guess_mimetype(file))
|
||||
resp = flask.send_file("client/test/"+file, mimetype=guess_mimetype(file))
|
||||
return resp
|
||||
|
||||
@app.route('/jsFiles/<file>')
|
||||
@ -154,12 +150,7 @@ def subdir_test_file(file):
|
||||
@app.route('/externalFiles/<file>')
|
||||
def subdir_file(file):
|
||||
subdir = flask.request.path.split('/')[1]
|
||||
try:
|
||||
with open("client/" + subdir+"/"+file, 'r') as content_file:
|
||||
content = content_file.read()
|
||||
except IOError:
|
||||
flask.abort(404)
|
||||
resp = flask.Response(content, mimetype=guess_mimetype(file))
|
||||
resp = flask.send_file("client/" + subdir+"/"+file, mimetype=guess_mimetype(file))
|
||||
#resp.headers['Content-Security-Policy'] = "sandbox; script-src 'unsafe-inline';"
|
||||
return resp
|
||||
|
||||
@ -174,12 +165,7 @@ def default():
|
||||
@app.route('/<file>')
|
||||
def general_file(file):
|
||||
subdir = "client/"
|
||||
try:
|
||||
with open(subdir+file, 'r') as content_file:
|
||||
content = content_file.read()
|
||||
except IOError:
|
||||
flask.abort(404)
|
||||
resp = flask.Response(content, mimetype=guess_mimetype(file))
|
||||
resp = flask.send_file(subdir+file, mimetype=guess_mimetype(file))
|
||||
#resp.headers['Content-Security-Policy'] = "sandbox; script-src 'unsafe-inline';"
|
||||
return resp
|
||||
|
||||
@ -332,7 +318,7 @@ class SeaInstrument(Instrument):
|
||||
|
||||
def poll_groups(self, paths):
|
||||
'polls values and components of requested groups'
|
||||
for path in paths:
|
||||
for path in list(paths):
|
||||
gobj = self.groups[path]
|
||||
now = time.time()
|
||||
if now < gobj.lastpoll + 0.5:
|
||||
@ -627,7 +613,9 @@ class SeaClient(SeaGraph):
|
||||
|
||||
def w_getblock(self, path):
|
||||
gobj = instrument.findgroup(path.split(',')[-1])
|
||||
self.group_version[path] = gobj.version
|
||||
# self.group_version[path] = gobj.version
|
||||
# simplify: allow only one group per client
|
||||
self.group_version = {path: gobj.version}
|
||||
logging.info('getblock %s %d', path, gobj.version)
|
||||
return dict(type='draw', title=gobj.grouptitle, path=path, components=gobj.components)
|
||||
|
||||
|
Reference in New Issue
Block a user