hytos / HYTOS / HYTOS / Drawing.py @ a6a2273e
이력 | 보기 | 이력해설 | 다운로드 (2.18 KB)
1 |
# coding: utf-8
|
---|---|
2 |
import os |
3 |
import uuid |
4 |
from AppDocData import AppDocData |
5 |
|
6 |
class Drawing: |
7 |
'''
|
8 |
@brief construction
|
9 |
@author humkyung
|
10 |
@date 2018.07.07
|
11 |
'''
|
12 |
def __init__(self, UID, path, date_time): |
13 |
app_doc_data = AppDocData.instance() |
14 |
|
15 |
self._attrs = [['Drawing No', ''], ['Rev No', ''], ['Units', '']] # attributes |
16 |
|
17 |
self.UID = UID
|
18 |
self.path = path
|
19 |
self.name = os.path.splitext(os.path.split(path)[1])[0] |
20 |
self.date_time = date_time
|
21 |
|
22 |
self.allItems = []
|
23 |
self._hmbTable = None |
24 |
|
25 |
self.setUnits(self.UID) |
26 |
|
27 |
def clearItemList(self): |
28 |
self.allItems.clear()
|
29 |
|
30 |
def setUnits(self, uid): |
31 |
value = {} |
32 |
|
33 |
unitsList = AppDocData.instance().getDrawingsUnitsByDrawingUID(uid) |
34 |
for units in unitsList: |
35 |
value[units[0]] = units[1] |
36 |
|
37 |
if len(value) > 0: |
38 |
self.setAttr('Units', value) |
39 |
'''
|
40 |
@brief getter of attrs
|
41 |
@author humkyung
|
42 |
@date 2018.07.07
|
43 |
'''
|
44 |
@property
|
45 |
def attrs(self): |
46 |
return self._attrs |
47 |
|
48 |
'''
|
49 |
@brief setter of attrs
|
50 |
@author humkyung
|
51 |
@date 2018.07.07
|
52 |
'''
|
53 |
@attrs.setter
|
54 |
def attrs(self, value): |
55 |
self._attrs = value
|
56 |
|
57 |
'''
|
58 |
@brief set attribute
|
59 |
@author humkyung
|
60 |
@date 2018.07.07
|
61 |
'''
|
62 |
def setAttr(self, name, value): |
63 |
attrs = [attr for attr in self._attrs if attr[0] == name] |
64 |
if attrs:
|
65 |
attrs[0][1] = value |
66 |
else:
|
67 |
self._attrs.append([name, value])
|
68 |
|
69 |
#print('attribute({},{})'.format(name, value))
|
70 |
|
71 |
'''
|
72 |
@brief getter of hmb table
|
73 |
@author humkyung
|
74 |
@date 2018.07.16
|
75 |
'''
|
76 |
@property
|
77 |
def hmbTable(self): |
78 |
from HMBTable import HMBTable |
79 |
|
80 |
if self._hmbTable is None: |
81 |
self._hmbTable = HMBTable()
|
82 |
self._hmbTable.loadDataByDrawingUID(self.UID) |
83 |
|
84 |
return self._hmbTable |
85 |
|
86 |
'''
|
87 |
@brief setter of hmb table
|
88 |
@author humkyung
|
89 |
@date 2018.07.16
|
90 |
'''
|
91 |
@hmbTable.setter
|
92 |
def hmbTable(self, value): |
93 |
self._hmbTable = value
|