Home ⌂Doc Index ◂Up ▴

eric6.MicroPython.MicroPythonWidget

Module implementing the MicroPython REPL widget.

Global Attributes

AnsiColorSchemes

Classes

MicroPythonWidget Class implementing the MicroPython REPL widget.

Functions

None


MicroPythonWidget

Class implementing the MicroPython REPL widget.

Signals

dataReceived(data)
emitted to send data received via the serial connection for further processing

Derived from

QWidget, Ui_MicroPythonWidget

Class Attributes

DevicePortRole
DeviceTypeRole
ZoomMax
ZoomMin

Class Methods

None

Methods

MicroPythonWidget Constructor
__aboutToShowSuperMenu Private slot to populate the Super Menu before showing it.
__clear Private slot to clear the REPL pane.
__compileEditor2Mpy Private slot to cross compile the current editor to a .mpy file.
__compileFile2Mpy Private slot to cross compile a Python file (*.py) to a .mpy file.
__configure Private slot to open the MicroPython configuration page.
__connectToDevice Private method to connect to the selected device.
__crossCompile Private method to cross compile a Python file to a .mpy file.
__disconnectFromDevice Private method to disconnect from the device.
__doZoom Private slot to zoom the REPL pane.
__downloadFirmware Private slot to open the firmware download page.
__getDeviceTime Private method to get a string containing the date and time of the connected device.
__handlePreferencesChanged Private slot to handle a change in preferences.
__manageIgnored Private slot to manage the list of ignored serial devices.
__mpyCrossAvailable Private method to check the availability of mpy-cross.
__paste Private slot to perform a paste operation.
__populateDeviceTypeComboBox Private method to populate the device type selector.
__processData Private slot to process bytes received from the device.
__setCharFormat Private method setting the current text format of the REPL pane based on the passed ANSI codes.
__setConnected Private method to set the connection status LED.
__showContextMenu Private slot to show the REPL context menu.
__showDeviceTime Private slot to show the date and time of the connected device.
__showDeviceVersion Private slot to show some version info about MicroPython of the device.
__showDocumentation Private slot to open the documentation URL for the selected device.
__showError Private method to show some error message.
__showImplementation Private slot to show some implementation related information.
__showLocalAndDeviceTime Private slot to show the local and device time side-by-side.
__showLocalTime Private slot to show the local date and time.
__showNoDeviceMessage Private method to show a message dialog indicating a missing device.
__synchronizeTime Private slot to set the time of the connected device to the local computer's time.
commandsInterface Public method to get a reference to the commands interface object.
eventFilter Public method to process events for the REPL pane.
getCurrentPort Public method to determine the port path of the selected device.
getDeviceWorkspace Public method to get the workspace directory of the device.
handleDataFlood Public slot handling a data flood from the device.
isConnected Public method to get the connection state.
isMicrobit Public method to check, if the connected/selected device is a BBC micro:bit.
on_chartButton_clicked Private slot to open a chart view to plot data received from the connected device.
on_checkButton_clicked Private slot to check for connected devices.
on_connectButton_clicked Private slot to connect to the selected device or disconnect from the currently connected device.
on_deviceTypeComboBox_activated Private slot handling the selection of a device type.
on_filesButton_clicked Private slot to open a file manager window to the connected device.
on_openButton_clicked Private slot to open a file of the connected device.
on_replButton_clicked Private slot to connect to enable or disable the REPL widget.
on_runButton_clicked Private slot to execute the script of the active editor on the selected device.
on_saveButton_clicked Private slot to save the current editor to the connected device.
setActionButtons Public method to set the enabled state of the various action buttons.

Static Methods

None

MicroPythonWidget (Constructor)

MicroPythonWidget(parent=None)

Constructor

parent (QWidget)
reference to the parent widget

MicroPythonWidget.__aboutToShowSuperMenu

__aboutToShowSuperMenu()

Private slot to populate the Super Menu before showing it.

MicroPythonWidget.__clear

__clear()

Private slot to clear the REPL pane.

MicroPythonWidget.__compileEditor2Mpy

__compileEditor2Mpy()

Private slot to cross compile the current editor to a .mpy file.

MicroPythonWidget.__compileFile2Mpy

__compileFile2Mpy()

Private slot to cross compile a Python file (*.py) to a .mpy file.

MicroPythonWidget.__configure

__configure()

Private slot to open the MicroPython configuration page.

MicroPythonWidget.__connectToDevice

__connectToDevice()

Private method to connect to the selected device.

MicroPythonWidget.__crossCompile

__crossCompile(pythonFile="", title="")

Private method to cross compile a Python file to a .mpy file.

pythonFile (str)
name of the Python file to be compiled
title (str)
title for the various dialogs

MicroPythonWidget.__disconnectFromDevice

__disconnectFromDevice()

Private method to disconnect from the device.

MicroPythonWidget.__doZoom

__doZoom(value)

Private slot to zoom the REPL pane.

value (int)
zoom value

MicroPythonWidget.__downloadFirmware

__downloadFirmware()

Private slot to open the firmware download page.

MicroPythonWidget.__getDeviceTime

__getDeviceTime()

Private method to get a string containing the date and time of the connected device.

Returns:
date and time of the connected device
Return Type:
str

MicroPythonWidget.__handlePreferencesChanged

__handlePreferencesChanged()

Private slot to handle a change in preferences.

MicroPythonWidget.__manageIgnored

__manageIgnored()

Private slot to manage the list of ignored serial devices.

MicroPythonWidget.__mpyCrossAvailable

__mpyCrossAvailable()

Private method to check the availability of mpy-cross.

Returns:
flag indicating the availability of mpy-cross
Return Type:
bool

MicroPythonWidget.__paste

__paste()

Private slot to perform a paste operation.

MicroPythonWidget.__populateDeviceTypeComboBox

__populateDeviceTypeComboBox()

Private method to populate the device type selector.

MicroPythonWidget.__processData

__processData(data)

Private slot to process bytes received from the device.

data (bytes)
bytes received from the device

MicroPythonWidget.__setCharFormat

__setCharFormat(formatCodes, textCursor)

Private method setting the current text format of the REPL pane based on the passed ANSI codes.

Following codes are used:

formatCodes (list of str)
list of format codes
textCursor (QTextCursor)
reference to the text cursor

MicroPythonWidget.__setConnected

__setConnected(connected)

Private method to set the connection status LED.

connected (bool)
connection state

MicroPythonWidget.__showContextMenu

__showContextMenu(pos)

Private slot to show the REPL context menu.

pos (QPoint)
position to show the menu at

MicroPythonWidget.__showDeviceTime

__showDeviceTime()

Private slot to show the date and time of the connected device.

MicroPythonWidget.__showDeviceVersion

__showDeviceVersion()

Private slot to show some version info about MicroPython of the device.

MicroPythonWidget.__showDocumentation

__showDocumentation()

Private slot to open the documentation URL for the selected device.

MicroPythonWidget.__showError

__showError(method, error)

Private method to show some error message.

method (str)
name of the method the error occured in
error (str)
error message

MicroPythonWidget.__showImplementation

__showImplementation()

Private slot to show some implementation related information.

MicroPythonWidget.__showLocalAndDeviceTime

__showLocalAndDeviceTime()

Private slot to show the local and device time side-by-side.

MicroPythonWidget.__showLocalTime

__showLocalTime()

Private slot to show the local date and time.

MicroPythonWidget.__showNoDeviceMessage

__showNoDeviceMessage()

Private method to show a message dialog indicating a missing device.

MicroPythonWidget.__synchronizeTime

__synchronizeTime(quiet=False)

Private slot to set the time of the connected device to the local computer's time.

quiet (bool)
flag indicating to not show a message

MicroPythonWidget.commandsInterface

commandsInterface()

Public method to get a reference to the commands interface object.

Returns:
reference to the commands interface object
Return Type:
MicroPythonCommandsInterface

MicroPythonWidget.eventFilter

eventFilter(obj, evt)

Public method to process events for the REPL pane.

obj (QObject)
reference to the object the event was meant for
evt (QEvent)
reference to the event object
Returns:
flag to indicate that the event was handled
Return Type:
bool

MicroPythonWidget.getCurrentPort

getCurrentPort()

Public method to determine the port path of the selected device.

Returns:
path of the port of the selected device
Return Type:
str

MicroPythonWidget.getDeviceWorkspace

getDeviceWorkspace()

Public method to get the workspace directory of the device.

Returns:
workspace directory of the device
Return Type:
str

MicroPythonWidget.handleDataFlood

handleDataFlood()

Public slot handling a data flood from the device.

MicroPythonWidget.isConnected

isConnected()

Public method to get the connection state.

Returns:
connection state
Return Type:
bool

MicroPythonWidget.isMicrobit

isMicrobit()

Public method to check, if the connected/selected device is a BBC micro:bit.

Returns:
flag indicating a micro:bit device rtype bool

MicroPythonWidget.on_chartButton_clicked

on_chartButton_clicked(checked)

Private slot to open a chart view to plot data received from the connected device.

If the selected device is not connected yet, this will be done now.

checked (bool)
state of the button

MicroPythonWidget.on_checkButton_clicked

on_checkButton_clicked()

Private slot to check for connected devices.

MicroPythonWidget.on_connectButton_clicked

on_connectButton_clicked()

Private slot to connect to the selected device or disconnect from the currently connected device.

MicroPythonWidget.on_deviceTypeComboBox_activated

on_deviceTypeComboBox_activated(index)

Private slot handling the selection of a device type.

index (int)
index of the selected device

MicroPythonWidget.on_filesButton_clicked

on_filesButton_clicked(checked)

Private slot to open a file manager window to the connected device.

If the selected device is not connected yet, this will be done now.

checked (bool)
state of the button

MicroPythonWidget.on_openButton_clicked

on_openButton_clicked()

Private slot to open a file of the connected device.

MicroPythonWidget.on_replButton_clicked

on_replButton_clicked(checked)

Private slot to connect to enable or disable the REPL widget.

If the selected device is not connected yet, this will be done now.

checked (bool)
state of the button

MicroPythonWidget.on_runButton_clicked

on_runButton_clicked()

Private slot to execute the script of the active editor on the selected device.

If the REPL is not active yet, it will be activated, which might cause an unconnected device to be connected.

MicroPythonWidget.on_saveButton_clicked

on_saveButton_clicked()

Private slot to save the current editor to the connected device.

MicroPythonWidget.setActionButtons

setActionButtons(**kwargs)

Public method to set the enabled state of the various action buttons.

kwargs= (dict)
keyword arguments containg the enabled states (keys are 'run', 'repl', 'files', 'chart', 'open', 'save'
Up



Home ⌂Doc Index ◂Up ▴