개정판 e80ac39b
Import AutoCAD 기능 개선
Change-Id: I7f00398827004cac8a877877b876df30e1fb8696
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
1 | 1 |
# coding: utf-8 |
2 |
""" |
|
3 |
This is text importing module from CAD |
|
4 |
""" |
|
2 |
"""This is text importing module from AutoCAD""" |
|
5 | 3 |
import os |
6 | 4 |
import sys |
7 | 5 |
from PyQt5.QtCore import * |
8 | 6 |
from PyQt5.QtGui import * |
9 | 7 |
from PyQt5.QtWidgets import * |
10 | 8 |
from AppDocData import AppDocData |
11 |
import XmlGenerator as xg
|
|
9 |
from functools import reduce, partial
|
|
12 | 10 |
import subprocess |
13 | 11 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse |
14 | 12 |
|
15 | 13 |
import ImportTextFromCAD_UI |
16 | 14 |
|
17 | 15 |
|
16 |
class LineTypeMappingDelegate(QStyledItemDelegate): |
|
17 |
def __init__(self, line_types: list, parent=None): |
|
18 |
QStyledItemDelegate.__init__(self, parent) |
|
19 |
|
|
20 |
self._line_types = line_types |
|
21 |
|
|
22 |
def createEditor(self, parent, option, index): |
|
23 |
editor = None |
|
24 |
|
|
25 |
item = index.model().itemFromIndex(index) |
|
26 |
if not item.parent(): |
|
27 |
if index.column() == 1: |
|
28 |
editor = QComboBox(parent) |
|
29 |
editor.addItems(self._line_types) |
|
30 |
|
|
31 |
return editor if editor else super(LineTypeMappingDelegate, self).createEditor(parent, option, index) |
|
32 |
|
|
33 |
|
|
34 |
class LineTypeMappingModel(QStandardItemModel): |
|
35 |
"""This is LineTypeMapping Model class""" |
|
36 |
def __init__(self): |
|
37 |
from LineTypeConditions import LineTypeConditions |
|
38 |
|
|
39 |
QStandardItemModel.__init__(self) |
|
40 |
|
|
41 |
app_doc_data = AppDocData.instance() |
|
42 |
configs = app_doc_data.getConfigs(section='Line Type Mapping') |
|
43 |
|
|
44 |
for condition in LineTypeConditions.items(): |
|
45 |
items = [QStandardItem(condition.name), QStandardItem(''), QStandardItem('')] |
|
46 |
items[0].setEditable(False) |
|
47 |
self.appendRow(items) |
|
48 |
|
|
49 |
matches = [config for config in configs if config.key == condition.name] |
|
50 |
for match in matches: |
|
51 |
line_types = match.value.split(',') |
|
52 |
for line_type in line_types: |
|
53 |
childs = [QStandardItem(''), QStandardItem(line_type), QStandardItem('')] |
|
54 |
childs[0].setData(condition.name, Qt.UserRole) |
|
55 |
for child in childs: |
|
56 |
child.setEditable(False) |
|
57 |
items[0].appendRow(childs) |
|
58 |
|
|
59 |
headers = [QStandardItem("ID2 Line Type"), QStandardItem("AutoCAD Line Type"), QStandardItem('')] |
|
60 |
for idx, header in enumerate(headers): |
|
61 |
header.setTextAlignment(Qt.AlignCenter) |
|
62 |
self.setHorizontalHeaderItem(idx, header) |
|
63 |
|
|
64 |
|
|
18 | 65 |
class QImportTextFromCADDialog(QDialog): |
19 | 66 |
def __init__(self, parent): |
20 | 67 |
QDialog.__init__(self, parent) |
... | ... | |
22 | 69 |
self.ui = ImportTextFromCAD_UI.Ui_ImportTextFromCADDialog() |
23 | 70 |
self.ui.setupUi(self) |
24 | 71 |
|
72 |
self._dwgs = [] |
|
73 |
self._line_types = [] |
|
74 |
self.on_load_line_type_mapping() |
|
75 |
|
|
25 | 76 |
self.isAccepted = False |
26 | 77 |
|
27 |
self.ui.toolButtonID2.clicked.connect(self.on_add_id2_click) |
|
28 | 78 |
self.ui.toolButtonCAD.clicked.connect(self.on_add_cad_click) |
29 |
self.ui.pushButtonImport.clicked.connect(self.importTextFromCAD) |
|
79 |
self.ui.pushButtonSave.clicked.connect(self.on_save_line_type_mapping) |
|
80 |
self.ui.pushButtonImport.clicked.connect(self.on_import_autocad) |
|
30 | 81 |
self.ui.pushButtonClose.clicked.connect(self.close) |
31 | 82 |
|
83 |
def on_load_line_type_mapping(self): |
|
84 |
"""load ID2-AutoCAD """ |
|
85 |
def on_remove_treeview_item(): |
|
86 |
indices = self.ui.treeViewLineType.selectionModel().selectedRows() |
|
87 |
for index in sorted(indices): |
|
88 |
self.ui.treeViewLineType.model().removeRow(index.row(), index.parent()) |
|
89 |
|
|
90 |
def on_add_line_type_item(index: QModelIndex): |
|
91 |
_index = self.ui.treeViewLineType.model().index(index.row(), 1) |
|
92 |
autocad_line_type_item = self.ui.treeViewLineType.model().itemFromIndex(_index) |
|
93 |
if autocad_line_type_item and autocad_line_type_item.text(): |
|
94 |
_index = self.ui.treeViewLineType.model().index(index.row(), 0, index.parent()) |
|
95 |
id2_line_type_item = self.ui.treeViewLineType.model().itemFromIndex(_index) |
|
96 |
items = [QStandardItem(''), QStandardItem(autocad_line_type_item.text()), QStandardItem('')] |
|
97 |
items[0].setData(id2_line_type_item.text(), Qt.UserRole) |
|
98 |
for item in items: |
|
99 |
item.setEditable(False) |
|
100 |
id2_line_type_item.appendRow(items) |
|
101 |
|
|
102 |
"""add remove button""" |
|
103 |
child_count = self.ui.treeViewLineType.model().rowCount(id2_line_type_item.index()) |
|
104 |
button = QPushButton(icon=QIcon(":/newPrefix/Remove.svg")) |
|
105 |
button.setMaximumWidth(20) |
|
106 |
button.clicked.connect(on_remove_treeview_item) |
|
107 |
_index = self.ui.treeViewLineType.model().index(child_count - 1, 2, id2_line_type_item.index()) |
|
108 |
self.ui.treeViewLineType.setIndexWidget(_index, button) |
|
109 |
"""up to here""" |
|
110 |
|
|
111 |
self.ui.treeViewLineType.expandAll() |
|
112 |
|
|
113 |
model = LineTypeMappingModel() |
|
114 |
model.invisibleRootItem() |
|
115 |
self.ui.treeViewLineType.setModel(model) |
|
116 |
self.ui.treeViewLineType.setItemDelegate(LineTypeMappingDelegate(self._line_types, self.ui.treeViewLineType)) |
|
117 |
|
|
118 |
for row in range(model.rowCount()): |
|
119 |
button = QPushButton(icon=QIcon(":/newPrefix/Add.svg")) |
|
120 |
button.setMaximumWidth(20) |
|
121 |
index = self.ui.treeViewLineType.model().index(row, 2) |
|
122 |
button.clicked.connect(partial(on_add_line_type_item, index)) |
|
123 |
self.ui.treeViewLineType.setIndexWidget(index, button) |
|
124 |
|
|
125 |
parent_index = model.index(row, 0) |
|
126 |
child_count = model.rowCount(parent_index) |
|
127 |
for child_row in range(child_count): |
|
128 |
button = QPushButton(icon=QIcon(":/newPrefix/Remove.svg")) |
|
129 |
button.setMaximumWidth(20) |
|
130 |
_index = self.ui.treeViewLineType.model().index(child_row, 2, parent_index) |
|
131 |
button.clicked.connect(on_remove_treeview_item) |
|
132 |
self.ui.treeViewLineType.setIndexWidget(_index, button) |
|
133 |
|
|
134 |
self.ui.treeViewLineType.resizeColumnToContents(0) |
|
135 |
self.ui.treeViewLineType.resizeColumnToContents(1) |
|
136 |
self.ui.treeViewLineType.resizeColumnToContents(2) |
|
137 |
self.ui.treeViewLineType.expandAll() |
|
138 |
|
|
32 | 139 |
def on_add_id2_click(self): |
33 | 140 |
"""select id2 xml files""" |
34 | 141 |
project = AppDocData.instance().getCurrentProject() |
... | ... | |
48 | 155 |
|
49 | 156 |
options = QFileDialog.Options() |
50 | 157 |
options |= QFileDialog.DontUseNativeDialog |
51 |
files, _ = QFileDialog.getOpenFileNames(self, self.tr('Import', "Select CAD File"), |
|
52 |
os.path.join(project.getDrawingFilePath(), 'Native'),
|
|
53 |
"dwg files (*.dwg)", options=options)
|
|
158 |
files, _ = QFileDialog.getOpenFileNames(self, self.tr('Import', "Select AutoCAD File"),
|
|
159 |
os.path.join(project.getDrawingFilePath(), 'Native'), |
|
160 |
"dwg files (*.dwg)", options=options) |
|
54 | 161 |
if files: |
55 | 162 |
self.ui.lineEditCAD.setText(files[0]) if len(files) == 1 else \ |
56 | 163 |
self.ui.lineEditCAD.setText(str(len(files)) + ' files') |
57 |
self.dwgs = files |
|
58 |
|
|
59 |
def importTextFromCAD(self): |
|
164 |
|
|
165 |
self._dwgs.clear() |
|
166 |
self._line_types.clear() |
|
167 |
for file in files: |
|
168 |
if os.path.exists(file): |
|
169 |
try: |
|
170 |
executable = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'OdReadExMgd', |
|
171 |
'OdReadExMgd.exe') |
|
172 |
args = [executable, file, '0', '0', '1'] |
|
173 |
CREATE_NO_WINDOW = 0x08000000 |
|
174 |
p = subprocess.Popen( |
|
175 |
args, |
|
176 |
stdin=subprocess.PIPE, |
|
177 |
stdout=subprocess.PIPE, |
|
178 |
stderr=subprocess.PIPE, |
|
179 |
creationflags=CREATE_NO_WINDOW |
|
180 |
) |
|
181 |
|
|
182 |
stdout, stderr = p.communicate() |
|
183 |
if len(stderr) != 0: |
|
184 |
raise RuntimeError('OdReadExMgd threw error:\n' + stderr.decode('utf-8')) |
|
185 |
|
|
186 |
"""parse line type""" |
|
187 |
autocad_xml_path = os.path.join(os.path.dirname(file), |
|
188 |
os.path.splitext(os.path.basename(file))[0] + '.xml') |
|
189 |
autocad_xml = parse(autocad_xml_path) |
|
190 |
autocad_xml_root = autocad_xml.getroot() |
|
191 |
for line_type_tbl_record in autocad_xml_root.iter('AcDbLinetypeTableRecord'): |
|
192 |
line_type_name = line_type_tbl_record.attrib['Name'] |
|
193 |
if line_type_name in self._line_types: |
|
194 |
continue |
|
195 |
|
|
196 |
self._line_types.append(line_type_tbl_record.attrib['Name']) |
|
197 |
"""up to here""" |
|
198 |
|
|
199 |
self._dwgs.append(file) |
|
200 |
except Exception as ex: |
|
201 |
from App import App |
|
202 |
from AppDocData import MessageType |
|
203 |
|
|
204 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
205 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
206 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
207 |
|
|
208 |
def on_save_line_type_mapping(self): |
|
209 |
"""save line type mapping""" |
|
210 |
from AppDocData import Config |
|
211 |
|
|
212 |
configs = [] |
|
213 |
|
|
214 |
model = self.ui.treeViewLineType.model() |
|
215 |
for row in range(model.rowCount()): |
|
216 |
parent_index = model.index(row, 0) |
|
217 |
id2_line_type = model.itemFromIndex(parent_index).text() |
|
218 |
|
|
219 |
autocad_line_types = [] |
|
220 |
child_count = model.rowCount(parent_index) |
|
221 |
for child_row in range(child_count): |
|
222 |
child_index = model.index(child_row, 1, parent_index) |
|
223 |
autocad_line_types.append(model.itemFromIndex(child_index).text()) |
|
224 |
|
|
225 |
if autocad_line_types: |
|
226 |
configs.append((Config('Line Type Mapping', id2_line_type, ','.join(autocad_line_types)))) |
|
227 |
|
|
228 |
app_doc_data = AppDocData.instance() |
|
229 |
app_doc_data.saveConfigs(configs) |
|
230 |
"""up to here""" |
|
231 |
|
|
232 |
def on_import_autocad(self): |
|
233 |
"""import line and text from autocad""" |
|
234 |
from AppDocData import Config |
|
235 |
import XmlGenerator as xg |
|
236 |
|
|
60 | 237 |
project = AppDocData.instance().getCurrentProject() |
61 |
xmlPaths = self.xmls |
|
62 |
dwgPaths = self.dwgs |
|
63 |
x_offset = self.ui.doubleSpinBoxX.value() |
|
64 |
y_offset = self.ui.doubleSpinBoxY.value() |
|
65 |
|
|
66 |
if len(xmlPaths) != len(dwgPaths): |
|
67 |
QMessageBox.Warning(self, self.tr('Warning'), self.tr('Please check files'), QMessageBox.Close) |
|
68 |
return |
|
69 |
|
|
70 |
for index in range(len(xmlPaths)): |
|
71 |
id2_xml_path = xmlPaths[index] |
|
72 |
dwgPath = dwgPaths[index] |
|
73 |
if os.path.exists(id2_xml_path) and os.path.exists(dwgPath): |
|
238 |
|
|
239 |
temp_path = project.getTempPath() |
|
240 |
id2_xml_files = [f for f in os.listdir(temp_path) if os.path.isfile(os.path.join(temp_path, f)) and |
|
241 |
(os.path.splitext(f)[1].upper() == '.XML')] |
|
242 |
|
|
243 |
for file in self._dwgs: |
|
244 |
file_name = os.path.splitext(os.path.basename(file))[0] |
|
245 |
autocad_xml_path = os.path.join(os.path.dirname(file), os.path.splitext(os.path.basename(file))[0] + '.xml') |
|
246 |
matches = [id2_xml_file for id2_xml_file in id2_xml_files if id2_xml_file.startswith(file_name)] |
|
247 |
if matches: |
|
74 | 248 |
try: |
75 |
executable = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'OdReadExMgd', |
|
76 |
'OdReadExMgd.exe') |
|
77 |
args = [executable, dwgPath, str(x_offset), str(y_offset), '1'] |
|
78 |
CREATE_NO_WINDOW = 0x08000000 |
|
79 |
p = subprocess.Popen( |
|
80 |
args, |
|
81 |
stdin=subprocess.PIPE, |
|
82 |
stdout=subprocess.PIPE, |
|
83 |
stderr=subprocess.PIPE, |
|
84 |
creationflags=CREATE_NO_WINDOW |
|
85 |
) |
|
86 |
|
|
87 |
stdout, stderr = p.communicate() |
|
88 |
if len(stderr) != 0: |
|
89 |
raise RuntimeError('OdReadExMgd threw error:\n' + stderr.decode('utf-8')) |
|
90 |
|
|
91 |
autocad_xml_path = os.path.join(os.path.join(project.getDrawingFilePath(), 'Native'), |
|
92 |
os.path.splitext(os.path.basename(dwgPath))[0] + '.xml') |
|
93 | 249 |
autocad_xml = parse(autocad_xml_path) |
250 |
id2_xml_path = os.path.join(temp_path, matches[0]) |
|
94 | 251 |
id2_xml = parse(id2_xml_path) |
95 | 252 |
autocad_xml_root = autocad_xml.getroot() |
96 | 253 |
id2_xml_root = id2_xml.getroot() |
... | ... | |
255 | 412 |
|
256 | 413 |
def lines_to_xml(self, line_node, id2_bbox, autocad_bbox): |
257 | 414 |
"""try to convert line element to id2 xml""" |
415 |
from LineTypeConditions import LineTypeConditions |
|
258 | 416 |
import uuid |
259 | 417 |
|
260 | 418 |
scale = max([id2_bbox[2] / autocad_bbox[2], id2_bbox[3] / autocad_bbox[3]]) |
... | ... | |
265 | 423 |
pts.append((float(vertex.attrib['X']) * scale + offsets[0], |
266 | 424 |
-float(vertex.attrib['Y']) * scale + offsets[1])) |
267 | 425 |
|
426 |
"""get id2 line type uid""" |
|
427 |
line_type, line_type_cond = line_node.attrib['Linetype'], None |
|
428 |
model = self.ui.treeViewLineType.model() |
|
429 |
for row in range(model.rowCount()): |
|
430 |
parent_index = model.index(row, 0) |
|
431 |
id2_line_type = model.itemFromIndex(parent_index).text() |
|
432 |
|
|
433 |
child_count = model.rowCount(parent_index) |
|
434 |
for child_row in range(child_count): |
|
435 |
child_index = model.index(child_row, 1, parent_index) |
|
436 |
autocad_line_type = model.itemFromIndex(child_index).text() |
|
437 |
if autocad_line_type == line_type: |
|
438 |
matches = [item for item in LineTypeConditions.items() if item.name == id2_line_type] |
|
439 |
if matches: |
|
440 |
line_type_cond = matches[0] |
|
441 |
break |
|
442 |
"""up to here""" |
|
443 |
|
|
268 | 444 |
for idx in range(len(pts) - 1): |
269 | 445 |
start, end = pts[idx], pts[idx + 1] |
270 | 446 |
"""create a element for id2""" |
... | ... | |
279 | 455 |
_node = SubElement(node, 'ENDPOINT') |
280 | 456 |
_node.text = f"{end[0]},{end[1]}" |
281 | 457 |
|
458 |
if line_type_cond: |
|
459 |
_node = SubElement(node, 'TYPE') |
|
460 |
_node.text = line_type_cond.name |
|
461 |
_node.attrib['TYPEUID'] = line_type_cond.uid |
|
462 |
|
|
282 | 463 |
_node = SubElement(node, 'AREA') |
283 | 464 |
_node.text = 'Drawing' |
284 | 465 |
|
DTI_PID/DTI_PID/ImportTextFromCAD_UI.py | ||
---|---|---|
13 | 13 |
class Ui_ImportTextFromCADDialog(object): |
14 | 14 |
def setupUi(self, ImportTextFromCADDialog): |
15 | 15 |
ImportTextFromCADDialog.setObjectName("ImportTextFromCADDialog") |
16 |
ImportTextFromCADDialog.resize(650, 143)
|
|
16 |
ImportTextFromCADDialog.resize(650, 470)
|
|
17 | 17 |
ImportTextFromCADDialog.setMinimumSize(QtCore.QSize(650, 79)) |
18 |
ImportTextFromCADDialog.setMaximumSize(QtCore.QSize(650, 200))
|
|
18 |
ImportTextFromCADDialog.setMaximumSize(QtCore.QSize(16777215, 650))
|
|
19 | 19 |
font = QtGui.QFont() |
20 | 20 |
font.setFamily("맑은 고딕") |
21 | 21 |
font.setBold(True) |
... | ... | |
25 | 25 |
self.verticalLayout.setObjectName("verticalLayout") |
26 | 26 |
self.gridLayout = QtWidgets.QGridLayout() |
27 | 27 |
self.gridLayout.setObjectName("gridLayout") |
28 |
self.toolButtonID2 = QtWidgets.QToolButton(ImportTextFromCADDialog) |
|
29 |
self.toolButtonID2.setText("") |
|
30 |
icon = QtGui.QIcon() |
|
31 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/File.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
32 |
self.toolButtonID2.setIcon(icon) |
|
33 |
self.toolButtonID2.setObjectName("toolButtonID2") |
|
34 |
self.gridLayout.addWidget(self.toolButtonID2, 0, 6, 1, 1) |
|
35 |
self.label = QtWidgets.QLabel(ImportTextFromCADDialog) |
|
36 |
self.label.setMinimumSize(QtCore.QSize(50, 0)) |
|
37 |
self.label.setObjectName("label") |
|
38 |
self.gridLayout.addWidget(self.label, 0, 0, 1, 1) |
|
39 |
self.label_2 = QtWidgets.QLabel(ImportTextFromCADDialog) |
|
40 |
self.label_2.setMinimumSize(QtCore.QSize(50, 0)) |
|
41 |
self.label_2.setObjectName("label_2") |
|
42 |
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) |
|
43 |
self.toolButtonCAD = QtWidgets.QToolButton(ImportTextFromCADDialog) |
|
44 |
self.toolButtonCAD.setText("") |
|
45 |
self.toolButtonCAD.setIcon(icon) |
|
46 |
self.toolButtonCAD.setObjectName("toolButtonCAD") |
|
47 |
self.gridLayout.addWidget(self.toolButtonCAD, 1, 6, 1, 1) |
|
48 |
self.lineEditCAD = QtWidgets.QLineEdit(ImportTextFromCADDialog) |
|
49 |
self.lineEditCAD.setObjectName("lineEditCAD") |
|
50 |
self.gridLayout.addWidget(self.lineEditCAD, 1, 1, 1, 5) |
|
51 |
self.pushButtonImport = QtWidgets.QPushButton(ImportTextFromCADDialog) |
|
52 |
icon1 = QtGui.QIcon() |
|
53 |
icon1.addPixmap(QtGui.QPixmap(":/newPrefix/OK.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
54 |
self.pushButtonImport.setIcon(icon1) |
|
55 |
self.pushButtonImport.setObjectName("pushButtonImport") |
|
56 |
self.gridLayout.addWidget(self.pushButtonImport, 4, 4, 1, 1) |
|
57 |
self.lineEditID2 = QtWidgets.QLineEdit(ImportTextFromCADDialog) |
|
58 |
self.lineEditID2.setObjectName("lineEditID2") |
|
59 |
self.gridLayout.addWidget(self.lineEditID2, 0, 1, 1, 5) |
|
60 |
self.pushButtonClose = QtWidgets.QPushButton(ImportTextFromCADDialog) |
|
61 |
icon2 = QtGui.QIcon() |
|
62 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Remove.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
63 |
self.pushButtonClose.setIcon(icon2) |
|
64 |
self.pushButtonClose.setObjectName("pushButtonClose") |
|
65 |
self.gridLayout.addWidget(self.pushButtonClose, 4, 5, 1, 1) |
|
66 | 28 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
67 | 29 |
self.horizontalLayout.setObjectName("horizontalLayout") |
68 | 30 |
self.label_3 = QtWidgets.QLabel(ImportTextFromCADDialog) |
... | ... | |
85 | 47 |
self.doubleSpinBoxY.setMaximum(100000.0) |
86 | 48 |
self.doubleSpinBoxY.setObjectName("doubleSpinBoxY") |
87 | 49 |
self.horizontalLayout.addWidget(self.doubleSpinBoxY) |
88 |
self.gridLayout.addLayout(self.horizontalLayout, 2, 1, 1, 5) |
|
50 |
self.gridLayout.addLayout(self.horizontalLayout, 3, 1, 1, 3) |
|
51 |
self.lineEditCAD = QtWidgets.QLineEdit(ImportTextFromCADDialog) |
|
52 |
self.lineEditCAD.setObjectName("lineEditCAD") |
|
53 |
self.gridLayout.addWidget(self.lineEditCAD, 0, 1, 1, 3) |
|
54 |
self.toolButtonCAD = QtWidgets.QToolButton(ImportTextFromCADDialog) |
|
55 |
self.toolButtonCAD.setText("") |
|
56 |
icon = QtGui.QIcon() |
|
57 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/File.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
58 |
self.toolButtonCAD.setIcon(icon) |
|
59 |
self.toolButtonCAD.setObjectName("toolButtonCAD") |
|
60 |
self.gridLayout.addWidget(self.toolButtonCAD, 0, 4, 1, 1) |
|
61 |
self.pushButtonImport = QtWidgets.QPushButton(ImportTextFromCADDialog) |
|
62 |
icon1 = QtGui.QIcon() |
|
63 |
icon1.addPixmap(QtGui.QPixmap(":/newPrefix/OK.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
64 |
self.pushButtonImport.setIcon(icon1) |
|
65 |
self.pushButtonImport.setObjectName("pushButtonImport") |
|
66 |
self.gridLayout.addWidget(self.pushButtonImport, 5, 2, 1, 1) |
|
67 |
self.label_2 = QtWidgets.QLabel(ImportTextFromCADDialog) |
|
68 |
self.label_2.setMinimumSize(QtCore.QSize(50, 0)) |
|
69 |
self.label_2.setObjectName("label_2") |
|
70 |
self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) |
|
71 |
self.pushButtonClose = QtWidgets.QPushButton(ImportTextFromCADDialog) |
|
72 |
icon2 = QtGui.QIcon() |
|
73 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Remove.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
74 |
self.pushButtonClose.setIcon(icon2) |
|
75 |
self.pushButtonClose.setObjectName("pushButtonClose") |
|
76 |
self.gridLayout.addWidget(self.pushButtonClose, 5, 3, 1, 1) |
|
77 |
self.pushButtonSave = QtWidgets.QPushButton(ImportTextFromCADDialog) |
|
78 |
icon3 = QtGui.QIcon() |
|
79 |
icon3.addPixmap(QtGui.QPixmap(":/newPrefix/Save.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
80 |
self.pushButtonSave.setIcon(icon3) |
|
81 |
self.pushButtonSave.setObjectName("pushButtonSave") |
|
82 |
self.gridLayout.addWidget(self.pushButtonSave, 2, 3, 1, 1) |
|
83 |
self.treeViewLineType = QtWidgets.QTreeView(ImportTextFromCADDialog) |
|
84 |
self.treeViewLineType.setObjectName("treeViewLineType") |
|
85 |
self.gridLayout.addWidget(self.treeViewLineType, 1, 1, 1, 3) |
|
89 | 86 |
self.verticalLayout.addLayout(self.gridLayout) |
90 | 87 |
self.errorLabel = QtWidgets.QLabel(ImportTextFromCADDialog) |
91 | 88 |
self.errorLabel.setMaximumSize(QtCore.QSize(16777215, 0)) |
... | ... | |
101 | 98 |
def retranslateUi(self, ImportTextFromCADDialog): |
102 | 99 |
_translate = QtCore.QCoreApplication.translate |
103 | 100 |
ImportTextFromCADDialog.setWindowTitle(_translate("ImportTextFromCADDialog", "Import Text From CAD")) |
104 |
self.label.setText(_translate("ImportTextFromCADDialog", "ID2 : ")) |
|
105 |
self.label_2.setText(_translate("ImportTextFromCADDialog", "CAD : ")) |
|
106 |
self.pushButtonImport.setText(_translate("ImportTextFromCADDialog", "Import")) |
|
107 |
self.pushButtonClose.setText(_translate("ImportTextFromCADDialog", "Close")) |
|
108 | 101 |
self.label_3.setText(_translate("ImportTextFromCADDialog", "X offset : ")) |
109 | 102 |
self.label_5.setText(_translate("ImportTextFromCADDialog", " Y offset : ")) |
103 |
self.pushButtonImport.setText(_translate("ImportTextFromCADDialog", "Import")) |
|
104 |
self.label_2.setText(_translate("ImportTextFromCADDialog", "AutoCAD Files : ")) |
|
105 |
self.pushButtonClose.setText(_translate("ImportTextFromCADDialog", "Close")) |
|
106 |
self.pushButtonSave.setText(_translate("ImportTextFromCADDialog", "Save")) |
|
110 | 107 |
import MainWindow_rc |
DTI_PID/DTI_PID/LineTypeConditions.py | ||
---|---|---|
3 | 3 |
|
4 | 4 |
import sys |
5 | 5 |
|
6 |
|
|
6 | 7 |
class LineTypeConditions: |
7 | 8 |
""" This is line type conditions class """ |
8 | 9 |
|
DTI_PID/DTI_PID/UI/ImportTextFromCAD.ui | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>650</width> |
10 |
<height>143</height>
|
|
10 |
<height>470</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="minimumSize"> |
... | ... | |
18 | 18 |
</property> |
19 | 19 |
<property name="maximumSize"> |
20 | 20 |
<size> |
21 |
<width>650</width>
|
|
22 |
<height>200</height>
|
|
21 |
<width>16777215</width>
|
|
22 |
<height>650</height>
|
|
23 | 23 |
</size> |
24 | 24 |
</property> |
25 | 25 |
<property name="font"> |
... | ... | |
35 | 35 |
<layout class="QVBoxLayout" name="verticalLayout"> |
36 | 36 |
<item> |
37 | 37 |
<layout class="QGridLayout" name="gridLayout"> |
38 |
<item row="0" column="6"> |
|
39 |
<widget class="QToolButton" name="toolButtonID2"> |
|
40 |
<property name="text"> |
|
41 |
<string/> |
|
42 |
</property> |
|
43 |
<property name="icon"> |
|
44 |
<iconset resource="../res/MainWindow.qrc"> |
|
45 |
<normaloff>:/newPrefix/File.svg</normaloff>:/newPrefix/File.svg</iconset> |
|
46 |
</property> |
|
47 |
</widget> |
|
48 |
</item> |
|
49 |
<item row="0" column="0"> |
|
50 |
<widget class="QLabel" name="label"> |
|
51 |
<property name="minimumSize"> |
|
52 |
<size> |
|
53 |
<width>50</width> |
|
54 |
<height>0</height> |
|
55 |
</size> |
|
56 |
</property> |
|
57 |
<property name="text"> |
|
58 |
<string>ID2 : </string> |
|
59 |
</property> |
|
60 |
</widget> |
|
61 |
</item> |
|
62 |
<item row="1" column="0"> |
|
63 |
<widget class="QLabel" name="label_2"> |
|
64 |
<property name="minimumSize"> |
|
65 |
<size> |
|
66 |
<width>50</width> |
|
67 |
<height>0</height> |
|
68 |
</size> |
|
69 |
</property> |
|
70 |
<property name="text"> |
|
71 |
<string>CAD : </string> |
|
72 |
</property> |
|
73 |
</widget> |
|
74 |
</item> |
|
75 |
<item row="1" column="6"> |
|
76 |
<widget class="QToolButton" name="toolButtonCAD"> |
|
77 |
<property name="text"> |
|
78 |
<string/> |
|
79 |
</property> |
|
80 |
<property name="icon"> |
|
81 |
<iconset resource="../res/MainWindow.qrc"> |
|
82 |
<normaloff>:/newPrefix/File.svg</normaloff>:/newPrefix/File.svg</iconset> |
|
83 |
</property> |
|
84 |
</widget> |
|
85 |
</item> |
|
86 |
<item row="1" column="1" colspan="5"> |
|
87 |
<widget class="QLineEdit" name="lineEditCAD"/> |
|
88 |
</item> |
|
89 |
<item row="4" column="4"> |
|
90 |
<widget class="QPushButton" name="pushButtonImport"> |
|
91 |
<property name="text"> |
|
92 |
<string>Import</string> |
|
93 |
</property> |
|
94 |
<property name="icon"> |
|
95 |
<iconset resource="../res/MainWindow.qrc"> |
|
96 |
<normaloff>:/newPrefix/OK.svg</normaloff>:/newPrefix/OK.svg</iconset> |
|
97 |
</property> |
|
98 |
</widget> |
|
99 |
</item> |
|
100 |
<item row="0" column="1" colspan="5"> |
|
101 |
<widget class="QLineEdit" name="lineEditID2"/> |
|
102 |
</item> |
|
103 |
<item row="4" column="5"> |
|
104 |
<widget class="QPushButton" name="pushButtonClose"> |
|
105 |
<property name="text"> |
|
106 |
<string>Close</string> |
|
107 |
</property> |
|
108 |
<property name="icon"> |
|
109 |
<iconset resource="../res/MainWindow.qrc"> |
|
110 |
<normaloff>:/newPrefix/Remove.svg</normaloff>:/newPrefix/Remove.svg</iconset> |
|
111 |
</property> |
|
112 |
</widget> |
|
113 |
</item> |
|
114 |
<item row="2" column="1" colspan="5"> |
|
38 |
<item row="3" column="1" colspan="3"> |
|
115 | 39 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
116 | 40 |
<item> |
117 | 41 |
<widget class="QLabel" name="label_3"> |
... | ... | |
167 | 91 |
</item> |
168 | 92 |
</layout> |
169 | 93 |
</item> |
94 |
<item row="0" column="1" colspan="3"> |
|
95 |
<widget class="QLineEdit" name="lineEditCAD"/> |
|
96 |
</item> |
|
97 |
<item row="0" column="4"> |
|
98 |
<widget class="QToolButton" name="toolButtonCAD"> |
|
99 |
<property name="text"> |
|
100 |
<string/> |
|
101 |
</property> |
|
102 |
<property name="icon"> |
|
103 |
<iconset resource="../res/MainWindow.qrc"> |
|
104 |
<normaloff>:/newPrefix/File.svg</normaloff>:/newPrefix/File.svg</iconset> |
|
105 |
</property> |
|
106 |
</widget> |
|
107 |
</item> |
|
108 |
<item row="5" column="2"> |
|
109 |
<widget class="QPushButton" name="pushButtonImport"> |
|
110 |
<property name="text"> |
|
111 |
<string>Import</string> |
|
112 |
</property> |
|
113 |
<property name="icon"> |
|
114 |
<iconset resource="../res/MainWindow.qrc"> |
|
115 |
<normaloff>:/newPrefix/OK.svg</normaloff>:/newPrefix/OK.svg</iconset> |
|
116 |
</property> |
|
117 |
</widget> |
|
118 |
</item> |
|
119 |
<item row="0" column="0"> |
|
120 |
<widget class="QLabel" name="label_2"> |
|
121 |
<property name="minimumSize"> |
|
122 |
<size> |
|
123 |
<width>50</width> |
|
124 |
<height>0</height> |
|
125 |
</size> |
|
126 |
</property> |
|
127 |
<property name="text"> |
|
128 |
<string>AutoCAD Files : </string> |
|
129 |
</property> |
|
130 |
</widget> |
|
131 |
</item> |
|
132 |
<item row="5" column="3"> |
|
133 |
<widget class="QPushButton" name="pushButtonClose"> |
|
134 |
<property name="text"> |
|
135 |
<string>Close</string> |
|
136 |
</property> |
|
137 |
<property name="icon"> |
|
138 |
<iconset resource="../res/MainWindow.qrc"> |
|
139 |
<normaloff>:/newPrefix/Remove.svg</normaloff>:/newPrefix/Remove.svg</iconset> |
|
140 |
</property> |
|
141 |
</widget> |
|
142 |
</item> |
|
143 |
<item row="2" column="3"> |
|
144 |
<widget class="QPushButton" name="pushButtonSave"> |
|
145 |
<property name="text"> |
|
146 |
<string>Save</string> |
|
147 |
</property> |
|
148 |
<property name="icon"> |
|
149 |
<iconset resource="../res/MainWindow.qrc"> |
|
150 |
<normaloff>:/newPrefix/Save.svg</normaloff>:/newPrefix/Save.svg</iconset> |
|
151 |
</property> |
|
152 |
</widget> |
|
153 |
</item> |
|
154 |
<item row="1" column="1" colspan="3"> |
|
155 |
<widget class="QTreeView" name="treeViewLineType"/> |
|
156 |
</item> |
|
170 | 157 |
</layout> |
171 | 158 |
</item> |
172 | 159 |
<item> |
DTI_PID/DTI_PID/coffee.qss | ||
---|---|---|
154 | 154 |
border: transparent; |
155 | 155 |
background: transparent; |
156 | 156 |
} |
157 |
QTreeView::branch:has-siblings:!adjoins-item { |
|
158 |
border-image: url(:/images/vline.png) 0; |
|
157 |
|
|
158 |
QTreeView::branch:has-siblings:!adjoins-item |
|
159 |
{ |
|
160 |
border-image: url(:/newPrefix/vline.png) 0; |
|
159 | 161 |
} |
160 |
QTreeView::branch:has-siblings:adjoins-item { |
|
161 |
border-image: url(:/images/branch-more.png) 0; |
|
162 |
|
|
163 |
QTreeView::branch:has-siblings:adjoins-item |
|
164 |
{ |
|
165 |
border-image: url(:/newPrefix/branch-more.png) 0; |
|
162 | 166 |
} |
163 |
QTreeView::branch:!has-children:!has-siblings:adjoins-item { |
|
164 |
border-image: url(:/images/branch-end.png) 0; |
|
167 |
|
|
168 |
QTreeView::branch:!has-children:!has-siblings:adjoins-item |
|
169 |
{ |
|
170 |
border-image: url(:/newPrefix/branch-end.png) 0; |
|
165 | 171 |
} |
166 |
QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings { |
|
167 |
border-image:none;image:url(:/images/branch-closed.png); |
|
172 |
|
|
173 |
QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings |
|
174 |
{ |
|
175 |
border-image:none;image:url(:/newPrefix/branch-closed.png); |
|
168 | 176 |
} |
169 |
QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings{ |
|
170 |
border-image:none;image:url(:/images/branch-open.png); |
|
177 |
|
|
178 |
QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings |
|
179 |
{ |
|
180 |
border-image:none;image:url(:/newPrefix/branch-open.png); |
|
171 | 181 |
} |
DTI_PID/DTI_PID/pagefold.qss | ||
---|---|---|
154 | 154 |
background: transparent; |
155 | 155 |
} |
156 | 156 |
|
157 |
QTreeWidget::branch:has-siblings:!adjoins-item { |
|
158 |
border-image: url(:/images/vline.png) 0; |
|
157 |
QTreeView::branch:has-siblings:!adjoins-item |
|
158 |
{ |
|
159 |
border-image: url(:/newPrefix/vline.png) 0; |
|
159 | 160 |
} |
160 |
QTreeWidget::branch:has-siblings:adjoins-item { |
|
161 |
border-image: url(:/images/branch-more.png) 0; |
|
161 |
|
|
162 |
QTreeView::branch:has-siblings:adjoins-item |
|
163 |
{ |
|
164 |
border-image: url(:/newPrefix/branch-more.png) 0; |
|
162 | 165 |
} |
163 |
QTreeWidget::branch:!has-children:!has-siblings:adjoins-item { |
|
164 |
border-image: url(:/images/branch-end.png) 0; |
|
166 |
|
|
167 |
QTreeView::branch:!has-children:!has-siblings:adjoins-item |
|
168 |
{ |
|
169 |
border-image: url(:/newPrefix/branch-end.png) 0; |
|
165 | 170 |
} |
166 |
QTreeWidget::branch:has-children:!has-siblings:closed,QTreeWidget::branch:closed:has-children:has-siblings { |
|
167 |
border-image:none;image:url(:/images/branch-closed.png); |
|
171 |
|
|
172 |
QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings |
|
173 |
{ |
|
174 |
border-image:none;image:url(:/newPrefix/branch-closed.png); |
|
168 | 175 |
} |
169 |
QTreeWidget::branch:open:has-children:!has-siblings,QTreeWidget::branch:open:has-children:has-siblings{ |
|
170 |
border-image:none;image:url(:/images/branch-open.png); |
|
176 |
|
|
177 |
QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings |
|
178 |
{ |
|
179 |
border-image:none;image:url(:/newPrefix/branch-open.png); |
|
171 | 180 |
} |
내보내기 Unified diff