개정판 128bedc4
cad symbol expression on going
Change-Id: I32137dd2e76d061de1bbd9c3ce5f7bc231a6529f
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
136 | 136 |
child.setEditable(False) |
137 | 137 |
id2_symbol_item.appendRow(childs) |
138 | 138 |
|
139 |
headers = [QStandardItem("ID2 Symbol"), QStandardItem("AutoCAD Symbol"), QStandardItem('')] |
|
139 |
headers = [QStandardItem("ID2 Symbol"), QStandardItem("AutoCAD Symbol"), QStandardItem(' '), QStandardItem('Expression'), QStandardItem('')]
|
|
140 | 140 |
for idx, header in enumerate(headers): |
141 | 141 |
header.setTextAlignment(Qt.AlignCenter) |
142 | 142 |
self.setHorizontalHeaderItem(idx, header) |
... | ... | |
148 | 148 |
|
149 | 149 |
symbolTypeList = app_doc_data.getSymbolTypeList() |
150 | 150 |
for row, symbolType in enumerate(symbolTypeList): |
151 |
items = [QStandardItem(symbolType[2]), QStandardItem(''), QStandardItem('')] |
|
151 |
items = [QStandardItem(symbolType[2]), QStandardItem(''), QStandardItem(''), QStandardItem(''), QStandardItem('')]
|
|
152 | 152 |
items[0].setData(symbolType, Qt.UserRole) |
153 | 153 |
items[0].setEditable(False) |
154 | 154 |
items[0].setSelectable(False) |
... | ... | |
156 | 156 |
items[1].setSelectable(False) |
157 | 157 |
items[2].setEditable(False) |
158 | 158 |
items[2].setSelectable(False) |
159 |
items[3].setEditable(False) |
|
160 |
items[3].setSelectable(False) |
|
161 |
items[4].setEditable(False) |
|
162 |
items[4].setSelectable(False) |
|
159 | 163 |
|
160 | 164 |
symbolList = app_doc_data.getSymbolListByType('UID', symbolType[0]) |
161 | 165 |
for symbol in symbolList: |
162 |
childs = [QStandardItem(symbol.getName()), QStandardItem(''), QStandardItem('')] |
|
166 |
childs = [QStandardItem(symbol.getName()), QStandardItem(''), QStandardItem(''), QStandardItem(''), QStandardItem('')]
|
|
163 | 167 |
childs[0].setData(symbol.getUid(), Qt.UserRole) |
164 | 168 |
childs[0].setEditable(False) |
165 | 169 |
|
... | ... | |
639 | 643 |
|
640 | 644 |
self.ui.treeViewSymbolMapping.model().removeRow(index.row(), index.parent()) |
641 | 645 |
|
642 |
def on_add_symbol_type_item(self, index: QModelIndex): |
|
646 |
def on_add_symbol_type_item(self, index: QModelIndex, expression=False):
|
|
643 | 647 |
"""map AutoCAD symbol and ID2 symbol""" |
644 | 648 |
|
645 | 649 |
try: |
646 |
_index = self.ui.treeViewSymbolMapping.model().index(index.row(), 1, index.parent()) |
|
650 |
_index = None |
|
651 |
if not expression: |
|
652 |
_index = self.ui.treeViewSymbolMapping.model().index(index.row(), 1, index.parent()) |
|
653 |
else: |
|
654 |
_index = self.ui.treeViewSymbolMapping.model().index(index.row(), 3, index.parent()) |
|
647 | 655 |
autocad_symbol_item = self.ui.treeViewSymbolMapping.model().itemFromIndex(_index) |
648 | 656 |
if autocad_symbol_item and autocad_symbol_item.text(): |
649 | 657 |
_index = self.ui.treeViewSymbolMapping.model().index(index.row(), 0, index.parent()) |
650 | 658 |
id2_symbol_item = self.ui.treeViewSymbolMapping.model().itemFromIndex(_index) |
651 | 659 |
if autocad_symbol_item.text() not in self.ui.treeViewSymbolMapping.model()._autocad_symbols: |
652 |
items = [QStandardItem(''), QStandardItem(autocad_symbol_item.text()), QStandardItem('')] |
|
660 |
items = [QStandardItem(''), QStandardItem(autocad_symbol_item.text()), QStandardItem(''), QStandardItem(''), QStandardItem('')]
|
|
653 | 661 |
items[0].setData(id2_symbol_item.data(Qt.UserRole), Qt.UserRole) |
654 | 662 |
for item in items: |
655 | 663 |
item.setEditable(False) |
... | ... | |
693 | 701 |
button.clicked.connect(partial(self.on_add_symbol_type_item, index)) |
694 | 702 |
self.ui.treeViewSymbolMapping.setIndexWidget(index, button) |
695 | 703 |
|
704 |
button = QPushButton(icon=QIcon(":/newPrefix/Add.svg")) |
|
705 |
button.setMaximumWidth(20) |
|
706 |
index = model.index(child_row, 4, parent_index) |
|
707 |
button.clicked.connect(partial(self.on_add_symbol_type_item, index, True)) |
|
708 |
self.ui.treeViewSymbolMapping.setIndexWidget(index, button) |
|
709 |
|
|
696 | 710 |
"""add autocad symbol item""" |
697 | 711 |
id2_symbol_index = model.index(child_row, 0, parent_index) |
698 | 712 |
acad_symbol_count = model.rowCount(id2_symbol_index) |
내보내기 Unified diff