def changeRemoteDir(self, directory): """修改当前的本地目录""" # if not path.isdir(directory): # return directory = directory or '/' self.lstRemote.clear() try: dirs, files = self.__adb.ls(directory) if dirs is None or files is None: self.setStatusTip('没有连接设备') return except ADBException as e: self.setStatusTip(e.msg) return for d in dirs: li = QListWidgetItem() li.setIcon(MyResources.icons['dir']) li.setText(d.name) li.fileType = 1 self.lstRemote.addItem(li) for f in files: li = QListWidgetItem() li.setIcon(MyResources.icons['file']) li.setText(f.name) li.fileType = 0 self.lstRemote.addItem(li) self.curRemoteDir = directory
def changeLocalDir(self, directory): """修改当前的本地目录""" try: directory = directory or '/' if not path.isdir(directory): return dirs = [m for m in os.scandir(directory) if m.is_dir()] files = [m for m in os.scandir(directory) if m.is_file()] self.lstLocal.clear() for d in dirs: li = QListWidgetItem() li.setIcon(MyResources.icons['dir']) li.setText(d.name) li.fileType = 1 self.lstLocal.addItem(li) for f in files: li = QListWidgetItem() li.setIcon(MyResources.icons['file']) li.setText(f.name) li.fileType = 0 self.lstLocal.addItem(li) self.curLocalDir = directory except Exception: pass