maps4fs 1.8.224__py3-none-any.whl → 1.8.226__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
 
7
7
  import os
8
8
  from abc import ABC, abstractmethod
9
- from typing import TYPE_CHECKING, Type
9
+ from typing import TYPE_CHECKING, Any, Type
10
10
  from zipfile import ZipFile
11
11
 
12
12
  import numpy as np
@@ -53,6 +53,14 @@ class DTMProvider(ABC):
53
53
 
54
54
  _base_instructions = None
55
55
 
56
+ # AdvancedSettings that should be changed by the DTM Provider if it's selected.
57
+ # * This feature has effect only in the WebUI of the app and ignored in Python package.
58
+ # The first level of the dictionary is a category name,
59
+ # for example: TextureSettings, DEMSettings, etc.
60
+ # The second level is a name of particular setting in the category.
61
+ # Example: {"DEMSettings": {"blur_radius": 35}}
62
+ _default_settings: dict[str, dict[str, Any]] = {}
63
+
56
64
  def __init__(
57
65
  self,
58
66
  coordinates: tuple[float, float],
@@ -74,6 +82,15 @@ class DTMProvider(ABC):
74
82
  self.logger = logger
75
83
  self.map = map
76
84
 
85
+ @classmethod
86
+ def default_settings(cls) -> dict[str, dict[str, Any]]:
87
+ """Default settings of the provider.
88
+
89
+ Returns:
90
+ dict: Default settings of the provider.
91
+ """
92
+ return cls._default_settings
93
+
77
94
  @classmethod
78
95
  def name(cls) -> str | None:
79
96
  """Name of the provider.
@@ -25,7 +25,9 @@ class SRTM30Provider(DTMProvider):
25
25
 
26
26
  _author = "[iwatkot](https://github.com/iwatkot)"
27
27
 
28
- _instructions = "ℹ️ Recommended settings: \nDEM Settings -> Blur Radius: **35**"
28
+ # _instructions = "ℹ️ Recommended settings: \nDEM Settings -> Blur Radius: **35**"
29
+
30
+ _default_settings = {"DEMSettings": {"blur_radius": 35}}
29
31
 
30
32
  def __init__(self, *args, **kwargs):
31
33
  super().__init__(*args, **kwargs)
@@ -18,10 +18,10 @@ except Exception:
18
18
 
19
19
  STATS_HOST = os.getenv("STATS_HOST")
20
20
  if not STATS_HOST:
21
- print("STATS_HOST not set in environment")
21
+ logger.debug("STATS_HOST not set in environment")
22
22
  API_TOKEN = os.getenv("API_TOKEN")
23
23
  if not API_TOKEN:
24
- print("API_TOKEN not set in environment")
24
+ logger.debug("API_TOKEN not set in environment")
25
25
 
26
26
 
27
27
  def send_settings(endpoint: str, data: dict[str, Any]) -> None:
@@ -31,6 +31,10 @@ def send_settings(endpoint: str, data: dict[str, Any]) -> None:
31
31
  endpoint (str): The endpoint to send the settings to.
32
32
  data (dict[str, Any]): The settings to send.
33
33
  """
34
+ if not STATS_HOST or not API_TOKEN:
35
+ logger.info("STATS_HOST or API_TOKEN not set in environment, can't send settings.")
36
+ return
37
+
34
38
  headers = {"Authorization": f"Bearer {API_TOKEN}", "Content-Type": "application/json"}
35
39
  response = requests.post(endpoint, headers=headers, json=data, timeout=10)
36
40
  if response.status_code != 200:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.224
3
+ Version: 1.8.226
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -6,7 +6,7 @@ maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,112
6
6
  maps4fs/generator/map.py,sha256=b_X8iVhvXgnSfcly6m8BhbFcWeG2HrSM4iAOylZRebE,12575
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
8
  maps4fs/generator/settings.py,sha256=d3NaMpyFh-IZWtHV2UQMMqUfuPP76lv7mIN2d7mORqA,6747
9
- maps4fs/generator/statistics.py,sha256=itae_EeAxxEMTpV_G3SsX6soUqDz8uGEFoit8GVrV5o,1621
9
+ maps4fs/generator/statistics.py,sha256=JfhiGDZf2-VoWZbL-Kikzv4_DqerYwKcseccVL9qzXo,1783
10
10
  maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
11
11
  maps4fs/generator/component/background.py,sha256=ppxK2RheCYrLRnBkLeZUst6Ciopo9Z_zUyjS-n8YwGE,18794
12
12
  maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
@@ -27,7 +27,7 @@ maps4fs/generator/dtm/bavaria.py,sha256=nH2wTxiIdQgKotauTqD-zztwFgfZzIdym2sjmSqf
27
27
  maps4fs/generator/dtm/canada.py,sha256=XJ_za2LDV9PEV7hmjPnzdwPbpr6ezAR73-HDVaTuKPk,1290
28
28
  maps4fs/generator/dtm/czech.py,sha256=sT0gwbtEnizVNcZeL7kyDdwmKvB3w8m6UgJR7ZTk1to,1058
29
29
  maps4fs/generator/dtm/denmark.py,sha256=JFuBRrCJTMXe_vdO3gRCwsnZ3nZOp_Y6671Kq8aXRGM,1591
30
- maps4fs/generator/dtm/dtm.py,sha256=iuZ5lV5OFefpmJh8NKu37APZydcjFzcrhLe1ChxVRjc,16748
30
+ maps4fs/generator/dtm/dtm.py,sha256=d5ZSBw1Nz6iCAek4O5ioLIijNRaxGvHNlNlEpkqqUIE,17464
31
31
  maps4fs/generator/dtm/england.py,sha256=3URUm7uLH_RYXcQdDW3Vt09GWKAE8RAy1ZFJB94kXOA,1124
32
32
  maps4fs/generator/dtm/finland.py,sha256=VpXpvCgzbyKA6VGSa7ikSzE4B-cLfR1_2zOHvS8delc,1870
33
33
  maps4fs/generator/dtm/flanders.py,sha256=LltmowbS84_DaBHAS9XYoJPMunX6sWGy6zaVACHj5Ro,1039
@@ -43,7 +43,7 @@ maps4fs/generator/dtm/rema.py,sha256=arLE12yE92EWmWysNUTtdEzwcNiCBtEBmnfnryOriRY
43
43
  maps4fs/generator/dtm/sachsenanhalt.py,sha256=UvLrQVxJX30BqtNbKZyR6EJc-vS5fLyanh6fntjYj2k,1144
44
44
  maps4fs/generator/dtm/scotland.py,sha256=kUGPNjn3mQPOU9sgK3k-uwumPG2wrRFLaDMyPMh06Jw,4819
45
45
  maps4fs/generator/dtm/spain.py,sha256=A5QScsrd_bkVlf2n9ZfXBL9z_YoXpLsm_5FWs-5nd_o,1021
46
- maps4fs/generator/dtm/srtm.py,sha256=RcAB0PRaTLAJNvasLLdGVvjww05Lby2O2Aw5TG0M0sY,4263
46
+ maps4fs/generator/dtm/srtm.py,sha256=INn3Kpfmo2nLPCDko1sFk9_ZinWW3e8I9S-TX0fMHoY,4327
47
47
  maps4fs/generator/dtm/switzerland.py,sha256=Jn3qYVEps_K6cH-9rMfB_zoXMxhzWQKPnlKkSE-TehE,3549
48
48
  maps4fs/generator/dtm/usgs_wcs.py,sha256=X8VxdhyH0-EciGE_X-KgrAM6sVLTGssYIhtebOj8MPI,1021
49
49
  maps4fs/generator/dtm/utils.py,sha256=I-wUSA_J85Xbt8sZCZAVKHSIcrMj5Ng-0adtPVhVmk0,2315
@@ -53,8 +53,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
53
53
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
54
54
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
55
55
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
56
- maps4fs-1.8.224.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
- maps4fs-1.8.224.dist-info/METADATA,sha256=UPYXmUHEToUSIqSiNy2fOOgIbtncy4E-HX1LzktnBWo,45770
58
- maps4fs-1.8.224.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
- maps4fs-1.8.224.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
- maps4fs-1.8.224.dist-info/RECORD,,
56
+ maps4fs-1.8.226.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
+ maps4fs-1.8.226.dist-info/METADATA,sha256=cm-M7GQ_AC_Pcoi8pm1Y9JMYOI05Tv036PCoed1-Qa8,45770
58
+ maps4fs-1.8.226.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
+ maps4fs-1.8.226.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
+ maps4fs-1.8.226.dist-info/RECORD,,