1006 """ |
1006 """ |
1007 Private method to connect to the selected device. |
1007 Private method to connect to the selected device. |
1008 """ |
1008 """ |
1009 port = self.getCurrentPort() |
1009 port = self.getCurrentPort() |
1010 if not port: |
1010 if not port: |
1011 # TODO: implement port and device selection dialog |
1011 from .ConnectionSelectionDialog import ConnectionSelectionDialog |
1012 deviceType = "circuitpython" |
1012 with E5OverridenCursor(): |
1013 port = "ttyACM0" |
1013 dlg = ConnectionSelectionDialog( |
1014 vid = 0 |
1014 self.__unknownPorts, self.__lastPort, self.__lastDeviceType |
1015 pid = 0 |
1015 ) |
1016 |
1016 if dlg.exec() == QDialog.Accepted: |
1017 self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon( |
1017 vid, pid, port, deviceType = dlg.getData() |
1018 deviceType, False)) |
1018 |
1019 self.__device = MicroPythonDevices.getDevice(deviceType, self, |
1019 self.deviceIconLabel.setPixmap( |
1020 vid, pid) |
1020 MicroPythonDevices.getDeviceIcon(deviceType, False)) |
1021 self.__device.setButtons() |
1021 self.__device = MicroPythonDevices.getDevice( |
|
1022 deviceType, self, vid, pid) |
|
1023 self.__device.setButtons() |
|
1024 |
|
1025 self.__lastPort = port |
|
1026 self.__lastDeviceType = deviceType |
1022 |
1027 |
1023 if self.__interface.connectToDevice(port): |
1028 if self.__interface.connectToDevice(port): |
1024 self.__setConnected(True) |
1029 self.__setConnected(True) |
1025 |
1030 |
1026 if (Preferences.getMicroPython("SyncTimeAfterConnect") and |
1031 if (Preferences.getMicroPython("SyncTimeAfterConnect") and |