cannect 1.0.2__py3-none-any.whl → 1.0.3__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.
- cannect/config.py +2 -3
- cannect/core/can/ascet/comdef.py +15 -15
- cannect/core/can/ascet/comrx.py +4 -4
- cannect/core/can/ascet/diag.py +26 -26
- cannect/core/can/db/_dbc.py +394 -0
- cannect/core/can/db/reader.py +56 -10
- cannect/core/can/db/specification/wrapper.py +37 -38
- cannect/core/can/db/vcs.py +10 -3
- cannect/core/ir/changehistory.py +118 -144
- cannect/core/ir/diff.py +6 -4
- cannect/core/ir/ir.py +40 -38
- cannect/core/subversion.py +25 -0
- cannect/core/testcase/unitcase.py +1 -1
- cannect/errors.py +6 -0
- cannect/utils/ppt.py +1 -4
- cannect/utils/tools.py +4 -1
- cannect-1.0.3.dist-info/METADATA +651 -0
- {cannect-1.0.2.dist-info → cannect-1.0.3.dist-info}/RECORD +21 -20
- cannect-1.0.2.dist-info/METADATA +0 -214
- {cannect-1.0.2.dist-info → cannect-1.0.3.dist-info}/WHEEL +0 -0
- {cannect-1.0.2.dist-info → cannect-1.0.3.dist-info}/licenses/LICENSE +0 -0
- {cannect-1.0.2.dist-info → cannect-1.0.3.dist-info}/top_level.txt +0 -0
cannect/core/can/db/vcs.py
CHANGED
|
@@ -27,6 +27,9 @@ class CANDBVcs:
|
|
|
27
27
|
def __init__(self, filename:str=''):
|
|
28
28
|
if not filename:
|
|
29
29
|
filename = "자체제어기_KEFICO-EMS_CANFD.xlsx"
|
|
30
|
+
if not filename.endswith('.xlsx'):
|
|
31
|
+
filename += '.xlsx'
|
|
32
|
+
|
|
30
33
|
filepath = env.SVN_CANDB / filename
|
|
31
34
|
if not filepath.exists():
|
|
32
35
|
raise CANDBError(f'{filename} NOT EXISTS')
|
|
@@ -90,9 +93,11 @@ class CANDBVcs:
|
|
|
90
93
|
self.logger(f"- Saved as : {path_abbreviate(jsonpath)}")
|
|
91
94
|
return
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
def commit_json(self):
|
|
97
|
+
# TODO
|
|
98
|
+
Subversion.add(self.json)
|
|
99
|
+
Subversion.commit(self.json, message=f"[CANNECT] AUTO-COMMIT CAN JSON - {self.revision}")
|
|
100
|
+
return
|
|
96
101
|
|
|
97
102
|
if __name__ == "__main__":
|
|
98
103
|
from pandas import set_option
|
|
@@ -100,6 +105,8 @@ if __name__ == "__main__":
|
|
|
100
105
|
|
|
101
106
|
cdb = CANDBVcs()
|
|
102
107
|
# cdb = CANDBVcs(r"G-PROJECT_KEFICO-EMS_CANFD.xlsx")
|
|
108
|
+
# print(cdb.revision)
|
|
103
109
|
cdb.to_json()
|
|
104
110
|
print(cdb.json)
|
|
111
|
+
|
|
105
112
|
# cdb.commit_json()
|
cannect/core/ir/changehistory.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
from cannect.core.ir.ir import IntegrationRequest
|
|
1
2
|
from cannect.utils.ppt import PptRW
|
|
3
|
+
from cannect.utils import tools
|
|
2
4
|
from pandas import DataFrame
|
|
3
5
|
from typing import Iterable, List
|
|
4
6
|
import pygetwindow as gw
|
|
@@ -8,6 +10,119 @@ import time
|
|
|
8
10
|
|
|
9
11
|
class ChangeHistoryManager(PptRW):
|
|
10
12
|
|
|
13
|
+
def __init__(self, ir:IntegrationRequest):
|
|
14
|
+
ir.logger.log(f'[WRITE PPT ON "{tools.path_abbreviate(ir.deliverables.change_history)}"]')
|
|
15
|
+
if not ir.is_previous_svn_version_selected():
|
|
16
|
+
ir.logger.log('! WARNING: PREVIOUS MODEL NOT SELECTED')
|
|
17
|
+
|
|
18
|
+
super().__init__(ir.deliverables.change_history)
|
|
19
|
+
self.ir = ir
|
|
20
|
+
|
|
21
|
+
ir.logger.log('>>> RESIZING COVER PAGE')
|
|
22
|
+
self._resize_cover()
|
|
23
|
+
|
|
24
|
+
# PAGE OVERVIEW: SET FUNCTION LIST
|
|
25
|
+
self.set_text_in_table(n_slide=1, n_table=2, cell=(3, 2), text=", ".join(ir.table["FunctionName"]), pos='new')
|
|
26
|
+
self.set_table_font(n_slide=1, n_table=2, cell=(3, 2), size=10)
|
|
27
|
+
|
|
28
|
+
# PAGE MODEL DESCRIPTION:
|
|
29
|
+
if ir.is_previous_svn_version_selected():
|
|
30
|
+
ir.logger.log('>>> WRITE ON "SW 기능 상세 설명 - 변경 전"')
|
|
31
|
+
text = ''
|
|
32
|
+
for n in ir.p_table.index:
|
|
33
|
+
text += f'%{ir.p_table.loc[n, "FunctionName"]} <r.{ir.p_table.loc[n, "SCMRev"]}>\x0b\x0b\n'
|
|
34
|
+
text = text[:-1]
|
|
35
|
+
self.set_text_in_table(n_slide=2, n_table=1, cell=(2, 1), text=text, pos='new')
|
|
36
|
+
|
|
37
|
+
ir.logger.log('>>> WRITE ON "SW 기능 상세 설명 - 변경 후"')
|
|
38
|
+
text = ''
|
|
39
|
+
for n in ir.table.index:
|
|
40
|
+
text += f'%{ir.table.loc[n, "FunctionName"]} <r.{ir.table.loc[n, "SCMRev"]}>\x0b-\x0b\n'
|
|
41
|
+
text = text[:-1]
|
|
42
|
+
self.set_text_in_table(n_slide=2, n_table=1, cell=(2, 2), text=text, pos='new')
|
|
43
|
+
|
|
44
|
+
# PAGE MODEL DETAILS
|
|
45
|
+
ir.logger.log('>>> GENERATE SLIDES ')
|
|
46
|
+
self._set_model_slides()
|
|
47
|
+
|
|
48
|
+
if ir.is_previous_svn_version_selected():
|
|
49
|
+
ir.logger('>>> WRITING PREVIOUS MODEL DETAILS...')
|
|
50
|
+
for n in ir.p_table.index:
|
|
51
|
+
name, rev = ir.p_table.loc[n, "FunctionName"], ir.p_table.loc[n, "SCMRev"]
|
|
52
|
+
ir.logger(f'>>> ... {name} @{rev}')
|
|
53
|
+
slides = self.get_slide_n(f'{name} ')
|
|
54
|
+
for slide in slides:
|
|
55
|
+
self.replace_text_in_table(
|
|
56
|
+
n_slide=slide,
|
|
57
|
+
n_table=1,
|
|
58
|
+
cell=(1, 1),
|
|
59
|
+
prev="Rev.",
|
|
60
|
+
post=f"Rev.{rev}"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
ir.logger('>>> WRITING REVISED MODEL DETAILS...')
|
|
64
|
+
for n in ir.table.index:
|
|
65
|
+
name, rev = ir.table.loc[n, "FunctionName"], ir.table.loc[n, "SCMRev"]
|
|
66
|
+
ir.logger(f'>>> ... {name} @{rev}')
|
|
67
|
+
slides = self.get_slide_n(f'{name} ')
|
|
68
|
+
for slide in slides:
|
|
69
|
+
self.replace_text_in_table(
|
|
70
|
+
n_slide=slide,
|
|
71
|
+
n_table=1,
|
|
72
|
+
cell=(1, 2),
|
|
73
|
+
prev="Rev.",
|
|
74
|
+
post=f"Rev.{rev}"
|
|
75
|
+
)
|
|
76
|
+
slides = self.get_slide_n(f'{name} / Element')
|
|
77
|
+
for slide in slides:
|
|
78
|
+
self.set_text_in_table(
|
|
79
|
+
n_slide=slide,
|
|
80
|
+
n_table=1,
|
|
81
|
+
cell=(3, 1),
|
|
82
|
+
text='Element 삭제\x0b' + ir.table.loc[n, "ElementDeleted"],
|
|
83
|
+
pos="new"
|
|
84
|
+
)
|
|
85
|
+
self.set_text_in_table(
|
|
86
|
+
n_slide=slide,
|
|
87
|
+
n_table=1,
|
|
88
|
+
cell=(3, 2),
|
|
89
|
+
text='Element 추가\x0b' + ir.table.loc[n, "ElementAdded"],
|
|
90
|
+
pos="new"
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# WRITE CALIBRATION GUIDE
|
|
94
|
+
if len(ir.parameters) == 0:
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
ir.logger('>>> WRITING CALIBRATION PARAMETERS')
|
|
98
|
+
|
|
99
|
+
n_param = self.get_slide_n('Calibration')[0]
|
|
100
|
+
for n in range(len(ir.parameters) - 1):
|
|
101
|
+
self.ppt.Slides(n_param).Duplicate()
|
|
102
|
+
|
|
103
|
+
for n, param in enumerate(ir.parameters):
|
|
104
|
+
table = self._get_table(n_param + n, 1)
|
|
105
|
+
if len(param) > 3:
|
|
106
|
+
for _ in range(len(param) - 3):
|
|
107
|
+
table.Rows.Add()
|
|
108
|
+
table.Columns(1).Width = 5.0 * 28.346
|
|
109
|
+
table.Columns(2).Width = 7.0 * 28.346
|
|
110
|
+
table.Columns(3).Width = 4.0 * 28.346
|
|
111
|
+
table.Columns(5).Width = 2.0 * 28.346
|
|
112
|
+
table.Columns(6).Width = 2.0 * 28.346
|
|
113
|
+
table.Columns(7).Width = 2.0 * 28.346
|
|
114
|
+
for r, index in enumerate(param.index, start=1):
|
|
115
|
+
row = param.loc[index]
|
|
116
|
+
for c, val in enumerate(row.values, start=1):
|
|
117
|
+
cell = table.Cell(r + 1, c).Shape
|
|
118
|
+
cell.TextFrame.TextRange.Text = str(val)
|
|
119
|
+
cell.TextFrame.TextRange.Font.Name = "현대하모니 L"
|
|
120
|
+
cell.TextFrame.TextRange.Font.Size = 10
|
|
121
|
+
|
|
122
|
+
cell.TextFrame.TextRange.ParagraphFormat.Alignment = 1 if c == 2 else 2
|
|
123
|
+
cell.TextFrame.VerticalAnchor = 3
|
|
124
|
+
return
|
|
125
|
+
|
|
11
126
|
@classmethod
|
|
12
127
|
def routine_capture(cls, ppt:str='', size:int=26, *hotkey):
|
|
13
128
|
"""
|
|
@@ -55,7 +170,7 @@ class ChangeHistoryManager(PptRW):
|
|
|
55
170
|
|
|
56
171
|
return
|
|
57
172
|
|
|
58
|
-
def
|
|
173
|
+
def _resize_cover(self):
|
|
59
174
|
"""
|
|
60
175
|
| n == 7 | n == 3 |
|
|
61
176
|
| n == 8 | n == 4 |
|
|
@@ -104,15 +219,6 @@ class ChangeHistoryManager(PptRW):
|
|
|
104
219
|
self.set_text_in_table(n_slide=1, n_table=1, cell=(2, 1), text=developer, pos='new')
|
|
105
220
|
self.set_table_font(n_slide=1, n_table=1, cell=(2, 1), size=10)
|
|
106
221
|
|
|
107
|
-
@property
|
|
108
|
-
def function(self) -> str:
|
|
109
|
-
return self.__dict__.get('_function', '')
|
|
110
|
-
|
|
111
|
-
@function.setter
|
|
112
|
-
def function(self, functions:Iterable):
|
|
113
|
-
self.set_text_in_table(n_slide=1, n_table=2, cell=(3, 2), text=", ".join(functions), pos='new')
|
|
114
|
-
self.set_table_font(n_slide=1, n_table=2, cell=(3, 2), size=10)
|
|
115
|
-
|
|
116
222
|
@property
|
|
117
223
|
def issue(self) -> str:
|
|
118
224
|
return self.__dict__.get('_issue', '')
|
|
@@ -146,33 +252,8 @@ class ChangeHistoryManager(PptRW):
|
|
|
146
252
|
def problem(self, problem:str):
|
|
147
253
|
self.set_text_in_table(n_slide=1, n_table=2, cell=(5, 1), text=problem, pos='new')
|
|
148
254
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return self.__dict__.get('_prev_model_description', '')
|
|
152
|
-
|
|
153
|
-
@prev_model_description.setter
|
|
154
|
-
def prev_model_description(self, models:DataFrame):
|
|
155
|
-
text = ''
|
|
156
|
-
for n in models.index:
|
|
157
|
-
text += f'%{models.loc[n, "FunctionName"]} <r.{models.loc[n, "SCMRev"]}>\x0b\x0b\n'
|
|
158
|
-
text = text[:-1]
|
|
159
|
-
self.set_text_in_table(n_slide=2, n_table=1, cell=(2, 1), text=text, pos='new')
|
|
160
|
-
|
|
161
|
-
@property
|
|
162
|
-
def post_model_description(self) -> str:
|
|
163
|
-
return self.__dict__.get('_post_model_description', '')
|
|
164
|
-
|
|
165
|
-
@post_model_description.setter
|
|
166
|
-
def post_model_description(self, models: DataFrame):
|
|
167
|
-
text = ''
|
|
168
|
-
for n in models.index:
|
|
169
|
-
text += f'%{models.loc[n, "FunctionName"]} <r.{models.loc[n, "SCMRev"]}>\x0b-\x0b\n'
|
|
170
|
-
text = text[:-1]
|
|
171
|
-
self.set_text_in_table(n_slide=2, n_table=1, cell=(2, 2), text=text, pos='new')
|
|
172
|
-
|
|
173
|
-
def set_model_slides(self, ir:DataFrame):
|
|
174
|
-
if self.log is not None:
|
|
175
|
-
self.log('>>> GENERATING MODEL SLIDES...')
|
|
255
|
+
def _set_model_slides(self):
|
|
256
|
+
ir = self.ir.table
|
|
176
257
|
self.set_shape(n_slide=3, n_shape=1, width=26.1 * 28.346, left=0.8 * 28.346)
|
|
177
258
|
self.set_text_font(n_slide=3, n_shape=1, name="현대하모니 M", size=20)
|
|
178
259
|
self.set_table_height(n_slide=3, n_table=1, row=2, height=11 * 28.346)
|
|
@@ -201,110 +282,3 @@ class ChangeHistoryManager(PptRW):
|
|
|
201
282
|
self.set_text_in_table(n_slide=n_formula, n_table=1, cell=(3, 2), text="Impl. 추가\x0b", pos="new")
|
|
202
283
|
self.ppt.SectionProperties.AddBeforeSlide(self.get_slide_n('Calibration')[0], 'Calibration Guide')
|
|
203
284
|
return
|
|
204
|
-
|
|
205
|
-
@property
|
|
206
|
-
def prev_model_details(self):
|
|
207
|
-
return self.__dict__.get('_prev_model_details', '')
|
|
208
|
-
|
|
209
|
-
@prev_model_details.setter
|
|
210
|
-
def prev_model_details(self, models:DataFrame):
|
|
211
|
-
if self.log is not None:
|
|
212
|
-
self.log('>>> WRITING PREVIOUS MODEL DETAILS...')
|
|
213
|
-
for n in models.index:
|
|
214
|
-
name, rev = models.loc[n, "FunctionName"], models.loc[n, "SCMRev"]
|
|
215
|
-
if self.log is not None:
|
|
216
|
-
self.log(f'>>> ... {name} @{rev}')
|
|
217
|
-
slides = self.get_slide_n(f'{name} ')
|
|
218
|
-
for slide in slides:
|
|
219
|
-
self.replace_text_in_table(
|
|
220
|
-
n_slide=slide,
|
|
221
|
-
n_table=1,
|
|
222
|
-
cell=(1, 1),
|
|
223
|
-
prev="Rev.",
|
|
224
|
-
post=f"Rev.{rev}"
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
@property
|
|
228
|
-
def post_model_details(self):
|
|
229
|
-
return self.__dict__.get('_post_model_details', '')
|
|
230
|
-
|
|
231
|
-
@post_model_details.setter
|
|
232
|
-
def post_model_details(self, models:DataFrame):
|
|
233
|
-
if self.log is not None:
|
|
234
|
-
self.log('>>> WRITING POST MODEL DETAILS...')
|
|
235
|
-
for n in models.index:
|
|
236
|
-
name, rev = models.loc[n, "FunctionName"], models.loc[n, "SCMRev"]
|
|
237
|
-
if self.log is not None:
|
|
238
|
-
self.log(f'>>> ... {name} @{rev}')
|
|
239
|
-
slides = self.get_slide_n(f'{name} ')
|
|
240
|
-
for slide in slides:
|
|
241
|
-
self.replace_text_in_table(
|
|
242
|
-
n_slide=slide,
|
|
243
|
-
n_table=1,
|
|
244
|
-
cell=(1, 2),
|
|
245
|
-
prev="Rev.",
|
|
246
|
-
post=f"Rev.{rev}"
|
|
247
|
-
)
|
|
248
|
-
slides = self.get_slide_n(f'{name} / Element')
|
|
249
|
-
for slide in slides:
|
|
250
|
-
self.set_text_in_table(
|
|
251
|
-
n_slide=slide,
|
|
252
|
-
n_table=1,
|
|
253
|
-
cell=(3, 1),
|
|
254
|
-
text='Element 삭제\x0b' + models.loc[n, "ElementDeleted"],
|
|
255
|
-
pos="new"
|
|
256
|
-
)
|
|
257
|
-
self.set_text_in_table(
|
|
258
|
-
n_slide=slide,
|
|
259
|
-
n_table=1,
|
|
260
|
-
cell=(3, 2),
|
|
261
|
-
text='Element 추가\x0b' + models.loc[n, "ElementAdded"],
|
|
262
|
-
pos="new"
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
@property
|
|
266
|
-
def parameters(self) -> List[DataFrame]:
|
|
267
|
-
return self.__dict__.get('_parameters', [])
|
|
268
|
-
|
|
269
|
-
@parameters.setter
|
|
270
|
-
def parameters(self, parameters: List[DataFrame]):
|
|
271
|
-
if len(parameters) == 0:
|
|
272
|
-
return
|
|
273
|
-
self.__dict__['_parameters'] = parameters
|
|
274
|
-
if self.log is not None:
|
|
275
|
-
self.log('>>> WRITING CALIBRATION PARAMETERS...')
|
|
276
|
-
|
|
277
|
-
n_param = self.get_slide_n('Calibration')[0]
|
|
278
|
-
for n in range(len(parameters) - 1):
|
|
279
|
-
self.ppt.Slides(n_param).Duplicate()
|
|
280
|
-
|
|
281
|
-
for n, param in enumerate(parameters):
|
|
282
|
-
table = self._get_table(n_param + n, 1)
|
|
283
|
-
if len(param) > 3:
|
|
284
|
-
for _ in range(len(param) - 3):
|
|
285
|
-
table.Rows.Add()
|
|
286
|
-
table.Columns(1).Width = 5.0 * 28.346
|
|
287
|
-
table.Columns(2).Width = 7.0 * 28.346
|
|
288
|
-
table.Columns(3).Width = 4.0 * 28.346
|
|
289
|
-
table.Columns(5).Width = 2.0 * 28.346
|
|
290
|
-
table.Columns(6).Width = 2.0 * 28.346
|
|
291
|
-
table.Columns(7).Width = 2.0 * 28.346
|
|
292
|
-
for r, index in enumerate(param.index, start=1):
|
|
293
|
-
row = param.loc[index]
|
|
294
|
-
for c, val in enumerate(row.values, start=1):
|
|
295
|
-
cell = table.Cell(r + 1, c).Shape
|
|
296
|
-
cell.TextFrame.TextRange.Text = str(val)
|
|
297
|
-
cell.TextFrame.TextRange.Font.Name = "현대하모니 L"
|
|
298
|
-
cell.TextFrame.TextRange.Font.Size = 10
|
|
299
|
-
|
|
300
|
-
cell.TextFrame.TextRange.ParagraphFormat.Alignment = 1 if c == 2 else 2
|
|
301
|
-
cell.TextFrame.VerticalAnchor = 3
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if __name__ == "__main__":
|
|
306
|
-
# ChangeHistoryManager.routine_capture('0000_CNGPIO_통신_인터페이스_개발.pptx', 13)
|
|
307
|
-
chm = ChangeHistoryManager(
|
|
308
|
-
path = r"D:\Archive\00_프로젝트\2017 통신개발-\2026\DS0127 CR10787035 DTC별 IUMPR 표출 조건 변경 ICE\0000_CAN_ICE_IUMPR표출_DEM조건_추가.pptx"
|
|
309
|
-
)
|
|
310
|
-
chm.resize_cover()
|
cannect/core/ir/diff.py
CHANGED
|
@@ -61,7 +61,7 @@ class AmdDiff:
|
|
|
61
61
|
@property
|
|
62
62
|
def added(self) -> List[str]:
|
|
63
63
|
if self.is_equal:
|
|
64
|
-
return
|
|
64
|
+
return []
|
|
65
65
|
return list(set(self.post_elem['name']) - set(self.prev_elem['name']))
|
|
66
66
|
|
|
67
67
|
@property
|
|
@@ -91,7 +91,9 @@ if __name__ == "__main__":
|
|
|
91
91
|
set_option('display.expand_frame_repr', False)
|
|
92
92
|
|
|
93
93
|
diff = AmdDiff(
|
|
94
|
-
r"D:\Archive\00_프로젝트\2017 통신개발-\
|
|
95
|
-
r"D:\Archive\00_프로젝트\2017 통신개발-\
|
|
94
|
+
r"D:\Archive\00_프로젝트\2017 통신개발-\2026\test\04_Model\Prev\ComDef_HEV.main.amd",
|
|
95
|
+
r"D:\Archive\00_프로젝트\2017 통신개발-\2026\test\04_Model\Post\ComDef_HEV-22550\ComDef_HEV.main.amd",
|
|
96
96
|
)
|
|
97
|
-
print(diff.added_parameters)
|
|
97
|
+
# print(diff.added_parameters)
|
|
98
|
+
print(diff.added)
|
|
99
|
+
print(len(diff.added))
|
cannect/core/ir/ir.py
CHANGED
|
@@ -81,6 +81,24 @@ class IntegrationRequest:
|
|
|
81
81
|
def _repr_html_(self):
|
|
82
82
|
return getattr(self.table, '_repr_html_')()
|
|
83
83
|
|
|
84
|
+
@property
|
|
85
|
+
def ChangeHistory(self) -> str:
|
|
86
|
+
return self._change_history
|
|
87
|
+
|
|
88
|
+
@ChangeHistory.setter
|
|
89
|
+
def ChangeHistory(self, change: str):
|
|
90
|
+
self.table["ChangeHistoryName"] = change
|
|
91
|
+
self._change_history = change
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def Comment(self) -> str:
|
|
95
|
+
return self._comment
|
|
96
|
+
|
|
97
|
+
@Comment.setter
|
|
98
|
+
def Comment(self, comment: str):
|
|
99
|
+
self.table["Comment"] = comment
|
|
100
|
+
self._comment = comment
|
|
101
|
+
|
|
84
102
|
@property
|
|
85
103
|
def deliverables(self) -> Deliverables:
|
|
86
104
|
"""
|
|
@@ -99,15 +117,6 @@ class IntegrationRequest:
|
|
|
99
117
|
def parameters(self) -> List[DataFrame]:
|
|
100
118
|
return self._parameters
|
|
101
119
|
|
|
102
|
-
@property
|
|
103
|
-
def Comment(self) -> str:
|
|
104
|
-
return self._comment
|
|
105
|
-
|
|
106
|
-
@Comment.setter
|
|
107
|
-
def Comment(self, comment: str):
|
|
108
|
-
self.table["Comment"] = comment
|
|
109
|
-
self._comment = comment
|
|
110
|
-
|
|
111
120
|
@property
|
|
112
121
|
def User(self) -> str:
|
|
113
122
|
return self._user
|
|
@@ -117,15 +126,6 @@ class IntegrationRequest:
|
|
|
117
126
|
self.table["User"] = user
|
|
118
127
|
self._user = user
|
|
119
128
|
|
|
120
|
-
@property
|
|
121
|
-
def ChangeHistory(self) -> str:
|
|
122
|
-
return self._change_history
|
|
123
|
-
|
|
124
|
-
@ChangeHistory.setter
|
|
125
|
-
def ChangeHistory(self, change: str):
|
|
126
|
-
self.table["ChangeHistoryName"] = change
|
|
127
|
-
self._change_history = change
|
|
128
|
-
|
|
129
129
|
@staticmethod
|
|
130
130
|
def _column_selector(key: str) -> str:
|
|
131
131
|
"""
|
|
@@ -153,7 +153,7 @@ class IntegrationRequest:
|
|
|
153
153
|
Subversion.commit(self.ws[f'{name}.zip'], message)
|
|
154
154
|
return
|
|
155
155
|
|
|
156
|
-
def compare_model(self, prev: str = '', post: str = '', exclude_imported: bool =
|
|
156
|
+
def compare_model(self, prev: str = '', post: str = '', exclude_imported: bool = False):
|
|
157
157
|
self.logger("[COMPARE ELEMENTS]")
|
|
158
158
|
if not prev:
|
|
159
159
|
prev = self.deliverables.Model / "Prev"
|
|
@@ -170,7 +170,7 @@ class IntegrationRequest:
|
|
|
170
170
|
dat = Amd(post_amd).data.dataframe('DataEntry')
|
|
171
171
|
self.table.loc[n, 'ElementAdded'] = ", ".join(amd["name"])
|
|
172
172
|
self.logger(
|
|
173
|
-
f">>> %{name: <{self._space}}: NEW ELEMENT / ADDED ={len(amd): >3}")
|
|
173
|
+
f">>> %{name: <{self._space}}: NEW ELEMENT / ADDED = {len(amd): >3}")
|
|
174
174
|
params = AmdDiff.parameters2table(amd, dat)
|
|
175
175
|
if not params.empty:
|
|
176
176
|
self._parameters.append(params)
|
|
@@ -182,7 +182,7 @@ class IntegrationRequest:
|
|
|
182
182
|
if not params.empty:
|
|
183
183
|
self._parameters.append(params)
|
|
184
184
|
|
|
185
|
-
self.logger(f">>> %{name: <{self._space}}: DELETED ={len(diff.deleted): >3} / ADDED ={len(diff.added): >3}")
|
|
185
|
+
self.logger(f">>> %{name: <{self._space}}: DELETED = {len(diff.deleted): >3} / ADDED = {len(diff.added): >3}")
|
|
186
186
|
return
|
|
187
187
|
|
|
188
188
|
def copy_model_to_svn(
|
|
@@ -295,6 +295,9 @@ class IntegrationRequest:
|
|
|
295
295
|
self.p_table.reset_index(inplace=True)
|
|
296
296
|
return
|
|
297
297
|
|
|
298
|
+
def is_previous_svn_version_selected(self):
|
|
299
|
+
return self.deliverables is not None and os.listdir(self.deliverables.Model / "Prev")
|
|
300
|
+
|
|
298
301
|
def resolve_model(self, model: str):
|
|
299
302
|
"""
|
|
300
303
|
모델 정보를 @self.table에 추가 (SVN Revision 제외)
|
|
@@ -396,9 +399,9 @@ class IntegrationRequest:
|
|
|
396
399
|
tools.clear(temp, leave_path=True)
|
|
397
400
|
return
|
|
398
401
|
|
|
399
|
-
def select_previous_svn_version(self, mode: str = '
|
|
402
|
+
def select_previous_svn_version(self, mode: str = 'latest'):
|
|
400
403
|
"""
|
|
401
|
-
@mode: [str] {'
|
|
404
|
+
@mode: [str] {'previous', 'latest', 'select'}
|
|
402
405
|
"""
|
|
403
406
|
# 산출물 경로가 존재하는 경우 모델 과거 버전 조회 이력 확인 후 재 사용
|
|
404
407
|
if self.deliverables is not None and os.listdir(self.deliverables.Model / "Prev"):
|
|
@@ -416,14 +419,14 @@ class IntegrationRequest:
|
|
|
416
419
|
self.p_table.loc[n, "SCMRev"] = '-'
|
|
417
420
|
return
|
|
418
421
|
|
|
419
|
-
if not mode.lower() in ['
|
|
422
|
+
if not mode.lower() in ['previous', 'latest']:
|
|
420
423
|
self.logger(f'[SELECT PREVIOUS MODEL VERSION]')
|
|
421
424
|
for n, row in enumerate(self):
|
|
422
425
|
file = self.ws[row["FunctionName"]]
|
|
423
426
|
history = Subversion.log(file)
|
|
424
|
-
if mode.lower() in ['
|
|
427
|
+
if mode.lower() in ['previous', 'latest']:
|
|
425
428
|
try:
|
|
426
|
-
i = 1 if mode.lower() == '
|
|
429
|
+
i = 1 if mode.lower() == 'previous' else 0
|
|
427
430
|
self.p_table.loc[n, "SCMRev"] = rev = history["revision"].values[i][1:]
|
|
428
431
|
if self.deliverables is not None:
|
|
429
432
|
Subversion.save_revision_to(file, rev, self.deliverables.Model / "Prev")
|
|
@@ -521,8 +524,8 @@ class IntegrationRequest:
|
|
|
521
524
|
# # TODO
|
|
522
525
|
# return
|
|
523
526
|
|
|
524
|
-
def to_clipboard(self
|
|
525
|
-
return self.table[SCHEMA].to_clipboard(
|
|
527
|
+
def to_clipboard(self):
|
|
528
|
+
return self.table[SCHEMA].to_clipboard(index=False)
|
|
526
529
|
|
|
527
530
|
|
|
528
531
|
if __name__ == "__main__":
|
|
@@ -536,14 +539,13 @@ if __name__ == "__main__":
|
|
|
536
539
|
# r"E:\TEMP\CanCNG\CanCNG.main.amd", # 신규 모델은 전체 경로 사용
|
|
537
540
|
# r"E:\TEMP\CanEMS_CNG\CanEMS_CNG.main.amd", # 신규 모델은 전체 경로 사용
|
|
538
541
|
# r"E:\TEMP\CanEMSM_CNG\CanEMSM_CNG.main.amd", # 신규 모델은 전체 경로 사용
|
|
539
|
-
"
|
|
540
|
-
"CanNOXD"
|
|
542
|
+
"ComDef_HEV", "ComRx_HEV", "CanFDMCUD_HEV", "CanFDMCUM_HEV", "LogIf_HEV"
|
|
541
543
|
)
|
|
542
|
-
ir.deliverables =
|
|
543
|
-
ir.User = "이제혁"
|
|
544
|
-
ir.Comment = "VCDM CR10787034 HEV/CANFD DTC별 IUMPR 표출 조건 변경"
|
|
544
|
+
ir.deliverables = env.DOWNLOADS / 'test'
|
|
545
|
+
# ir.User = "이제혁"
|
|
546
|
+
# ir.Comment = "VCDM CR10787034 HEV/CANFD DTC별 IUMPR 표출 조건 변경"
|
|
545
547
|
# ir.select_previous_svn_version(mode='select')
|
|
546
|
-
|
|
548
|
+
ir.select_previous_svn_version(mode='latest')
|
|
547
549
|
|
|
548
550
|
# POST-ACTION
|
|
549
551
|
# ir.update_sdd(comment=ir.Comment)
|
|
@@ -555,9 +557,9 @@ if __name__ == "__main__":
|
|
|
555
557
|
# ir.commit_sdd(log='') # TODO
|
|
556
558
|
|
|
557
559
|
# ir.resolve_svn_version('POLYSPACE')
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
ir.resolve_svn_version()
|
|
561
|
+
ir.resolve_sdd_version()
|
|
562
|
+
ir.compare_model(prev='', post='', exclude_imported=False)
|
|
561
563
|
|
|
562
564
|
# 변경내역서 작성
|
|
563
565
|
# ppt = ChangeHistoryManager(
|
|
@@ -578,4 +580,4 @@ if __name__ == "__main__":
|
|
|
578
580
|
# ppt.parameters = ir.parameters # .compare_model()의 후행
|
|
579
581
|
|
|
580
582
|
print(ir)
|
|
581
|
-
# ir.to_clipboard(
|
|
583
|
+
# ir.to_clipboard()
|
cannect/core/subversion.py
CHANGED
|
@@ -13,6 +13,31 @@ class Subversion:
|
|
|
13
13
|
logger :Callable = print
|
|
14
14
|
silence:bool = False
|
|
15
15
|
|
|
16
|
+
@classmethod
|
|
17
|
+
def add(cls, path:Union[str, Path]):
|
|
18
|
+
post = False
|
|
19
|
+
drive = "Z:"
|
|
20
|
+
if str(path).startswith("\\\\"):
|
|
21
|
+
post = True
|
|
22
|
+
anchor = Path(path).anchor
|
|
23
|
+
subprocess.run(["net", "use", drive, "/delete", "/y"], capture_output=True)
|
|
24
|
+
subprocess.run(["net", "use", drive, anchor], check=True)
|
|
25
|
+
path = Path(drive) / "\\" / Path(path).relative_to(anchor)
|
|
26
|
+
|
|
27
|
+
result = subprocess.run(
|
|
28
|
+
["svn", "add", str(path), '--force'],
|
|
29
|
+
shell=True,
|
|
30
|
+
capture_output=True,
|
|
31
|
+
text=True,
|
|
32
|
+
check=True
|
|
33
|
+
)
|
|
34
|
+
if post:
|
|
35
|
+
subprocess.run(["net", "use", drive, "/delete", "/y"], capture_output=True)
|
|
36
|
+
if not cls.silence:
|
|
37
|
+
cls.logger("Add successful!")
|
|
38
|
+
cls.logger(result.stdout)
|
|
39
|
+
return
|
|
40
|
+
|
|
16
41
|
@classmethod
|
|
17
42
|
def read_wcdb(cls, path:Union[Path,str]) -> DataFrame:
|
|
18
43
|
conn = sqlite3.connect(path)
|
|
@@ -35,7 +35,7 @@ LABEL = {
|
|
|
35
35
|
"ER-Value": '',
|
|
36
36
|
"Test Result": '',
|
|
37
37
|
"Test Result Description": '',
|
|
38
|
-
"Test Conductor": f"{env.
|
|
38
|
+
"Test Conductor": f"{env.USER} @HYUNDAI-KEFICO",
|
|
39
39
|
"Test SW": '',
|
|
40
40
|
"Test HW": '',
|
|
41
41
|
"Test Vehicle / Engine / HIL": '',
|
cannect/errors.py
CHANGED
cannect/utils/ppt.py
CHANGED
|
@@ -52,9 +52,7 @@ class PptRW:
|
|
|
52
52
|
cls.app.Visible = True
|
|
53
53
|
return super().__new__(cls)
|
|
54
54
|
|
|
55
|
-
def __init__(self, path:str
|
|
56
|
-
if logger is not None:
|
|
57
|
-
logger.log(f'[WRITE PPT ON "{os.path.basename(path)}"]')
|
|
55
|
+
def __init__(self, path:str):
|
|
58
56
|
if self.app.Presentations.Count > 0:
|
|
59
57
|
for n in range(1, self.app.Presentations.Count + 1):
|
|
60
58
|
_ppt = self.app.Presentations.Item(n)
|
|
@@ -62,7 +60,6 @@ class PptRW:
|
|
|
62
60
|
self.ppt = _ppt
|
|
63
61
|
return
|
|
64
62
|
self.ppt = self.app.Presentations.Open(path)
|
|
65
|
-
self.log = logger
|
|
66
63
|
return
|
|
67
64
|
|
|
68
65
|
def __iter__(self) -> Generator[win32.CDispatch, None, None]:
|
cannect/utils/tools.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
from cannect.config import env
|
|
1
2
|
from pathlib import Path
|
|
2
|
-
from typing import
|
|
3
|
+
from typing import Callable, Iterable, List, Union
|
|
3
4
|
from xml.etree.ElementTree import Element, ElementTree
|
|
4
5
|
from xml.dom import minidom
|
|
5
6
|
import os, zipfile, shutil, io, re
|
|
@@ -85,6 +86,8 @@ def clear(path: str, leave_path: bool = True):
|
|
|
85
86
|
print(f"Error occurs while clearing directory: {e}")
|
|
86
87
|
|
|
87
88
|
def path_abbreviate(path: Union[str, Path]) -> str:
|
|
89
|
+
if str(path).startswith(str(env.DOWNLOADS)):
|
|
90
|
+
return path
|
|
88
91
|
sep = os.path.sep
|
|
89
92
|
split = str(path).split(sep)
|
|
90
93
|
return f"{sep.join(split[:2])}{sep} ... {sep}{sep.join(split[-3:])}"
|