Changes op server voor plotter en uitlijning

This commit is contained in:
mt 2019-11-02 15:41:31 +01:00
parent 7d07edb5de
commit 9674e7bbe4
13 changed files with 23 additions and 13 deletions

View file

@ -164,7 +164,7 @@ class CentralManagement():
# park always triggers a plotter.finished after being processed # park always triggers a plotter.finished after being processed
elif signal.name[:4] == 'sqs.': elif signal.name[:4] == 'sqs.':
if signal.params['event']['HITId'] != self.currentHit.id: if signal.params['event']['HITId'] != self.currentHit.hit_id:
self.logger.warning(f"SQS hit.info hit_id != currenthit.id: {signal}, update status for older HIT") self.logger.warning(f"SQS hit.info hit_id != currenthit.id: {signal}, update status for older HIT")
sqsHit = self.store.getHitByRemoteId(signal.params['event']['HITId']) sqsHit = self.store.getHitByRemoteId(signal.params['event']['HITId'])
updateStatus = False updateStatus = False
@ -268,6 +268,8 @@ class CentralManagement():
# TODO: have HITStore/HIT take care of this by emitting a signal # TODO: have HITStore/HIT take care of this by emitting a signal
self.server.statusPage.set('hit_id', new_hit['HIT']['HITId']) self.server.statusPage.set('hit_id', new_hit['HIT']['HITId'])
self.server.statusPage.set('hit_created', self.currentHit.created_at) self.server.statusPage.set('hit_created', self.currentHit.created_at)
self.server.statusPage.set('fee', f"${self.currentHit.fee:.2f}")
self.server.statusPage.set('state', self.currentHit.getStatus())
# mturk.send_test_event_notification() # mturk.send_test_event_notification()
if self.config['amazon']['sqs_url']: if self.config['amazon']['sqs_url']:
@ -325,7 +327,7 @@ class CentralManagement():
cmd = [ cmd = [
'sudo', 'scanimage', '-d', 'epkowa', '--format', 'jpeg', 'sudo', 'scanimage', '-d', 'epkowa', '--format', 'jpeg',
'--resolution=100', '-l','20','-t','30','-x',str(185), '--resolution=100', '-l','18','-t','30','-x',str(185),
'-y',str(245) '-y',str(245)
] ]
self.logger.info(f"{cmd}") self.logger.info(f"{cmd}")
@ -343,7 +345,7 @@ class CentralManagement():
try: try:
f = io.BytesIO(o) f = io.BytesIO(o)
img = Image.open(f) img = Image.open(f)
img = img.transpose(Image.ROTATE_90) img = img.transpose(Image.ROTATE_90).transpose(Image.FLIP_TOP_BOTTOM)
img.save(filename) img.save(filename)
except Exception as e: except Exception as e:
self.logger.critical("Cannot create image from scan. Did scanner work?") self.logger.critical("Cannot create image from scan. Did scanner work?")

View file

@ -29,7 +29,11 @@ class Plotter:
def park(self): def park(self):
self.logger.info("Queue to park plotter") self.logger.info("Queue to park plotter")
self.goPark = True self.goPark = True
self.q.put([(1/2.54)/self.plotWidth + 1,0,0]) #self.q.put([(1/2.54)/self.plotWidth + 1,0,0])
absPlotWidth = 26.5/2.54
topLeft = absPlotWidth / self.plotWidth #ignore changes in config plotwidth
self.q.put([(1/2.54)/absPlotWidth + topLeft,0,0])
def start(self): def start(self):
try: try:
@ -130,8 +134,8 @@ class Plotter:
# if no info comes in for .5sec, plot that segment # if no info comes in for .5sec, plot that segment
segment = self.q.get(True, .5) segment = self.q.get(True, .5)
if self.goPark: #if self.goPark:
print("seg",segment) # print("seg",segment)
# change of pen state? draw previous segments! # change of pen state? draw previous segments!
if (segment[2] == 1 and not self.pen_down) or (segment[2] == 0 and self.pen_down) or len(segments) > 150: if (segment[2] == 1 and not self.pen_down) or (segment[2] == 0 and self.pen_down) or len(segments) > 150:

View file

@ -312,7 +312,6 @@ class BackendHandler(tornado.web.RequestHandler):
seconds = (hit.submit_hit_at - hit.accept_time).total_seconds() seconds = (hit.submit_hit_at - hit.accept_time).total_seconds()
duration_m = int(seconds/60) duration_m = int(seconds/60)
duration_s = max(int(seconds%60), 0) duration_s = max(int(seconds%60), 0)
print(duration_m, duration_s)
duration = (f"{duration_m}m" if duration_m else "") + f"{duration_s:02d}s" duration = (f"{duration_m}m" if duration_m else "") + f"{duration_s:02d}s"
else: else:
duration = "-" duration = "-"
@ -321,7 +320,7 @@ class BackendHandler(tornado.web.RequestHandler):
rows.append( rows.append(
f""" f"""
<tr><td></td><td>{hit.worker_id}</th> <tr><td></td><td>{hit.worker_id}</td>
<td>{hit.turk_ip}</td> <td>{hit.turk_ip}</td>
<td>{hit.turk_country}</td> <td>{hit.turk_country}</td>
<td>{fee}</td> <td>{fee}</td>

View file

@ -8,7 +8,7 @@
<body> <body>
<div id="wrapper"> <div id="wrapper">
<div id="logo"> <img src="amazon.svg" /> </div> <div id="header"><span id="aai">Artificial Artificial Intelligence</span> <img src="amazon.svg" /> </div>
<table> <table>
<thead> <thead>
<tr> <tr>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
www/font/FreeSans.ttf Normal file

Binary file not shown.

View file

@ -37,7 +37,7 @@
<span class="grid-item spec_value" id="hit_opened">&nbsp;</span> <span class="grid-item spec_value" id="hit_opened">&nbsp;</span>
<span class="grid-item spec_name" id="state_descriptor">task status</span> <span class="grid-item spec_name" id="state_descriptor">task status</span>
<span class="grid-item spec_value" id="state">&nbsp;</span> <span class="grid-item spec_value" id="state">&nbsp;</span>
<span class="grid-item spec_name" id="fee_descriptor">task fee</span> <span class="grid-item spec_name" id="fee_descriptor">calculated fee</span>
<span class="grid-item spec_value" id="fee">&nbsp;</span> <span class="grid-item spec_value" id="fee">&nbsp;</span>

View file

@ -11,7 +11,7 @@
:root{ :root{
--base-font-size: 22px; --base-font-size: 17px;
--spec_name-font-size: 120%; --spec_name-font-size: 120%;
--spec_value-font-size: 250%; --spec_value-font-size: 250%;
@ -21,7 +21,7 @@
/* /////// GAT VOORKANT PLEK & POSITIE //////// */ /* /////// GAT VOORKANT PLEK & POSITIE //////// */
/* */ /* */ /* */ /* */
/* */ --pos-x: 555px; /* */ /* */ --pos-x: 555px; /* */
/* */ --pos-y: 120px; /* */ /* */ --pos-y: 110px; /* */
/* */ --width: 420px; /* 115mm */ /* */ --width: 420px; /* 115mm */
/* */ --height: 1000px; /* 270mm */ /* */ --height: 1000px; /* 270mm */
/* */ /* */ /* */ /* */
@ -74,7 +74,7 @@ html, body{
.spec_value{ .spec_value{
font-size: var(--spec_value-font-size); font-size: var(--spec_value-font-size);
padding-bottom: 2%; padding-bottom: 3%;
} }
@ -91,3 +91,8 @@ html, body{
.narrative_phase_text{ .narrative_phase_text{
font-size: var(--spec_value-font-size); font-size: var(--spec_value-font-size);
} }
#hit_id{
font-size: 190%;
position: relative;
top: 5px;
}