diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2026-08-17 20:29:02 +0200 |
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2026-08-17 20:29:02 +0200 |
| commit | 0eece020318bc9a0223dd4d3bac6b29949146699 (patch) | |
| tree | ae9c15922ebaf08005661ff310af898ac1347295 /hittekaart-py/src | |
| parent | 9a576a8d3a8cb1d143be0ade0310f71b490cacb9 (diff) | |
| parent | 99db2d1e499c3ca0b113e50ddd46f46f52c9e28b (diff) | |
| download | hittekaart-0eece020318bc9a0223dd4d3bac6b29949146699.tar.gz hittekaart-0eece020318bc9a0223dd4d3bac6b29949146699.tar.bz2 hittekaart-0eece020318bc9a0223dd4d3bac6b29949146699.zip | |
Merge branch 'mbtiles-desc'
Diffstat (limited to 'hittekaart-py/src')
| -rw-r--r-- | hittekaart-py/src/lib.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/hittekaart-py/src/lib.rs b/hittekaart-py/src/lib.rs index b93d9d6..3a9b3ed 100644 --- a/hittekaart-py/src/lib.rs +++ b/hittekaart-py/src/lib.rs @@ -88,7 +88,7 @@ impl Track { enum StorageType { Folder(PathBuf), OsmAnd(PathBuf), - MbTiles(PathBuf), + MbTiles(PathBuf, Option<String>, Option<String>), } /// Represents a storage target. @@ -125,17 +125,17 @@ impl Storage { } #[staticmethod] - #[pyo3(name = "MbTiles")] - fn mbtiles(path: &[u8]) -> Self { + #[pyo3(name = "MbTiles", signature = (path, name = None, description = None))] + fn mbtiles(path: &[u8], name: Option<String>, description: Option<String>) -> Self { let path = OsStr::from_bytes(path); - Storage(StorageType::MbTiles(path.into())) + Storage(StorageType::MbTiles(path.into(), name, description)) } fn __repr__(&self) -> String { match self.0 { StorageType::Folder(ref path) => format!("<Storage.Folder path='{}'>", path.display()), StorageType::OsmAnd(ref path) => format!("<Storage.OsmAnd path='{}'>", path.display()), - StorageType::MbTiles(ref path) => format!("<Storage.MbTiles path='{}'>", path.display()), + StorageType::MbTiles(ref path, ..) => format!("<Storage.MbTiles path='{}'>", path.display()), } } } @@ -152,9 +152,13 @@ impl Storage { .map_err(|e| err_to_py(&e))?; Ok(Box::new(storage)) } - StorageType::MbTiles(ref path) => { - let storage = hittekaart::storage::MbTiles::open(path.clone()) + StorageType::MbTiles(ref path, ref name, ref desc) => { + let mut storage = hittekaart::storage::MbTiles::open(path.clone()) .map_err(|e| err_to_py(&e))?; + if let Some(n) = name { + storage = storage.with_name(n.clone()); + } + storage = storage.with_description(desc.clone()); Ok(Box::new(storage)) } } |
