

def OnPortSettings(self, event):
    '\n        Show the port settings dialog. The reader thread is stopped for the\n        settings change.\n        '
    if (event is not None):
        self.StopThread()
        self.serial.close()
    ok = False
    while (not ok):
        with wxSerialConfigDialog.SerialConfigDialog(self, (- 1), '', show=((wxSerialConfigDialog.SHOW_BAUDRATE | wxSerialConfigDialog.SHOW_FORMAT) | wxSerialConfigDialog.SHOW_FLOW), serial=self.serial) as dialog_serial_cfg:
            dialog_serial_cfg.CenterOnParent()
            result = dialog_serial_cfg.ShowModal()
        if ((result == wx.ID_OK) or (event is not None)):
            try:
                self.serial.open()
            except serial.SerialException as e:
                with wx.MessageDialog(self, str(e), 'Serial Port Error', (wx.OK | wx.ICON_ERROR)) as dlg:
                    dlg.ShowModal()
            else:
                self.StartThread()
                self.SetTitle(('Serial Terminal on %s [%s,%s,%s,%s%s%s]' % (self.serial.portstr, dialog_serial_cfg.serial.baudrate, self.serial.bytesize, self.serial.parity, self.serial.stopbits, (' RTS/CTS' if self.serial.rtscts else ''), (' Xon/Xoff' if self.serial.xonxoff else ''))))
                ok = True
        else:
            self.alive.clear()
            ok = True

dataset/ETHPy150Open pyserial/pyserial/examples/wxTerminal.py TerminalFrame.OnPortSettings/VarMisuse@212/332 `self`->`dialog_serial_cfg`