Commit 91f109c77b92f5541db927b26ec0a4cdcc9eb0b4

Authored by okahilak
Committed by GitHub
1 parent 0f775c4e
Exists in master

FIX: Bug in StopNavigation, causing error if serial port not enabled (#327)

- The correct way to ask if serial port is enabled is to use
  SerialPortEnabled function in Navigation class.

- While at it, remove the unused Enabled function from
  SerialPortConnection class.
invesalius/data/serial_port_connection.py
... ... @@ -42,9 +42,6 @@ class SerialPortConnection(threading.Thread):
42 42 self.event = event
43 43 self.sleep_nav = sleep_nav
44 44  
45   - def Enabled(self):
46   - return self.port is not None
47   -
48 45 def Connect(self):
49 46 if self.port is None:
50 47 print("Serial port init error: COM port is unset.")
... ...
invesalius/gui/task_navigator.py
... ... @@ -508,7 +508,7 @@ class Navigation():
508 508 self.tracts_queue.clear()
509 509 self.tracts_queue.join()
510 510  
511   - vis_components = [self.serial_port_connection.Enabled(), self.view_tracts, self.peel_loaded]
  511 + vis_components = [self.SerialPortEnabled(), self.view_tracts, self.peel_loaded]
512 512 Publisher.sendMessage("Navigation status", nav_status=False, vis_status=vis_components)
513 513  
514 514  
... ...