개정판 d8ad8a2c
dev issue #646: 등록된 심볼 뷰 추가
DTI_PID/DTI_PID/DetectSymbolDialog.py | ||
---|---|---|
55 | 55 |
self.table.cellDoubleClicked.connect(self.cellDoubleClickedEvent) |
56 | 56 |
self.table.currentCellChanged.connect(self.currentCellChangedEvent) |
57 | 57 |
|
58 |
self.setAllSymbolsTable() |
|
59 |
|
|
58 | 60 |
''' |
59 | 61 |
@brief current cell chage event |
60 | 62 |
@author kyouho |
... | ... | |
79 | 81 |
if cell is not None: |
80 | 82 |
import SymbolEditorDialog |
81 | 83 |
symbolEditorDialog = SymbolEditorDialog.QSymbolEditorDialog(self, cell.pixmap(), AppDocData.instance().getCurrentProject()) |
82 |
symbolEditorDialog.showDialog() |
|
83 |
self.parent.dirTreeWidget.initDirTreeWidget() |
|
84 |
(isAccepted, isImmediateInsert, offsetX, offsetY, newSym) = symbolEditorDialog.showDialog() |
|
85 |
if isAccepted: |
|
86 |
self.table.removeCellWidget(row, column) |
|
87 |
self.parent.dirTreeWidget.initDirTreeWidget() |
|
84 | 88 |
|
85 | 89 |
''' |
86 | 90 |
@brief text changed Event |
... | ... | |
91 | 95 |
self.imageName = text |
92 | 96 |
self.imgPath = self.drawingDir + self.ui.listWidgetDrawings.currentItem().data(32) |
93 | 97 |
self.tableSetting() |
98 |
|
|
99 |
''' |
|
100 |
@brief text changed Event |
|
101 |
@author kyouho |
|
102 |
@date 2018.10.11 |
|
103 |
''' |
|
104 |
def setAllSymbolsTable(self): |
|
105 |
table = self.ui.tableWidgetAllSymbols |
|
106 |
table.setRowCount(0) |
|
107 |
|
|
108 |
imageFiles = [] |
|
109 |
imageDir = AppDocData.instance().getCurrentProject().path + '/image/' |
|
110 |
self.findFiles(imageDir, imageFiles) |
|
111 |
|
|
112 |
table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch) |
|
113 |
size = table.maximumWidth() - 40 |
|
114 |
|
|
115 |
table.setRowCount(len(imageFiles)) |
|
116 |
row = 0 |
|
117 |
for path in imageFiles: |
|
118 |
cell = QLabel() |
|
119 |
pixmap = QPixmap(path) |
|
120 |
cell.setPixmap(pixmap.scaled(size, size, Qt.KeepAspectRatio)) |
|
121 |
table.setCellWidget(row, 0, cell) |
|
122 |
row = row + 1 |
|
123 |
|
|
124 |
table.resizeRowsToContents() |
|
125 |
|
|
126 |
''' |
|
127 |
@brief find image files |
|
128 |
@author kyouho |
|
129 |
@date 2018.10.11 |
|
130 |
''' |
|
131 |
def findFiles(self, dir, list): |
|
132 |
fileList = os.listdir(dir) |
|
133 |
for file in fileList: |
|
134 |
path = os.path.join(dir, file) |
|
135 |
if os.path.isdir(path): |
|
136 |
self.findFiles(path, list) |
|
137 |
elif os.path.splitext(path)[1] == '.png': |
|
138 |
list.append(path) |
|
139 |
|
|
140 |
|
|
94 | 141 |
|
95 | 142 |
''' |
96 | 143 |
@brief text changed Event |
DTI_PID/DTI_PID/DetectSymbol_UI.py | ||
---|---|---|
29 | 29 |
self.gridLayout_2.addLayout(self.formLayout, 0, 0, 1, 1) |
30 | 30 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
31 | 31 |
self.horizontalLayout.setObjectName("horizontalLayout") |
32 |
self.verticalLayout = QtWidgets.QVBoxLayout() |
|
33 |
self.verticalLayout.setObjectName("verticalLayout") |
|
32 | 34 |
self.listWidgetDrawings = QtWidgets.QListWidget(DetectSymbolDialog) |
35 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) |
|
36 |
sizePolicy.setHorizontalStretch(0) |
|
37 |
sizePolicy.setVerticalStretch(0) |
|
38 |
sizePolicy.setHeightForWidth(self.listWidgetDrawings.sizePolicy().hasHeightForWidth()) |
|
39 |
self.listWidgetDrawings.setSizePolicy(sizePolicy) |
|
33 | 40 |
self.listWidgetDrawings.setMaximumSize(QtCore.QSize(250, 16777215)) |
34 | 41 |
self.listWidgetDrawings.setObjectName("listWidgetDrawings") |
35 |
self.horizontalLayout.addWidget(self.listWidgetDrawings) |
|
42 |
self.verticalLayout.addWidget(self.listWidgetDrawings) |
|
43 |
self.tableWidgetAllSymbols = QtWidgets.QTableWidget(DetectSymbolDialog) |
|
44 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) |
|
45 |
sizePolicy.setHorizontalStretch(0) |
|
46 |
sizePolicy.setVerticalStretch(0) |
|
47 |
sizePolicy.setHeightForWidth(self.tableWidgetAllSymbols.sizePolicy().hasHeightForWidth()) |
|
48 |
self.tableWidgetAllSymbols.setSizePolicy(sizePolicy) |
|
49 |
self.tableWidgetAllSymbols.setMaximumSize(QtCore.QSize(250, 16777215)) |
|
50 |
self.tableWidgetAllSymbols.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) |
|
51 |
self.tableWidgetAllSymbols.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) |
|
52 |
self.tableWidgetAllSymbols.setColumnCount(1) |
|
53 |
self.tableWidgetAllSymbols.setObjectName("tableWidgetAllSymbols") |
|
54 |
self.tableWidgetAllSymbols.setRowCount(0) |
|
55 |
self.tableWidgetAllSymbols.horizontalHeader().setVisible(False) |
|
56 |
self.tableWidgetAllSymbols.verticalHeader().setVisible(False) |
|
57 |
self.verticalLayout.addWidget(self.tableWidgetAllSymbols) |
|
58 |
self.horizontalLayout.addLayout(self.verticalLayout) |
|
36 | 59 |
self.tableWidgetSymbol = QtWidgets.QTableWidget(DetectSymbolDialog) |
37 | 60 |
self.tableWidgetSymbol.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) |
38 | 61 |
self.tableWidgetSymbol.setAlternatingRowColors(False) |
39 | 62 |
self.tableWidgetSymbol.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) |
63 |
self.tableWidgetSymbol.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) |
|
64 |
self.tableWidgetSymbol.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) |
|
40 | 65 |
self.tableWidgetSymbol.setShowGrid(False) |
41 | 66 |
self.tableWidgetSymbol.setGridStyle(QtCore.Qt.NoPen) |
42 | 67 |
self.tableWidgetSymbol.setRowCount(0) |
DTI_PID/DTI_PID/UI/DetectSymbol.ui | ||
---|---|---|
40 | 40 |
<item row="1" column="0"> |
41 | 41 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
42 | 42 |
<item> |
43 |
<widget class="QListWidget" name="listWidgetDrawings"> |
|
44 |
<property name="maximumSize"> |
|
45 |
<size> |
|
46 |
<width>250</width> |
|
47 |
<height>16777215</height> |
|
48 |
</size> |
|
49 |
</property> |
|
50 |
</widget> |
|
43 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
44 |
<item> |
|
45 |
<widget class="QListWidget" name="listWidgetDrawings"> |
|
46 |
<property name="sizePolicy"> |
|
47 |
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|
48 |
<horstretch>0</horstretch> |
|
49 |
<verstretch>0</verstretch> |
|
50 |
</sizepolicy> |
|
51 |
</property> |
|
52 |
<property name="maximumSize"> |
|
53 |
<size> |
|
54 |
<width>250</width> |
|
55 |
<height>16777215</height> |
|
56 |
</size> |
|
57 |
</property> |
|
58 |
</widget> |
|
59 |
</item> |
|
60 |
<item> |
|
61 |
<widget class="QTableWidget" name="tableWidgetAllSymbols"> |
|
62 |
<property name="sizePolicy"> |
|
63 |
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|
64 |
<horstretch>0</horstretch> |
|
65 |
<verstretch>0</verstretch> |
|
66 |
</sizepolicy> |
|
67 |
</property> |
|
68 |
<property name="maximumSize"> |
|
69 |
<size> |
|
70 |
<width>250</width> |
|
71 |
<height>16777215</height> |
|
72 |
</size> |
|
73 |
</property> |
|
74 |
<property name="editTriggers"> |
|
75 |
<set>QAbstractItemView::NoEditTriggers</set> |
|
76 |
</property> |
|
77 |
<property name="selectionMode"> |
|
78 |
<enum>QAbstractItemView::NoSelection</enum> |
|
79 |
</property> |
|
80 |
<property name="columnCount"> |
|
81 |
<number>1</number> |
|
82 |
</property> |
|
83 |
<attribute name="horizontalHeaderVisible"> |
|
84 |
<bool>false</bool> |
|
85 |
</attribute> |
|
86 |
<attribute name="verticalHeaderVisible"> |
|
87 |
<bool>false</bool> |
|
88 |
</attribute> |
|
89 |
<column/> |
|
90 |
</widget> |
|
91 |
</item> |
|
92 |
</layout> |
|
51 | 93 |
</item> |
52 | 94 |
<item> |
53 | 95 |
<widget class="QTableWidget" name="tableWidgetSymbol"> |
... | ... | |
60 | 102 |
<property name="selectionMode"> |
61 | 103 |
<enum>QAbstractItemView::SingleSelection</enum> |
62 | 104 |
</property> |
105 |
<property name="verticalScrollMode"> |
|
106 |
<enum>QAbstractItemView::ScrollPerPixel</enum> |
|
107 |
</property> |
|
108 |
<property name="horizontalScrollMode"> |
|
109 |
<enum>QAbstractItemView::ScrollPerPixel</enum> |
|
110 |
</property> |
|
63 | 111 |
<property name="showGrid"> |
64 | 112 |
<bool>false</bool> |
65 | 113 |
</property> |
내보내기 Unified diff