maps4fs 2.5.3__py3-none-any.whl → 2.5.4__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.
@@ -21,10 +21,23 @@ os.makedirs(MFS_DEM_DEFAULTS_DIR, exist_ok=True)
21
21
  DEFAULT_OSM_PATH = os.path.join(MFS_OSM_DEFAULTS_DIR, "custom_osm.osm")
22
22
  DEFAULT_DEM_PATH = os.path.join(MFS_DEM_DEFAULTS_DIR, "custom_dem.png")
23
23
 
24
- DEFAULT_OSM = DEFAULT_OSM_PATH if os.path.isfile(DEFAULT_OSM_PATH) else None
25
- DEFAULT_DEM = DEFAULT_DEM_PATH if os.path.isfile(DEFAULT_DEM_PATH) else None
26
- logger.info("Default OSM: %s", DEFAULT_OSM)
27
- logger.info("Default DEM: %s", DEFAULT_DEM)
24
+
25
+ def default_osm() -> str | None:
26
+ """Get the path to the default OSM file if it exists.
27
+
28
+ Returns:
29
+ str | None: The path to the default OSM file, or None if it doesn't exist.
30
+ """
31
+ return DEFAULT_OSM_PATH if os.path.isfile(DEFAULT_OSM_PATH) else None
32
+
33
+
34
+ def default_dem() -> str | None:
35
+ """Get the path to the default DEM file if it exists.
36
+
37
+ Returns:
38
+ str | None: The path to the default DEM file, or None if it doesn't exist.
39
+ """
40
+ return DEFAULT_DEM_PATH if os.path.isfile(DEFAULT_DEM_PATH) else None
28
41
 
29
42
 
30
43
  def ensure_templates():
maps4fs/generator/map.py CHANGED
@@ -66,7 +66,7 @@ class Map:
66
66
  # endregion
67
67
 
68
68
  # region custom OSM properties
69
- self.custom_osm = custom_osm or mfscfg.DEFAULT_OSM
69
+ self.custom_osm = custom_osm or mfscfg.default_osm()
70
70
  if custom_osm and not os.path.isfile(custom_osm):
71
71
  raise FileNotFoundError(f"Custom OSM file {custom_osm} does not exist.")
72
72
  mfsutils.check_and_fix_osm(self.custom_osm, save_directory=self.map_directory)
@@ -126,7 +126,7 @@ class Map:
126
126
  self.shared_settings = SharedSettings()
127
127
  self.components: list[Component] = []
128
128
  custom_dem = kwargs.get("custom_background_path", None)
129
- self.custom_background_path = custom_dem or mfscfg.DEFAULT_DEM
129
+ self.custom_background_path = custom_dem or mfscfg.default_dem()
130
130
 
131
131
  def process_settings(self) -> None:
132
132
  """Checks the settings by predefined rules and updates them accordingly."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.5.3
3
+ Version: 2.5.4
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: GNU Affero General Public License v3.0
@@ -1,9 +1,9 @@
1
1
  maps4fs/__init__.py,sha256=5ixsCA5vgcIV0OrF9EJBm91Mmc_KfMiDRM-QyifMAvo,386
2
2
  maps4fs/logger.py,sha256=6sem0aFKQqtVjQ_yNu9iGcc-hqzLQUhfxco05K6nqow,763
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/config.py,sha256=kFGeChqHUqqDoMpu1ieQpUg5d8DmqFL7yD0_LadFN44,6159
4
+ maps4fs/generator/config.py,sha256=8eWdMTizo47aYVuOQbhxrgIBMsDtrDIZ01KCFI14UUM,6460
5
5
  maps4fs/generator/game.py,sha256=nf6iuYNA5NJc-ir_WOgkw-MdJVgetVHeEtxbWJYt3Vo,14462
6
- maps4fs/generator/map.py,sha256=_eVfdGzE9HZCY0sRyGP8fBdCcVuYomREcmgKiAsmcjo,12881
6
+ maps4fs/generator/map.py,sha256=ZTkTlQhBcKB_sMapua_QfaD0moc2MJ-kQix2lWD6pUk,12885
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
8
  maps4fs/generator/settings.py,sha256=WvuNe9-aqiEABjGP_ySsZi_HU6OnJFvBbMVhkm_cf4k,12923
9
9
  maps4fs/generator/statistics.py,sha256=Dp1-NS-DWv0l0UdmhOoXeQs_N-Hs7svYUnmziSW5Z9I,2098
@@ -22,8 +22,8 @@ maps4fs/generator/component/base/component.py,sha256=lf0V9CLUXMg88Nm2yI3rP5taVYY
22
22
  maps4fs/generator/component/base/component_image.py,sha256=WTGC6v1KuS5sLNCC95Z48nCspvATKKNOuhTNYzTWXr4,8315
23
23
  maps4fs/generator/component/base/component_mesh.py,sha256=3hC-qDT8Vde6SmRMqs9USAkrF-gL2dDTYW71ATpxUS4,9130
24
24
  maps4fs/generator/component/base/component_xml.py,sha256=MT-VhU2dEckLFxAgmxg6V3gnv11di_94Qq6atfpOLdc,5342
25
- maps4fs-2.5.3.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
26
- maps4fs-2.5.3.dist-info/METADATA,sha256=TUPpvg5-KvFRJJzI_nfIG6bt2XIDk_hsU4rgESV7zac,10113
27
- maps4fs-2.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- maps4fs-2.5.3.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
29
- maps4fs-2.5.3.dist-info/RECORD,,
25
+ maps4fs-2.5.4.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
26
+ maps4fs-2.5.4.dist-info/METADATA,sha256=cUIlIjfVwW0PV4Wm7An13RXBGR5xOvxsCv2qWa9cnKo,10113
27
+ maps4fs-2.5.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ maps4fs-2.5.4.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
29
+ maps4fs-2.5.4.dist-info/RECORD,,