PySimultan 0.5.9.5__py3-none-any.whl → 0.5.9.6__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
PySimultan2/__about__.py CHANGED
@@ -1 +1 @@
1
- version = '0.5.9.5'
1
+ version = '0.5.9.6'
PySimultan2/data_model.py CHANGED
@@ -587,18 +587,33 @@ class DataModel:
587
587
 
588
588
  del_copy = False
589
589
 
590
- existing_files = [x.Name for x in self.project_data_manager.AssetManager.Resources]
590
+ existing_files = [x.current_full_path for x in self.project_data_manager.AssetManager.Resources]
591
591
  try:
592
592
  act_filename = filename.replace('\\', os.sep)
593
593
  except TypeError:
594
594
  act_filename = filename
595
595
 
596
- if os.path.basename(act_filename) in existing_files:
596
+ if not act_filename.startswith(self.project.ProjectUnpackFolder.FullPath) and target_dir is None:
597
+ target_dir_str = self.project.ProjectUnpackFolder.FullPath
598
+ elif target_dir is not None:
599
+ if isinstance(target_dir, ResourceDirectoryEntry):
600
+ target_dir_str = target_dir.CurrentFullPath
601
+ elif isinstance(target_dir, SystemFileInfo):
602
+ target_dir_str = target_dir.FullPath
603
+ elif isinstance(target_dir, str):
604
+ target_dir_str = target_dir
605
+ elif isinstance(target_dir, DirectoryInfo):
606
+ target_dir_str = target_dir.FullPath
607
+
608
+ full_filename = os.path.join(target_dir_str, os.path.basename(act_filename))
609
+
610
+ if full_filename in existing_files:
597
611
  # create copy with running counter in temp dir and use this file:
598
612
  counter = 1
599
613
  while True:
600
614
  new_filename = os.path.basename(filename) + f'({str(counter)})'
601
- if new_filename not in existing_files and not os.path.exists(new_filename):
615
+ full_filename = os.path.join(target_dir_str, new_filename)
616
+ if full_filename not in existing_files and not os.path.exists(new_filename):
602
617
  break
603
618
  counter += 1
604
619
  shutil.copy(filename, os.path.join(os.path.dirname(filename), new_filename))
@@ -860,7 +875,18 @@ class DataModel:
860
875
 
861
876
  @lru_cache()
862
877
  def get_file_infos(self) -> list[PythonFileInfo]:
863
- return [PythonFileInfo(resource_entry=asset) for asset in self.assets]
878
+ file_infos = []
879
+ for asset in self.assets:
880
+ if isinstance(asset, ResourceFileEntry):
881
+ file_infos.append(PythonFileInfo(resource_entry=asset))
882
+ return file_infos
883
+
884
+ def get_directory_infos(self) -> list[PythonDirectoryInfo]:
885
+ dir_infos = []
886
+ for asset in self.assets:
887
+ if isinstance(asset, ResourceDirectoryEntry):
888
+ dir_infos.append(PythonDirectoryInfo(resource_entry=asset, data_model=self))
889
+ return dir_infos
864
890
 
865
891
  def get_file_info_by_key(self,
866
892
  key: int) -> Optional[PythonFileInfo]:
@@ -17,6 +17,9 @@ from SIMULTAN.Data.Components import (ComponentWalker, SimComponent, SimBoolPara
17
17
  SimEnumParameter, SimIntegerParameter, SimStringParameter, ComponentMapping,
18
18
  SimSlot, SimComponentVisibility, SimChildComponentEntry, SimDefaultSlots,
19
19
  SimParameterOperations, SimComponentReference)
20
+
21
+ from SIMULTAN.Data.Assets import DocumentAsset
22
+
20
23
  from .files import FileInfo
21
24
 
22
25
  from . import config
@@ -562,9 +565,14 @@ class ComponentDictionary(SimultanObject):
562
565
  for ref_asset in self._wrapped_obj.ReferencedAssets.Items:
563
566
  for tag in ref_asset.Resource.Tags:
564
567
  key = tag.Target.Key.replace('__dict_key__', '')
565
- comp_dict[key] = get_obj_value(ref_asset.Target,
566
- data_model=self._data_model,
567
- object_mapper=self._object_mapper)
568
+ if isinstance(ref_asset, DocumentAsset):
569
+ comp_dict[key] = get_obj_value(ref_asset.Resource,
570
+ data_model=self._data_model,
571
+ object_mapper=self._object_mapper)
572
+ else:
573
+ comp_dict[key] = get_obj_value(ref_asset.Target,
574
+ data_model=self._data_model,
575
+ object_mapper=self._object_mapper)
568
576
 
569
577
  object.__setattr__(self, '_dict', comp_dict)
570
578
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySimultan
3
- Version: 0.5.9.5
3
+ Version: 0.5.9.6
4
4
  Project-URL: Documentation, https://github.com/Bühler Maximilian/PySimultan2#readme
5
5
  Project-URL: Issues, https://github.com/Bühler Maximilian/PySimultan2/issues
6
6
  Project-URL: Source, https://github.com/Bühler Maximilian/PySimultan2
@@ -1,8 +1,8 @@
1
1
  PySimultan2/CHANGELOG.md,sha256=oibgN_OC1p98_zVtpae5CtPZNLLnpQYd3XGIN0ztniU,484
2
- PySimultan2/__about__.py,sha256=MeQdhI4ntQ60lTPRhDyMx9nuGAA9YdviWq3YIh1IWyA,21
2
+ PySimultan2/__about__.py,sha256=ptvmvpFwZ_clKafeUlFFn3VFq_2wL5rI09ZmrrGMku8,21
3
3
  PySimultan2/__init__.py,sha256=PGVR1uhY01dF5tHyad-znURUZ_LVB95vsjId2BT0aJM,3245
4
- PySimultan2/data_model.py,sha256=x1fvcPt9iC3Qy8uUkE59KRZCdh-paze8hDtDOzpf3YI,36278
5
- PySimultan2/default_types.py,sha256=K-Eka5BCKk8DT3HU5761Ym_-ZFmu1_Dro0zW0LVGoHA,27157
4
+ PySimultan2/data_model.py,sha256=QbxlCb5g2j1Ai-ZFhvstbahLPE5Ll3zaMCLgJC8uolk,37589
5
+ PySimultan2/default_types.py,sha256=P43xVs8ItrxONRwq902-InUmCVXiTYerD0i-PME3KeM,27542
6
6
  PySimultan2/files.py,sha256=4wuTfjgOMz6BEEwUDgNmUjfHZj0PYvcuE5-LWz2UEb0,28763
7
7
  PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
8
8
  PySimultan2/object_mapper.py,sha256=_SQye38NmIr4m_-X9CuvUJnVDBmjmUDdPH2bnaxpzKY,18546
@@ -75,7 +75,7 @@ PySimultan2/resources/assimp.dll,sha256=HwfDwXqoPDTFRyoQpA3qmgZoUdFtziJkV5fNtktE
75
75
  PySimultan2/resources/componentmanager.user,sha256=hrzr1US4pqkFnLHXcvPkvrgGd7QvlxaV8mhS6fuikEs,760
76
76
  PySimultan2/resources/defaultsettings.xml,sha256=s6Tk1tubLz5UYqXZWpD42EDHzedemRY1nEneoIVcUfg,392
77
77
  PySimultan2/resources/setup.bat,sha256=fjvvYfVM6TalS-QTSiKAbAId5nTsk8kGGo06ba-wWaY,32
78
- pysimultan-0.5.9.5.dist-info/METADATA,sha256=0eJZRacdVEhpQah_9YRazQnhF_mD2rVJk0UEQvKXe8Y,6256
79
- pysimultan-0.5.9.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
80
- pysimultan-0.5.9.5.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.5.9.5.dist-info/RECORD,,
78
+ pysimultan-0.5.9.6.dist-info/METADATA,sha256=Y4NHrFi0t1XhhoTLncaHgMnwmFZj9FW02HrXjh7R_hI,6256
79
+ pysimultan-0.5.9.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
80
+ pysimultan-0.5.9.6.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
+ pysimultan-0.5.9.6.dist-info/RECORD,,