eric6.MicroPython.MicroPythonDevices
Module implementing some utility functions and the MicroPythonDevice base
class.
Global Attributes
| IgnoredBoards |
| SupportedBoards |
Classes
Functions
| getDevice |
Public method to instantiate a specific MicroPython device interface. |
| getDeviceIcon |
Function to get the icon for the given board. |
| getFoundDevices |
Function to check the serial ports for supported MicroPython devices. |
| getSupportedDevices |
Function to get a list of supported MicroPython devices. |
MicroPythonDevice
Base class for the more specific MicroPython devices.
Derived from
QObject
Class Attributes
Class Methods
Methods
| MicroPythonDevice |
Constructor |
| addDeviceMenuEntries |
Public method to add device specific entries to the given menu. |
| canRunScript |
Public method to determine, if a script can be executed. |
| canStartFileManager |
Public method to determine, if a File Manager can be started. |
| canStartPlotter |
Public method to determine, if a Plotter can be started. |
| canStartRepl |
Public method to determine, if a REPL can be started. |
| deviceName |
Public method to get the name of the device. |
| forceInterrupt |
Public method to determine the need for an interrupt when opening the serial connection. |
| getDocumentationUrl |
Public method to get the device documentation URL. |
| getFirmwareUrl |
Public method to get the device firmware download URL. |
| getWorkspace |
Public method to get the workspace directory. |
| handleDataFlood |
Public slot handling a data floof from the device. |
| hasDocumentationUrl |
Public method to check, if the device has a configured documentation URL. |
| hasFirmwareUrl |
Public method to check, if the device has a configured firmware download URL. |
| hasTimeCommands |
Public method to check, if the device supports time commands. |
| runScript |
Public method to run the given Python script. |
| sendCommands |
Public method to send a list of commands to the device. |
| setButtons |
Public method to enable the supported action buttons. |
| setFileManager |
Public method to set the File Manager status and dependent status. |
| setPlotter |
Public method to set the Plotter status and dependent status. |
| setRepl |
Public method to set the REPL status and dependent status. |
| supportsLocalFileAccess |
Public method to indicate file access via a local directory. |
Static Methods
MicroPythonDevice (Constructor)
MicroPythonDevice(microPythonWidget, parent=None)
Constructor
- microPythonWidget (MicroPythonWidget)
-
reference to the main MicroPython widget
- parent (QObject)
-
reference to the parent object
MicroPythonDevice.addDeviceMenuEntries
addDeviceMenuEntries(menu)
Public method to add device specific entries to the given menu.
- menu (QMenu)
-
reference to the context menu
MicroPythonDevice.canRunScript
canRunScript()
Public method to determine, if a script can be executed.
- Returns:
-
tuple containing a flag indicating it is safe to start a
Plotter and a reason why it cannot.
- Return Type:
-
tuple of (bool, str)
MicroPythonDevice.canStartFileManager
canStartFileManager()
Public method to determine, if a File Manager can be started.
- Returns:
-
tuple containing a flag indicating it is safe to start a
File Manager and a reason why it cannot.
- Return Type:
-
tuple of (bool, str)
MicroPythonDevice.canStartPlotter
canStartPlotter()
Public method to determine, if a Plotter can be started.
- Returns:
-
tuple containing a flag indicating it is safe to start a
Plotter and a reason why it cannot.
- Return Type:
-
tuple of (bool, str)
MicroPythonDevice.canStartRepl
canStartRepl()
Public method to determine, if a REPL can be started.
- Returns:
-
tuple containing a flag indicating it is safe to start a REPL
and a reason why it cannot.
- Return Type:
-
tuple of (bool, str)
MicroPythonDevice.deviceName
deviceName()
Public method to get the name of the device.
- Returns:
-
name of the device
- Return Type:
-
str
MicroPythonDevice.forceInterrupt
forceInterrupt()
Public method to determine the need for an interrupt when opening the
serial connection.
- Returns:
-
flag indicating an interrupt is needed
- Return Type:
-
bool
MicroPythonDevice.getDocumentationUrl
getDocumentationUrl()
Public method to get the device documentation URL.
- Returns:
-
documentation URL of the device
- Return Type:
-
str
MicroPythonDevice.getFirmwareUrl
getFirmwareUrl()
Public method to get the device firmware download URL.
- Returns:
-
firmware download URL of the device
- Return Type:
-
str
MicroPythonDevice.getWorkspace
getWorkspace()
Public method to get the workspace directory.
- Returns:
-
workspace directory used for saving files
- Return Type:
-
str
MicroPythonDevice.handleDataFlood
handleDataFlood()
Public slot handling a data floof from the device.
MicroPythonDevice.hasDocumentationUrl
hasDocumentationUrl()
Public method to check, if the device has a configured documentation
URL.
- Returns:
-
flag indicating a configured documentation URL
- Return Type:
-
bool
MicroPythonDevice.hasFirmwareUrl
hasFirmwareUrl()
Public method to check, if the device has a configured firmware
download URL.
- Returns:
-
flag indicating a configured firmware download URL
- Return Type:
-
bool
MicroPythonDevice.hasTimeCommands
hasTimeCommands()
Public method to check, if the device supports time commands.
The default returns True.
- Returns:
-
flag indicating support for time commands
- Return Type:
-
bool
MicroPythonDevice.runScript
runScript(script)
Public method to run the given Python script.
- script (str)
-
script to be executed
MicroPythonDevice.sendCommands
sendCommands(commandsList)
Public method to send a list of commands to the device.
- commandsList (list of str)
-
list of commands to be sent to the device
MicroPythonDevice.setButtons
setButtons()
Public method to enable the supported action buttons.
MicroPythonDevice.setFileManager
setFileManager(on)
Public method to set the File Manager status and dependent status.
- on (bool)
-
flag indicating the active status
MicroPythonDevice.setPlotter
setPlotter(on)
Public method to set the Plotter status and dependent status.
- on (bool)
-
flag indicating the active status
MicroPythonDevice.setRepl
setRepl(on)
Public method to set the REPL status and dependent status.
- on (bool)
-
flag indicating the active status
MicroPythonDevice.supportsLocalFileAccess
supportsLocalFileAccess()
Public method to indicate file access via a local directory.
- Returns:
-
flag indicating file access via local directory
- Return Type:
-
bool
getDevice
getDevice(deviceType, microPythonWidget)
Public method to instantiate a specific MicroPython device interface.
- deviceType (str)
-
type of the device interface
- microPythonWidget (MicroPythonWidget)
-
reference to the main MicroPython widget
- Returns:
-
instantiated device interface
- Return Type:
-
MicroPythonDevice
getDeviceIcon
getDeviceIcon(boardName, iconFormat=True)
Function to get the icon for the given board.
- boardName (str)
-
name of the board
- iconFormat (bool)
-
flag indicating to get an icon or a pixmap
- Returns:
-
icon for the board (iconFormat == True) or
a pixmap (iconFormat == False)
- Return Type:
-
QIcon or QPixmap
getFoundDevices
getFoundDevices()
Function to check the serial ports for supported MicroPython devices.
- Returns:
-
tuple containing a list of tuples with the board type, a
description and the serial port it is connected at for known device
types and a list of tuples with VID, PID and description for unknown
devices
- Return Type:
-
tuple of (list of tuples of (str, str, str), list of tuples of
(int, int, str)
getSupportedDevices
getSupportedDevices()
Function to get a list of supported MicroPython devices.
- Returns:
-
set of tuples with the board type and description
- Return Type:
-
set of tuples of (str, str)