eric6/MicroPython/MicrobitDevices.py

Tue, 30 Jul 2019 19:29:15 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 30 Jul 2019 19:29:15 +0200
branch
micropython
changeset 7100
c4d9c28ebcd8
parent 7082
ec199ef0cfc6
child 7114
f416440c8be1
permissions
-rw-r--r--

Devices.py files: removed some methods no longer needed after the recent improvements.

# -*- coding: utf-8 -*-

# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the device interface class for BBC micro:bit boards.
"""

from __future__ import unicode_literals

from PyQt5.QtCore import pyqtSlot

from .MicroPythonDevices import MicroPythonDevice
from .MicroPythonReplWidget import HAS_QTCHART


class MicrobitDevice(MicroPythonDevice):
    """
    Class implementing the device for BBC micro:bit boards.
    """
    def __init__(self, microPythonWidget, parent=None):
        """
        Constructor
        
        @param microPythonWidget reference to the main MicroPython widget
        @type MicroPythonReplWidget
        @param parent reference to the parent object
        @type QObject
        """
        super(MicrobitDevice, self).__init__(microPythonWidget, parent)
    
    def setButtons(self):
        """
        Public method to enable the supported action buttons.
        """
        super(MicrobitDevice, self).setButtons()
        self.microPython.setActionButtons(
            repl=True, files=True, chart=HAS_QTCHART)
    
    def forceInterrupt(self):
        """
        Public method to determine the need for an interrupt when opening the
        serial connection.
        
        @return flag indicating an interrupt is needed
        @rtype bool
        """
        return True
    
    def canStartRepl(self):
        """
        Public method to determine, if a REPL can be started.
        
        @return tuple containing a flag indicating it is safe to start a REPL
            and a reason why it cannot.
        @rtype tuple of (bool, str)
        """
        return True, ""
    
    def canStartPlotter(self):
        """
        Public method to determine, if a Plotter can be started.
        
        @return tuple containing a flag indicating it is safe to start a
            Plotter and a reason why it cannot.
        @rtype tuple of (bool, str)
        """
        return True, ""
    
    def canStartFileManager(self):
        """
        Public method to determine, if a File Manager can be started.
        
        @return tuple containing a flag indicating it is safe to start a
            File Manager and a reason why it cannot.
        @rtype tuple of (bool, str)
        """
        return True, ""
    
    @pyqtSlot()
    def handleDataFlood(self):
        """
        Public slot handling a data floof from the device.
        """
        self.microPython.setActionButtons(files=True)

eric ide

mercurial