195 DeviceVidRole = Qt.UserRole + 3 |
195 DeviceVidRole = Qt.UserRole + 3 |
196 DevicePidRole = Qt.UserRole + 4 |
196 DevicePidRole = Qt.UserRole + 4 |
197 |
197 |
198 dataReceived = pyqtSignal(bytes) |
198 dataReceived = pyqtSignal(bytes) |
199 |
199 |
|
200 ManualMarker = "<manual>" |
|
201 |
200 def __init__(self, parent=None): |
202 def __init__(self, parent=None): |
201 """ |
203 """ |
202 Constructor |
204 Constructor |
203 |
205 |
204 @param parent reference to the parent widget |
206 @param parent reference to the parent widget |
338 self.deviceInfoLabel.setText( |
340 self.deviceInfoLabel.setText( |
339 self.tr("No supported devices detected.")) |
341 self.tr("No supported devices detected.")) |
340 |
342 |
341 self.__unknownPorts = unknownPorts |
343 self.__unknownPorts = unknownPorts |
342 if self.__unknownPorts: |
344 if self.__unknownPorts: |
343 self.connectButton.setEnabled(True) |
345 if self.deviceTypeComboBox.count(): |
|
346 self.deviceTypeComboBox.insertSeparator( |
|
347 self.deviceTypeComboBox.count()) |
|
348 self.deviceTypeComboBox.addItem(self.tr("Manual Selection")) |
|
349 self.deviceTypeComboBox.setItemData( |
|
350 self.deviceTypeComboBox.count() - 1, |
|
351 self.ManualMarker, self.DeviceTypeRole) |
344 |
352 |
345 index = self.deviceTypeComboBox.findText(currentDevice, |
353 index = self.deviceTypeComboBox.findText(currentDevice, |
346 Qt.MatchExactly) |
354 Qt.MatchExactly) |
347 if index == -1: |
355 if index == -1: |
348 # entry is no longer present |
356 # entry is no longer present |
453 @param index index of the selected device |
461 @param index index of the selected device |
454 @type int |
462 @type int |
455 """ |
463 """ |
456 deviceType = self.deviceTypeComboBox.itemData( |
464 deviceType = self.deviceTypeComboBox.itemData( |
457 index, self.DeviceTypeRole) |
465 index, self.DeviceTypeRole) |
458 self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon( |
466 if deviceType == self.ManualMarker: |
459 deviceType, False)) |
467 self.connectButton.setEnabled(bool(self.__unknownPorts)) |
460 |
468 else: |
461 vid = self.deviceTypeComboBox.itemData( |
469 self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon( |
462 index, self.DeviceVidRole) |
470 deviceType, False)) |
463 pid = self.deviceTypeComboBox.itemData( |
471 |
464 index, self.DevicePidRole) |
472 vid = self.deviceTypeComboBox.itemData( |
465 |
473 index, self.DeviceVidRole) |
466 self.__device = MicroPythonDevices.getDevice(deviceType, self, |
474 pid = self.deviceTypeComboBox.itemData( |
467 vid, pid) |
475 index, self.DevicePidRole) |
468 self.__device.setButtons() |
476 |
469 |
477 self.__device = MicroPythonDevices.getDevice(deviceType, self, |
470 self.connectButton.setEnabled(bool(deviceType) or |
478 vid, pid) |
471 bool(self.__unknownPorts)) |
479 self.__device.setButtons() |
|
480 |
|
481 self.connectButton.setEnabled(bool(deviceType)) |
472 |
482 |
473 @pyqtSlot() |
483 @pyqtSlot() |
474 def on_checkButton_clicked(self): |
484 def on_checkButton_clicked(self): |
475 """ |
485 """ |
476 Private slot to check for connected devices. |
486 Private slot to check for connected devices. |