PySimultan 0.1.54__py3-none-any.whl → 0.2.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- PySimultan-0.2.1.dist-info/LICENSE.txt +17 -0
- PySimultan-0.2.1.dist-info/METADATA +36 -0
- PySimultan-0.2.1.dist-info/RECORD +82 -0
- {PySimultan-0.1.54.dist-info → PySimultan-0.2.1.dist-info}/WHEEL +1 -1
- PySimultan-0.2.1.dist-info/top_level.txt +1 -0
- {PySimultan → PySimultan2}/__init__.py +11 -6
- PySimultan2/config.py +52 -0
- PySimultan2/data_model.py +713 -0
- PySimultan2/default_types.py +507 -0
- PySimultan2/files.py +371 -0
- PySimultan2/geometry/__init__.py +4 -0
- PySimultan2/geometry/geometry_base.py +654 -0
- PySimultan2/geometry/utils.py +181 -0
- PySimultan2/multi_values.py +277 -0
- PySimultan2/object_mapper.py +200 -0
- PySimultan2/resources/AssimpNet.dll +0 -0
- PySimultan2/resources/AvalonDock.dll +0 -0
- PySimultan2/resources/BruTile.dll +0 -0
- PySimultan2/resources/ClosedXML.dll +0 -0
- PySimultan2/resources/ComponentBuilder.dll +0 -0
- PySimultan/resources/ComponentBuilder.exe.config → PySimultan2/resources/ComponentBuilder.dll.config +6 -2
- PySimultan2/resources/ComponentBuilder.runtimeconfig.json +18 -0
- {PySimultan → PySimultan2}/resources/ComponentBuilder.xml +11877 -6754
- PySimultan2/resources/ControlzEx.dll +0 -0
- PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
- PySimultan2/resources/ExcelNumberFormat.dll +0 -0
- PySimultan2/resources/Fluent.dll +0 -0
- PySimultan2/resources/GeometryViewer.dll +0 -0
- {PySimultan → PySimultan2}/resources/GeometryViewer.xml +2201 -1155
- PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- PySimultan2/resources/HelixToolkit.dll +0 -0
- PySimultan2/resources/MathNet.Numerics.dll +0 -0
- PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
- PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
- PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
- PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
- PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
- PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
- PySimultan2/resources/Newtonsoft.Json.dll +0 -0
- PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
- PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll +0 -0
- PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll.config +15 -0
- PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- {PySimultan → PySimultan2}/resources/SIMULTAN.Lang.xml +5282 -3252
- PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- {PySimultan → PySimultan2}/resources/SIMULTAN.Plugins.xml +110 -0
- PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- {PySimultan → PySimultan2}/resources/SIMULTAN.UI.xml +10483 -4937
- PySimultan2/resources/SIMULTAN.dll +0 -0
- PySimultan2/resources/SIMULTAN.xml +34122 -0
- PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- {PySimultan → PySimultan2}/resources/SharpDX.Mathematics.dll +0 -0
- PySimultan2/resources/SharpDX.dll +0 -0
- {PySimultan → PySimultan2}/resources/SitePlanner.dll +0 -0
- {PySimultan → PySimultan2}/resources/SitePlanner.xml +959 -1110
- PySimultan2/resources/Sprache.dll +0 -0
- PySimultan2/resources/System.Data.OleDb.dll +0 -0
- PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
- PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- PySimultan2/resources/assimp.dll +0 -0
- {PySimultan → PySimultan2}/resources/defaultsettings.xml +0 -0
- PySimultan2/simultan_object.py +366 -0
- PySimultan2/taxonomy_maps.py +169 -0
- PySimultan2/utils.py +1383 -0
- PySimultan/config.py +0 -57
- PySimultan/data_model.py +0 -376
- PySimultan/default_types.py +0 -1771
- PySimultan/geo_default_types.py +0 -763
- PySimultan/geometry.py +0 -309
- PySimultan/resources/AssimpNet.dll +0 -0
- PySimultan/resources/AssimpNet.xml +0 -12074
- PySimultan/resources/BruTile.dll +0 -0
- PySimultan/resources/BruTile.xml +0 -1845
- PySimultan/resources/ControlzEx.dll +0 -0
- PySimultan/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- PySimultan/resources/DXFImportExport.dll +0 -0
- PySimultan/resources/DotSpatial.Projections.xml +0 -5879
- PySimultan/resources/EXCELImportExport.dll +0 -0
- PySimultan/resources/Fluent.dll +0 -0
- PySimultan/resources/Fluent.xml +0 -9103
- PySimultan/resources/GeoJSON.Net.dll +0 -0
- PySimultan/resources/GeometryViewer.Data.dll +0 -0
- PySimultan/resources/GeometryViewer.Data.xml +0 -4443
- PySimultan/resources/GeometryViewer.Shared.dll +0 -0
- PySimultan/resources/GeometryViewer.Shared.xml +0 -588
- PySimultan/resources/GeometryViewer.dll +0 -0
- PySimultan/resources/HelixToolkit.Wpf.SharpDX.dll +0 -0
- PySimultan/resources/HelixToolkit.Wpf.SharpDX.xml +0 -43219
- PySimultan/resources/HelixToolkit.Wpf.dll +0 -0
- PySimultan/resources/HelixToolkit.Wpf.xml +0 -22363
- PySimultan/resources/HelixToolkit.dll +0 -0
- PySimultan/resources/HelixToolkit.xml +0 -144
- PySimultan/resources/ImportLog_SMART_CAMPUS_TU_WIEN_BIBLIOTHEK_20210305_ZONENMODELL_23_11_2021-06_54_54.txt +0 -1
- PySimultan/resources/LibGit2Sharp.dll +0 -0
- PySimultan/resources/LibGit2Sharp.dll.config +0 -4
- PySimultan/resources/LibGit2Sharp.xml +0 -13770
- PySimultan/resources/MathNet.Numerics.dll +0 -0
- PySimultan/resources/MathNet.Numerics.xml +0 -57152
- PySimultan/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- PySimultan/resources/Microsoft.WindowsAPICodePack.Shell.xml +0 -25496
- PySimultan/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- PySimultan/resources/Microsoft.WindowsAPICodePack.xml +0 -2934
- PySimultan/resources/Newtonsoft.Json.dll +0 -0
- PySimultan/resources/Newtonsoft.Json.xml +0 -11305
- PySimultan/resources/ParameterStructure.dll +0 -0
- PySimultan/resources/ParameterStructure.xml +0 -10750
- PySimultan/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
- PySimultan/resources/SIMULTAN.DataExchange.dll +0 -0
- PySimultan/resources/SIMULTAN.Lang.dll +0 -0
- PySimultan/resources/SIMULTAN.Legacy.dll +0 -0
- PySimultan/resources/SIMULTAN.Legacy.xml +0 -254
- PySimultan/resources/SIMULTAN.Plugins.dll +0 -0
- PySimultan/resources/SIMULTAN.Project.dll +0 -0
- PySimultan/resources/SIMULTAN.Project.dll.config +0 -11
- PySimultan/resources/SIMULTAN.UI.dll +0 -0
- PySimultan/resources/SIMULTAN.Util.dll +0 -0
- PySimultan/resources/SIMULTAN.Util.xml +0 -3430
- PySimultan/resources/SharpDX.D3DCompiler.dll +0 -0
- PySimultan/resources/SharpDX.D3DCompiler.xml +0 -5897
- PySimultan/resources/SharpDX.DXGI.dll +0 -0
- PySimultan/resources/SharpDX.DXGI.xml +0 -8737
- PySimultan/resources/SharpDX.Direct2D1.dll +0 -0
- PySimultan/resources/SharpDX.Direct2D1.xml +0 -46691
- PySimultan/resources/SharpDX.Direct3D11.dll +0 -0
- PySimultan/resources/SharpDX.Direct3D11.xml +0 -31826
- PySimultan/resources/SharpDX.Direct3D9.dll +0 -0
- PySimultan/resources/SharpDX.Direct3D9.xml +0 -36489
- PySimultan/resources/SharpDX.Mathematics.xml +0 -16449
- PySimultan/resources/SharpDX.dll +0 -0
- PySimultan/resources/Sprache.dll +0 -0
- PySimultan/resources/Sprache.xml +0 -1199
- PySimultan/resources/System.Net.Http.Formatting.dll +0 -0
- PySimultan/resources/System.Net.Http.Formatting.xml +0 -2094
- PySimultan/resources/System.Windows.Interactivity.dll +0 -0
- PySimultan/resources/TalkGit.dll +0 -0
- PySimultan/resources/TalkGit.dll.config +0 -11
- PySimultan/resources/WebServiceConnector.dll +0 -0
- PySimultan/resources/WebServiceConnector.dll.config +0 -11
- PySimultan/resources/XAMLMarkupExtensions.dll +0 -0
- PySimultan/resources/XAMLMarkupExtensions.xml +0 -862
- PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.Aero.dll +0 -0
- PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.Metro.dll +0 -0
- PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.VS2010.dll +0 -0
- PySimultan/resources/Xceed.Wpf.AvalonDock.dll +0 -0
- PySimultan/resources/Xceed.Wpf.Toolkit.dll +0 -0
- PySimultan/resources/assimp.dll +0 -0
- PySimultan/resources/schema.yaml +0 -13
- PySimultan/resources/simultan_exception_07_10_2021-08_34_24.txt +0 -17
- PySimultan/resources/simultan_exception_07_10_2021-10_13_31.txt +0 -17
- PySimultan/resources/simultan_exception_11_10_2021-19_45_42.txt +0 -17
- PySimultan/resources/simultan_exception_22_11_2021-16_41_52.txt +0 -14
- PySimultan/resources/simultan_exception_22_11_2021-17_37_40.txt +0 -14
- PySimultan/simultan_geometry_utils.py +0 -81
- PySimultan/simultan_utils.py +0 -165
- PySimultan/slots.py +0 -51
- PySimultan/template_tools.py +0 -631
- PySimultan/utils.py +0 -298
- PySimultan-0.1.54.dist-info/LICENSE +0 -674
- PySimultan-0.1.54.dist-info/LICENSE.txt +0 -674
- PySimultan-0.1.54.dist-info/METADATA +0 -690
- PySimultan-0.1.54.dist-info/RECORD +0 -119
- PySimultan-0.1.54.dist-info/entry_points.txt +0 -3
- PySimultan-0.1.54.dist-info/top_level.txt +0 -1
- PySimultan-0.1.54.dist-info/zip-safe +0 -1
- {PySimultan → PySimultan2}/resources/DotSpatial.Projections.dll +0 -0
- {PySimultan → PySimultan2}/resources/GeometryViewer.dll.config +0 -0
- {PySimultan → PySimultan2}/resources/SIMULTAN.AutoUpdate.Client.dll.config +0 -0
- {PySimultan → PySimultan2}/resources/SitePlanner.dll.config +0 -0
- {PySimultan → PySimultan2}/resources/Sprache.Calc.dll +0 -0
- {PySimultan → PySimultan2}/resources/__init__.py +0 -0
- {PySimultan → PySimultan2}/resources/setup.bat +0 -0
PySimultan/utils.py
DELETED
@@ -1,298 +0,0 @@
|
|
1
|
-
from .config import logger
|
2
|
-
from random import choices
|
3
|
-
# from .config import yaml
|
4
|
-
import re
|
5
|
-
from typing import Tuple
|
6
|
-
|
7
|
-
|
8
|
-
from System.Windows.Media import Color
|
9
|
-
|
10
|
-
|
11
|
-
class classproperty(object):
|
12
|
-
|
13
|
-
def __init__(self, getter):
|
14
|
-
self.getter = getter
|
15
|
-
|
16
|
-
def __get__(self, instance, owner):
|
17
|
-
return self.getter(owner)
|
18
|
-
|
19
|
-
|
20
|
-
class SimultanComponent(object):
|
21
|
-
|
22
|
-
def __init__(self, *args, **kwargs):
|
23
|
-
self.data = list(kwargs.get('data'))
|
24
|
-
self.component_list = set()
|
25
|
-
self.typed_component_list = set()
|
26
|
-
|
27
|
-
self.get_component_list(self.data, self.data[0])
|
28
|
-
self.get_typed_component_list()
|
29
|
-
|
30
|
-
def get_component_list(self, components, component):
|
31
|
-
if component not in self.typed_component_list:
|
32
|
-
self.component_list.add(component)
|
33
|
-
|
34
|
-
component_list = component.Components
|
35
|
-
for neighbour in component_list:
|
36
|
-
self.get_component_list(component_list, neighbour)
|
37
|
-
|
38
|
-
def get_typed_component_list(self):
|
39
|
-
for component in self.component_list:
|
40
|
-
for param in component.Parameters.Items:
|
41
|
-
if param.Name == 'TYPE':
|
42
|
-
self.typed_component_list.add(component)
|
43
|
-
|
44
|
-
#
|
45
|
-
# def dfs(self, visited, components, component):
|
46
|
-
# if component not in visited:
|
47
|
-
# print(component)
|
48
|
-
# visited.add(component)
|
49
|
-
# component_list = component.ContainedComponentsAsList
|
50
|
-
# for neighbour in component_list:
|
51
|
-
# dfs(visited, component_list, neighbour)
|
52
|
-
#
|
53
|
-
# def visit_components_list(self, visited, components, component, typed_component_list=[]):
|
54
|
-
# if component not in visited:
|
55
|
-
# visited.add(component)
|
56
|
-
#
|
57
|
-
# for neighbour in components:
|
58
|
-
# if neighbour.ContainedParameters:
|
59
|
-
# print('PARAMS')
|
60
|
-
# print(neighbour.ContainedParameters)
|
61
|
-
# for el in component.ContainedParameters:
|
62
|
-
# if el.Name == 'TYPE':
|
63
|
-
# print('TYPE')
|
64
|
-
# print(el)
|
65
|
-
# typed_component_list.append(neighbour)
|
66
|
-
# if neighbour.ContainedComponentsAsList:
|
67
|
-
# print('LIST')
|
68
|
-
# print(neighbour.ContainedComponentsAsList)
|
69
|
-
# visit_components_list(component.ContainedComponentsAsList, neighbour, typed_component_list)
|
70
|
-
#
|
71
|
-
# def get_flat_list(self, visited, component_list, component):
|
72
|
-
# if component not in visited:
|
73
|
-
# visited.add(component)
|
74
|
-
# component_list = component.ContainedComponentsAsList
|
75
|
-
# for neighbour in component_list:
|
76
|
-
# dfs(visited, component_list, neighbour)
|
77
|
-
#
|
78
|
-
# if not component_list:
|
79
|
-
# return []
|
80
|
-
# for comp in component_list:
|
81
|
-
# flat_list.append(comp)
|
82
|
-
# return (get_flat_list((comp.ContainedComponentsAsList, flat_list)))
|
83
|
-
|
84
|
-
|
85
|
-
def create_example_template():
|
86
|
-
|
87
|
-
from .template_tools import Template
|
88
|
-
|
89
|
-
material_template = Template(template_name='Material',
|
90
|
-
template_id='1',
|
91
|
-
content=['c', 'w20', 'w80', 'lambda', 'mu', 'rho'],
|
92
|
-
documentation='c: specific heat = capacity in J/kg*K; ',
|
93
|
-
units={'c': 'J/kg K',
|
94
|
-
'w20': 'g/m=C2=B3',
|
95
|
-
'w80': 'g/m=C2=B3',
|
96
|
-
'lambda': 'W/mK',
|
97
|
-
'mu': '-',
|
98
|
-
'rho': 'kg/m=C2=B3'},
|
99
|
-
types={'c': 'float',
|
100
|
-
'w20': 'float',
|
101
|
-
'w80': 'float',
|
102
|
-
'lambda': 'float',
|
103
|
-
'mu': 'float',
|
104
|
-
'rho': 'float'}
|
105
|
-
)
|
106
|
-
|
107
|
-
layer_template = Template(template_name='Layer',
|
108
|
-
template_id='2',
|
109
|
-
content=['d', 'Material'],
|
110
|
-
documentation="d: thickness of the layer = in m, Material: see Template 'Material'",
|
111
|
-
units={'d': 'm', 'Material': '-'},
|
112
|
-
types={'d': 'float'}
|
113
|
-
)
|
114
|
-
|
115
|
-
layer_template2 = Template(inherits_from=layer_template,
|
116
|
-
template_name='Layer2',
|
117
|
-
template_id='2.1',
|
118
|
-
content=['d', 'Material'],
|
119
|
-
documentation="d: thickness of the = layer in m, Material: see Template 'Material'",
|
120
|
-
units={'d': 'm', 'Material': '-'},
|
121
|
-
types={'d': 'int'}
|
122
|
-
)
|
123
|
-
|
124
|
-
construction_template = Template(template_name='Construction',
|
125
|
-
template_id='3',
|
126
|
-
content=['layers'],
|
127
|
-
documentation="layers: list of = items with type 'Layer'",
|
128
|
-
units={'layers': '-'}
|
129
|
-
)
|
130
|
-
|
131
|
-
return [material_template, layer_template, layer_template2, construction_template]
|
132
|
-
|
133
|
-
|
134
|
-
def create_example_template_bim_bestand_network():
|
135
|
-
|
136
|
-
from .template_tools import Template
|
137
|
-
|
138
|
-
component_template = Template(template_name='Component',
|
139
|
-
template_id=1,
|
140
|
-
content=['AKS-Id', 'Loss Factor'],
|
141
|
-
documentation='c: specific heat = capacity in J/kg*K;',
|
142
|
-
units={'AKS-Id': 'J/kg K',
|
143
|
-
'Loss Factor': 'g/m=C2=B3'},
|
144
|
-
types={'AKS-Id': 'int',
|
145
|
-
'Loss Factor': 'float'}
|
146
|
-
)
|
147
|
-
|
148
|
-
material_template = Template(template_name='Material',
|
149
|
-
template_id='1',
|
150
|
-
content=['c', 'w20', 'w80', 'lambda', 'mu', 'rho'],
|
151
|
-
documentation='c: specific heat = capacity in J/kg*K; ',
|
152
|
-
units={'c': 'J/kg K',
|
153
|
-
'w20': 'g/m=C2=B3',
|
154
|
-
'w80': 'g/m=C2=B3',
|
155
|
-
'lambda': 'W/mK',
|
156
|
-
'mu': '-',
|
157
|
-
'rho': 'kg/m=C2=B3'},
|
158
|
-
types={'c': 'float',
|
159
|
-
'w20': 'float',
|
160
|
-
'w80': 'float',
|
161
|
-
'lambda': 'float',
|
162
|
-
'mu': 'float',
|
163
|
-
'rho': 'float'}
|
164
|
-
)
|
165
|
-
|
166
|
-
edge_template = Template(inherits_from=component_template,
|
167
|
-
template_name='Edge',
|
168
|
-
template_id='2',
|
169
|
-
content=['Start-ID', 'End-ID', 'COMPONENT-ID', 'COMPONENT-TYPE', 'Length', 'Lambda', 'K'],
|
170
|
-
documentation="d: thickness of the layer = in m, Material: see Template 'Material'",
|
171
|
-
units={'d': 'm', 'Material': '-'},
|
172
|
-
types={'d': 'float'}
|
173
|
-
)
|
174
|
-
|
175
|
-
confuser_diffuser_rectangular_template = Template(inherits_from=edge_template,
|
176
|
-
template_name='CONFUSERDIFFUSERRECTANGULAR',
|
177
|
-
template_id='2.1',
|
178
|
-
content=['EndHight', 'EndWidth', 'StartHight', 'StartWidth'],
|
179
|
-
documentation="d: thickness of the = layer in m, Material: see Template 'Material'",
|
180
|
-
units={'d': 'm', 'Material': '-'},
|
181
|
-
types={'d': 'int'}
|
182
|
-
)
|
183
|
-
|
184
|
-
confuser_diffuser_round_template = Template(inherits_from=edge_template,
|
185
|
-
template_name='CONFUSERDIFFUSERROUND',
|
186
|
-
template_id='3',
|
187
|
-
content=['EndDiameter', 'StartDiameter'],
|
188
|
-
documentation="layers: list of = items with type 'Layer'",
|
189
|
-
units={'layers': '-'}
|
190
|
-
)
|
191
|
-
|
192
|
-
return [component_template, material_template, edge_template, confuser_diffuser_rectangular_template, confuser_diffuser_round_template]
|
193
|
-
|
194
|
-
|
195
|
-
def class_type_simultan_components(components, template_classes):
|
196
|
-
|
197
|
-
# collect component classes in a dictionary:
|
198
|
-
component_classes = {}
|
199
|
-
|
200
|
-
# loop trough all components:
|
201
|
-
for component in components:
|
202
|
-
# get the template-id
|
203
|
-
template_name = None
|
204
|
-
for comp_type in component.Parameters.Items:
|
205
|
-
if comp_type.Name == 'TYPE':
|
206
|
-
template_name = comp_type.TextValue
|
207
|
-
|
208
|
-
# check if the component class already exists:
|
209
|
-
if template_name in component_classes.keys(): # if it already = exists take it
|
210
|
-
new_component_class_dict = component_classes[template_name]
|
211
|
-
elif template_name in template_classes.keys(): # create new component class
|
212
|
-
# find the python template class:
|
213
|
-
template_class = template_classes[template_name]
|
214
|
-
|
215
|
-
# init new instance
|
216
|
-
new_instance = template_class(wrapped_obj=component)
|
217
|
-
|
218
|
-
print(new_instance)
|
219
|
-
|
220
|
-
|
221
|
-
return components
|
222
|
-
|
223
|
-
|
224
|
-
def create_example_simultan_components(templates, flat_list_components):
|
225
|
-
|
226
|
-
simultan_components = []
|
227
|
-
|
228
|
-
for template in templates:
|
229
|
-
for component in flat_list_components:
|
230
|
-
print(template)
|
231
|
-
print(component)
|
232
|
-
|
233
|
-
return simultan_components
|
234
|
-
|
235
|
-
|
236
|
-
def get_obj_by_id(cls, id):
|
237
|
-
return cls._cls_instances_dict.get(id, None)
|
238
|
-
|
239
|
-
|
240
|
-
def sort_component_list(components):
|
241
|
-
|
242
|
-
if components.__len__() == 0:
|
243
|
-
return components
|
244
|
-
|
245
|
-
slots = [x.Slot.SlotBase.Base for x in components]
|
246
|
-
if not all(slots[0] == x for x in slots):
|
247
|
-
raise TypeError(f'List elements do not have same slot')
|
248
|
-
|
249
|
-
# slot_extensions = [int(re.findall("[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?", x.CurrentSlot)[-1]) for x in components]
|
250
|
-
slot_extensions = [x.Slot.SlotExtension for x in components]
|
251
|
-
return slot_extensions
|
252
|
-
|
253
|
-
|
254
|
-
def sort_slots(slots):
|
255
|
-
|
256
|
-
if slots.__len__() == 0:
|
257
|
-
return slots
|
258
|
-
|
259
|
-
if not all(slots[0].SlotBase == x.SlotBase for x in slots):
|
260
|
-
raise TypeError(f'List elements do not have same slot')
|
261
|
-
|
262
|
-
slot_extensions = [x.SlotExtension for x in slots]
|
263
|
-
return slot_extensions
|
264
|
-
|
265
|
-
|
266
|
-
def sort_references(references):
|
267
|
-
|
268
|
-
if references.__len__() == 0:
|
269
|
-
return references
|
270
|
-
# check if same slot:
|
271
|
-
slots = [x.Slot.SlotBase for x in references]
|
272
|
-
|
273
|
-
if not all(slots[0] == x for x in slots):
|
274
|
-
raise TypeError(f'List elements do not have same slot')
|
275
|
-
|
276
|
-
slot_extensions = [x.Slot.SlotExtension for x in references]
|
277
|
-
return slot_extensions
|
278
|
-
|
279
|
-
|
280
|
-
def get_random_color():
|
281
|
-
rgb = choices(range(256), k=3)
|
282
|
-
return Color.FromArgb(rgb[0], rgb[1], rgb[2], 255)
|
283
|
-
|
284
|
-
|
285
|
-
def parse_slot(full_slot_name: str) -> Tuple[str, any]:
|
286
|
-
"""
|
287
|
-
Parse the slot name. Returns slot_name and slot_extension
|
288
|
-
:param full_slot_name:
|
289
|
-
:return: (slot_name, slot_extension)
|
290
|
-
"""
|
291
|
-
if full_slot_name.startswith('Undefined Slot'):
|
292
|
-
slot_extension = full_slot_name.split('_')[-1]
|
293
|
-
slot_name = 'Undefined Slot'
|
294
|
-
else:
|
295
|
-
slot_extension = full_slot_name.split()[-1]
|
296
|
-
slot_name = ' '.join(full_slot_name.split()[0:-1])
|
297
|
-
|
298
|
-
return slot_name, slot_extension
|