maps4fs 2.1.6__tar.gz → 2.1.7__tar.gz

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.
Files changed (34) hide show
  1. {maps4fs-2.1.6 → maps4fs-2.1.7}/PKG-INFO +1 -1
  2. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/background.py +1 -3
  3. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/i3d.py +1 -2
  4. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/map.py +18 -23
  5. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs.egg-info/PKG-INFO +1 -1
  6. {maps4fs-2.1.6 → maps4fs-2.1.7}/pyproject.toml +1 -1
  7. {maps4fs-2.1.6 → maps4fs-2.1.7}/LICENSE.md +0 -0
  8. {maps4fs-2.1.6 → maps4fs-2.1.7}/README.md +0 -0
  9. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/__init__.py +0 -0
  10. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/__init__.py +0 -0
  11. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/__init__.py +0 -0
  12. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/base/__init__.py +0 -0
  13. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/base/component.py +0 -0
  14. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/base/component_image.py +0 -0
  15. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/base/component_mesh.py +0 -0
  16. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/base/component_xml.py +0 -0
  17. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/config.py +0 -0
  18. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/dem.py +0 -0
  19. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/grle.py +0 -0
  20. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/layer.py +0 -0
  21. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/satellite.py +0 -0
  22. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/component/texture.py +0 -0
  23. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/config.py +0 -0
  24. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/game.py +0 -0
  25. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/qgis.py +0 -0
  26. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/settings.py +0 -0
  27. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/generator/statistics.py +0 -0
  28. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs/logger.py +0 -0
  29. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs.egg-info/SOURCES.txt +0 -0
  30. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs.egg-info/dependency_links.txt +0 -0
  31. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs.egg-info/requires.txt +0 -0
  32. {maps4fs-2.1.6 → maps4fs-2.1.7}/maps4fs.egg-info/top_level.txt +0 -0
  33. {maps4fs-2.1.6 → maps4fs-2.1.7}/setup.cfg +0 -0
  34. {maps4fs-2.1.6 → maps4fs-2.1.7}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.1.6
3
+ Version: 2.1.7
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: Apache License 2.0
@@ -601,9 +601,7 @@ class Background(MeshComponent, ImageComponent):
601
601
  fitted_polygon = shapely.Polygon(fitted_polygon_points)
602
602
  fitted_polygons.append(fitted_polygon)
603
603
  except Exception as e:
604
- self.logger.warning(
605
- "Could not fit polygon into bounds with error: %s, polygon: %s", e, polygon
606
- )
604
+ self.logger.debug("Could not fit polygon into bounds with error: %s.", e)
607
605
  continue
608
606
 
609
607
  if not fitted_polygons:
@@ -658,8 +658,7 @@ class I3d(XMLComponent):
658
658
  Returns:
659
659
  int: The number of non-empty pixels in the image.
660
660
  """
661
- result = np.count_nonzero(image > 0)
662
- return result
661
+ return int(np.count_nonzero(image > 0))
663
662
 
664
663
  def get_step_by_limit(
665
664
  self, image: np.ndarray, limit: int, current_step: int | None = None
@@ -290,8 +290,6 @@ class Map:
290
290
  self.size,
291
291
  self.rotation,
292
292
  )
293
- error_text = None
294
-
295
293
  for game_component in self.game.components:
296
294
  component = game_component(
297
295
  self.game,
@@ -311,35 +309,18 @@ class Map:
311
309
 
312
310
  try:
313
311
  component.process()
314
- except Exception as e:
315
- self.logger.error(
316
- "Error processing component %s: %s",
317
- component.__class__.__name__,
318
- e,
319
- )
320
- error_text = str(e)
321
- raise e
322
-
323
- finally:
324
- with open(self.main_settings_path, "r", encoding="utf-8") as file:
325
- main_settings_json = json.load(file)
326
-
327
- main_settings_json["completed"] = True
328
- main_settings_json["error"] = error_text
329
-
330
- with open(self.main_settings_path, "w", encoding="utf-8") as file:
331
- json.dump(main_settings_json, file, indent=4)
332
-
333
- try:
334
312
  component.commit_generation_info()
335
313
  except Exception as e:
336
314
  self.logger.error(
337
- "Error committing generation info for component %s: %s",
315
+ "Error processing or committing generation info for component %s: %s",
338
316
  component.__class__.__name__,
339
317
  e,
340
318
  )
319
+ self._update_main_settings({"error": str(e)})
341
320
  raise e
342
321
 
322
+ self._update_main_settings({"completed": True})
323
+
343
324
  self.logger.debug(
344
325
  "Map generation completed. Game code: %s. Coordinates: %s, size: %s. Rotation: %s.",
345
326
  self.game.code,
@@ -348,6 +329,20 @@ class Map:
348
329
  self.rotation,
349
330
  )
350
331
 
332
+ def _update_main_settings(self, data: dict[str, Any]) -> None:
333
+ """Update main settings with provided data.
334
+
335
+ Arguments:
336
+ data (dict[str, Any]): Data to update main settings.
337
+ """
338
+ with open(self.main_settings_path, "r", encoding="utf-8") as file:
339
+ main_settings_json = json.load(file)
340
+
341
+ main_settings_json.update(data)
342
+
343
+ with open(self.main_settings_path, "w", encoding="utf-8") as file:
344
+ json.dump(main_settings_json, file, indent=4)
345
+
351
346
  def get_component(self, component_name: str) -> Component | None:
352
347
  """Get component by name.
353
348
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.1.6
3
+ Version: 2.1.7
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: Apache License 2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "2.1.6"
7
+ version = "2.1.7"
8
8
  description = "Generate map templates for Farming Simulator from real places."
9
9
  authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
10
10
  license = {text = "Apache License 2.0"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes