357 from .MicroPythonWebreplUrlsConfigDialog import ( |
357 from .MicroPythonWebreplUrlsConfigDialog import ( |
358 MicroPythonWebreplUrlsConfigDialog, |
358 MicroPythonWebreplUrlsConfigDialog, |
359 ) |
359 ) |
360 |
360 |
361 webreplUrlsDict = Preferences.getMicroPython("WebreplUrls") |
361 webreplUrlsDict = Preferences.getMicroPython("WebreplUrls") |
362 dlg = MicroPythonWebreplUrlsConfigDialog(webreplUrlsDict) |
362 dlg = MicroPythonWebreplUrlsConfigDialog(webreplUrlsDict, parent=self) |
363 if dlg.exec() == QDialog.DialogCode.Accepted: |
363 if dlg.exec() == QDialog.DialogCode.Accepted: |
364 webreplUrlsDict = dlg.getWebreplDict() |
364 webreplUrlsDict = dlg.getWebreplDict() |
365 Preferences.setMicroPython("WebreplUrls", webreplUrlsDict) |
365 Preferences.setMicroPython("WebreplUrls", webreplUrlsDict) |
366 |
366 |
367 self.__populateDeviceTypeComboBox() |
367 self.__populateDeviceTypeComboBox() |
664 if interfaceType == "serial": |
664 if interfaceType == "serial": |
665 port = self.getCurrentPort() |
665 port = self.getCurrentPort() |
666 if not port: |
666 if not port: |
667 with EricOverridenCursor(): |
667 with EricOverridenCursor(): |
668 dlg = ConnectionSelectionDialog( |
668 dlg = ConnectionSelectionDialog( |
669 self.__unknownPorts, self.__lastPort, self.__lastDeviceType |
669 self.__unknownPorts, |
|
670 self.__lastPort, |
|
671 self.__lastDeviceType, |
|
672 parent=self, |
670 ) |
673 ) |
671 if dlg.exec() == QDialog.DialogCode.Accepted: |
674 if dlg.exec() == QDialog.DialogCode.Accepted: |
672 vid, pid, port, deviceType = dlg.getData() |
675 vid, pid, port, deviceType = dlg.getData() |
673 |
676 |
674 self.deviceIconLabel.setPixmap( |
677 self.deviceIconLabel.setPixmap( |
685 elif interfaceType == "webrepl": |
688 elif interfaceType == "webrepl": |
686 port = self.deviceTypeComboBox.currentData(self.DeviceWebreplUrlRole) |
689 port = self.deviceTypeComboBox.currentData(self.DeviceWebreplUrlRole) |
687 if not port: |
690 if not port: |
688 with EricOverridenCursor(): |
691 with EricOverridenCursor(): |
689 dlg = MicroPythonWebreplConnectionDialog( |
692 dlg = MicroPythonWebreplConnectionDialog( |
690 self.__lastWebreplUrl, self.__lastDeviceType |
693 self.__lastWebreplUrl, self.__lastDeviceType, parent=self |
691 ) |
694 ) |
692 if dlg.exec() == QDialog.DialogCode.Accepted: |
695 if dlg.exec() == QDialog.DialogCode.Accepted: |
693 port, deviceType = dlg.getWebreplConnectionParameters() |
696 port, deviceType = dlg.getWebreplConnectionParameters() |
694 |
697 |
695 self.deviceIconLabel.setPixmap( |
698 self.deviceIconLabel.setPixmap( |
1566 Private slot to manage the list of ignored serial devices. |
1569 Private slot to manage the list of ignored serial devices. |
1567 """ |
1570 """ |
1568 from .IgnoredDevicesDialog import IgnoredDevicesDialog |
1571 from .IgnoredDevicesDialog import IgnoredDevicesDialog |
1569 |
1572 |
1570 dlg = IgnoredDevicesDialog( |
1573 dlg = IgnoredDevicesDialog( |
1571 Preferences.getMicroPython("IgnoredUnknownDevices"), self |
1574 Preferences.getMicroPython("IgnoredUnknownDevices"), parent=self |
1572 ) |
1575 ) |
1573 if dlg.exec() == QDialog.DialogCode.Accepted: |
1576 if dlg.exec() == QDialog.DialogCode.Accepted: |
1574 ignoredDevices = dlg.getDevices() |
1577 ignoredDevices = dlg.getDevices() |
1575 Preferences.setMicroPython("IgnoredUnknownDevices", ignoredDevices) |
1578 Preferences.setMicroPython("IgnoredUnknownDevices", ignoredDevices) |
1576 |
1579 |
1587 Private slot to manage manually added boards (i.e. those not in the |
1590 Private slot to manage manually added boards (i.e. those not in the |
1588 list of supported boards). |
1591 list of supported boards). |
1589 """ |
1592 """ |
1590 from .UnknownDevicesDialog import UnknownDevicesDialog |
1593 from .UnknownDevicesDialog import UnknownDevicesDialog |
1591 |
1594 |
1592 dlg = UnknownDevicesDialog() |
1595 dlg = UnknownDevicesDialog(parent=None) |
1593 dlg.exec() |
1596 dlg.exec() |
1594 |
1597 |
1595 def __addUnknownDevices(self, devices): |
1598 def __addUnknownDevices(self, devices): |
1596 """ |
1599 """ |
1597 Private method to add devices to the list of manually added boards. |
1600 Private method to add devices to the list of manually added boards. |
1615 |
1618 |
1616 if selectedDevices: |
1619 if selectedDevices: |
1617 manualDevices = Preferences.getMicroPython("ManualDevices") |
1620 manualDevices = Preferences.getMicroPython("ManualDevices") |
1618 for vid, pid, description in devices: |
1621 for vid, pid, description in devices: |
1619 if description in selectedDevices: |
1622 if description in selectedDevices: |
1620 dlg = AddEditDevicesDialog(vid, pid, description) |
1623 dlg = AddEditDevicesDialog(vid, pid, description, parent=self) |
1621 if dlg.exec() == QDialog.DialogCode.Accepted: |
1624 if dlg.exec() == QDialog.DialogCode.Accepted: |
1622 manualDevices.append(dlg.getDeviceDict()) |
1625 manualDevices.append(dlg.getDeviceDict()) |
1623 Preferences.setMicroPython("ManualDevices", manualDevices) |
1626 Preferences.setMicroPython("ManualDevices", manualDevices) |
1624 |
1627 |
1625 # rescan the ports |
1628 # rescan the ports |
1629 def __flashUF2(self): |
1632 def __flashUF2(self): |
1630 """ |
1633 """ |
1631 Private slot to flash MicroPython/CircuitPython to a device |
1634 Private slot to flash MicroPython/CircuitPython to a device |
1632 support the UF2 bootloader. |
1635 support the UF2 bootloader. |
1633 """ |
1636 """ |
1634 dlg = UF2FlashDialog.UF2FlashDialog() |
1637 dlg = UF2FlashDialog.UF2FlashDialog(parent=self) |
1635 dlg.exec() |
1638 dlg.exec() |
1636 |
1639 |
1637 @pyqtSlot() |
1640 @pyqtSlot() |
1638 def __convertToUF2(self): |
1641 def __convertToUF2(self): |
1639 """ |
1642 """ |
1640 Private slot to convert a non-UF2 MicroPython firmware file to UF2. |
1643 Private slot to convert a non-UF2 MicroPython firmware file to UF2. |
1641 """ |
1644 """ |
1642 dlg = ConvertToUF2Dialog.ConvertToUF2Dialog() |
1645 dlg = ConvertToUF2Dialog.ConvertToUF2Dialog(parent=self) |
1643 dlg.exec() |
1646 dlg.exec() |
1644 |
1647 |
1645 @pyqtSlot() |
1648 @pyqtSlot() |
1646 def __showBuiltinModules(self): |
1649 def __showBuiltinModules(self): |
1647 """ |
1650 """ |
1680 " got {0}." |
1683 " got {0}." |
1681 ).format(method) |
1684 ).format(method) |
1682 |
1685 |
1683 if method in ("local_mip", "mip"): |
1686 if method in ("local_mip", "mip"): |
1684 title = self.tr("Install Package") |
1687 title = self.tr("Install Package") |
1685 dlg = MipPackageDialog(self) |
1688 dlg = MipPackageDialog(parent=self) |
1686 if dlg.exec() == QDialog.DialogCode.Accepted: |
1689 if dlg.exec() == QDialog.DialogCode.Accepted: |
1687 package, version, mpy, target, index = dlg.getData() |
1690 package, version, mpy, target, index = dlg.getData() |
1688 if method == "mip": |
1691 if method == "mip": |
1689 with EricOverrideCursor(): |
1692 with EricOverrideCursor(): |
1690 out, err = self.__device.mipInstall( |
1693 out, err = self.__device.mipInstall( |