def ls(self): """ List the files on the micro:bit. Emit the resulting tuple of filenames or emit a failure signal. """ try: result = tuple(microfs.ls()) self.on_list_files.emit(result) except Exception as ex: logger.exception(ex) self.on_list_fail.emit()
def ls(self): """ Gets a list of the files on the micro:bit. Naive implementation for simplicity's sake. """ self.microbit_fs.clear() self.local_fs.clear() microbit_files = microfs.ls(microfs.get_serial()) for f in microbit_files: self.microbit_fs.addItem(f) local_files = [f for f in os.listdir(self.home) if os.path.isfile(os.path.join(self.home, f))] local_files.sort() for f in local_files: self.local_fs.addItem(f)