개정판 936bbf2b
issue #501: bug fix and separate adding part
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1268 | 1268 |
QApplication.processEvents() |
1269 | 1269 |
self.drawDetectedTitleBlockTextItem(titleBlockTextInfoList) |
1270 | 1270 |
|
1271 |
self.drawDetectedItemsToSecene() |
|
1272 |
|
|
1271 | 1273 |
self.dbUpdate() |
1272 | 1274 |
self.saveToXml(False) |
1273 | 1275 |
|
... | ... | |
1277 | 1279 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
1278 | 1280 |
self.addMessage.emit(MessageType.Error, message) |
1279 | 1281 |
|
1282 |
def drawDetectedItemsToSecene(self): |
|
1283 |
''' |
|
1284 |
@brief add detected items to scene |
|
1285 |
@author euisung |
|
1286 |
@date 2018.11.26 |
|
1287 |
''' |
|
1288 |
appDocData = AppDocData.instance() |
|
1289 |
|
|
1290 |
for symbol in appDocData.symbols: |
|
1291 |
if issubclass(type(symbol), SymbolSvgItem): |
|
1292 |
self.addSvgItemToScene(symbol) |
|
1293 |
else: |
|
1294 |
self.graphicsView.scene.addItem(symbol) |
|
1295 |
|
|
1296 |
for text in appDocData.texts: |
|
1297 |
self.addTextItemToScene(text) |
|
1298 |
|
|
1280 | 1299 |
def postDetectLineProcess(self): |
1281 | 1300 |
''' |
1282 | 1301 |
@brief check allowables among undetected items |
... | ... | |
1346 | 1365 |
item.size = (width, height) |
1347 | 1366 |
item.angle = angle |
1348 | 1367 |
item.area = textInfo[0] |
1349 |
self.addTextItemToScene(item) |
|
1368 |
#self.addTextItemToScene(item)
|
|
1350 | 1369 |
appDocData.texts.append(item) |
1351 | 1370 |
except Exception as ex: |
1352 | 1371 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
... | ... | |
1383 | 1402 |
import math |
1384 | 1403 |
|
1385 | 1404 |
try: |
1386 |
project = AppDocData.instance().getCurrentProject() |
|
1405 |
appDocData = AppDocData.instance() |
|
1406 |
project = appDocData.getCurrentProject() |
|
1387 | 1407 |
|
1388 | 1408 |
searchedMap = [] |
1389 | 1409 |
for symbol in symbolList: |
... | ... | |
1418 | 1438 |
# up to here |
1419 | 1439 |
|
1420 | 1440 |
svg.transfer.onRemoved.connect(self.itemRemoved) |
1421 |
self.addSvgItemToScene(svg) |
|
1441 |
#self.addSvgItemToScene(svg) |
|
1442 |
appDocData.symbols.append(svg) |
|
1422 | 1443 |
else: |
1423 | 1444 |
item = QGraphicsBoundingBoxItem(pt[0], pt[1], size[0], size[1]) |
1424 | 1445 |
item.isSymbol = True |
1425 | 1446 |
item.angle = angle |
1426 | 1447 |
item.setPen(QPen(Qt.red, 5, Qt.SolidLine)) |
1427 |
self.graphicsView.scene.addItem(item) |
|
1448 |
#self.graphicsView.scene.addItem(item) |
|
1449 |
appDocData.symbols.append(item) |
|
1428 | 1450 |
# up to here |
1429 | 1451 |
except Exception as ex: |
1430 | 1452 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
... | ... | |
1458 | 1480 |
item.angle = angle |
1459 | 1481 |
item.area = 'Drawing' |
1460 | 1482 |
item.transfer.onRemoved.connect(self.itemRemoved) |
1461 |
self.addTextItemToScene(item) |
|
1483 |
#self.addTextItemToScene(item)
|
|
1462 | 1484 |
appDocData.texts.append(item) |
1463 | 1485 |
except Exception as ex: |
1464 | 1486 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
... | ... | |
1493 | 1515 |
item.size = (width, height) |
1494 | 1516 |
item.angle = angle |
1495 | 1517 |
item.area = textInfoMap[0] |
1496 |
self.addTextItemToScene(item) |
|
1518 |
#self.addTextItemToScene(item)
|
|
1497 | 1519 |
appDocData.texts.append(item) |
1498 | 1520 |
|
1499 | 1521 |
except Exception as ex: |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
190 | 190 |
""" |
191 | 191 |
import re |
192 | 192 |
from TextDetector import TextDetector |
193 |
from Drawing import Drawing |
|
193 | 194 |
|
194 | 195 |
global ocrCompletedSrc |
195 | 196 |
global threadLock |
... | ... | |
234 | 235 |
appDocData.setImgFilePath(mainRes) |
235 | 236 |
appDocData.imgSrc = None |
236 | 237 |
appDocData.activeDrawing = Drawing(appDocData.imgName) |
237 |
appDocData.setCurrentPidSource(Image.open(self.path))
|
|
238 |
appDocData.setCurrentPidSource(Image.open(mainRes))
|
|
238 | 239 |
|
239 | 240 |
# remove equipment desc. area |
240 | 241 |
configs = appDocData.getConfigs('{} Equipment Desc Area'.format(appDocData.imgName)) |
내보내기 Unified diff