Commit b155dc526881d9697eb7c231653a774dc75d57a8
Committed by
GitHub
Exists in
master
Merge pull request #392 from okahilak/fix-selecting-com-port-in-ui
FIX: Selecting COM port in UI
Showing
3 changed files
with
12 additions
and
9 deletions
Show diff stats
invesalius/data/trackers.py
... | ... | @@ -268,9 +268,11 @@ def PlhSerialConnection(tracker_id): |
268 | 268 | trck_init = None |
269 | 269 | dlg_port = dlg.SetCOMPort(select_baud_rate=False) |
270 | 270 | if dlg_port.ShowModal() == ID_OK: |
271 | - com_port = dlg_port.GetValue() | |
271 | + com_port = dlg_port.GetCOMPort() | |
272 | + baud_rate = 115200 | |
273 | + | |
272 | 274 | try: |
273 | - trck_init = serial.Serial(com_port, baudrate=115200, timeout=0.03) | |
275 | + trck_init = serial.Serial(com_port, baudrate=baud_rate, timeout=0.03) | |
274 | 276 | |
275 | 277 | if tracker_id == 2: |
276 | 278 | # Polhemus FASTRAK needs configurations first | ... | ... |
invesalius/gui/dialogs.py
... | ... | @@ -4487,15 +4487,16 @@ class SetCOMPort(wx.Dialog): |
4487 | 4487 | |
4488 | 4488 | self.CenterOnParent() |
4489 | 4489 | |
4490 | - def GetValue(self): | |
4490 | + def GetCOMPort(self): | |
4491 | 4491 | com_port = self.com_port_dropdown.GetString(self.com_port_dropdown.GetSelection()) |
4492 | + return com_port | |
4492 | 4493 | |
4493 | - if self.select_baud_rate: | |
4494 | - baud_rate = self.baud_rate_dropdown.GetString(self.baud_rate_dropdown.GetSelection()) | |
4495 | - else: | |
4496 | - baud_rate = None | |
4494 | + def GetBaudRate(self): | |
4495 | + if not self.select_baud_rate: | |
4496 | + return None | |
4497 | 4497 | |
4498 | - return com_port, baud_rate | |
4498 | + baud_rate = self.baud_rate_dropdown.GetString(self.baud_rate_dropdown.GetSelection()) | |
4499 | + return baud_rate | |
4499 | 4500 | |
4500 | 4501 | |
4501 | 4502 | class ManualWWWLDialog(wx.Dialog): | ... | ... |
invesalius/gui/task_navigator.py
... | ... | @@ -293,7 +293,7 @@ class InnerFoldPanel(wx.Panel): |
293 | 293 | ctrl.SetValue(False) |
294 | 294 | return |
295 | 295 | |
296 | - com_port = dlg_port.GetValue() | |
296 | + com_port = dlg_port.GetCOMPort() | |
297 | 297 | baud_rate = 115200 |
298 | 298 | |
299 | 299 | Publisher.sendMessage('Update serial port', serial_port_in_use=True, com_port=com_port, baud_rate=baud_rate) | ... | ... |