src/eric7/MicroPython/MicroPythonFileManagerWidget.py

branch
eric7
changeset 10896
9cbbed624751
parent 10806
2f6df822e3b9
child 10898
8349907e1319
equal deleted inserted replaced
10895:11069c6bfff0 10896:9cbbed624751
707 devicePath = ( 707 devicePath = (
708 self.deviceCwd.text() 708 self.deviceCwd.text()
709 if item is None 709 if item is None
710 else item.data(0, Qt.ItemDataRole.UserRole) 710 else item.data(0, Qt.ItemDataRole.UserRole)
711 ) 711 )
712 deviceParent = item 712 deviceParent = self.deviceFileTreeWidget if item is None else item
713 else: 713 else:
714 devicePath = self.deviceCwd.text() 714 devicePath = self.deviceCwd.text()
715 deviceParent = self.deviceFileTreeWidget 715 deviceParent = self.deviceFileTreeWidget
716 716
717 if self.__isFileInList(deviceFilename, deviceParent): 717 if self.__isFileInList(deviceFilename, deviceParent):
736 else: 736 else:
737 if devicePath: 737 if devicePath:
738 deviceFilename = ( 738 deviceFilename = (
739 f"{devicePath}/{deviceFilename}" 739 f"{devicePath}/{deviceFilename}"
740 if devicePath != "/" 740 if devicePath != "/"
741 else f"/{devicePath}" 741 else f"/{deviceFilename}"
742 ) 742 )
743 self.__fileManager.put(filepath, deviceFilename) 743 self.__fileManager.put(filepath, deviceFilename)
744 744
745 @pyqtSlot() 745 @pyqtSlot()
746 def on_putAsButton_clicked(self): 746 def on_putAsButton_clicked(self):
786 localPath = ( 786 localPath = (
787 self.localCwd.text() 787 self.localCwd.text()
788 if item is None 788 if item is None
789 else item.data(0, Qt.ItemDataRole.UserRole) 789 else item.data(0, Qt.ItemDataRole.UserRole)
790 ) 790 )
791 localParent = item 791 localParent = self.localFileTreeWidget if item is None else item
792 else: 792 else:
793 localPath = self.localCwd.text() 793 localPath = self.localCwd.text()
794 localParent = self.localFileTreeWidget 794 localParent = self.localFileTreeWidget
795 795
796 if self.__isFileInList(localFilename, localParent): 796 if self.__isFileInList(localFilename, localParent):
1026 devicePath = ( 1026 devicePath = (
1027 self.deviceCwd.text() 1027 self.deviceCwd.text()
1028 if item is None 1028 if item is None
1029 else item.data(0, Qt.ItemDataRole.UserRole) 1029 else item.data(0, Qt.ItemDataRole.UserRole)
1030 ) 1030 )
1031 deviceParent = item 1031 deviceParent = self.deviceFileTreeWidget if item is None else item
1032 else: 1032 else:
1033 devicePath = self.deviceCwd.text() 1033 devicePath = self.deviceCwd.text()
1034 deviceParent = self.deviceFileTreeWidget 1034 deviceParent = self.deviceFileTreeWidget
1035 1035
1036 if saveAs and self.__isFileInList(filename, deviceParent): 1036 if saveAs and self.__isFileInList(filename, deviceParent):
1057 aw.setFileName(filename) 1057 aw.setFileName(filename)
1058 else: 1058 else:
1059 filename = ( 1059 filename = (
1060 f"{devicePath}/{filename}" 1060 f"{devicePath}/{filename}"
1061 if devicePath != "/" 1061 if devicePath != "/"
1062 else f"/{devicePath}" 1062 else f"/{filename}"
1063 ) 1063 )
1064 dirname = filename.rsplit("/", 1)[0] 1064 dirname = filename.rsplit("/", 1)[0]
1065 self.__fileManager.makedirs(dirname) 1065 self.__fileManager.makedirs(dirname)
1066 self.__fileManager.putData(filename, text.encode("utf-8")) 1066 self.__fileManager.putData(filename, text.encode("utf-8"))
1067 aw.setFileName(FileSystemUtilities.deviceFileName(filename)) 1067 aw.setFileName(FileSystemUtilities.deviceFileName(filename))

eric ide

mercurial