src/eric7/MicroPython/MicroPythonFileManagerWidget.py

branch
eric7
changeset 10236
c270c9501f1c
parent 10143
bf84513859ca
child 10388
a34ce7f42e8b
equal deleted inserted replaced
10235:4a12b160094c 10236:c270c9501f1c
405 if name.endswith("/"): 405 if name.endswith("/"):
406 # directory names end with a '/' 406 # directory names end with a '/'
407 self.__fileManager.cd(name[:-1]) 407 self.__fileManager.cd(name[:-1])
408 else: 408 else:
409 data = self.__fileManager.getData(name) 409 data = self.__fileManager.getData(name)
410 text = data.decode(encoding="utf-8") 410 try:
411 ericApp().getObject("ViewManager").newEditorWithText( 411 text = data.decode(encoding="utf-8")
412 text, fileName="device:{0}".format(name) 412 ericApp().getObject("ViewManager").newEditorWithText(
413 ) 413 text, fileName="device:{0}".format(name)
414 )
415 except UnicodeDecodeError:
416 EricMessageBox.warning(
417 self,
418 self.tr("Open Device File"),
419 self.tr(
420 "<p>The file <b>{0}</b> does not contain Unicode text.</p>"
421 ).format(name),
422 )
423 return
414 424
415 @pyqtSlot() 425 @pyqtSlot()
416 def on_deviceFileTreeWidget_itemSelectionChanged(self): 426 def on_deviceFileTreeWidget_itemSelectionChanged(self):
417 """ 427 """
418 Private slot handling a change of selection in the local pane. 428 Private slot handling a change of selection in the local pane.

eric ide

mercurial