diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-01-22 16:11:19 -0500 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-01-22 16:11:19 -0500 |
| commit | 3dd22f40996fc128ffce6026e8e747ca66bcc21d (patch) | |
| tree | a5e7fc57dc620fc4d4a408ffdbf114bb66dcf91d /python/filemetadata.py | |
| parent | 96053ffc711aa27fcaeeb6cbfa89df0c253361f8 (diff) | |
Project support
Diffstat (limited to 'python/filemetadata.py')
| -rw-r--r-- | python/filemetadata.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/python/filemetadata.py b/python/filemetadata.py index ec0e16bb..e51436b1 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -31,6 +31,7 @@ from .log import log_error from . import binaryview from . import database from . import deprecation +from . import project ProgressFuncType = Callable[[int, int], bool] ViewName = str @@ -298,6 +299,20 @@ class FileMetadata: def snapshot_data_applied_without_error(self) -> bool: return core.BNIsSnapshotDataAppliedWithoutError(self.handle) + @property + def project(self) -> Optional['project.Project']: + project_file = self.project_file + if project_file is None: + return None + return project_file.project + + @property + def project_file(self) -> Optional['project.ProjectFile']: + handle = core.BNGetProjectFile(self.handle) + if handle is None: + return None + return project.ProjectFile(handle) + def close(self) -> None: """ Closes the underlying file handle. It is recommended that this is done in a @@ -606,14 +621,6 @@ class FileMetadata: return None return binaryview.BinaryView(file_metadata=self, handle=view) - def open_project(self) -> bool: - return core.BNOpenProject(self.handle) - - def close_project(self) -> None: - core.BNCloseProject(self.handle) - - def is_project_open(self) -> bool: - return core.BNIsProjectOpen(self.handle) @property def existing_views(self) -> List[ViewName]: |
