maps4fs 2.9.32__py3-none-any.whl → 2.9.33__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.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

@@ -7,6 +7,7 @@ import os
7
7
  import shutil
8
8
  import warnings
9
9
  from collections import defaultdict
10
+ from time import perf_counter
10
11
  from typing import Any, Callable, Generator, Optional
11
12
 
12
13
  import cv2
@@ -815,6 +816,7 @@ class Texture(ImageComponent):
815
816
 
816
817
  ox_settings.use_cache = self.map.texture_settings.use_cache
817
818
  ox_settings.requests_timeout = 30
819
+ ox_settings.log_console = True
818
820
 
819
821
  objects = self.fetch_osm_data(tags)
820
822
  if objects is None or objects.empty:
@@ -843,7 +845,14 @@ class Texture(ImageComponent):
843
845
  warnings.simplefilter("ignore", FutureWarning)
844
846
  objects = ox.features_from_xml(self.map.custom_osm, tags=tags)
845
847
  else:
848
+ ox_start_time = perf_counter()
849
+ self.logger.info("------------------------------------------")
850
+ self.logger.info("Fetching OSM data for tags: %s.", tags)
846
851
  objects = ox.features_from_bbox(bbox=self.new_bbox, tags=tags)
852
+ self.logger.info("Fetched %s objects for tags: %s.", len(objects), tags)
853
+ ox_end_time = perf_counter()
854
+ self.logger.info("OSM data fetch time: %.2f seconds.", ox_end_time - ox_start_time)
855
+ self.logger.info("------------------------------------------")
847
856
  except Exception as e:
848
857
  self.logger.debug("Error fetching objects for tags: %s. Error: %s.", tags, e)
849
858
  return None
@@ -51,11 +51,19 @@ def ensure_templates():
51
51
  If MFS_TEMPLATES_DIR is empty or doesn't exist, clone the maps4fsdata
52
52
  repository and run the preparation script to populate it.
53
53
  """
54
-
55
54
  # Check if templates directory exists and has content
56
- if os.path.exists(MFS_TEMPLATES_DIR) and os.listdir(MFS_TEMPLATES_DIR):
57
- logger.info("Templates directory already exists and contains data: %s", MFS_TEMPLATES_DIR)
58
- return
55
+ if os.path.exists(MFS_TEMPLATES_DIR): # and os.listdir(MFS_TEMPLATES_DIR):
56
+ logger.info("Templates directory already exists: %s", MFS_TEMPLATES_DIR)
57
+
58
+ files = [
59
+ entry
60
+ for entry in os.listdir(MFS_TEMPLATES_DIR)
61
+ if os.path.isfile(os.path.join(MFS_TEMPLATES_DIR, entry))
62
+ ]
63
+
64
+ if files:
65
+ logger.info("Templates directory contains files and will not be modified.")
66
+ return
59
67
 
60
68
  logger.info("Templates directory is empty or missing, preparing data...")
61
69
 
@@ -156,6 +164,27 @@ def ensure_template_subdirs() -> None:
156
164
  logger.info("Templates directory is ready at: %s", MFS_TEMPLATES_DIR)
157
165
 
158
166
 
167
+ def reload_templates() -> None:
168
+ """Reload templates by removing existing files and re-preparing them.
169
+ Does not affect nested directories containing user data.
170
+ If needed, the files should be removed manually.
171
+ """
172
+ logger.info("Reloading templates...")
173
+ # Remove files from the templates directory.
174
+ # But do not remove nested directories, because they contain user data.
175
+ # Only remove files in the top-level templates directory.
176
+ for item in os.listdir(MFS_TEMPLATES_DIR):
177
+ item_path = os.path.join(MFS_TEMPLATES_DIR, item)
178
+ if os.path.isfile(item_path):
179
+ try:
180
+ os.remove(item_path)
181
+ except Exception as e:
182
+ logger.warning("Could not remove file %s: %s", item_path, str(e))
183
+ ensure_templates()
184
+ ensure_template_subdirs()
185
+ logger.info("Templates reloaded successfully.")
186
+
187
+
159
188
  ensure_templates()
160
189
  ensure_template_subdirs()
161
190
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.9.32
3
+ Version: 2.9.33
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,7 +1,7 @@
1
1
  maps4fs/__init__.py,sha256=5ixsCA5vgcIV0OrF9EJBm91Mmc_KfMiDRM-QyifMAvo,386
2
2
  maps4fs/logger.py,sha256=aZAa9glzgvH6ySVDLelSPTwHfWZtpGK5YBl-ufNUsPg,801
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/config.py,sha256=_s5pLpATVF-hwpcVquDUOhochD1RghPJczwyKepXtrc,7889
4
+ maps4fs/generator/config.py,sha256=gLYch5ZTmuJ4Bo9EKzwutZVpOHsTVlY90gSFLkzegmk,9035
5
5
  maps4fs/generator/game.py,sha256=bflRv0lxJ9-wkRvauh0k0RzIgF7zVWguygqQLcC7U-s,18457
6
6
  maps4fs/generator/map.py,sha256=9F3PaoK63sbhNONvHN46k62-ZFMBQy5qvu9T193gwWs,16045
7
7
  maps4fs/generator/monitor.py,sha256=Yrc7rClpmJK53SRzrOYZNBlwJmb5l6TkW-laFbyBEno,3524
@@ -18,14 +18,14 @@ maps4fs/generator/component/grle.py,sha256=FAcGmG7yq0icOElRoO4QMsVisZMsNrLhfNSWv
18
18
  maps4fs/generator/component/i3d.py,sha256=qB18jQWfWjlTiaZ4fHd16vv359hN2YHRLzGTZuJnbbU,27166
19
19
  maps4fs/generator/component/layer.py,sha256=-MHnIXyJ7Xth9wOcjJCX-XkXBIYYv23lRRGbQ0XlHdU,7602
20
20
  maps4fs/generator/component/satellite.py,sha256=1bPqd8JqAPqU0tEI9m-iuljMW9hXqlaCIxvq7kdpMY0,5219
21
- maps4fs/generator/component/texture.py,sha256=pmX8KE96dJAwzhnOe_ed-1In6sOLXs8-qdJ0aPc-ePM,38526
21
+ maps4fs/generator/component/texture.py,sha256=tr0hyTdQew388FbqeK_gCEdzMJ9mX_5NPLkNN6uCg24,39108
22
22
  maps4fs/generator/component/base/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
23
23
  maps4fs/generator/component/base/component.py,sha256=-7H3donrH19f0_rivNyI3fgLsiZkntXfGywEx4tOnM4,23924
24
24
  maps4fs/generator/component/base/component_image.py,sha256=GXFkEFARNRkWkDiGSjvU4WX6f_8s6R1t2ZYqZflv1jk,9626
25
25
  maps4fs/generator/component/base/component_mesh.py,sha256=2wGe_-wAZVRljMKzzVJ8jdzIETWg7LjxGj8A3inH5eI,25550
26
26
  maps4fs/generator/component/base/component_xml.py,sha256=MT-VhU2dEckLFxAgmxg6V3gnv11di_94Qq6atfpOLdc,5342
27
- maps4fs-2.9.32.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
28
- maps4fs-2.9.32.dist-info/METADATA,sha256=4X4Nut1e-f0FRrwMLVvJy1LZwUxhs4JH6C1KAleQ4Yk,10213
29
- maps4fs-2.9.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- maps4fs-2.9.32.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
31
- maps4fs-2.9.32.dist-info/RECORD,,
27
+ maps4fs-2.9.33.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
28
+ maps4fs-2.9.33.dist-info/METADATA,sha256=WV4lKidF0KkY8h1Nx4sqGGq-jy6dvsTAX7vmZX3T0HI,10213
29
+ maps4fs-2.9.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ maps4fs-2.9.33.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
31
+ maps4fs-2.9.33.dist-info/RECORD,,