개정판 f426b39d
add line no duplication search
Change-Id: I97ad31ab3b1ea9082224e2725065652118ff27e4
DTI_PID/DTI_PID/Commands/HighlightCommand.py | ||
---|---|---|
174 | 174 |
if items: |
175 | 175 |
param = items[0] |
176 | 176 |
else: |
177 |
return
|
|
177 |
continue
|
|
178 | 178 |
|
179 | 179 |
if type(param) is QEngineeringRunItem: |
180 | 180 |
rect = None |
... | ... | |
196 | 196 |
for item in param.items: |
197 | 197 |
item.setSelected(True) |
198 | 198 |
item.update() |
199 |
elif type(param) is list and type(param[0]) is QEngineeringNoteItem:
|
|
199 |
elif type(param) is list: |
|
200 | 200 |
rect = None |
201 | 201 |
for item in param: |
202 |
_rect = item.symbol.sceneBoundingRect() if item.symbol else item.sceneBoundingRect()
|
|
202 |
_rect = item.sceneBoundingRect() |
|
203 | 203 |
rect = _rect if rect is None else rect.united(_rect) |
204 | 204 |
|
205 | 205 |
if rect is not None: |
... | ... | |
214 | 214 |
bottomRight.y() - topLeft.y())) |
215 | 215 |
|
216 | 216 |
for item in param: |
217 |
if item.symbol: |
|
218 |
item.symbol.setSelected(True) |
|
219 |
item.symbol.update() |
|
220 |
else: |
|
221 |
item.setSelected(True) |
|
222 |
item.update() |
|
217 |
item.setSelected(True) |
|
218 |
item.update() |
|
223 | 219 |
else: |
224 | 220 |
rect = param.sceneBoundingRect() |
225 | 221 |
self.imageViewer.centerOn(rect.center()) |
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
12 | 12 |
from SymbolSvgItem import SymbolSvgItem |
13 | 13 |
from EngineeringLineItem import QEngineeringLineItem |
14 | 14 |
from EngineeringVendorItem import QEngineeringVendorItem |
15 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
15 | 16 |
|
16 | 17 |
|
17 | 18 |
class QTextItemEditDialog(QDialog): |
... | ... | |
301 | 302 |
if hasattr(item, 'uid') and (str(item.uid).upper().count(text.upper()) if not self.ui.checkBoxMatch.isChecked() else str(item.uid).upper() == text.upper())] |
302 | 303 |
else: |
303 | 304 |
if not self.ui.checkBoxSymbol.isChecked(): |
304 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
|
305 |
if text.upper() == 'LINE NO': |
|
306 |
line_nos = [item for item in self.mainWindow.graphicsView.scene().items() if type(item) is QEngineeringLineNoTextItem] |
|
307 |
duplication = {} |
|
308 |
for line_no1 in line_nos: |
|
309 |
for line_no2 in line_nos: |
|
310 |
if line_no1 == line_no2: |
|
311 |
continue |
|
312 |
elif line_no1.text() == line_no2.text() : |
|
313 |
if line_no1.text() not in duplication: |
|
314 |
duplication[line_no1.text()] = [line_no1, line_no2] |
|
315 |
else: |
|
316 |
if line_no1 not in duplication[line_no1.text()]: |
|
317 |
duplication[line_no1.text()].append(line_no1) |
|
318 |
if line_no2 not in duplication[line_no1.text()]: |
|
319 |
duplication[line_no1.text()].append(line_no2) |
|
320 |
text_items = list(duplication.values()) |
|
321 |
else: |
|
322 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
|
305 | 323 |
if issubclass(type(item), QEngineeringTextItem) and (item.text().upper().count(text.upper()) if not self.ui.checkBoxMatch.isChecked() else item.text().upper() == text.upper())] |
306 | 324 |
else: |
307 | 325 |
if text.upper() == 'PACKAGE': |
... | ... | |
320 | 338 |
model = QStandardItemModel(len(text_items), 1) |
321 | 339 |
model.setHorizontalHeaderLabels(['UID']) |
322 | 340 |
for row in range(len(text_items)): |
323 |
item = QStandardItem(str(text_items[row])) |
|
341 |
item = QStandardItem(text_items[row][0].text()) if type(text_items[row]) is list else QStandardItem(str(text_items[row]))
|
|
324 | 342 |
item.setData(text_items[row]) |
325 | 343 |
model.setItem(row, 0, item) |
326 | 344 |
item.setEditable(False) |
... | ... | |
369 | 387 |
def selectTextItem(self, item): |
370 | 388 |
from HighlightCommand import HighlightCommand |
371 | 389 |
|
372 |
if item not in self.mainWindow.graphicsView.scene().items(): |
|
390 |
if type(item) is not list and item not in self.mainWindow.graphicsView.scene().items():
|
|
373 | 391 |
return |
374 | 392 |
|
375 |
HighlightCommand(self.mainWindow.graphicsView).execute(item) |
|
393 |
if type(item) is not list: |
|
394 |
HighlightCommand(self.mainWindow.graphicsView).execute(item) |
|
395 |
item.setSelected(True) |
|
396 |
else: |
|
397 |
HighlightCommand(self.mainWindow.graphicsView).executeForPSN([item]) |
|
376 | 398 |
#rect = item.sceneBoundingRect() |
377 | 399 |
#self.mainWindow.graphicsView.centerOn(rect.center()) |
378 | 400 |
#self.mainWindow.graphicsView.zoomImage(True, QMouseEvent(QEvent.MouseButtonPress, |
379 | 401 |
# self.mainWindow.graphicsView.mapFromScene( |
380 | 402 |
# QPointF(rect.left(), rect.top())), Qt.LeftButton, |
381 | 403 |
# Qt.LeftButton, Qt.NoModifier), 3) |
382 |
item.setSelected(True) |
|
383 | 404 |
|
384 | 405 |
def replaceTextItem(self, item): |
385 | 406 |
pass |
내보내기 Unified diff