def open_file(self, file_name): # The Qt thread should never hit the core directly. # Synchronous calls can run directly in the job system # as they won't block the Qt loop for long path = self.jobs_ctx.run_sync( self.core.mountpoint_manager.get_path_in_mountpoint, self.workspace_fs.workspace_id, self.current_directory / file_name, self.workspace_fs.timestamp if isinstance(self.workspace_fs, WorkspaceFSTimestamped) else None, ) desktop.open_file(str(path))
def item_double_clicked(self, row, column): name_item = self.table_files.item(row, 1) type_item = self.table_files.item(row, 0) file_type = type_item.data(Qt.UserRole) if file_type == FileType.ParentFolder: self.load(os.path.dirname(self.current_directory)) elif file_type == FileType.ParentWorkspace: self.back_clicked.emit() elif file_type == FileType.File: desktop.open_file( os.path.join(self.core.mountpoint, self.workspace, self.current_directory, name_item.text())) elif file_type == FileType.Folder: self.load( os.path.join( os.path.join(self.current_directory, name_item.text())))
def open_workspace_file(self, workspace_fs, file_name): file_name = FsPath("/", file_name) if file_name else FsPath("/") try: # The Qt thread should never hit the core directly. # Synchronous calls can run directly in the job system # as they won't block the Qt loop for long path = self.jobs_ctx.run_sync( self.core.mountpoint_manager.get_path_in_mountpoint, workspace_fs.workspace_id, file_name, workspace_fs.timestamp if isinstance(workspace_fs, WorkspaceFSTimestamped) else None, ) except MountpointNotMounted: # The mountpoint has been umounted in our back, nothing left to do pass desktop.open_file(str(path))
def open_mountpoint(self, path): desktop.open_file(path)
def _inner_open_file(): desktop.open_file( os.path.join(self.core.mountpoint, self.workspace, self.current_directory, file_name))