개정판 aaf53137
기능별 마우스 커서 변경/편의기능추가/svg파일 생성구문 추가/마우스 휠 줌 추가 등
DTI_PID/DTI_PID/Commands/AreaEraserCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QPainter, QColor, QPen, QBrush |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QPainter, QColor, QPen, QBrush, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QPainter, QColor, QPen, QBrush |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QPainter, QColor, QPen, QBrush, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(AreaEraserCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'AreaEraser' |
18 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/Commands/AreaZoomCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(AreaZoomCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'AreaZoom' |
18 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/Commands/ConnectionPointCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QMimeData |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform |
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform, QCursor
|
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox
|
|
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QMimeData |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QColor, QPen, QBrush |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QColor, QPen, QBrush, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
18 | 18 |
self.connectionPointLineEdit = connectionPointLineEdit |
19 | 19 |
self.connectionPointListWidget = connectionPointListWidget |
20 | 20 |
self.listItems = self.connectionPointListWidget.items(QMimeData()) |
21 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
21 | 22 |
#self.isSelected = False |
22 | 23 |
|
23 | 24 |
''' |
... | ... | |
30 | 31 |
if 'mousePressEvent' == param[0]: |
31 | 32 |
if event.button() == Qt.LeftButton: |
32 | 33 |
#if not self.isSelected: |
33 |
self.imageViewer.scene.addItem(self.imageViewer.scene.addEllipse(QRectF(int(scenePos.x()), int(scenePos.y()), 1, 1), QPen(QColor(0, 0, 255)), QBrush(QColor(0, 0, 255)))) |
|
34 |
#self.isSelected = True |
|
35 |
text = "{},{}".format(int(scenePos.x()), int(scenePos.y())) |
|
36 |
self.connectionPointLineEdit.setText(text) |
|
37 |
self.connectionPointListWidget.addItem(text) |
|
34 |
image = self.imageViewer.image() |
|
35 |
width = image.width() |
|
36 |
height = image.height() |
|
37 |
|
|
38 |
clickedX = int(scenePos.x()) |
|
39 |
clickedY = int(scenePos.y()) |
|
40 |
|
|
41 |
if (clickedX >= 0 and clickedX <= width) and (clickedY >= 0 and clickedY <= height): |
|
42 |
self.imageViewer.scene.addItem(self.imageViewer.scene.addEllipse(QRectF(int(scenePos.x()), int(scenePos.y()), 1, 1), QPen(QColor(0, 0, 255)), QBrush(QColor(0, 0, 255)))) |
|
43 |
#self.isSelected = True |
|
44 |
text = "{},{}".format(int(scenePos.x()), int(scenePos.y())) |
|
45 |
self.connectionPointLineEdit.setText(text) |
|
46 |
self.connectionPointListWidget.addItem(text) |
|
47 |
else: |
|
48 |
QMessageBox.about(self.imageViewer, "알림", "심볼 내부를 선택해주세요.") |
|
38 | 49 |
QGraphicsView.mousePressEvent(self.imageViewer, event) |
39 | 50 |
elif 'mouseMoveEvent' == param[0]: |
40 | 51 |
#if not self.isSelected: |
DTI_PID/DTI_PID/Commands/CropCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(CropCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'Crop' |
18 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief crop image by rectangle selected by user |
DTI_PID/DTI_PID/Commands/EraserCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(EraserCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'Eraser' |
18 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/Commands/HandCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog
|
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImge, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(HandCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'Hand' |
18 |
self.imageViewer.setCursor(QCursor(Qt.OpenHandCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/Commands/OriginalPointCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform |
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QColor, QPen, QBrush, QTransform, QCursor
|
|
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox
|
|
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QColor, QPen, QBrush |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QColor, QPen, QBrush, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
17 | 17 |
self.name = 'OriginalPoint' |
18 | 18 |
self.originalPointLineEdit = originalPointLineEdit |
19 | 19 |
self.isSelected = False |
20 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
21 |
self.imageViewer.isOriginalPointSelected = False |
|
20 | 22 |
|
21 | 23 |
coords = self.originalPointLineEdit.text() |
22 | 24 |
if coords: |
... | ... | |
34 | 36 |
if 'mousePressEvent' == param[0]: |
35 | 37 |
if event.button() == Qt.LeftButton: |
36 | 38 |
if not self.isSelected: |
37 |
self.imageViewer.scene.addItem(self.imageViewer.scene.addEllipse(QRectF(int(scenePos.x()), int(scenePos.y()), 1, 1), QPen(QColor(255, 0, 0)), QBrush(QColor(255, 0, 0)))) |
|
38 |
self.isSelected = True |
|
39 |
self.originalPointLineEdit.setText("{},{}".format(int(scenePos.x()), int(scenePos.y()))) |
|
39 |
image = self.imageViewer.image() |
|
40 |
width = image.width() |
|
41 |
height = image.height() |
|
42 |
|
|
43 |
clickedX = int(scenePos.x()) |
|
44 |
clickedY = int(scenePos.y()) |
|
45 | ||
46 |
if (clickedX >= 0 and clickedX <= width) and (clickedY >= 0 and clickedY <= height): |
|
47 |
self.imageViewer.scene.addItem(self.imageViewer.scene.addEllipse(QRectF(clickedX, clickedY, 1, 1), QPen(QColor(255, 0, 0)), QBrush(QColor(255, 0, 0)))) |
|
48 |
self.isSelected = True |
|
49 |
self.originalPointLineEdit.setText("{},{}".format(clickedX, clickedY)) |
|
50 |
self.imageViewer.isOriginalPointSelected = True |
|
51 |
else: |
|
52 |
QMessageBox.about(self.imageViewer, "알림", "심볼 내부를 선택해주세요.") |
|
40 | 53 |
QGraphicsView.mousePressEvent(self.imageViewer, event) |
41 | 54 |
elif 'mouseMoveEvent' == param[0]: |
42 | 55 |
if not self.isSelected: |
DTI_PID/DTI_PID/Commands/PenCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(PenCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'Pen' |
18 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
|
19 | ||
18 | 20 |
|
19 | 21 |
''' |
20 | 22 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/Commands/ZoomCommand.py | ||
---|---|---|
2 | 2 |
import AbstractCommand |
3 | 3 |
try: |
4 | 4 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath |
|
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QCursor
|
|
6 | 6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
7 | 7 |
except ImportError: |
8 | 8 |
try: |
9 | 9 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor
|
|
11 | 11 |
except ImportError: |
12 | 12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 | 13 | |
... | ... | |
15 | 15 |
def __init__(self, imageViewer): |
16 | 16 |
super(ZoomCommand, self).__init__(imageViewer) |
17 | 17 |
self.name = 'Zoom' |
18 |
self.imageViewer.setCursor(QCursor(Qt.PointingHandCursor)) |
|
18 | 19 |
|
19 | 20 |
''' |
20 | 21 |
@brief pan image by left click and drag |
DTI_PID/DTI_PID/QSymbolEditorDialog.py | ||
---|---|---|
8 | 8 |
import sys |
9 | 9 |
import SG_DbHelper |
10 | 10 |
import symbol, SymbolBase |
11 |
import potrace |
|
11 | 12 | |
12 | 13 |
import UI_SymbolEditor |
13 | 14 | |
... | ... | |
30 | 31 |
self.initForms() |
31 | 32 |
self.initContents() |
32 | 33 |
self.isAccepted = False |
34 |
self.dbHelper = SG_DbHelper.SG_DbHelper(self.project.getPath()) |
|
33 | 35 | |
34 | 36 |
def setupImageViewer(self): |
35 | 37 |
x = self.ui.imageViewContainer.x() |
... | ... | |
59 | 61 |
self.ui.areaEraserButton.clicked.connect(self.areaEraserToolClickEvent) |
60 | 62 |
self.ui.zoomButton.clicked.connect(self.zoomToolClickEvent) |
61 | 63 |
self.ui.initZoomButton.clicked.connect(self.zoomInitToolClickEvent) |
64 |
self.ui.guidelineCheckbox.stateChanged.connect(self.guidelineStateChangedEvent) |
|
62 | 65 | |
63 | 66 |
def initForms(self): |
64 | 67 |
self.ui.idLineEdit.setValidator(QRegExpValidator(QtCore.QRegExp("^[1-9]\d+$"))) |
65 |
self.ui.thresholdLineEdit.setValidator(QRegExpValidator(QtCore.QRegExp("^([0-1]{1}[.])?[0-9]+$")))
|
|
68 |
self.ui.thresholdLineEdit.setValidator(QRegExpValidator(QtCore.QRegExp("^[0-9]\d+$"))) # ([0-1]{1}[.])?[0-9]+
|
|
66 | 69 |
self.ui.minMatchPointLineEdit.setValidator(QRegExpValidator(QtCore.QRegExp("^[0-9]\d+$"))) |
67 | 70 |
self.initIsOriginDetectComboBoxItems() |
68 | 71 |
self.initOcrOptionComboBoxItems() |
... | ... | |
106 | 109 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
107 | 110 |
self.show() |
108 | 111 |
self.exec_() |
112 |
return self.isAccepted |
|
109 | 113 | |
110 | 114 |
def makeFileName(self, originName, newName): |
111 | 115 |
imageFolderDir = self.project.getPath() + "\\image" |
112 | 116 |
imageDir = imageFolderDir + "\\" + newName + ".png" |
113 |
dbHelper = SG_DbHelper.SG_DbHelper(self.project.getPath()) |
|
114 |
if (os.path.exists(imageDir)) or (dbHelper.isExistFileName(imageDir)): |
|
117 |
svgFolderDir = self.project.getPath() + "\\svg" |
|
118 |
svgDir = svgFolderDir + "\\" + newName + ".svg" |
|
119 |
if (os.path.exists(imageDir)) or (self.dbHelper.isExistFileName(imageDir) or (os.path.exists(svgDir))): |
|
115 | 120 |
self.FILE_NUMBER = self.FILE_NUMBER + 1 |
116 | 121 |
imgName = originName + "({})".format(self.FILE_NUMBER) |
117 | 122 |
return self.makeFileName(originName, imgName) |
... | ... | |
130 | 135 |
isDetectOnOrigin = self.ui.isOriginDetectComboBox.currentData() |
131 | 136 |
rotationCount = self.ui.rotationCountSpinBox.value() |
132 | 137 |
ocrOption = self.ui.ocrOptionComboBox.currentData() |
133 |
isContainChild = 0 |
|
138 |
isContainChild = 1 if self.ui.isContainChildCheckBox.isChecked() else 0
|
|
134 | 139 |
originalPoint = self.ui.originalPointLineEdit.text() |
135 | 140 |
connectionPoint = self.makeConnectionPointListString() |
136 | 141 |
### 기초심볼추가 |
... | ... | |
138 | 143 |
### 부가심볼추가 |
139 | 144 |
additionalSymbol = None |
140 | 145 | |
141 |
newSym = symbol.SymbolBase(int(symId), fileName, type, path, float(threshold), int(minMatchPoint), isDetectOnOrigin |
|
146 |
convertedThreshold = int(threshold) / 100.0 |
|
147 | ||
148 |
newSym = symbol.SymbolBase(int(symId), fileName, type, path, convertedThreshold, int(minMatchPoint), isDetectOnOrigin |
|
142 | 149 |
, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol) |
143 | 150 | |
144 | 151 |
return newSym |
... | ... | |
159 | 166 | |
160 | 167 |
def accept(self): |
161 | 168 |
print("save") |
162 |
self.isAccepted = True |
|
163 | 169 | |
164 | 170 |
isValid, exceptionMsg = self.isValidSymbolInfo() |
165 | 171 |
if isValid: |
166 | 172 |
print("valid symbol info") |
167 |
dbHelper = SG_DbHelper.SG_DbHelper(self.project.getPath()) |
|
168 |
isAdded, imagePath = dbHelper.insertSymbol(self.makeSymbolData()) |
|
173 |
isAdded, fileName, imagePath = self.dbHelper.insertSymbol(self.makeSymbolData()) |
|
169 | 174 | |
170 | 175 |
if isAdded: |
171 | 176 |
image = self.ui.imageView.image() |
172 | 177 |
if image is not None: |
173 | 178 |
image.save(imagePath, 'PNG') |
179 |
potrace.convertImageToSvg(imagePath, self.project.getPath()+"\\svg\\" + fileName + ".svg") |
|
180 |
self.isAccepted = True |
|
174 | 181 |
else: |
175 | 182 |
QMessageBox.about(self.ui.buttonBox, "알림", "심볼 저장 과정 중 문제가 발생했습니다.") |
176 | 183 |
QDialog.accept(self) |
... | ... | |
233 | 240 |
print("area eraser") |
234 | 241 |
self.ui.imageView.command = AreaEraserCommand.AreaEraserCommand(self.ui.imageView) |
235 | 242 | |
243 |
def guidelineStateChangedEvent(self, value): |
|
244 |
if self.ui.guidelineCheckbox.isChecked(): |
|
245 |
self.ui.imageView.showGuideline(True) |
|
246 |
else: |
|
247 |
self.ui.imageView.showGuideline(False) |
|
248 | ||
236 | 249 |
def addAdditionalSymbol(self, event): |
237 | 250 |
print("addAdditionalSymbol") |
238 | 251 |
direction = self.ui.defaultSymbolDirectionComboBox.currentData() |
... | ... | |
249 | 262 |
def isValidSymbolInfo(self): |
250 | 263 |
print("isValid") |
251 | 264 |
EXCEPTION_MSG_FORMAT = "{} 입력을 확인해주세요." |
265 |
EXCEPTION_MSG_DUPLICATED_FORMAT = "이미 저장된 {} 값입니다." |
|
252 | 266 |
infoTitle = "" |
253 | 267 | |
254 | 268 |
idText = self.ui.idLineEdit.text() |
255 | 269 |
id = int(idText) if idText else -1 |
256 |
if id == -1 or id < 100:
|
|
270 |
if (id == -1 or id < 100):
|
|
257 | 271 |
infoTitle = self.ui.idLabel.text() |
258 | 272 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
259 | 273 | |
274 |
if self.dbHelper.isExistData('symId', id): |
|
275 |
infoTitle = self.ui.idLabel.text() |
|
276 |
return (False, EXCEPTION_MSG_DUPLICATED_FORMAT.format(infoTitle)) |
|
277 | ||
260 | 278 |
if not self.ui.nameLineEdit.text(): |
261 | 279 |
infoTitle = self.ui.nameLabel.text() |
262 | 280 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
... | ... | |
267 | 285 | |
268 | 286 |
thresholdText = self.ui.thresholdLineEdit.text() |
269 | 287 |
threshold = float(thresholdText) if thresholdText else -1 |
270 |
if not(threshold >= 0.0 and threshold <= 1.0):
|
|
288 |
if not(threshold >= 0 and threshold <= 100):
|
|
271 | 289 |
infoTitle = self.ui.thresholdLabel.text() |
272 | 290 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
273 | 291 |
|
... | ... | |
277 | 295 |
infoTitle = self.ui.minMatchPointLabel.text() |
278 | 296 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
279 | 297 | |
280 |
if not self.ui.originalPointLineEdit.text(): |
|
298 |
if not self.ui.originalPointLineEdit.text() or self.ui.imageView.isOriginalPointSelected == False:
|
|
281 | 299 |
infoTitle = self.ui.originalPointLabel.text() |
282 | 300 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
283 | 301 | |
284 |
if not self.ui.connectionPointLineEdit.text():
|
|
302 |
if not (self.ui.connectionPointList.count() > 0):
|
|
285 | 303 |
infoTitle = self.ui.connectionPointLabel.text() |
286 | 304 |
return (False, EXCEPTION_MSG_FORMAT.format(infoTitle)) |
287 | 305 |
|
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
3 | 3 |
import os.path |
4 | 4 |
try: |
5 | 5 |
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR, QPointF |
6 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QPainter |
|
6 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QPainter, QCursor, QPen, QBrush, QColor
|
|
7 | 7 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
8 | 8 |
except ImportError: |
9 | 9 |
try: |
... | ... | |
53 | 53 |
self.isPressCtrl = False |
54 | 54 |
self.scaleFactor = 1.0 |
55 | 55 |
self.numScheduledScalings = 0 |
56 |
self.isOriginalPointSelected = False |
|
56 | 57 |
#self.currentMenuTool = self.MENU_HAND_TOOL |
57 | 58 | |
58 | 59 |
# Store a local handle to the scene's current image pixmap. |
... | ... | |
162 | 163 |
if self.hasImage(): |
163 | 164 |
self.zoomStack = [] |
164 | 165 |
self.updateViewer() |
166 |
self.setCursor(QCursor(Qt.ArrowCursor)) |
|
165 | 167 | |
166 | 168 |
def zoomImage(self, isZoomIn, event): |
167 | 169 |
""" Zoom in & out |
... | ... | |
292 | 294 |
except Exception as ex: |
293 | 295 |
print('Error occurs', ex) |
294 | 296 | |
297 |
GUIDELINE_ITEMS = [] |
|
298 |
def showGuideline(self, isShow): |
|
299 |
image = self.image() |
|
300 |
width = image.width() |
|
301 |
height = image.height() |
|
302 |
pen = QPen() |
|
303 |
pen.setColor(QColor(80, 80, 80)) |
|
304 |
pen.setStyle(Qt.DashLine) |
|
305 |
pen.setWidthF(0.5) |
|
306 |
if isShow: |
|
307 |
verticalLine = self.scene.addLine(width/2, 0, width/2, height, pen) |
|
308 |
horizontalLine = self.scene.addLine(0, height/2, width, height/2, pen) |
|
309 |
self.GUIDELINE_ITEMS.append(verticalLine) |
|
310 |
self.GUIDELINE_ITEMS.append(horizontalLine) |
|
311 |
self.scene.addItem(verticalLine) |
|
312 |
self.scene.addItem(horizontalLine) |
|
313 |
else: |
|
314 |
for item in self.GUIDELINE_ITEMS: |
|
315 |
self.scene.removeItem(item) |
|
316 | ||
295 | 317 | |
296 | 318 |
if __name__ == '__main__': |
297 | 319 |
import sys |
DTI_PID/DTI_PID/SG_DbHelper.py | ||
---|---|---|
53 | 53 |
finally: |
54 | 54 |
conn.close() |
55 | 55 | |
56 |
def isExistData(self, fieldName, data): |
|
57 |
rows = None |
|
58 |
try: |
|
59 |
conn = sqlite3.connect(self.dbFullPath) |
|
60 |
cursor = conn.cursor() |
|
61 |
sql = "" |
|
62 |
if isinstance(data, str): |
|
63 |
sql = "SELECT * FROM Symbol WHERE " + fieldName + " = '"+ data +"'" |
|
64 |
else: |
|
65 |
sql = "SELECT * FROM Symbol WHERE " + fieldName + " = "+ str(data) +"" |
|
66 |
cursor.execute(sql) |
|
67 |
rows = cursor.fetchall() |
|
68 |
except Error as e: |
|
69 |
print(e) |
|
70 |
finally: |
|
71 |
conn.close() |
|
72 |
if rows is not None and len(rows) > 0: |
|
73 |
return True |
|
74 |
else: |
|
75 |
return False |
|
76 | ||
56 | 77 |
def isExistFileName(self, imageDir): |
78 |
rows = None |
|
57 | 79 |
try: |
58 | 80 |
conn = sqlite3.connect(self.dbFullPath) |
59 | 81 |
cursor = conn.cursor() |
... | ... | |
87 | 109 |
print(e) |
88 | 110 |
finally: |
89 | 111 |
conn.close() |
90 |
return (isAdded, symbol.getPath()) |
|
112 |
return (isAdded, symbol.getName(), symbol.getPath())
|
|
91 | 113 |
|
DTI_PID/DTI_PID/SymbolGenerator.py | ||
---|---|---|
278 | 278 |
print("next step tool clicked") |
279 | 279 |
if self.imageView.hasImage(): |
280 | 280 |
self.symbolEditorDialog = QSymbolEditorDialog.QSymbolEditorDialog(self.imageView, self.imageView.image(), self.project) |
281 |
self.symbolEditorDialog.showDialog() |
|
282 |
#self.symbolEditorDialog = SymbolEditor(self.imageView.image()) |
|
283 |
#self.symbolEditorDialog.showDialog() |
|
281 |
isSymbolAdded = self.symbolEditorDialog.showDialog() |
|
282 |
|
|
283 |
if isSymbolAdded: |
|
284 |
self.initTreeWidget(self.project) |
|
284 | 285 |
else: |
285 | 286 |
QMessageBox.about(self.topWidget, "알림", "이미지를 선택한 후 다시 시도해주세요.") |
286 | 287 | |
287 | 288 | |
288 | ||
289 | 289 |
if __name__ == "__main__": |
290 | 290 |
import sys |
291 | 291 |
app = QtWidgets.QApplication(sys.argv) |
DTI_PID/DTI_PID/UI/SymbolEditor.ui | ||
---|---|---|
184 | 184 |
</font> |
185 | 185 |
</property> |
186 | 186 |
<property name="text"> |
187 |
<string>임계값</string> |
|
187 |
<string>임계값(%)</string>
|
|
188 | 188 |
</property> |
189 | 189 |
</widget> |
190 | 190 |
</item> |
... | ... | |
200 | 200 |
</font> |
201 | 201 |
</property> |
202 | 202 |
<property name="text"> |
203 |
<string>최소 특징점</string> |
|
203 |
<string>최소 특징점 개수</string>
|
|
204 | 204 |
</property> |
205 | 205 |
</widget> |
206 | 206 |
</item> |
... | ... | |
232 | 232 |
</font> |
233 | 233 |
</property> |
234 | 234 |
<property name="text"> |
235 |
<string>검출 시 회전수</string> |
|
235 |
<string>검출 시 심볼 회전수</string>
|
|
236 | 236 |
</property> |
237 | 237 |
</widget> |
238 | 238 |
</item> |
... | ... | |
265 | 265 |
<item row="8" column="1"> |
266 | 266 |
<widget class="QComboBox" name="ocrOptionComboBox"/> |
267 | 267 |
</item> |
268 |
<item row="9" column="0">
|
|
268 |
<item row="10" column="0">
|
|
269 | 269 |
<widget class="QLabel" name="baseSymbolLabel"> |
270 | 270 |
<property name="font"> |
271 | 271 |
<font> |
... | ... | |
278 | 278 |
</property> |
279 | 279 |
</widget> |
280 | 280 |
</item> |
281 |
<item row="9" column="1">
|
|
281 |
<item row="10" column="1">
|
|
282 | 282 |
<widget class="QComboBox" name="baseSymbolComboBox"/> |
283 | 283 |
</item> |
284 |
<item row="10" column="0">
|
|
284 |
<item row="11" column="0">
|
|
285 | 285 |
<widget class="QLabel" name="additionalSymbolLabel"> |
286 | 286 |
<property name="font"> |
287 | 287 |
<font> |
... | ... | |
294 | 294 |
</property> |
295 | 295 |
</widget> |
296 | 296 |
</item> |
297 |
<item row="10" column="1">
|
|
297 |
<item row="11" column="1">
|
|
298 | 298 |
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
299 | 299 |
<item> |
300 | 300 |
<widget class="QComboBox" name="defaultSymbolDirectionComboBox"> |
... | ... | |
324 | 324 |
</item> |
325 | 325 |
</layout> |
326 | 326 |
</item> |
327 |
<item row="11" column="1">
|
|
327 |
<item row="12" column="1">
|
|
328 | 328 |
<widget class="QListView" name="additionalSymbolListView"/> |
329 | 329 |
</item> |
330 |
<item row="12" column="0">
|
|
330 |
<item row="13" column="0">
|
|
331 | 331 |
<widget class="QLabel" name="originalPointLabel"> |
332 | 332 |
<property name="sizePolicy"> |
333 | 333 |
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> |
... | ... | |
349 | 349 |
</property> |
350 | 350 |
</widget> |
351 | 351 |
</item> |
352 |
<item row="12" column="1">
|
|
352 |
<item row="13" column="1">
|
|
353 | 353 |
<layout class="QHBoxLayout" name="horizontalLayout_4"> |
354 | 354 |
<item> |
355 | 355 |
<widget class="QLineEdit" name="originalPointLineEdit"> |
... | ... | |
373 | 373 |
</item> |
374 | 374 |
</layout> |
375 | 375 |
</item> |
376 |
<item row="15" column="0">
|
|
376 |
<item row="16" column="0">
|
|
377 | 377 |
<widget class="QLabel" name="connectionPointLabel"> |
378 | 378 |
<property name="font"> |
379 | 379 |
<font> |
... | ... | |
389 | 389 |
</property> |
390 | 390 |
</widget> |
391 | 391 |
</item> |
392 |
<item row="15" column="1">
|
|
392 |
<item row="16" column="1">
|
|
393 | 393 |
<layout class="QHBoxLayout" name="horizontalLayout_6"> |
394 | 394 |
<item> |
395 | 395 |
<widget class="QLineEdit" name="connectionPointLineEdit"> |
... | ... | |
413 | 413 |
</item> |
414 | 414 |
</layout> |
415 | 415 |
</item> |
416 |
<item row="16" column="1">
|
|
416 |
<item row="17" column="1">
|
|
417 | 417 |
<widget class="QListWidget" name="connectionPointList"/> |
418 | 418 |
</item> |
419 |
<item row="9" column="0"> |
|
420 |
<widget class="QLabel" name="isContainChildLabel"> |
|
421 |
<property name="font"> |
|
422 |
<font> |
|
423 |
<weight>75</weight> |
|
424 |
<bold>true</bold> |
|
425 |
</font> |
|
426 |
</property> |
|
427 |
<property name="text"> |
|
428 |
<string>자식 심볼 포함 여부</string> |
|
429 |
</property> |
|
430 |
</widget> |
|
431 |
</item> |
|
432 |
<item row="9" column="1"> |
|
433 |
<widget class="QCheckBox" name="isContainChildCheckBox"> |
|
434 |
<property name="text"> |
|
435 |
<string/> |
|
436 |
</property> |
|
437 |
<property name="checkable"> |
|
438 |
<bool>true</bool> |
|
439 |
</property> |
|
440 |
</widget> |
|
441 |
</item> |
|
419 | 442 |
</layout> |
420 | 443 |
</widget> |
421 | 444 |
</widget> |
422 |
<zorder>widget_6</zorder> |
|
423 |
<zorder>buttonBox</zorder> |
|
424 | 445 |
</widget> |
425 | 446 |
</widget> |
426 | 447 |
</item> |
... | ... | |
536 | 557 |
</property> |
537 | 558 |
</widget> |
538 | 559 |
</item> |
560 |
<item> |
|
561 |
<widget class="QCheckBox" name="guidelineCheckbox"> |
|
562 |
<property name="text"> |
|
563 |
<string>Show Guideline</string> |
|
564 |
</property> |
|
565 |
</widget> |
|
566 |
</item> |
|
539 | 567 |
</layout> |
540 | 568 |
</widget> |
541 | 569 |
</widget> |
... | ... | |
558 | 586 |
</layout> |
559 | 587 |
</widget> |
560 | 588 |
</widget> |
561 |
<zorder>verticalSpacer</zorder> |
|
562 |
<zorder>widget</zorder> |
|
563 |
<zorder>widget_3</zorder> |
|
564 | 589 |
</widget> |
565 | 590 |
</item> |
566 | 591 |
</layout> |
DTI_PID/DTI_PID/UI/UI_SymbolEditor.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 | ||
3 |
# Form implementation generated from reading ui file 'SymbolEditor.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.6 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 | ||
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
|
10 | ||
11 |
class Ui_Dialog(object): |
|
12 |
def setupUi(self, Dialog): |
|
13 |
Dialog.setObjectName("Dialog") |
|
14 |
Dialog.resize(1280, 720) |
|
15 |
self.horizontalLayoutWidget = QtWidgets.QWidget(Dialog) |
|
16 |
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 1281, 721)) |
|
17 |
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") |
|
18 |
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) |
|
19 |
self.horizontalLayout.setContentsMargins(0, 0, 0, 0) |
|
20 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
21 |
self.widget_2 = QtWidgets.QWidget(self.horizontalLayoutWidget) |
|
22 |
self.widget_2.setMaximumSize(QtCore.QSize(16777215, 1240)) |
|
23 |
self.widget_2.setObjectName("widget_2") |
|
24 |
self.widget = QtWidgets.QWidget(self.widget_2) |
|
25 |
self.widget.setGeometry(QtCore.QRect(890, 10, 381, 701)) |
|
26 |
self.widget.setMaximumSize(QtCore.QSize(400, 1240)) |
|
27 |
self.widget.setObjectName("widget") |
|
28 |
self.verticalLayoutWidget = QtWidgets.QWidget(self.widget) |
|
29 |
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 381, 701)) |
|
30 |
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") |
|
31 |
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) |
|
32 |
self.verticalLayout.setContentsMargins(0, 0, 0, 0) |
|
33 |
self.verticalLayout.setObjectName("verticalLayout") |
|
34 |
self.scrollArea = QtWidgets.QScrollArea(self.verticalLayoutWidget) |
|
35 |
self.scrollArea.setWidgetResizable(True) |
|
36 |
self.scrollArea.setObjectName("scrollArea") |
|
37 |
self.scrollAreaWidgetContents = QtWidgets.QWidget() |
|
38 |
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 377, 668)) |
|
39 |
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") |
|
40 |
self.widget_6 = QtWidgets.QWidget(self.scrollAreaWidgetContents) |
|
41 |
self.widget_6.setGeometry(QtCore.QRect(0, 0, 381, 671)) |
|
42 |
self.widget_6.setObjectName("widget_6") |
|
43 |
self.formLayoutWidget = QtWidgets.QWidget(self.widget_6) |
|
44 |
self.formLayoutWidget.setGeometry(QtCore.QRect(0, 0, 381, 671)) |
|
45 |
self.formLayoutWidget.setObjectName("formLayoutWidget") |
|
46 |
self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) |
|
47 |
self.formLayout.setLabelAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
|
48 |
self.formLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) |
|
49 |
self.formLayout.setContentsMargins(6, 6, 6, 6) |
|
50 |
self.formLayout.setObjectName("formLayout") |
|
51 |
self.targetDBLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
52 |
font = QtGui.QFont() |
|
53 |
font.setBold(True) |
|
54 |
font.setWeight(75) |
|
55 |
self.targetDBLabel.setFont(font) |
|
56 |
self.targetDBLabel.setObjectName("targetDBLabel") |
|
57 |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.targetDBLabel) |
|
58 |
self.targetDBLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
59 |
self.targetDBLineEdit.setReadOnly(True) |
|
60 |
self.targetDBLineEdit.setObjectName("targetDBLineEdit") |
|
61 |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.targetDBLineEdit) |
|
62 |
self.idLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
63 |
font = QtGui.QFont() |
|
64 |
font.setBold(True) |
|
65 |
font.setWeight(75) |
|
66 |
self.idLabel.setFont(font) |
|
67 |
self.idLabel.setObjectName("idLabel") |
|
68 |
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.idLabel) |
|
69 |
self.idLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
70 |
self.idLineEdit.setObjectName("idLineEdit") |
|
71 |
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.idLineEdit) |
|
72 |
self.nameLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
73 |
font = QtGui.QFont() |
|
74 |
font.setBold(True) |
|
75 |
font.setWeight(75) |
|
76 |
self.nameLabel.setFont(font) |
|
77 |
self.nameLabel.setObjectName("nameLabel") |
|
78 |
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.nameLabel) |
|
79 |
self.nameLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
80 |
self.nameLineEdit.setObjectName("nameLineEdit") |
|
81 |
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.nameLineEdit) |
|
82 |
self.typeLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
83 |
font = QtGui.QFont() |
|
84 |
font.setBold(True) |
|
85 |
font.setWeight(75) |
|
86 |
self.typeLabel.setFont(font) |
|
87 |
self.typeLabel.setObjectName("typeLabel") |
|
88 |
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.typeLabel) |
|
89 |
self.typeLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
90 |
self.typeLineEdit.setObjectName("typeLineEdit") |
|
91 |
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.typeLineEdit) |
|
92 |
self.thresholdLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
93 |
font = QtGui.QFont() |
|
94 |
font.setBold(True) |
|
95 |
font.setWeight(75) |
|
96 |
self.thresholdLabel.setFont(font) |
|
97 |
self.thresholdLabel.setObjectName("thresholdLabel") |
|
98 |
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.thresholdLabel) |
|
99 |
self.thresholdLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
100 |
self.thresholdLineEdit.setObjectName("thresholdLineEdit") |
|
101 |
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.thresholdLineEdit) |
|
102 |
self.minMatchPointLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
103 |
font = QtGui.QFont() |
|
104 |
font.setBold(True) |
|
105 |
font.setWeight(75) |
|
106 |
self.minMatchPointLabel.setFont(font) |
|
107 |
self.minMatchPointLabel.setObjectName("minMatchPointLabel") |
|
108 |
self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.minMatchPointLabel) |
|
109 |
self.minMatchPointLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
110 |
self.minMatchPointLineEdit.setObjectName("minMatchPointLineEdit") |
|
111 |
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.minMatchPointLineEdit) |
|
112 |
self.isOriginDetectLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
113 |
font = QtGui.QFont() |
|
114 |
font.setBold(True) |
|
115 |
font.setWeight(75) |
|
116 |
self.isOriginDetectLabel.setFont(font) |
|
117 |
self.isOriginDetectLabel.setObjectName("isOriginDetectLabel") |
|
118 |
self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.isOriginDetectLabel) |
|
119 |
self.isOriginDetectComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
|
120 |
self.isOriginDetectComboBox.setObjectName("isOriginDetectComboBox") |
|
121 |
self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.isOriginDetectComboBox) |
|
122 |
self.rotationCountLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
123 |
font = QtGui.QFont() |
|
124 |
font.setBold(True) |
|
125 |
font.setWeight(75) |
|
126 |
self.rotationCountLabel.setFont(font) |
|
127 |
self.rotationCountLabel.setObjectName("rotationCountLabel") |
|
128 |
self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.rotationCountLabel) |
|
129 |
self.rotationCountSpinBox = QtWidgets.QSpinBox(self.formLayoutWidget) |
|
130 |
self.rotationCountSpinBox.setMinimum(0) |
|
131 |
self.rotationCountSpinBox.setMaximum(3) |
|
132 |
self.rotationCountSpinBox.setProperty("value", 0) |
|
133 |
self.rotationCountSpinBox.setObjectName("rotationCountSpinBox") |
|
134 |
self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.rotationCountSpinBox) |
|
135 |
self.ocrOptionLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
136 |
font = QtGui.QFont() |
|
137 |
font.setBold(True) |
|
138 |
font.setWeight(75) |
|
139 |
self.ocrOptionLabel.setFont(font) |
|
140 |
self.ocrOptionLabel.setObjectName("ocrOptionLabel") |
|
141 |
self.formLayout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.ocrOptionLabel) |
|
142 |
self.ocrOptionComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
|
143 |
self.ocrOptionComboBox.setObjectName("ocrOptionComboBox") |
|
144 |
self.formLayout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.ocrOptionComboBox) |
|
145 |
self.baseSymbolLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
146 |
font = QtGui.QFont() |
|
147 |
font.setBold(True) |
|
148 |
font.setWeight(75) |
|
149 |
self.baseSymbolLabel.setFont(font) |
|
150 |
self.baseSymbolLabel.setObjectName("baseSymbolLabel") |
|
151 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.baseSymbolLabel) |
|
152 |
self.baseSymbolComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
|
153 |
self.baseSymbolComboBox.setObjectName("baseSymbolComboBox") |
|
154 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.baseSymbolComboBox) |
|
155 |
self.additionalSymbolLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
156 |
font = QtGui.QFont() |
|
157 |
font.setBold(True) |
|
158 |
font.setWeight(75) |
|
159 |
self.additionalSymbolLabel.setFont(font) |
|
160 |
self.additionalSymbolLabel.setObjectName("additionalSymbolLabel") |
|
161 |
self.formLayout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.additionalSymbolLabel) |
|
162 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
|
163 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
|
164 |
self.defaultSymbolDirectionComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
|
165 |
self.defaultSymbolDirectionComboBox.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
166 |
self.defaultSymbolDirectionComboBox.setObjectName("defaultSymbolDirectionComboBox") |
|
167 |
self.horizontalLayout_2.addWidget(self.defaultSymbolDirectionComboBox) |
|
168 |
self.addtionalSymbolComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
|
169 |
self.addtionalSymbolComboBox.setObjectName("addtionalSymbolComboBox") |
|
170 |
self.horizontalLayout_2.addWidget(self.addtionalSymbolComboBox) |
|
171 |
self.addAdditionalSymbolButton = QtWidgets.QPushButton(self.formLayoutWidget) |
|
172 |
self.addAdditionalSymbolButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
|
173 |
self.addAdditionalSymbolButton.setObjectName("addAdditionalSymbolButton") |
|
174 |
self.horizontalLayout_2.addWidget(self.addAdditionalSymbolButton) |
|
175 |
self.formLayout.setLayout(10, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_2) |
|
176 |
self.additionalSymbolListView = QtWidgets.QListView(self.formLayoutWidget) |
|
177 |
self.additionalSymbolListView.setObjectName("additionalSymbolListView") |
|
178 |
self.formLayout.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.additionalSymbolListView) |
|
179 |
self.originalPointLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
180 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) |
|
181 |
sizePolicy.setHorizontalStretch(0) |
|
182 |
sizePolicy.setVerticalStretch(0) |
|
183 |
sizePolicy.setHeightForWidth(self.originalPointLabel.sizePolicy().hasHeightForWidth()) |
|
184 |
self.originalPointLabel.setSizePolicy(sizePolicy) |
|
185 |
font = QtGui.QFont() |
|
186 |
font.setBold(True) |
|
187 |
font.setWeight(75) |
|
188 |
self.originalPointLabel.setFont(font) |
|
189 |
self.originalPointLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
|
190 |
self.originalPointLabel.setObjectName("originalPointLabel") |
|
191 |
self.formLayout.setWidget(12, QtWidgets.QFormLayout.LabelRole, self.originalPointLabel) |
|
192 |
self.horizontalLayout_4 = QtWidgets.QHBoxLayout() |
|
193 |
self.horizontalLayout_4.setObjectName("horizontalLayout_4") |
|
194 |
self.originalPointLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
195 |
self.originalPointLineEdit.setReadOnly(True) |
|
196 |
self.originalPointLineEdit.setObjectName("originalPointLineEdit") |
|
197 |
self.horizontalLayout_4.addWidget(self.originalPointLineEdit) |
|
198 |
self.addOriginalPointButton = QtWidgets.QPushButton(self.formLayoutWidget) |
|
199 |
self.addOriginalPointButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
|
200 |
self.addOriginalPointButton.setObjectName("addOriginalPointButton") |
|
201 |
self.horizontalLayout_4.addWidget(self.addOriginalPointButton) |
|
202 |
self.formLayout.setLayout(12, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4) |
|
203 |
self.connectionPointLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
204 |
font = QtGui.QFont() |
|
205 |
font.setBold(True) |
|
206 |
font.setWeight(75) |
|
207 |
self.connectionPointLabel.setFont(font) |
|
208 |
self.connectionPointLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
|
209 |
self.connectionPointLabel.setObjectName("connectionPointLabel") |
|
210 |
self.formLayout.setWidget(15, QtWidgets.QFormLayout.LabelRole, self.connectionPointLabel) |
|
211 |
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() |
|
212 |
self.horizontalLayout_6.setObjectName("horizontalLayout_6") |
|
213 |
self.connectionPointLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
|
214 |
self.connectionPointLineEdit.setReadOnly(True) |
|
215 |
self.connectionPointLineEdit.setObjectName("connectionPointLineEdit") |
|
216 |
self.horizontalLayout_6.addWidget(self.connectionPointLineEdit) |
|
217 |
self.addConnectionPointButton = QtWidgets.QPushButton(self.formLayoutWidget) |
|
218 |
self.addConnectionPointButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
|
219 |
self.addConnectionPointButton.setObjectName("addConnectionPointButton") |
|
220 |
self.horizontalLayout_6.addWidget(self.addConnectionPointButton) |
|
221 |
self.formLayout.setLayout(15, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_6) |
|
222 |
self.connectionPointList = QtWidgets.QListWidget(self.formLayoutWidget) |
|
223 |
self.connectionPointList.setObjectName("connectionPointList") |
|
224 |
self.formLayout.setWidget(16, QtWidgets.QFormLayout.FieldRole, self.connectionPointList) |
|
225 |
self.widget_6.raise_() |
|
226 |
self.scrollArea.setWidget(self.scrollAreaWidgetContents) |
|
227 |
self.verticalLayout.addWidget(self.scrollArea) |
|
228 |
self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) |
|
229 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Save) |
|
230 |
self.buttonBox.setObjectName("buttonBox") |
|
231 |
self.verticalLayout.addWidget(self.buttonBox) |
|
232 |
self.widget_3 = QtWidgets.QWidget(self.widget_2) |
|
233 |
self.widget_3.setGeometry(QtCore.QRect(10, 10, 871, 701)) |
|
234 |
self.widget_3.setObjectName("widget_3") |
|
235 |
self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.widget_3) |
|
236 |
self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(0, 0, 871, 701)) |
|
237 |
self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2") |
|
238 |
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2) |
|
239 |
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) |
|
240 |
self.verticalLayout_2.setObjectName("verticalLayout_2") |
|
241 |
self.toolWidget = QtWidgets.QWidget(self.verticalLayoutWidget_2) |
|
242 |
self.toolWidget.setMaximumSize(QtCore.QSize(869, 40)) |
|
243 |
self.toolWidget.setObjectName("toolWidget") |
|
244 |
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.toolWidget) |
|
245 |
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(0, 0, 871, 41)) |
|
246 |
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3") |
|
247 |
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3) |
|
248 |
self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) |
|
249 |
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) |
|
250 |
self.horizontalLayout_3.setObjectName("horizontalLayout_3") |
|
251 |
self.handButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
252 |
self.handButton.setObjectName("handButton") |
|
253 |
self.horizontalLayout_3.addWidget(self.handButton) |
|
254 |
self.penButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
255 |
self.penButton.setObjectName("penButton") |
|
256 |
self.horizontalLayout_3.addWidget(self.penButton) |
|
257 |
self.penWidthSpinBox = QtWidgets.QSpinBox(self.horizontalLayoutWidget_3) |
|
258 |
self.penWidthSpinBox.setMinimum(1) |
|
259 |
self.penWidthSpinBox.setMaximum(5) |
|
260 |
self.penWidthSpinBox.setObjectName("penWidthSpinBox") |
|
261 |
self.horizontalLayout_3.addWidget(self.penWidthSpinBox) |
|
262 |
self.eraserButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
263 |
self.eraserButton.setObjectName("eraserButton") |
|
264 |
self.horizontalLayout_3.addWidget(self.eraserButton) |
|
265 |
self.eraserSpinBox = QtWidgets.QSpinBox(self.horizontalLayoutWidget_3) |
|
266 |
self.eraserSpinBox.setMinimum(1) |
|
267 |
self.eraserSpinBox.setMaximum(5) |
|
268 |
self.eraserSpinBox.setObjectName("eraserSpinBox") |
|
269 |
self.horizontalLayout_3.addWidget(self.eraserSpinBox) |
|
270 |
self.areaEraserButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
271 |
self.areaEraserButton.setObjectName("areaEraserButton") |
|
272 |
self.horizontalLayout_3.addWidget(self.areaEraserButton) |
|
273 |
self.zoomButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
274 |
self.zoomButton.setObjectName("zoomButton") |
|
275 |
self.horizontalLayout_3.addWidget(self.zoomButton) |
|
276 |
self.initZoomButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
|
277 |
self.initZoomButton.setObjectName("initZoomButton") |
|
278 |
self.horizontalLayout_3.addWidget(self.initZoomButton) |
|
279 |
self.verticalLayout_2.addWidget(self.toolWidget) |
|
280 |
self.imageViewContainer = QtWidgets.QWidget(self.verticalLayoutWidget_2) |
|
281 |
self.imageViewContainer.setObjectName("imageViewContainer") |
|
282 |
self.verticalLayoutWidget_3 = QtWidgets.QWidget(self.imageViewContainer) |
|
283 |
self.verticalLayoutWidget_3.setGeometry(QtCore.QRect(0, 0, 871, 651)) |
|
284 |
self.verticalLayoutWidget_3.setObjectName("verticalLayoutWidget_3") |
|
285 |
self.imageViewerContainerLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_3) |
|
286 |
self.imageViewerContainerLayout.setContentsMargins(0, 0, 0, 0) |
|
287 |
self.imageViewerContainerLayout.setObjectName("imageViewerContainerLayout") |
|
288 |
self.verticalLayout_2.addWidget(self.imageViewContainer) |
|
289 |
self.widget.raise_() |
|
290 |
self.widget_3.raise_() |
|
291 |
self.horizontalLayout.addWidget(self.widget_2) |
|
292 | ||
293 |
self.retranslateUi(Dialog) |
|
294 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
|
295 | ||
296 |
def retranslateUi(self, Dialog): |
|
297 |
_translate = QtCore.QCoreApplication.translate |
|
298 |
Dialog.setWindowTitle(_translate("Dialog", "Dialog")) |
|
299 |
self.targetDBLabel.setText(_translate("Dialog", "대상 DB")) |
|
300 |
self.idLabel.setText(_translate("Dialog", "ID")) |
|
301 |
self.nameLabel.setText(_translate("Dialog", "Name")) |
|
302 |
self.typeLabel.setText(_translate("Dialog", "Type")) |
|
303 |
self.thresholdLabel.setText(_translate("Dialog", "임계값")) |
|
304 |
self.minMatchPointLabel.setText(_translate("Dialog", "최소 특징점")) |
|
305 |
self.isOriginDetectLabel.setText(_translate("Dialog", "검출 소스")) |
|
306 |
self.rotationCountLabel.setText(_translate("Dialog", "검출 시 회전수")) |
|
307 |
self.ocrOptionLabel.setText(_translate("Dialog", "OCR 옵션")) |
|
308 |
self.baseSymbolLabel.setText(_translate("Dialog", "기초 심볼")) |
|
309 |
self.additionalSymbolLabel.setText(_translate("Dialog", "부가 심볼")) |
|
310 |
self.addAdditionalSymbolButton.setText(_translate("Dialog", "추가")) |
|
311 |
self.originalPointLabel.setText(_translate("Dialog", "Original Point")) |
|
312 |
self.addOriginalPointButton.setText(_translate("Dialog", "추가")) |
|
313 |
self.connectionPointLabel.setText(_translate("Dialog", "Connection Point")) |
|
314 |
self.addConnectionPointButton.setText(_translate("Dialog", "추가")) |
|
315 |
self.handButton.setText(_translate("Dialog", "Hand")) |
|
316 |
self.penButton.setText(_translate("Dialog", "Pen")) |
|
317 |
self.eraserButton.setText(_translate("Dialog", "Eraser")) |
|
318 |
self.areaEraserButton.setText(_translate("Dialog", "Area Eraser")) |
|
319 |
self.zoomButton.setText(_translate("Dialog", "Zoom")) |
|
320 |
self.initZoomButton.setText(_translate("Dialog", "Init Zoom")) |
|
321 | ||
322 | ||
323 |
if __name__ == "__main__": |
|
324 |
import sys |
|
325 |
app = QtWidgets.QApplication(sys.argv) |
|
326 |
Dialog = QtWidgets.QDialog() |
|
327 |
ui = Ui_Dialog() |
|
328 |
ui.setupUi(Dialog) |
|
329 |
Dialog.show() |
|
330 |
sys.exit(app.exec_()) |
|
331 |
DTI_PID/DTI_PID/UI_SymbolEditor.py | ||
---|---|---|
148 | 148 |
font.setWeight(75) |
149 | 149 |
self.baseSymbolLabel.setFont(font) |
150 | 150 |
self.baseSymbolLabel.setObjectName("baseSymbolLabel") |
151 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.baseSymbolLabel)
|
|
151 |
self.formLayout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.baseSymbolLabel)
|
|
152 | 152 |
self.baseSymbolComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
153 | 153 |
self.baseSymbolComboBox.setObjectName("baseSymbolComboBox") |
154 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.baseSymbolComboBox)
|
|
154 |
self.formLayout.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.baseSymbolComboBox)
|
|
155 | 155 |
self.additionalSymbolLabel = QtWidgets.QLabel(self.formLayoutWidget) |
156 | 156 |
font = QtGui.QFont() |
157 | 157 |
font.setBold(True) |
158 | 158 |
font.setWeight(75) |
159 | 159 |
self.additionalSymbolLabel.setFont(font) |
160 | 160 |
self.additionalSymbolLabel.setObjectName("additionalSymbolLabel") |
161 |
self.formLayout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.additionalSymbolLabel)
|
|
161 |
self.formLayout.setWidget(11, QtWidgets.QFormLayout.LabelRole, self.additionalSymbolLabel)
|
|
162 | 162 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
163 | 163 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
164 | 164 |
self.defaultSymbolDirectionComboBox = QtWidgets.QComboBox(self.formLayoutWidget) |
... | ... | |
172 | 172 |
self.addAdditionalSymbolButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
173 | 173 |
self.addAdditionalSymbolButton.setObjectName("addAdditionalSymbolButton") |
174 | 174 |
self.horizontalLayout_2.addWidget(self.addAdditionalSymbolButton) |
175 |
self.formLayout.setLayout(10, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_2)
|
|
175 |
self.formLayout.setLayout(11, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_2)
|
|
176 | 176 |
self.additionalSymbolListView = QtWidgets.QListView(self.formLayoutWidget) |
177 | 177 |
self.additionalSymbolListView.setObjectName("additionalSymbolListView") |
178 |
self.formLayout.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.additionalSymbolListView)
|
|
178 |
self.formLayout.setWidget(12, QtWidgets.QFormLayout.FieldRole, self.additionalSymbolListView)
|
|
179 | 179 |
self.originalPointLabel = QtWidgets.QLabel(self.formLayoutWidget) |
180 | 180 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) |
181 | 181 |
sizePolicy.setHorizontalStretch(0) |
... | ... | |
188 | 188 |
self.originalPointLabel.setFont(font) |
189 | 189 |
self.originalPointLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
190 | 190 |
self.originalPointLabel.setObjectName("originalPointLabel") |
191 |
self.formLayout.setWidget(12, QtWidgets.QFormLayout.LabelRole, self.originalPointLabel)
|
|
191 |
self.formLayout.setWidget(13, QtWidgets.QFormLayout.LabelRole, self.originalPointLabel)
|
|
192 | 192 |
self.horizontalLayout_4 = QtWidgets.QHBoxLayout() |
193 | 193 |
self.horizontalLayout_4.setObjectName("horizontalLayout_4") |
194 | 194 |
self.originalPointLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
... | ... | |
199 | 199 |
self.addOriginalPointButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
200 | 200 |
self.addOriginalPointButton.setObjectName("addOriginalPointButton") |
201 | 201 |
self.horizontalLayout_4.addWidget(self.addOriginalPointButton) |
202 |
self.formLayout.setLayout(12, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4)
|
|
202 |
self.formLayout.setLayout(13, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4)
|
|
203 | 203 |
self.connectionPointLabel = QtWidgets.QLabel(self.formLayoutWidget) |
204 | 204 |
font = QtGui.QFont() |
205 | 205 |
font.setBold(True) |
... | ... | |
207 | 207 |
self.connectionPointLabel.setFont(font) |
208 | 208 |
self.connectionPointLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
209 | 209 |
self.connectionPointLabel.setObjectName("connectionPointLabel") |
210 |
self.formLayout.setWidget(15, QtWidgets.QFormLayout.LabelRole, self.connectionPointLabel)
|
|
210 |
self.formLayout.setWidget(16, QtWidgets.QFormLayout.LabelRole, self.connectionPointLabel)
|
|
211 | 211 |
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() |
212 | 212 |
self.horizontalLayout_6.setObjectName("horizontalLayout_6") |
213 | 213 |
self.connectionPointLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget) |
... | ... | |
218 | 218 |
self.addConnectionPointButton.setMaximumSize(QtCore.QSize(40, 16777215)) |
219 | 219 |
self.addConnectionPointButton.setObjectName("addConnectionPointButton") |
220 | 220 |
self.horizontalLayout_6.addWidget(self.addConnectionPointButton) |
221 |
self.formLayout.setLayout(15, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_6)
|
|
221 |
self.formLayout.setLayout(16, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_6)
|
|
222 | 222 |
self.connectionPointList = QtWidgets.QListWidget(self.formLayoutWidget) |
223 | 223 |
self.connectionPointList.setObjectName("connectionPointList") |
224 |
self.formLayout.setWidget(16, QtWidgets.QFormLayout.FieldRole, self.connectionPointList) |
|
225 |
self.widget_6.raise_() |
|
224 |
self.formLayout.setWidget(17, QtWidgets.QFormLayout.FieldRole, self.connectionPointList) |
|
225 |
self.isContainChildLabel = QtWidgets.QLabel(self.formLayoutWidget) |
|
226 |
font = QtGui.QFont() |
|
227 |
font.setBold(True) |
|
228 |
font.setWeight(75) |
|
229 |
self.isContainChildLabel.setFont(font) |
|
230 |
self.isContainChildLabel.setObjectName("isContainChildLabel") |
|
231 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.isContainChildLabel) |
|
232 |
self.isContainChildCheckBox = QtWidgets.QCheckBox(self.formLayoutWidget) |
|
233 |
self.isContainChildCheckBox.setText("") |
|
234 |
self.isContainChildCheckBox.setCheckable(True) |
|
235 |
self.isContainChildCheckBox.setObjectName("isContainChildCheckBox") |
|
236 |
self.formLayout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.isContainChildCheckBox) |
|
226 | 237 |
self.scrollArea.setWidget(self.scrollAreaWidgetContents) |
227 | 238 |
self.verticalLayout.addWidget(self.scrollArea) |
228 | 239 |
self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) |
... | ... | |
276 | 287 |
self.initZoomButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) |
277 | 288 |
self.initZoomButton.setObjectName("initZoomButton") |
278 | 289 |
self.horizontalLayout_3.addWidget(self.initZoomButton) |
290 |
self.guidelineCheckbox = QtWidgets.QCheckBox(self.horizontalLayoutWidget_3) |
|
291 |
self.guidelineCheckbox.setObjectName("guidelineCheckbox") |
|
292 |
self.horizontalLayout_3.addWidget(self.guidelineCheckbox) |
|
279 | 293 |
self.verticalLayout_2.addWidget(self.toolWidget) |
280 | 294 |
self.imageViewContainer = QtWidgets.QWidget(self.verticalLayoutWidget_2) |
281 | 295 |
self.imageViewContainer.setObjectName("imageViewContainer") |
... | ... | |
286 | 300 |
self.imageViewerContainerLayout.setContentsMargins(0, 0, 0, 0) |
287 | 301 |
self.imageViewerContainerLayout.setObjectName("imageViewerContainerLayout") |
288 | 302 |
self.verticalLayout_2.addWidget(self.imageViewContainer) |
289 |
self.widget.raise_() |
|
290 |
self.widget_3.raise_() |
|
291 | 303 |
self.horizontalLayout.addWidget(self.widget_2) |
292 | 304 | |
293 | 305 |
self.retranslateUi(Dialog) |
... | ... | |
302 | 314 |
self.idLabel.setText(_translate("Dialog", "ID")) |
303 | 315 |
self.nameLabel.setText(_translate("Dialog", "Name")) |
304 | 316 |
self.typeLabel.setText(_translate("Dialog", "Type")) |
305 |
self.thresholdLabel.setText(_translate("Dialog", "임계값")) |
|
306 |
self.minMatchPointLabel.setText(_translate("Dialog", "최소 특징점")) |
|
317 |
self.thresholdLabel.setText(_translate("Dialog", "임계값(%)"))
|
|
318 |
self.minMatchPointLabel.setText(_translate("Dialog", "최소 특징점 개수"))
|
|
307 | 319 |
self.isOriginDetectLabel.setText(_translate("Dialog", "검출 소스")) |
308 |
self.rotationCountLabel.setText(_translate("Dialog", "검출 시 회전수")) |
|
320 |
self.rotationCountLabel.setText(_translate("Dialog", "검출 시 심볼 회전수"))
|
|
309 | 321 |
self.ocrOptionLabel.setText(_translate("Dialog", "OCR 옵션")) |
310 | 322 |
self.baseSymbolLabel.setText(_translate("Dialog", "기초 심볼")) |
311 | 323 |
self.additionalSymbolLabel.setText(_translate("Dialog", "부가 심볼")) |
... | ... | |
314 | 326 |
self.addOriginalPointButton.setText(_translate("Dialog", "추가")) |
315 | 327 |
self.connectionPointLabel.setText(_translate("Dialog", "Connection Point")) |
316 | 328 |
self.addConnectionPointButton.setText(_translate("Dialog", "추가")) |
329 |
self.isContainChildLabel.setText(_translate("Dialog", "자식 심볼 포함 여부")) |
|
317 | 330 |
self.handButton.setText(_translate("Dialog", "Hand")) |
318 | 331 |
self.penButton.setText(_translate("Dialog", "Pen")) |
319 | 332 |
self.eraserButton.setText(_translate("Dialog", "Eraser")) |
320 | 333 |
self.areaEraserButton.setText(_translate("Dialog", "Area Eraser")) |
321 | 334 |
self.zoomButton.setText(_translate("Dialog", "Zoom")) |
322 | 335 |
self.initZoomButton.setText(_translate("Dialog", "Init Zoom")) |
336 |
self.guidelineCheckbox.setText(_translate("Dialog", "Show Guideline")) |
|
323 | 337 | |
324 | 338 | |
325 | 339 |
if __name__ == "__main__": |
DTI_PID/DTI_PID/potrace.py | ||
---|---|---|
15 | 15 |
POTRACE = os.path.dirname(os.path.realpath(__file__)) + '\\potrace.exe' |
16 | 16 |
ADJUST = 10 |
17 | 17 | |
18 |
def convertImageToSvg(imgFilePath, destFilePath): |
|
19 |
thresh = 127 |
|
20 | ||
21 |
image = cv2.imread(imgFilePath, cv2.IMREAD_GRAYSCALE) |
|
22 |
threshold = cv2.threshold(image, thresh, 255, cv2.THRESH_BINARY)[1] |
|
23 |
kernel = np.ones((3, 3), np.uint8) |
|
24 |
erode = cv2.dilate(threshold, kernel, iterations=1) |
|
25 | ||
26 |
# convert to bmp binary so that potrace can handle it |
|
27 |
retval, buf = cv2.imencode('.bmp', erode) |
|
28 |
if retval == False: |
|
29 |
raise ValueError('Failed to convert into BMP binary data') |
|
30 |
# convert buf from numpy.ndarray to bytes |
|
31 |
binbmp = buf.tobytes() |
|
32 |
|
|
33 |
args = [ |
|
34 |
POTRACE, |
|
35 |
'-', '-o-', '--svg' |
|
36 |
] |
|
37 |
|
|
38 |
p = subprocess.Popen( |
|
39 |
args, |
|
40 |
stdin=subprocess.PIPE, |
|
41 |
stdout=subprocess.PIPE, |
|
42 |
stderr=subprocess.PIPE, |
|
43 |
shell=False |
|
44 |
) |
|
45 |
|
|
46 |
stdout, stderr = p.communicate(input=binbmp) |
|
47 |
if len(stderr) != 0: |
|
48 |
raise RuntimeError('Potrace threw error:\n' + stderr.decode('utf-8')) |
|
49 | ||
50 |
imgLines = [] |
|
51 |
# parse svg data and extract lines |
|
52 |
svgdom = minidom.parseString(stdout) |
|
53 | ||
54 |
xmlFile = open(destFilePath, "a+") |
|
55 |
svgdom.writexml(xmlFile) |
|
56 |
xmlFile.close() |
|
57 | ||
18 | 58 |
# extract line from image by using potrace |
19 | 59 |
def passpotrace(imgFile): |
20 | 60 |
thresh = 127 |
내보내기 Unified diff