@@ -61,7 +61,7 @@ def __init__(self, config_file, version):
6161 self ._message_timer .timeout .connect (self ._read_message_queue )
6262 self ._message_timer .start (MESSAGE_TIMER_PERIOD )
6363
64- self ._camera_switch . restart_live_capture_from_side ()
64+ self ._restart_live_capture_from_side ()
6565
6666 def _init_ui (self ):
6767 """ Create the basic elements of the user interface.
@@ -157,7 +157,7 @@ def _on_scan_action_clicked(self):
157157 if not self ._camera_capture_alive ():
158158 self ._initialise_scanner ()
159159
160- self ._camera_switch . restart_live_capture_from_side ()
160+ self ._restart_live_capture_from_side ()
161161
162162 def _on_options_action_clicked (self ):
163163 result_ok = self ._open_options_dialog ()
@@ -166,7 +166,7 @@ def _on_options_action_clicked(self):
166166
167167 self ._cleanup ()
168168 self ._initialise_scanner ()
169- self ._camera_switch . restart_live_capture_from_side ()
169+ self ._restart_live_capture_from_side ()
170170
171171 def _open_options_dialog (self ):
172172 dialog = BarcodeConfigDialog (self ._config , self ._before_test_camera ) # pass the object here and trigger when the button is pressed
@@ -242,7 +242,8 @@ def _msg_timer_is_running(self):
242242 return self ._duplicate_msg_timer is not None
243243
244244 def _has_msg_timer_timeout (self ):
245- return self ._msg_timer_is_running () and time .time () - self ._duplicate_msg_timer > 2 * RESULT_TIMER_PERIOD / 1000
245+ timeout = 2 * RESULT_TIMER_PERIOD / 1000
246+ return self ._msg_timer_is_running () and time .time () - self ._duplicate_msg_timer > timeout
246247
247248 def _read_result_queue (self ):
248249 """ Called every second; read any new results from the scan results queue, store them and display them.
@@ -267,26 +268,20 @@ def _read_side_scan(self):
267268 # Barcode successfully read
268269 Beeper .beep ()
269270 print ("MAIN: puck barcode recorded" )
270- if not self ._is_latest_holder_plate (plate ):
271+ if not self ._record_table . is_latest_holder_barcode (plate ):
271272 self ._latest_holder_plate = plate
272273 self ._latest_holder_image = holder_image
273274 self ._message_box .display (MessageFactory .puck_recorded_message ())
274- self ._camera_switch . restart_live_capture_from_top ()
275+ self ._restart_live_capture_from_top ()
275276 else :
276277 self ._message_box .display (MessageFactory .duplicate_barcode_message ())
277278
278- def _is_latest_holder_plate (self , plate ):
279- if self ._latest_holder_plate is None :
280- return False
281-
282- return self ._latest_holder_plate .barcodes ()[0 ] == plate .barcodes ()[0 ]
283-
284279 def _read_top_scan (self ):
285280 if self ._result_queue .empty ():
286281 if self ._camera_switch .is_top_scan_timeout ():
287282 self ._message_box .display (MessageFactory .scan_timeout_message ())
288283 print ("\n *** Scan timeout ***" )
289- self ._camera_switch . restart_live_capture_from_side ()
284+ self ._restart_live_capture_from_side ()
290285 return
291286
292287 # Get the result
@@ -301,5 +296,12 @@ def _read_top_scan(self):
301296 Beeper .beep ()
302297 print ("Scan Completed" )
303298 self ._message_box .display (MessageFactory .scan_completed_message ())
299+ self ._restart_live_capture_from_side ()
300+
301+ def _restart_live_capture_from_top (self ):
302+ self ._camera_switch .restart_live_capture_from_top ()
303+
304+ def _restart_live_capture_from_side (self ):
305+ self ._reset_msg_timer ()
304306 self ._camera_switch .restart_live_capture_from_side ()
305307
0 commit comments