otlmow-template 0.11rc3__py3-none-any.whl → 1.0__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.
- otlmow_template/SubsetTemplateCreator.py +504 -462
- {otlmow_template-0.11rc3.dist-info → otlmow_template-1.0.dist-info}/METADATA +4 -4
- otlmow_template-1.0.dist-info/RECORD +7 -0
- {otlmow_template-0.11rc3.dist-info → otlmow_template-1.0.dist-info}/WHEEL +1 -1
- otlmow_template/CsvTemplateCreator.py +0 -155
- otlmow_template/ExcelTemplateCreator.py +0 -199
- otlmow_template/__init__.py +0 -0
- otlmow_template-0.11rc3.dist-info/RECORD +0 -10
- {otlmow_template-0.11rc3.dist-info → otlmow_template-1.0.dist-info/licenses}/LICENSE +0 -0
- {otlmow_template-0.11rc3.dist-info → otlmow_template-1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: otlmow_template
|
|
3
|
-
Version: 0
|
|
3
|
+
Version: 1.0
|
|
4
4
|
Author-email: David Vlaminck <david.vlaminck@mow.vlaanderen.be>, Jasper Berton <jasperberton1@telenet.be>
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -697,9 +697,9 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
697
697
|
Requires-Python: >=3.9
|
|
698
698
|
Description-Content-Type: text/markdown
|
|
699
699
|
License-File: LICENSE
|
|
700
|
-
Requires-Dist: otlmow-converter>=1.
|
|
700
|
+
Requires-Dist: otlmow-converter>=1.10
|
|
701
701
|
Requires-Dist: otlmow-modelbuilder>=0.25
|
|
702
|
-
|
|
702
|
+
Dynamic: license-file
|
|
703
703
|
|
|
704
704
|
# OTLMOW-Template
|
|
705
705
|
[](https://pypi.org/project/otlmow-template/)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
otlmow_template/SubsetTemplateCreator.py,sha256=KNRUXM75hdy0GXEo0P-9cYUpUF1sUL_o9EGcGE9e1DI,29471
|
|
2
|
+
otlmow_template/Exceptions/MissingTypeUriException.py,sha256=DSKwywmP9Bq8n7rzBoDcEPlxvC1IChx18QIHFUCTtdA,51
|
|
3
|
+
otlmow_template-1.0.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
4
|
+
otlmow_template-1.0.dist-info/METADATA,sha256=oWHg04cxfNe3HUeCzJ-4VRiC9LGMyofU9zwgA3tBvS4,44022
|
|
5
|
+
otlmow_template-1.0.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
|
6
|
+
otlmow_template-1.0.dist-info/top_level.txt,sha256=zPgBoaTLG-avoOLySlwOUEtHaFyA5Vc5wJqkSeX1l6A,16
|
|
7
|
+
otlmow_template-1.0.dist-info/RECORD,,
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import csv
|
|
2
|
-
import ntpath
|
|
3
|
-
import os
|
|
4
|
-
import tempfile
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
from typing import List, Sequence, Optional
|
|
7
|
-
|
|
8
|
-
from otlmow_converter.DotnotationHelper import DotnotationHelper
|
|
9
|
-
from otlmow_converter.OtlmowConverter import OtlmowConverter
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class CsvTemplateCreator:
|
|
13
|
-
|
|
14
|
-
@classmethod
|
|
15
|
-
def determine_multiplicity_csv(cls, path_to_template_file_and_extension: Path, path_to_subset: Path,
|
|
16
|
-
temporary_path: Path, **kwargs):
|
|
17
|
-
path_is_split = kwargs.get('split_per_type', True)
|
|
18
|
-
if path_is_split is False:
|
|
19
|
-
cls.alter_csv_template(path_to_template_file_and_extension=path_to_template_file_and_extension,
|
|
20
|
-
temporary_path=temporary_path, path_to_subset=path_to_subset, **kwargs)
|
|
21
|
-
else:
|
|
22
|
-
cls.multiple_csv_template(path_to_template_file_and_extension=path_to_template_file_and_extension,
|
|
23
|
-
path_to_subset=path_to_subset, **kwargs)
|
|
24
|
-
file_location = os.path.dirname(temporary_path)
|
|
25
|
-
[f.unlink() for f in Path(file_location).glob("*") if f.is_file()]
|
|
26
|
-
|
|
27
|
-
@classmethod
|
|
28
|
-
def multiple_csv_template(cls, path_to_template_file_and_extension, path_to_subset, **kwargs):
|
|
29
|
-
file_location = os.path.dirname(path_to_template_file_and_extension)
|
|
30
|
-
tempdir = Path(tempfile.gettempdir()) / 'temp-otlmow'
|
|
31
|
-
file_name = ntpath.basename(path_to_template_file_and_extension)
|
|
32
|
-
split_file_name = file_name.split('.')
|
|
33
|
-
things_in_there = os.listdir(tempdir)
|
|
34
|
-
csv_templates = [x for x in things_in_there if x.startswith(split_file_name[0] + '_')]
|
|
35
|
-
for file in csv_templates:
|
|
36
|
-
test_template_loc = Path(os.path.dirname(path_to_template_file_and_extension)) / file
|
|
37
|
-
temp_loc = Path(tempdir) / file
|
|
38
|
-
cls.alter_csv_template(path_to_template_file_and_extension=test_template_loc, temporary_path=temp_loc,
|
|
39
|
-
path_to_subset=path_to_subset, **kwargs)
|
|
40
|
-
|
|
41
|
-
@classmethod
|
|
42
|
-
def alter_csv_template(cls, path_to_template_file_and_extension, path_to_subset, temporary_path,
|
|
43
|
-
**kwargs):
|
|
44
|
-
converter = OtlmowConverter()
|
|
45
|
-
instantiated_attributes = converter.create_assets_from_file(filepath=temporary_path,
|
|
46
|
-
path_to_subset=path_to_subset)
|
|
47
|
-
header = []
|
|
48
|
-
data = []
|
|
49
|
-
delimiter = ';'
|
|
50
|
-
add_geo_artefact = kwargs.get('add_geo_artefact', False)
|
|
51
|
-
add_attribute_info = kwargs.get('add_attribute_info', False)
|
|
52
|
-
highlight_deprecated_attributes = kwargs.get('highlight_deprecated_attributes', False)
|
|
53
|
-
amount_of_examples = kwargs.get('amount_of_examples', 0)
|
|
54
|
-
quote_char = '"'
|
|
55
|
-
with open(temporary_path, 'r+', encoding='utf-8') as csvfile:
|
|
56
|
-
new_file = open(path_to_template_file_and_extension, 'w', encoding='utf-8')
|
|
57
|
-
reader = csv.reader(csvfile, delimiter=delimiter, quotechar=quote_char)
|
|
58
|
-
for row_nr, row in enumerate(reader):
|
|
59
|
-
if row_nr == 0:
|
|
60
|
-
header = row
|
|
61
|
-
else:
|
|
62
|
-
data.append(row)
|
|
63
|
-
if add_geo_artefact is False:
|
|
64
|
-
[header, data] = cls.remove_geo_artefact_csv(header=header, data=data)
|
|
65
|
-
if add_attribute_info:
|
|
66
|
-
info = cls.add_attribute_info_csv(header=header, data=data,
|
|
67
|
-
instantiated_objects=instantiated_attributes)
|
|
68
|
-
new_file.write(delimiter.join(info) + '\n')
|
|
69
|
-
data = cls.remove_mock_data_csv(data=data, rows_of_examples=amount_of_examples)
|
|
70
|
-
if highlight_deprecated_attributes:
|
|
71
|
-
header = cls.highlight_deprecated_attributes_csv(header=header, data=data,
|
|
72
|
-
instantiated_attributes=instantiated_attributes)
|
|
73
|
-
new_file.write(delimiter.join(header) + '\n')
|
|
74
|
-
for d in data:
|
|
75
|
-
new_file.write(delimiter.join(d) + '\n')
|
|
76
|
-
new_file.close()
|
|
77
|
-
|
|
78
|
-
@classmethod
|
|
79
|
-
def add_attribute_info_csv(cls, header: List[str], data: List[List[str]], instantiated_objects: List) -> List[str]:
|
|
80
|
-
info_data = []
|
|
81
|
-
info_data.extend(header)
|
|
82
|
-
|
|
83
|
-
dotnotation_module = DotnotationHelper()
|
|
84
|
-
|
|
85
|
-
uri_index = cls.get_type_uri_index_in_row(header)
|
|
86
|
-
found_uris = set(d[uri_index] for d in data)
|
|
87
|
-
|
|
88
|
-
for uri in found_uris:
|
|
89
|
-
single_object = next(x for x in instantiated_objects if x.typeURI == uri)
|
|
90
|
-
for index, dotnototation_title in enumerate(info_data):
|
|
91
|
-
if dotnototation_title == 'typeURI':
|
|
92
|
-
info_data[index] = 'De URI van het object volgens https://www.w3.org/2001/XMLSchema#anyURI .'
|
|
93
|
-
else:
|
|
94
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(
|
|
95
|
-
single_object, dotnototation_title)
|
|
96
|
-
info_data[index] = dotnotation_attribute.definition
|
|
97
|
-
return info_data
|
|
98
|
-
|
|
99
|
-
@classmethod
|
|
100
|
-
def remove_mock_data_csv(cls, data, rows_of_examples):
|
|
101
|
-
if rows_of_examples == 0:
|
|
102
|
-
data = []
|
|
103
|
-
return data
|
|
104
|
-
|
|
105
|
-
@classmethod
|
|
106
|
-
def highlight_deprecated_attributes_csv(cls, header, data, instantiated_attributes):
|
|
107
|
-
found_uri = []
|
|
108
|
-
dotnotation_module = DotnotationHelper()
|
|
109
|
-
uri_index = cls.get_type_uri_index_in_row(header)
|
|
110
|
-
for d in data:
|
|
111
|
-
if d[uri_index] not in found_uri:
|
|
112
|
-
found_uri.append(d[uri_index])
|
|
113
|
-
for uri in found_uri:
|
|
114
|
-
single_object = next(x for x in instantiated_attributes if x.typeURI == uri)
|
|
115
|
-
for dotnototation_title in header:
|
|
116
|
-
if dotnototation_title == 'typeURI':
|
|
117
|
-
continue
|
|
118
|
-
else:
|
|
119
|
-
index = header.index(dotnototation_title)
|
|
120
|
-
value = header[index]
|
|
121
|
-
try:
|
|
122
|
-
is_deprecated = False
|
|
123
|
-
if dotnototation_title.count('.') == 1:
|
|
124
|
-
dot_split = dotnototation_title.split('.')
|
|
125
|
-
attribute = dotnotation_module.get_attribute_by_dotnotation(single_object,
|
|
126
|
-
dot_split[0])
|
|
127
|
-
|
|
128
|
-
if len(attribute.deprecated_version) > 0:
|
|
129
|
-
is_deprecated = True
|
|
130
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_object,
|
|
131
|
-
dotnototation_title)
|
|
132
|
-
if len(dotnotation_attribute.deprecated_version) > 0:
|
|
133
|
-
is_deprecated = True
|
|
134
|
-
except AttributeError:
|
|
135
|
-
continue
|
|
136
|
-
if is_deprecated:
|
|
137
|
-
header[index] = "[DEPRECATED] " + value
|
|
138
|
-
return header
|
|
139
|
-
|
|
140
|
-
@classmethod
|
|
141
|
-
def get_type_uri_index_in_row(cls, header: Sequence[str]) -> Optional[int]:
|
|
142
|
-
try:
|
|
143
|
-
return header.index('typeURI')
|
|
144
|
-
except ValueError:
|
|
145
|
-
return None
|
|
146
|
-
|
|
147
|
-
@classmethod
|
|
148
|
-
def remove_geo_artefact_csv(cls, header, data):
|
|
149
|
-
if 'geometry' in header:
|
|
150
|
-
deletion_index = header.index('geometry')
|
|
151
|
-
header.remove('geometry')
|
|
152
|
-
for d in data:
|
|
153
|
-
d.pop(deletion_index)
|
|
154
|
-
return [header, data]
|
|
155
|
-
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
from openpyxl.reader.excel import load_workbook
|
|
6
|
-
from openpyxl.styles import PatternFill
|
|
7
|
-
from openpyxl.utils import get_column_letter
|
|
8
|
-
from openpyxl.worksheet.datavalidation import DataValidation
|
|
9
|
-
from openpyxl.worksheet.dimensions import DimensionHolder, ColumnDimension
|
|
10
|
-
from otlmow_converter.DotnotationHelper import DotnotationHelper
|
|
11
|
-
from otlmow_model.OtlmowModel.BaseClasses.BooleanField import BooleanField
|
|
12
|
-
from otlmow_model.OtlmowModel.BaseClasses.KeuzelijstField import KeuzelijstField
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ExcelTemplateCreator:
|
|
16
|
-
|
|
17
|
-
@classmethod
|
|
18
|
-
def alter_excel_template(cls, path_to_template_file_and_extension: Path, instantiated_attributes: List,
|
|
19
|
-
temporary_path: Path, **kwargs):
|
|
20
|
-
generate_choice_list = kwargs.get('generate_choice_list', False)
|
|
21
|
-
add_geo_artefact = kwargs.get('add_geo_artefact', False)
|
|
22
|
-
add_attribute_info = kwargs.get('add_attribute_info', False)
|
|
23
|
-
highlight_deprecated_attributes = kwargs.get('highlight_deprecated_attributes', False)
|
|
24
|
-
amount_of_examples = kwargs.get('amount_of_examples', 0)
|
|
25
|
-
wb = load_workbook(temporary_path)
|
|
26
|
-
wb.create_sheet('Keuzelijsten')
|
|
27
|
-
# Volgorde is belangrijk! Eerst rijen verwijderen indien nodig dan choice list toevoegen,
|
|
28
|
-
# staat namelijk vast op de kolom en niet het attribuut in die kolom
|
|
29
|
-
if add_geo_artefact is False:
|
|
30
|
-
cls.remove_geo_artefact_excel(workbook=wb)
|
|
31
|
-
if generate_choice_list:
|
|
32
|
-
cls.add_choice_list_excel(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
33
|
-
cls.add_mock_data_excel(workbook=wb, rows_of_examples=amount_of_examples)
|
|
34
|
-
if highlight_deprecated_attributes:
|
|
35
|
-
cls.check_for_deprecated_attributes_excel(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
36
|
-
if add_attribute_info:
|
|
37
|
-
cls.add_attribute_info_excel(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
38
|
-
cls.design_workbook_excel(workbook=wb)
|
|
39
|
-
wb.save(path_to_template_file_and_extension)
|
|
40
|
-
file_location = os.path.dirname(temporary_path)
|
|
41
|
-
[f.unlink() for f in Path(file_location).glob("*") if f.is_file()]
|
|
42
|
-
|
|
43
|
-
@classmethod
|
|
44
|
-
def add_attribute_info_excel(cls, workbook, instantiated_attributes: List):
|
|
45
|
-
dotnotation_module = DotnotationHelper()
|
|
46
|
-
for sheet in workbook:
|
|
47
|
-
if sheet == workbook['Keuzelijsten']:
|
|
48
|
-
break
|
|
49
|
-
filter_uri = cls.find_uri_in_sheet(sheet)
|
|
50
|
-
single_attribute = next(x for x in instantiated_attributes if x.typeURI == filter_uri)
|
|
51
|
-
sheet.insert_rows(1)
|
|
52
|
-
for rows in sheet.iter_rows(min_row=2, max_row=2, min_col=1):
|
|
53
|
-
for cell in rows:
|
|
54
|
-
if cell.value == 'typeURI':
|
|
55
|
-
value = 'De URI van het object volgens https://www.w3.org/2001/XMLSchema#anyURI .'
|
|
56
|
-
elif cell.value.find('[DEPRECATED]') != -1:
|
|
57
|
-
strip = cell.value.split(' ')
|
|
58
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
59
|
-
strip[1])
|
|
60
|
-
value = dotnotation_attribute.definition
|
|
61
|
-
else:
|
|
62
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
63
|
-
cell.value)
|
|
64
|
-
value = dotnotation_attribute.definition
|
|
65
|
-
|
|
66
|
-
sheet.cell(row=1, column=cell.column, value=value)
|
|
67
|
-
sheet.cell(row=1, column=cell.column).fill = PatternFill(start_color="808080", end_color="808080",
|
|
68
|
-
fill_type="solid")
|
|
69
|
-
|
|
70
|
-
@classmethod
|
|
71
|
-
def check_for_deprecated_attributes_excel(cls, workbook, instantiated_attributes: List):
|
|
72
|
-
dotnotation_module = DotnotationHelper()
|
|
73
|
-
for sheet in workbook:
|
|
74
|
-
if sheet == workbook['Keuzelijsten']:
|
|
75
|
-
break
|
|
76
|
-
filter_uri = cls.find_uri_in_sheet(sheet)
|
|
77
|
-
single_attribute = next(x for x in instantiated_attributes if x.typeURI == filter_uri)
|
|
78
|
-
for rows in sheet.iter_rows(min_row=1, max_row=1, min_col=2):
|
|
79
|
-
for cell in rows:
|
|
80
|
-
is_deprecated = False
|
|
81
|
-
if cell.value.count('.') == 1:
|
|
82
|
-
dot_split = cell.value.split('.')
|
|
83
|
-
attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
84
|
-
dot_split[0])
|
|
85
|
-
|
|
86
|
-
if len(attribute.deprecated_version) > 0:
|
|
87
|
-
is_deprecated = True
|
|
88
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
89
|
-
cell.value)
|
|
90
|
-
if len(dotnotation_attribute.deprecated_version) > 0:
|
|
91
|
-
is_deprecated = True
|
|
92
|
-
|
|
93
|
-
if is_deprecated:
|
|
94
|
-
cell.value = '[DEPRECATED] ' + cell.value
|
|
95
|
-
|
|
96
|
-
@classmethod
|
|
97
|
-
def find_uri_in_sheet(cls, sheet):
|
|
98
|
-
filter_uri = None
|
|
99
|
-
for row in sheet.iter_rows(min_row=1, max_row=1):
|
|
100
|
-
for cell in row:
|
|
101
|
-
if cell.value == 'typeURI':
|
|
102
|
-
row_index = cell.row
|
|
103
|
-
column_index = cell.column
|
|
104
|
-
filter_uri = sheet.cell(row=row_index + 1, column=column_index).value
|
|
105
|
-
return filter_uri
|
|
106
|
-
|
|
107
|
-
@classmethod
|
|
108
|
-
def remove_geo_artefact_excel(cls, workbook):
|
|
109
|
-
for sheet in workbook:
|
|
110
|
-
for row in sheet.iter_rows(min_row=1, max_row=1):
|
|
111
|
-
for cell in row:
|
|
112
|
-
if cell.value == 'geometry':
|
|
113
|
-
sheet.delete_cols(cell.column)
|
|
114
|
-
|
|
115
|
-
@classmethod
|
|
116
|
-
def add_choice_list_excel(cls, workbook, instantiated_attributes: List):
|
|
117
|
-
choice_list_dict = {}
|
|
118
|
-
dotnotation_module = DotnotationHelper()
|
|
119
|
-
for sheet in workbook:
|
|
120
|
-
if sheet == workbook['Keuzelijsten']:
|
|
121
|
-
break
|
|
122
|
-
filter_uri = cls.find_uri_in_sheet(sheet)
|
|
123
|
-
single_attribute = next(x for x in instantiated_attributes if x.typeURI == filter_uri)
|
|
124
|
-
for rows in sheet.iter_rows(min_row=1, max_row=1, min_col=2):
|
|
125
|
-
for cell in rows:
|
|
126
|
-
if cell.value.find('[DEPRECATED]') != -1:
|
|
127
|
-
strip = cell.value.split(' ')
|
|
128
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
129
|
-
strip[1])
|
|
130
|
-
else:
|
|
131
|
-
dotnotation_attribute = dotnotation_module.get_attribute_by_dotnotation(single_attribute,
|
|
132
|
-
cell.value)
|
|
133
|
-
|
|
134
|
-
if issubclass(dotnotation_attribute.field, KeuzelijstField):
|
|
135
|
-
name = dotnotation_attribute.field.naam
|
|
136
|
-
valid_options = [v.invulwaarde for k, v in dotnotation_attribute.field.options.items()
|
|
137
|
-
if v.status != 'verwijderd']
|
|
138
|
-
column = cls.return_column_letter_of_choice_list(name=name, choice_list_dict=choice_list_dict,
|
|
139
|
-
options=valid_options, workbook=workbook)
|
|
140
|
-
option_list = []
|
|
141
|
-
for option in valid_options:
|
|
142
|
-
option_list.append(option)
|
|
143
|
-
start_range = f"${column}$2"
|
|
144
|
-
end_range = f"${column}${len(valid_options) + 1}"
|
|
145
|
-
data_val = DataValidation(type="list", formula1=f"Keuzelijsten!{start_range}:{end_range}",
|
|
146
|
-
allowBlank=True)
|
|
147
|
-
sheet.add_data_validation(data_val)
|
|
148
|
-
data_val.add(f'{get_column_letter(cell.column)}2:{get_column_letter(cell.column)}1000')
|
|
149
|
-
if issubclass(dotnotation_attribute.field, BooleanField):
|
|
150
|
-
data_validation = DataValidation(type="list", formula1='"TRUE,FALSE,-"', allow_blank=True)
|
|
151
|
-
column = cell.column
|
|
152
|
-
sheet.add_data_validation(data_validation)
|
|
153
|
-
data_validation.add(f'{get_column_letter(column)}2:{get_column_letter(column)}1000')
|
|
154
|
-
sheet.add_data_validation(data_validation)
|
|
155
|
-
|
|
156
|
-
@classmethod
|
|
157
|
-
def add_mock_data_excel(cls, workbook, rows_of_examples: int):
|
|
158
|
-
for sheet in workbook:
|
|
159
|
-
if sheet == workbook["Keuzelijsten"]:
|
|
160
|
-
break
|
|
161
|
-
if rows_of_examples == 0:
|
|
162
|
-
for rows in sheet.iter_rows(min_row=2, max_row=2):
|
|
163
|
-
for cell in rows:
|
|
164
|
-
cell.value = ''
|
|
165
|
-
|
|
166
|
-
@classmethod
|
|
167
|
-
def return_column_letter_of_choice_list(cls, name, choice_list_dict, options, workbook):
|
|
168
|
-
if name in choice_list_dict:
|
|
169
|
-
column = choice_list_dict[name]
|
|
170
|
-
else:
|
|
171
|
-
choice_list_dict = cls.add_choice_list_to_sheet(workbook=workbook, name=name,
|
|
172
|
-
options=options,
|
|
173
|
-
choice_list_dict=choice_list_dict)
|
|
174
|
-
column = choice_list_dict[name]
|
|
175
|
-
return column
|
|
176
|
-
|
|
177
|
-
@classmethod
|
|
178
|
-
def add_choice_list_to_sheet(cls, workbook, name, options, choice_list_dict):
|
|
179
|
-
active_sheet = workbook['Keuzelijsten']
|
|
180
|
-
row_nr = 2
|
|
181
|
-
for rows in active_sheet.iter_rows(min_row=1, max_row=1, min_col=1, max_col=700):
|
|
182
|
-
for cell in rows:
|
|
183
|
-
if cell.value is None:
|
|
184
|
-
cell.value = name
|
|
185
|
-
column_nr = cell.column
|
|
186
|
-
for option in options:
|
|
187
|
-
active_sheet.cell(row=row_nr, column=column_nr, value=option)
|
|
188
|
-
row_nr += 1
|
|
189
|
-
choice_list_dict[name] = get_column_letter(column_nr)
|
|
190
|
-
break
|
|
191
|
-
return choice_list_dict
|
|
192
|
-
|
|
193
|
-
@classmethod
|
|
194
|
-
def design_workbook_excel(cls, workbook):
|
|
195
|
-
for sheet in workbook:
|
|
196
|
-
dim_holder = DimensionHolder(worksheet=sheet)
|
|
197
|
-
for col in range(sheet.min_column, sheet.max_column + 1):
|
|
198
|
-
dim_holder[get_column_letter(col)] = ColumnDimension(sheet, min=col, max=col, width=20)
|
|
199
|
-
sheet.column_dimensions = dim_holder
|
otlmow_template/__init__.py
DELETED
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
otlmow_template/CsvTemplateCreator.py,sha256=PQq2zGmliWk0N9bhYNB7ZEa8PWV16OTbvoHh3--qCMs,7538
|
|
2
|
-
otlmow_template/ExcelTemplateCreator.py,sha256=wW-7Uq2Gzr1vHYMO1I7TtqZSBTVFFSWotHvjwzCelV4,10853
|
|
3
|
-
otlmow_template/SubsetTemplateCreator.py,sha256=Znann1ZJSMVgFvL5vWSx6gWX6uSwcILiu_rCVEQ61pE,29186
|
|
4
|
-
otlmow_template/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
otlmow_template/Exceptions/MissingTypeUriException.py,sha256=DSKwywmP9Bq8n7rzBoDcEPlxvC1IChx18QIHFUCTtdA,51
|
|
6
|
-
otlmow_template-0.11rc3.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
7
|
-
otlmow_template-0.11rc3.dist-info/METADATA,sha256=lAr8tR2UjWJBxiZHtCy_pe6eGHRXNMwBgRxE5vk-mmE,44040
|
|
8
|
-
otlmow_template-0.11rc3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
-
otlmow_template-0.11rc3.dist-info/top_level.txt,sha256=zPgBoaTLG-avoOLySlwOUEtHaFyA5Vc5wJqkSeX1l6A,16
|
|
10
|
-
otlmow_template-0.11rc3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|