개정판 d9478fca
SymbolTreeWidget 수정
1. TreeView display 변경
기존 : Type-> symbol
변경 : Category -> Type -> symbol
2. 심벌 편집시 viewer에 png가 아닌 svg 파일 load
Change-Id: Ifa81cd839e1224969b7473021477e73fcd87830d
HYTOS/HYTOS/SymbolTreeWidget.py | ||
---|---|---|
148 | 148 |
humkyung 2018.07.30 sort child items |
149 | 149 |
''' |
150 | 150 |
def loadSymbolInfo(self): |
151 |
|
|
151 | 152 |
try: |
152 |
symbolTypeList = AppDocData.instance().getSymbolTypeList() |
|
153 |
for symbolType in symbolTypeList: |
|
154 |
parent = QTreeWidgetItem(self, [symbolType[2]]) |
|
155 |
parent.setData(0, self.TREE_DATA_ROLE, symbolType) |
|
156 |
symbolList = AppDocData.instance().getSymbolListByType('type', symbolType[2]) |
|
157 |
for symbol in symbolList: |
|
158 |
symbolItem = QTreeWidgetItem(parent, [symbol.getName()]) |
|
159 |
symbolItem.setData(0, self.TREE_DATA_ROLE, symbol) |
|
160 |
svgPath = symbol.getSvgFileFullPath() |
|
161 |
icon = QIcon(svgPath) |
|
162 |
symbolItem.setIcon(0, icon) |
|
163 |
symbolItem.svgFilePath = svgPath # save svg file path |
|
153 |
symbolCategoryList = AppDocData.instance().getSymbolCategoryList() |
|
154 |
for symbolCategory in symbolCategoryList: |
|
155 |
parent = QTreeWidgetItem(self, [symbolCategory]) |
|
156 |
parent.setData(0, self.TREE_DATA_ROLE, symbolCategory) |
|
164 | 157 |
|
165 |
parent.sortChildren(0, Qt.AscendingOrder) |
|
158 |
|
|
159 |
|
|
160 |
symbolTypeList = AppDocData.instance().getSymbolTypeListByCategory(symbolCategory) |
|
161 |
for symbolType in symbolTypeList: |
|
162 |
category = QTreeWidgetItem(parent, [symbolType[1]]) |
|
163 |
category.setData(0, self.TREE_DATA_ROLE, symbolType) |
|
164 |
symbolList = AppDocData.instance().getSymbolListByType('type', symbolType[1]) |
|
165 |
for symbol in symbolList: |
|
166 |
symbolItem = QTreeWidgetItem(category, [symbol.getName()]) |
|
167 |
symbolItem.setData(0, self.TREE_DATA_ROLE, symbol) |
|
168 |
svgPath = symbol.getSvgFileFullPath() |
|
169 |
icon = QIcon(svgPath) |
|
170 |
symbolItem.setIcon(0, icon) |
|
171 |
symbolItem.svgFilePath = svgPath # save svg file path |
|
172 |
|
|
173 |
parent.sortChildren(0, Qt.AscendingOrder) |
|
166 | 174 |
except Exception as ex: |
167 | 175 |
from App import App |
168 | 176 |
|
... | ... | |
193 | 201 |
if not os.path.exists(tempDir): |
194 | 202 |
os.makedirs(tempDir) |
195 | 203 |
|
204 |
''' |
|
205 |
@history 2019.07.11 yeonjin 심벌 편집 시 png 파일이 아닌 svg 파일을 불러 오도록 수정 |
|
206 |
|
|
207 |
''' |
|
196 | 208 |
def showSymbolEditorDialog(self, item, columnNo): |
197 | 209 |
try: |
198 | 210 |
sym = self.getSymbolByItemName(item, columnNo) |
199 | 211 |
if sym is not None: |
200 |
path = sym.getPath() |
|
201 |
image = QImage(path, "PNG") |
|
212 |
#path = sym.getPath() |
|
213 |
#image = QImage(path, "PNG") |
|
214 |
path = sym.getSvgFileFullPath() |
|
215 |
image = QImage(path, "SVG") |
|
202 | 216 |
symbolEditorDialog = SymbolEditorDialog.QSymbolEditorDialog(self, image, AppDocData.instance().getCurrentProject(), sym) |
203 | 217 |
(isAccepted, isImmediateInsert, offsetX, offsetY, newSym) = symbolEditorDialog.showDialog() |
204 | 218 |
self.initDirTreeWidget() |
내보내기 Unified diff