aboutsummaryrefslogtreecommitdiff
path: root/hittekaart-py
diff options
context:
space:
mode:
Diffstat (limited to 'hittekaart-py')
-rw-r--r--hittekaart-py/hittekaart_py/__pycache__/__init__.cpython-314.pycbin0 -> 207 bytes
-rw-r--r--hittekaart-py/hittekaart_py/hittekaart_py.pyi2
-rw-r--r--hittekaart-py/src/lib.rs18
3 files changed, 12 insertions, 8 deletions
diff --git a/hittekaart-py/hittekaart_py/__pycache__/__init__.cpython-314.pyc b/hittekaart-py/hittekaart_py/__pycache__/__init__.cpython-314.pyc
new file mode 100644
index 0000000..11caa7e
--- /dev/null
+++ b/hittekaart-py/hittekaart_py/__pycache__/__init__.cpython-314.pyc
Binary files differ
diff --git a/hittekaart-py/hittekaart_py/hittekaart_py.pyi b/hittekaart-py/hittekaart_py/hittekaart_py.pyi
index b3d110c..00ed13c 100644
--- a/hittekaart-py/hittekaart_py/hittekaart_py.pyi
+++ b/hittekaart-py/hittekaart_py/hittekaart_py.pyi
@@ -17,7 +17,7 @@ class Storage:
def OsmAnd(path: bytes) -> "Storage": ...
@staticmethod
- def MbTiles(path: bytes) -> "Storage": ...
+ def MbTiles(path: bytes, name: str | None, description: str | None) -> "Storage": ...
class HeatmapRenderer:
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))
}
}