개정판 18a45d2e
issue #103: save text area on db
Change-Id: Ic26e7db61f95f93ec5a7ab8528edd9b6bd029477
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
558 | 558 |
SET |
559 | 559 |
name = ?, SymbolType_UID=(select UID from SymbolType where Type=?), threshold = ?, minMatchPoint = ?, isDetectOrigin = ?, |
560 | 560 |
rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?, |
561 |
baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?, flip = ? |
|
561 |
baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?, flip = ?, text_area = ?,
|
|
562 | 562 |
WHERE uid = ? |
563 | 563 |
""") |
564 | 564 |
|
... | ... | |
568 | 568 |
, symbol.getOcrOption(), symbol.getIsContainChild() |
569 | 569 |
, symbol.getOriginalPoint(), symbol.getConnectionPoint() |
570 | 570 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), |
571 |
symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.detectFlip, |
|
571 |
symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.detectFlip, symbol.getText_area_str(),
|
|
572 | 572 |
symbol.getUid()) |
573 | 573 |
cursor.execute(sql, query) |
574 | 574 |
conn.commit() |
... | ... | |
599 | 599 |
with self.project.database.connect() as conn: |
600 | 600 |
cursor = conn.cursor() |
601 | 601 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
602 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE a.IsExceptDetect = 0 order by width * height desc""" |
|
602 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip, a.text_area\ |
|
603 |
b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE a.IsExceptDetect = 0 order by width * height desc""" |
|
603 | 604 |
try: |
604 | 605 |
cursor.execute(sql) |
605 | 606 |
rows = cursor.fetchall() |
606 | 607 |
for row in rows: |
607 | 608 |
sym = symbol.SymbolBase(row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], |
608 |
row[10], row[11], row[12], row[13], row[14], row[0], iType=row[16],
|
|
609 |
detectFlip=row[15]) # uid is last item |
|
609 |
row[10], row[11], row[12], row[13], row[14], row[0], iType=row[17],
|
|
610 |
detectFlip=row[15], text_area=row[16]) # uid is last item
|
|
610 | 611 |
targetSymbolList.append(sym) |
611 | 612 |
except Exception as ex: |
612 | 613 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
1628 | 1629 |
with self.project.database.connect() as conn: |
1629 | 1630 |
cursor = conn.cursor() |
1630 | 1631 |
sql = self.project.database.to_sql("""SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
1631 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE """ + "a." + fieldName + '=?') |
|
1632 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.text_area, \ |
|
1633 |
b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE """ + "a." + fieldName + '=?') |
|
1632 | 1634 |
try: |
1633 | 1635 |
cursor.execute(sql, (param,)) |
1634 | 1636 |
rows = cursor.fetchall() |
... | ... | |
1638 | 1640 |
, symbolTuple[4], symbolTuple[5], symbolTuple[6], symbolTuple[7], |
1639 | 1641 |
symbolTuple[8] |
1640 | 1642 |
, symbolTuple[9], symbolTuple[10], symbolTuple[11], symbolTuple[12], |
1641 |
symbolTuple[13], symbolTuple[14], symbolTuple[0], iType=symbolTuple[16],
|
|
1642 |
detectFlip=symbolTuple[15]) ## uid is last item |
|
1643 |
symbolTuple[13], symbolTuple[14], symbolTuple[0], iType=symbolTuple[17],
|
|
1644 |
detectFlip=symbolTuple[15], text_area=symbolTuple[16]) ## uid is last item
|
|
1643 | 1645 |
self._symbolBase[fieldName][param] = ret |
1644 | 1646 |
except Exception as ex: |
1645 | 1647 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
1659 | 1661 |
cursor = conn.cursor() |
1660 | 1662 |
if field_name is not None and param is not None: |
1661 | 1663 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
1662 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,b.UID
|
|
1663 |
FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where {}={})""".format( |
|
1664 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.text_area \
|
|
1665 |
b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where {}={})""".format(
|
|
1664 | 1666 |
field_name, self.project.database.place_holder) |
1665 | 1667 |
else: |
1666 | 1668 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
... | ... | |
1674 | 1676 |
, symbolTuple[5], symbolTuple[6], symbolTuple[7], symbolTuple[8], |
1675 | 1677 |
symbolTuple[9] |
1676 | 1678 |
, symbolTuple[10], symbolTuple[11], symbolTuple[12], symbolTuple[13], |
1677 |
symbolTuple[14], symbolTuple[0], iType=symbolTuple[16],
|
|
1678 |
detectFlip=symbolTuple[15]) ## uid is last item |
|
1679 |
symbolTuple[14], symbolTuple[0], iType=symbolTuple[17],
|
|
1680 |
detectFlip=symbolTuple[15], text_area=symbolTuple[16]) ## uid is last item
|
|
1679 | 1681 |
ret.append(sym) |
1680 | 1682 |
except Exception as ex: |
1681 | 1683 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
DTI_PID/DTI_PID/SymbolEditorDialog.py | ||
---|---|---|
655 | 655 |
|
656 | 656 |
text_area = [] |
657 | 657 |
for row in range(self.ui.textAreaTableWidget.rowCount()): |
658 |
text_area.append(self.ui.textAreaTableWidget.item(row, 0).text()) |
|
659 |
text_area = '/'.join(text_area) |
|
658 |
area = Area('Text Area') |
|
659 |
area.parse(self.ui.textAreaTableWidget.item(row, 0).text()) |
|
660 |
text_area.append(area) |
|
660 | 661 |
|
661 | 662 |
self.newSym = symbol.SymbolBase(fileName, category, convertedThreshold, int(minMatchPoint), True, |
662 | 663 |
rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, |
663 | 664 |
baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid, |
664 |
imageWidth, iamgeHeight, detectFlip=detectFlip) |
|
665 |
imageWidth, iamgeHeight, detectFlip=detectFlip, text_area=text_area)
|
|
665 | 666 |
|
666 | 667 |
return self.newSym |
667 | 668 |
|
DTI_PID/DTI_PID/symbol.py | ||
---|---|---|
13 | 13 |
def __init__(self, sName, sType, sp, width, height, threshold, minMatchCount, hitRate, rotatedAngle |
14 | 14 |
, isDetectOnOrigin, rotationCount, ocrOption, isContainChild = 0 |
15 | 15 |
, originalPoint = None, connectionPoint = None, baseSymbol = None, additionalSymbol = None |
16 |
, isExceptDetect = 0, hasInstrumentLabel = 0, uid = None, detectFlip = None): |
|
16 |
, isExceptDetect = 0, hasInstrumentLabel = 0, uid = None, detectFlip = None, text_area=None):
|
|
17 | 17 |
SymbolBase.__init__(self, sName, sType, threshold, minMatchCount |
18 | 18 |
, isDetectOnOrigin, rotationCount, ocrOption, isContainChild |
19 | 19 |
, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect |
20 |
, hasInstrumentLabel, uid, detectFlip=detectFlip) |
|
20 |
, hasInstrumentLabel, uid, detectFlip=detectFlip, text_area=text_area)
|
|
21 | 21 |
self.sp = sp |
22 | 22 |
self.width = width |
23 | 23 |
self.height = height |
내보내기 Unified diff