src/eric7/MicroPython/Devices/DeviceBase.py

branch
eric7
changeset 9766
f0e22f3a5878
parent 9765
6378da868bb0
child 9772
06ef28082c4d
equal deleted inserted replaced
9765:6378da868bb0 9766:f0e22f3a5878
23 23
24 24
25 class BaseDevice(QObject): 25 class BaseDevice(QObject):
26 """ 26 """
27 Base class for the more specific MicroPython devices. 27 Base class for the more specific MicroPython devices.
28
29 It includes a list of commands for general use on the various boards.
30 If a board needs special treatment, the command should be overwritten
31 in the board specific subclass. Commands are provided to perform operations
32 on the file system of a connected MicroPython device, for getting and setting
33 the time on the board and getting board related data. Supported file system
34 commands are:
35 <ul>
36 <li>ls: directory listing</li>
37 <li>lls: directory listing with meta data</li>
38 <li>cd: change directory</li>
39 <li>pwd: get the current directory</li>
40 <li>put: copy a file to the connected device</li>
41 <li>putData: write data to a file of the connected device</li>
42 <li>get: get a file from the connected device</li>
43 <li>getData: read data of a file of the connected device</li>
44 <li>rm: remove a file from the connected device</li>
45 <li>rmrf: remove a file/directory recursively (like 'rm -rf' in bash)
46 <li>mkdir: create a new directory</li>
47 <li>rmdir: remove an empty directory</li>
48 <li>fileSystemInfo: get information about the file system
49 </ul>
50
51 Supported non file system commands are:
52 <ul>
53 <li>getBoardData: get information about the connected board</li>
54 <li>getDeviceData: get version info about MicroPython and some implementation
55 information</li>
56 <li>getModules: get a list of built-in modules</li>
57 <li>getTime: get the current time</li>
58 <li>syncTime: synchronize the time of the connected device</li>
59 <li>showTime: show the current time of the connected device</li>
60 </ul>
28 """ 61 """
29 62
30 def __init__(self, microPythonWidget, deviceType, parent=None): 63 def __init__(self, microPythonWidget, deviceType, parent=None):
31 """ 64 """
32 Constructor 65 Constructor
616 @exception OSError raised to indicate an issue with the device 649 @exception OSError raised to indicate an issue with the device
617 """ 650 """
618 if dirname: 651 if dirname:
619 command = """ 652 command = """
620 import os as __os_ 653 import os as __os_
621 __os_.rmdir('{0}') 654
655 try:
656 __os_.rmdir('{0}')
657 except OSError as exc:
658 if exc.args[0] == 13:
659 raise OSError(13, 'Access denied or directory not empty.')
660 else:
661 raise
622 del __os_ 662 del __os_
623 """.format( 663 """.format(
624 dirname 664 dirname
625 ) 665 )
626 out, err = self._interface.execute(command) 666 out, err = self._interface.execute(command)

eric ide

mercurial