# eric6.MicroPython.MicroPythonFileManagerWidget

Module implementing a file manager for MicroPython devices.

### Global Attributes

None

### Classes

MicroPythonFileManagerWidget | Class implementing a file manager for MicroPython devices.

### Functions

None

## MicroPythonFileManagerWidget

Class implementing a file manager for MicroPython devices.

### Derived from

QWidget, Ui_MicroPythonFileManagerWidget

### Class Attributes

None

### Class Methods

None

### Methods

MicroPythonFileManagerWidget | Constructor
__changeDeviceDirectory | Private slot to change the current directory of the device.
__changeLocalDirectory | Private slot to change the local directory.
__createDeviceDirectory | Private slot to create a directory on the device.
__createLocalDirectory | Private slot to create a local directory.
__deleteDeviceDirectory | Private slot to delete an empty directory on the device.
__deleteDeviceDirectoryTree | Private slot to delete a directory and all its subdirectories recursively.
__deleteDeviceFile | Private slot to delete a file.
__deleteLocalDirectoryTree | Private slot to delete a local directory tree.
__deleteLocalFile | Private slot to delete a local file.
__deviceHiddenChanged | Private slot handling a change of the device show hidden menu entry.
__fsInfoResultReceived | Private slot to show the file system information of the device.
__handleCurrentDir | Private slot to handle a change of the current directory of the device.
__handleError | Private slot to handle errors.
__handleGetDone | Private slot handling a successful copy of a file from the device.
__handleLongListFiles | Private slot to receive a long directory listing.
__handleRsyncDone | Private method to handle the completion of the rsync operation.
__handleRsyncProgressMessage | Private slot handling progress messages sent by the file manager.
__isFileInList | Private method to check, if a file name is contained in a tree widget.
__listLocalFiles | Private method to populate the local files list.
__localHiddenChanged | Private slot handling a change of the local show hidden menu entry.
__newDeviceList | Private slot to initiate a new long list of the device directory.
__progressInfoDialogFinished | Private slot handling the closing of the progress info dialog.
__showDeviceContextMenu | Private slot to show the REPL context menu.
__showFileSystemInfo | Private slot to show some file system information.
__showLocalContextMenu | Private slot to show the REPL context menu.
on_deviceFileTreeWidget_itemActivated | Private slot to handle the activation of a device item.
on_deviceFileTreeWidget_itemSelectionChanged | Private slot handling a change of selection in the local pane.
on_deviceReloadButton_clicked | Private slot to reload the device list.
on_deviceUpButton_clicked | Private slot to go up one directory level on the device.
on_getAsButton_clicked | Private slot to copy the selected file from the connected device with a different name.
on_getButton_clicked | Private slot to copy the selected file from the connected device.
on_localFileTreeWidget_itemActivated | Private slot to handle the activation of a local item.
on_localFileTreeWidget_itemSelectionChanged | Private slot handling a change of selection in the local pane.
on_localReloadButton_clicked | Private slot to reload the local list.
on_localUpButton_clicked | Private slot to go up one directory level.
on_putAsButton_clicked | Private slot to copy the selected file to the connected device with a different name.
on_putButton_clicked | Private slot to copy the selected file to the connected device.
on_syncButton_clicked | Private slot to synchronize the local directory to the device.
start | Public method to start the widget.
stop | Public method to stop the widget.

### Static Methods

None

#### MicroPythonFileManagerWidget (Constructor)

MicroPythonFileManagerWidget(commandsInterface, deviceWithLocalAccess, parent=None)

Constructor

commandsInterface (MicroPythonCommandsInterface)
  reference to the commands interface object
deviceWithLocalAccess (bool)
  flag indicating the device supports file access via a local directory
parent (QWidget)
  reference to the parent widget

#### MicroPythonFileManagerWidget.__changeDeviceDirectory

__changeDeviceDirectory()

Private slot to change the current directory of the device.

Note: This triggers a re-population of the device list for the new current directory.

#### MicroPythonFileManagerWidget.__changeLocalDirectory

__changeLocalDirectory(localDevice=False)

Private slot to change the local directory.

localDevice (bool)
  flag indicating device access via local file system

#### MicroPythonFileManagerWidget.__createDeviceDirectory

__createDeviceDirectory()

Private slot to create a directory on the device.

#### MicroPythonFileManagerWidget.__createLocalDirectory

__createLocalDirectory(localDevice=False)

Private slot to create a local directory.

localDevice (bool)
  flag indicating device access via local file system

#### MicroPythonFileManagerWidget.__deleteDeviceDirectory

__deleteDeviceDirectory()

Private slot to delete an empty directory on the device.

#### MicroPythonFileManagerWidget.__deleteDeviceDirectoryTree

__deleteDeviceDirectoryTree()

Private slot to delete a directory and all its subdirectories recursively.

#### MicroPythonFileManagerWidget.__deleteDeviceFile

__deleteDeviceFile()

Private slot to delete a file.

#### MicroPythonFileManagerWidget.__deleteLocalDirectoryTree

__deleteLocalDirectoryTree(localDevice=False)

Private slot to delete a local directory tree.

localDevice (bool)
  flag indicating device access via local file system

#### MicroPythonFileManagerWidget.__deleteLocalFile

__deleteLocalFile(localDevice=False)

Private slot to delete a local file.

localDevice (bool)
  flag indicating device access via local file system

#### MicroPythonFileManagerWidget.__deviceHiddenChanged

__deviceHiddenChanged(checked)

Private slot handling a change of the device show hidden menu entry.

checked (bool)
  new check state of the action

#### MicroPythonFileManagerWidget.__fsInfoResultReceived

__fsInfoResultReceived(fsinfo)

Private slot to show the file system information of the device.

fsinfo (tuple of tuples of (str, int, int, int))
  tuple of tuples containing the file system name, the total size, the used size and the free size

#### MicroPythonFileManagerWidget.__handleCurrentDir

__handleCurrentDir(dirname)

Private slot to handle a change of the current directory of the device.

dirname (str)
  name of the current directory

#### MicroPythonFileManagerWidget.__handleError

__handleError(method, error)

Private slot to handle errors.

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

#### MicroPythonFileManagerWidget.__handleGetDone

__handleGetDone(deviceFile, localFile)

Private slot handling a successful copy of a file from the device.

deviceFile (str)
  name of the file on the device
localFile (str)
  name of the local file

#### MicroPythonFileManagerWidget.__handleLongListFiles

__handleLongListFiles(filesList)

Private slot to receive a long directory listing.

filesList (tuple of (str, str, str, str))
  tuple containing tuples with name, mode, size and time for each directory entry

#### MicroPythonFileManagerWidget.__handleRsyncDone

__handleRsyncDone(localDir, deviceDir)

Private method to handle the completion of the rsync operation.

localDir (str)
  name of the local directory
deviceDir (str)
  name of the device directory

#### MicroPythonFileManagerWidget.__handleRsyncProgressMessage

__handleRsyncProgressMessage(message)

Private slot handling progress messages sent by the file manager.

message (str)
  message to be shown

#### MicroPythonFileManagerWidget.__isFileInList

__isFileInList(filename, treeWidget)

Private method to check, if a file name is contained in a tree widget.

filename (str)
  name of the file to check
treeWidget
  reference to the tree widget to be checked against

Returns:
  flag indicating that the file name is present

Return Type:
  bool

#### MicroPythonFileManagerWidget.__listLocalFiles

__listLocalFiles(dirname="", localDevice=False)

Private method to populate the local files list.

dirname (str)
  name of the local directory to be listed
localDevice (bool)
  flag indicating device access via local file system

#### MicroPythonFileManagerWidget.__localHiddenChanged

__localHiddenChanged(checked)

Private slot handling a change of the local show hidden menu entry.

checked (bool)
  new check state of the action

#### MicroPythonFileManagerWidget.__newDeviceList

__newDeviceList()

Private slot to initiate a new long list of the device directory.

#### MicroPythonFileManagerWidget.__progressInfoDialogFinished

__progressInfoDialogFinished()

Private slot handling the closing of the progress info dialog.

#### MicroPythonFileManagerWidget.__showDeviceContextMenu

__showDeviceContextMenu(pos)

Private slot to show the REPL context menu.

pos (QPoint)
  position to show the menu at

#### MicroPythonFileManagerWidget.__showFileSystemInfo

__showFileSystemInfo()

Private slot to show some file system information.

#### MicroPythonFileManagerWidget.__showLocalContextMenu

__showLocalContextMenu(pos)

Private slot to show the REPL context menu.

pos (QPoint)
  position to show the menu at

#### MicroPythonFileManagerWidget.on_deviceFileTreeWidget_itemActivated

on_deviceFileTreeWidget_itemActivated(item, column)

Private slot to handle the activation of a device item.

If the item is a directory, the current working directory is changed and the list will be re-populated for this directory.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  column of the activation

#### MicroPythonFileManagerWidget.on_deviceFileTreeWidget_itemSelectionChanged

on_deviceFileTreeWidget_itemSelectionChanged()

Private slot handling a change of selection in the local pane.

#### MicroPythonFileManagerWidget.on_deviceReloadButton_clicked

on_deviceReloadButton_clicked()

Private slot to reload the device list.

#### MicroPythonFileManagerWidget.on_deviceUpButton_clicked

on_deviceUpButton_clicked()

Private slot to go up one directory level on the device.

#### MicroPythonFileManagerWidget.on_getAsButton_clicked

on_getAsButton_clicked()

Private slot to copy the selected file from the connected device with a different name.

#### MicroPythonFileManagerWidget.on_getButton_clicked

on_getButton_clicked(getAs=False)

Private slot to copy the selected file from the connected device.

getAs (bool)
  flag indicating to give it a new name

#### MicroPythonFileManagerWidget.on_localFileTreeWidget_itemActivated

on_localFileTreeWidget_itemActivated(item, column)

Private slot to handle the activation of a local item.

If the item is a directory, the list will be re-populated for this directory.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  column of the activation

#### MicroPythonFileManagerWidget.on_localFileTreeWidget_itemSelectionChanged

on_localFileTreeWidget_itemSelectionChanged()

Private slot handling a change of selection in the local pane.

#### MicroPythonFileManagerWidget.on_localReloadButton_clicked

on_localReloadButton_clicked()

Private slot to reload the local list.

#### MicroPythonFileManagerWidget.on_localUpButton_clicked

on_localUpButton_clicked()

Private slot to go up one directory level.

#### MicroPythonFileManagerWidget.on_putAsButton_clicked

on_putAsButton_clicked()

Private slot to copy the selected file to the connected device with a different name.

#### MicroPythonFileManagerWidget.on_putButton_clicked

on_putButton_clicked(putAs=False)

Private slot to copy the selected file to the connected device.

putAs (bool)
  flag indicating to give it a new name

#### MicroPythonFileManagerWidget.on_syncButton_clicked

on_syncButton_clicked()

Private slot to synchronize the local directory to the device.

#### MicroPythonFileManagerWidget.start

start()

Public method to start the widget.

#### MicroPythonFileManagerWidget.stop

stop()

Public method to stop the widget.

Up