개정판 f718c362
add symbol batch delete safe step
Change-Id: Icc5c12145823769ebb0b469cec4eb32d20ea5ac8
DTI_PID/DTI_PID/SymbolTreeWidget.py | ||
---|---|---|
163 | 163 |
|
164 | 164 |
def handleDeleteSymbolBatchAction(self, result, item): |
165 | 165 |
if result == QMessageBox.Ok: |
166 |
app_doc_data = AppDocData.instance() |
|
167 |
project = app_doc_data.getCurrentProject() |
|
166 |
text, result = QInputDialog.getText(self, self.tr('Delete symbols'), self.tr('To proceed, enter "Confirm" in the input box below.')) |
|
167 |
|
|
168 |
if result and text == 'Confirm': |
|
169 |
app_doc_data = AppDocData.instance() |
|
170 |
project = app_doc_data.getCurrentProject() |
|
168 | 171 |
|
169 |
data = item.data(self.TREE_DATA_ROLE) |
|
170 |
itemType = data[2] |
|
171 |
|
|
172 |
unusedSymbols = app_doc_data.getSymbolNameListByUnused() |
|
173 |
unusedUIDs = [symbol[0] for symbol in unusedSymbols] |
|
174 |
categorySymbols = app_doc_data.getSymbolListByType('type', itemType) |
|
175 |
itemNames = [symbol.sName for symbol in categorySymbols if symbol.uid in unusedUIDs] |
|
176 |
|
|
177 |
for itemName in itemNames: |
|
178 |
res, _ = app_doc_data.deleteSymbol(itemName) |
|
179 |
if res: |
|
180 |
imagePath = os.path.join(project.getImageFilePath(), itemType, |
|
181 |
itemName + '.png') # itemName DOESN'T includes ".png" |
|
182 |
imageDisplayPath = os.path.join(project.getImageFilePath(), itemType, |
|
183 |
itemName + '_display' + '.png') # itemName DOESN'T includes ".png" |
|
184 |
if os.path.exists(imagePath): |
|
185 |
os.remove(imagePath) |
|
186 |
if os.path.exists(imageDisplayPath): |
|
187 |
os.remove(imageDisplayPath) |
|
188 |
|
|
189 |
svgPath = os.path.join(project.getSvgFilePath(), itemType, itemName + '.svg') |
|
190 |
if os.path.exists(svgPath): |
|
191 |
os.remove(svgPath) |
|
192 |
else: |
|
193 |
pass |
|
194 |
|
|
195 |
self.initSymbolTreeView() |
|
172 |
data = item.data(self.TREE_DATA_ROLE)
|
|
173 |
itemType = data[2]
|
|
174 |
|
|
175 |
unusedSymbols = app_doc_data.getSymbolNameListByUnused()
|
|
176 |
unusedUIDs = [symbol[0] for symbol in unusedSymbols]
|
|
177 |
categorySymbols = app_doc_data.getSymbolListByType('type', itemType)
|
|
178 |
itemNames = [symbol.sName for symbol in categorySymbols if symbol.uid in unusedUIDs]
|
|
179 |
|
|
180 |
for itemName in itemNames:
|
|
181 |
res, _ = app_doc_data.deleteSymbol(itemName)
|
|
182 |
if res:
|
|
183 |
imagePath = os.path.join(project.getImageFilePath(), itemType,
|
|
184 |
itemName + '.png') # itemName DOESN'T includes ".png"
|
|
185 |
imageDisplayPath = os.path.join(project.getImageFilePath(), itemType,
|
|
186 |
itemName + '_display' + '.png') # itemName DOESN'T includes ".png"
|
|
187 |
if os.path.exists(imagePath):
|
|
188 |
os.remove(imagePath)
|
|
189 |
if os.path.exists(imageDisplayPath):
|
|
190 |
os.remove(imageDisplayPath)
|
|
191 |
|
|
192 |
svgPath = os.path.join(project.getSvgFilePath(), itemType, itemName + '.svg')
|
|
193 |
if os.path.exists(svgPath):
|
|
194 |
os.remove(svgPath)
|
|
195 |
else:
|
|
196 |
pass
|
|
197 |
|
|
198 |
self.initSymbolTreeView()
|
|
196 | 199 |
|
197 | 200 |
|
198 | 201 |
def onEditAttrClicked(self, item, columnNo): |
내보내기 Unified diff