10 |
10 |
11 import logging |
11 import logging |
12 import os |
12 import os |
13 |
13 |
14 from PyQt6.QtCore import QCoreApplication, QObject, pyqtSlot |
14 from PyQt6.QtCore import QCoreApplication, QObject, pyqtSlot |
|
15 from PyQt6.QtSerialPort import QSerialPortInfo |
15 from PyQt6.QtWidgets import QInputDialog |
16 from PyQt6.QtWidgets import QInputDialog |
16 |
17 |
17 from eric7 import Preferences |
18 from eric7 import Preferences |
18 from eric7.EricGui import EricPixmapCache |
19 from eric7.EricGui import EricPixmapCache |
19 from eric7.EricWidgets.EricApplication import ericApp |
20 from eric7.EricWidgets.EricApplication import ericApp |
280 PID, description and port name for ports with missing VID or PID |
281 PID, description and port name for ports with missing VID or PID |
281 @rtype tuple of (list of tuples of (str, str, str, str, int, int), |
282 @rtype tuple of (list of tuples of (str, str, str, str, int, int), |
282 list of tuples of (int, int, str), |
283 list of tuples of (int, int, str), |
283 list of tuples of (int, int, str, str) |
284 list of tuples of (int, int, str, str) |
284 """ |
285 """ |
285 from PyQt6.QtSerialPort import QSerialPortInfo |
|
286 |
|
287 foundDevices = [] |
286 foundDevices = [] |
288 unknownDevices = [] |
287 unknownDevices = [] |
289 unknownPorts = [] |
288 unknownPorts = [] |
290 |
289 |
291 manualDevices = {} |
290 manualDevices = {} |
408 @type int |
407 @type int |
409 @return instantiated device interface |
408 @return instantiated device interface |
410 @rtype MicroPythonDevice |
409 @rtype MicroPythonDevice |
411 """ |
410 """ |
412 if deviceType == "esp": |
411 if deviceType == "esp": |
413 from .EspDevices import EspDevice |
412 from .EspDevices import EspDevice # __IGNORE_WARNING_I101__ |
414 |
413 |
415 return EspDevice(microPythonWidget, deviceType) |
414 return EspDevice(microPythonWidget, deviceType) |
416 elif deviceType == "circuitpython": |
415 elif deviceType == "circuitpython": |
417 from .CircuitPythonDevices import CircuitPythonDevice |
416 from .CircuitPythonDevices import CircuitPythonDevice # __IGNORE_WARNING_I101__ |
418 |
417 |
419 return CircuitPythonDevice(microPythonWidget, deviceType) |
418 return CircuitPythonDevice(microPythonWidget, deviceType) |
420 elif deviceType in ("bbc_microbit", "calliope"): |
419 elif deviceType in ("bbc_microbit", "calliope"): |
421 from .MicrobitDevices import MicrobitDevice |
420 from .MicrobitDevices import MicrobitDevice # __IGNORE_WARNING_I101__ |
422 |
421 |
423 return MicrobitDevice(microPythonWidget, deviceType) |
422 return MicrobitDevice(microPythonWidget, deviceType) |
424 elif deviceType == "pyboard": |
423 elif deviceType == "pyboard": |
425 from .PyBoardDevices import PyBoardDevice |
424 from .PyBoardDevices import PyBoardDevice # __IGNORE_WARNING_I101__ |
426 |
425 |
427 return PyBoardDevice(microPythonWidget, deviceType) |
426 return PyBoardDevice(microPythonWidget, deviceType) |
428 elif deviceType == "rp2040": |
427 elif deviceType == "rp2040": |
429 from .RP2040Devices import RP2040Device |
428 from .RP2040Devices import RP2040Device # __IGNORE_WARNING_I101__ |
430 |
429 |
431 return RP2040Device(microPythonWidget, deviceType) |
430 return RP2040Device(microPythonWidget, deviceType) |
432 elif deviceType == "generic": |
431 elif deviceType == "generic": |
433 from .GenericMicroPythonDevices import GenericMicroPythonDevice |
432 from .GenericMicroPythonDevices import ( # __IGNORE_WARNING_I101__ |
|
433 GenericMicroPythonDevice, |
|
434 ) |
434 |
435 |
435 return GenericMicroPythonDevice(microPythonWidget, deviceType, vid, pid) |
436 return GenericMicroPythonDevice(microPythonWidget, deviceType, vid, pid) |
436 else: |
437 else: |
437 # nothing specific requested |
438 # nothing specific requested |
438 return MicroPythonDevice(microPythonWidget, deviceType) |
439 return MicroPythonDevice(microPythonWidget, deviceType) |