9 """ |
9 """ |
10 |
10 |
11 from PyQt6.QtCore import Qt, pyqtSlot |
11 from PyQt6.QtCore import Qt, pyqtSlot |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
13 |
13 |
14 from . import MicroPythonDevices |
14 from .Devices import getSupportedDevices |
15 from .Ui_ConnectionSelectionDialog import Ui_ConnectionSelectionDialog |
15 from .Ui_ConnectionSelectionDialog import Ui_ConnectionSelectionDialog |
16 |
16 |
17 |
17 |
18 class ConnectionSelectionDialog(QDialog, Ui_ConnectionSelectionDialog): |
18 class ConnectionSelectionDialog(QDialog, Ui_ConnectionSelectionDialog): |
19 """ |
19 """ |
51 self.portNameComboBox.setItemData(index, portName, self.PortNameRole) |
51 self.portNameComboBox.setItemData(index, portName, self.PortNameRole) |
52 self.portNameComboBox.setItemData(index, (vid, pid), self.VidPidRole) |
52 self.portNameComboBox.setItemData(index, (vid, pid), self.VidPidRole) |
53 |
53 |
54 self.deviceTypeComboBox.addItem("", "") |
54 self.deviceTypeComboBox.addItem("", "") |
55 for board, description in sorted( |
55 for board, description in sorted( |
56 MicroPythonDevices.getSupportedDevices(), key=lambda x: x[1] |
56 getSupportedDevices(), key=lambda x: x[1] |
57 ): |
57 ): |
58 self.deviceTypeComboBox.addItem(description, board) |
58 self.deviceTypeComboBox.addItem(description, board) |
59 |
59 |
60 if self.portNameComboBox.currentText(): |
60 if self.portNameComboBox.currentText(): |
61 # some ports were found; use the previously selected type as |
61 # some ports were found; use the previously selected type as |