프로젝트

일반

사용자정보

개정판 40b4bfe5

ID40b4bfe529f33e98c8efe185d7ce78f29a157767
상위 e605f280
하위 f1427639

humkyung 이(가) 약 7년 전에 추가함

1. Add QEngineeringLineItem,QGraphicsBoundingBoxItem,QRecognitionDialog
2. Add isTreated attribute to AbstractCommand

차이점 보기:

DTI_PID/DTI_PID/Commands/AbstractCommand.py
2 2
    def __init__(self, imageViewer):
3 3
        self.name = ''
4 4
        self.imageViewer = imageViewer
5
        self.isTreated = True
5 6

  
6 7
    def execute(self, param):
7 8
        raise NotImplementedError
DTI_PID/DTI_PID/Commands/CreateCommand.py
16 16
            instance = self.template.clone()
17 17
            self.imageViewer.scene.removeItem(self.template)
18 18
            self.template.init()
19
            self.imageViewer.scene.update()
19 20
            return instance
20 21
        else:
21 22
            if self.template in self.imageViewer.scene.items():
22 23
                pass
23 24
            else:
24 25
                self.imageViewer.scene.addItem(self.template)
26
            self.imageViewer.scene.update()
27

  
28
        self.isTreated = False
25 29
        
26 30
        return None
27 31
    
DTI_PID/DTI_PID/DTI_PID.py
37 37
from PyQt5.QtSvg import *
38 38
import DTI_PID_UI
39 39
import QtImageViewer
40
import SymbolSvg
41 40

  
42 41
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Commands')
43 42
import CreateCommand
......
45 44

  
46 45
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes')
47 46
import QGraphicsPolylineItem
47
from QEngineeringLineItem import QEngineeringLineItem
48
from SymbolSvg import SymbolSvg
49
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
48 50
#endregion
49 51

  
50 52
## Tesseract path
......
726 728
    global threadLock
727 729
    global textInfoList
728 730
    
731
    res = []
729 732
    try:
730 733
        srcList = []
731 734
        srcList.append(path)
......
795 798
            ####### Potrace
796 799
            imgLineList = potrace.passpotrace(removedSymbolImgPath)
797 800

  
798

  
799
            xg.writeXml(srcName, srcWidth, srcHeight, searchedSymbolList, textInfoList, imgLineList)
801
            xmlPath = xg.writeXml(srcName, srcWidth, srcHeight, searchedSymbolList, textInfoList, imgLineList)
802
            res.append(xmlPath)
800 803
            
801 804
            listWidget.addItem("Searched symbol count : " + str(len(searchedSymbolList)))
802 805

  
......
814 817
        msg.setText(ex)
815 818
        msg.exec_()
816 819
    
820
    return res
821
    
817 822
class Worker(QObject):
818 823
    from PyQt5.QtCore import QThread
819 824
    from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QGridLayout
......
824 829

  
825 830
    #pyqtSlot()
826 831
    def procCounter(self): # A slot takes no params
827
        main(self.path, self.listWidget)
832
        self.xmlPath = main(self.path, self.listWidget)
828 833
        self.finished.emit()
829 834

  
830 835
class ExampleApp(QMainWindow, DTI_PID_UI.Ui_MainWindow):
......
838 843
        # connect signals and slots
839 844
        self.actionClose.triggered.connect(self.close)
840 845
        self.actionOpen.triggered.connect(self.openImageDrawing)
846
        self.actionEqpNozzle.triggered.connect(self.connectEqpNozzle)
847
        self.actionLine.triggered.connect(self.createLine)
841 848
        self.actionRecognition.triggered.connect(self.recognize)
842 849
    
843 850
    '''
......
846 853
    def openImageDrawing(self, MainWindow):
847 854
        self.path = self.graphicsView.loadImageFromFile()
848 855

  
849
        svg = SymbolSvg.SymbolSvg()
856
        svg = SymbolSvg()
850 857
        svg.setPos(100,100) 
851 858
        self.graphicsView.scene.addItem(svg)
852 859

  
860
        return self.path
861

  
862
    '''
863
        @brief  connect equipment and nozzle
864
    '''
865
    def connectEqpNozzle(self):
866
        self.graphicsView.command = None
867

  
868
    '''
869
        @brief  create a line
870
    '''
871
    def createLine(self):
853 872
        # set imageviewer's command
854
        self.graphicsView.command = CreateCommand.CreateCommand(self.graphicsView, QGraphicsPolylineItem.QGraphicsPolylineItem())
873
        self.graphicsView.command = CreateCommand.CreateCommand(self.graphicsView, QEngineeringLineItem())
855 874
        # up to here
856 875

  
857
        return self.path
858

  
859 876
    '''
860 877
        @brief recognize symbol and text
861 878
    '''
862 879
    def recognize(self, MainWindow):
863
        import Recognition_UI
880
        from QRecognitionDialog import QRecognitionDialog
864 881

  
865 882
        try:
866
            self.dlg = QDialog(self)
867
            self.ui = Recognition_UI.Ui_Recognition()
868
            self.ui.setupUi(self.dlg)
883
            self.dlg = QRecognitionDialog(self)
869 884
            self.startThread()
870 885
            self.dlg.show()
871 886
            self.dlg.exec_()
887

  
888
            if self.dlg.isAccepted == True:
889
                self.loadRecognitionResult(self.xmlPath[0])
872 890
        except Exception as ex:
873
            print('에러가 발생했습니다.\n', ex)
891
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
892

  
893
    '''
894
        @brief load recognition result
895
    '''
896
    def loadRecognitionResult(self, xmlPath):
897
        from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse
898

  
899
        try:
900
            #xml = parse('d:\\Projects\\DTIPID\\DTI_PID\\DTI_PID\\res\\Result\\UY1-K-2007_P1_300dpi_black.xml')
901
            xml = parse(xmlPath)
902
            root = xml.getroot();
903
            for symbol in root.iter('SYMBOL'):
904
                pt = symbol.find('STARTPOINT').text.split(',')
905
                size = symbol.find('SIZE').text.split(',')
906
                item = QGraphicsBoundingBoxItem(float(pt[0]), float(pt[1]), float(size[0]), float(size[1]))
907
                item.setPen(QPen(Qt.red, 20, Qt.SolidLine))
908
                self.graphicsView.scene.addItem(item)
909
            for text in root.iter('TEXTINFO'):
910
                x = float(text.find('X').text)
911
                y = float(text.find('Y').text)
912
                width = float(text.find('WIDTH').text)
913
                height = float(text.find('HEIGHT').text)
914
                item = QGraphicsBoundingBoxItem(x, y, width, height)
915
                item.setPen(QPen(Qt.blue, 20, Qt.SolidLine))
916
                self.graphicsView.scene.addItem(item)
917
        except Exception as ex:
918
            print('error occured {} as at {0}'.format(ex, sys.exc_info()[-1].tb_lineno))
874 919

  
875 920
    '''
876 921
        @brief start thread
877 922
    '''
878 923
    def startThread(self):
879
        self.ui.buttonBox.setDisabled(True)
924
        self.dlg.ui.buttonBox.setDisabled(True)
880 925

  
881 926
        # 1 - create Worker and Thread inside the Form
882 927
        self.obj = Worker()  # no parent!
883 928
        self.obj.path = self.path
884
        self.obj.listWidget = self.ui.listWidget
929
        self.obj.listWidget = self.dlg.ui.listWidget
885 930
        self.thread = QThread()  # no parent!
886 931

  
887 932
        # 2 - Connect Worker`s Signals to Form method slots to post data.
......
906 951
        @brief set buttonbox's enabled flag
907 952
    '''
908 953
    def dlgExit(self):
909
        self.ui.buttonBox.setEnabled(True)
910
        
954
        self.xmlPath = self.obj.xmlPath
955
        self.dlg.ui.buttonBox.setEnabled(True)
911 956

  
912 957
if __name__ == '__main__':
913 958
    import DTI_PID_UI
DTI_PID/DTI_PID/DTI__PID.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>MainWindow</class>
4
 <widget class="QMainWindow" name="MainWindow">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>1031</width>
10
    <height>855</height>
11
   </rect>
12
  </property>
13
  <property name="font">
14
   <font>
15
    <family>맑은 고딕</family>
16
    <weight>75</weight>
17
    <bold>true</bold>
18
   </font>
19
  </property>
20
  <property name="windowTitle">
21
   <string>MainWindow</string>
22
  </property>
23
  <widget class="QWidget" name="centralwidget">
24
   <layout class="QGridLayout" name="gridLayout">
25
    <item row="0" column="0">
26
     <layout class="QVBoxLayout" name="verticalLayout">
27
      <property name="sizeConstraint">
28
       <enum>QLayout::SetMaximumSize</enum>
29
      </property>
30
     </layout>
31
    </item>
32
   </layout>
33
  </widget>
34
  <widget class="QMenuBar" name="menubar">
35
   <property name="geometry">
36
    <rect>
37
     <x>0</x>
38
     <y>0</y>
39
     <width>1031</width>
40
     <height>21</height>
41
    </rect>
42
   </property>
43
   <widget class="QMenu" name="menu">
44
    <property name="title">
45
     <string>파일</string>
46
    </property>
47
    <addaction name="actionOpen"/>
48
    <addaction name="separator"/>
49
    <addaction name="actionClose"/>
50
   </widget>
51
   <addaction name="menu"/>
52
  </widget>
53
  <widget class="QStatusBar" name="statusbar"/>
54
  <widget class="QToolBar" name="toolBar">
55
   <property name="font">
56
    <font>
57
     <family>맑은 고딕</family>
58
     <weight>75</weight>
59
     <bold>true</bold>
60
    </font>
61
   </property>
62
   <property name="windowTitle">
63
    <string>toolBar</string>
64
   </property>
65
   <attribute name="toolBarArea">
66
    <enum>TopToolBarArea</enum>
67
   </attribute>
68
   <attribute name="toolBarBreak">
69
    <bool>false</bool>
70
   </attribute>
71
   <addaction name="actionOpen"/>
72
   <addaction name="actionRecognition"/>
73
   <addaction name="separator"/>
74
   <addaction name="actionEqpNozzle"/>
75
   <addaction name="actionLine"/>
76
   <addaction name="separator"/>
77
   <addaction name="actionValidate"/>
78
  </widget>
79
  <widget class="QDockWidget" name="dockWidget">
80
   <attribute name="dockWidgetArea">
81
    <number>2</number>
82
   </attribute>
83
   <widget class="QWidget" name="dockWidgetContents">
84
    <layout class="QGridLayout" name="gridLayout_2">
85
     <item row="0" column="0">
86
      <widget class="QTabWidget" name="tabWidget">
87
       <property name="currentIndex">
88
        <number>0</number>
89
       </property>
90
       <widget class="QWidget" name="Symbol">
91
        <attribute name="title">
92
         <string>심볼</string>
93
        </attribute>
94
       </widget>
95
       <widget class="QWidget" name="Property">
96
        <attribute name="title">
97
         <string>속성</string>
98
        </attribute>
99
       </widget>
100
      </widget>
101
     </item>
102
    </layout>
103
   </widget>
104
  </widget>
105
  <action name="actionOpen">
106
   <property name="text">
107
    <string>열기</string>
108
   </property>
109
   <property name="font">
110
    <font>
111
     <family>맑은 고딕</family>
112
    </font>
113
   </property>
114
  </action>
115
  <action name="actionClose">
116
   <property name="text">
117
    <string>종료</string>
118
   </property>
119
   <property name="font">
120
    <font>
121
     <family>맑은 고딕</family>
122
    </font>
123
   </property>
124
  </action>
125
  <action name="actionRecognition">
126
   <property name="text">
127
    <string>인식</string>
128
   </property>
129
   <property name="toolTip">
130
    <string>인식</string>
131
   </property>
132
  </action>
133
  <action name="actionLine">
134
   <property name="text">
135
    <string>라인 생성</string>
136
   </property>
137
   <property name="toolTip">
138
    <string>라인 생성</string>
139
   </property>
140
  </action>
141
  <action name="actionEqpNozzle">
142
   <property name="text">
143
    <string>장치와 노즐 연계</string>
144
   </property>
145
   <property name="toolTip">
146
    <string>장치와 노즐 연계</string>
147
   </property>
148
  </action>
149
  <action name="actionValidate">
150
   <property name="text">
151
    <string>검사</string>
152
   </property>
153
   <property name="toolTip">
154
    <string>검사</string>
155
   </property>
156
  </action>
157
 </widget>
158
 <resources/>
159
 <connections/>
160
</ui>
DTI_PID/DTI_PID/QRecognitionDialog.py
1
# coding: utf-8
2
from PyQt5.QtCore import *
3
from PyQt5.QtGui import *
4
from PyQt5.QtWidgets import *
5
import Recognition_UI
6

  
7
class QRecognitionDialog(QDialog):
8
    def __init__(self, parent):
9
        QDialog.__init__(self, parent)
10

  
11
        self.ui = Recognition_UI.Ui_Recognition()
12
        self.ui.setupUi(self)
13
        self.isAccepted = False
14

  
15
    def accept(self):
16
        self.isAccepted = True
17
        QDialog.accept(self)
DTI_PID/DTI_PID/QtImageViewer.py
197 197
        if self.command is not None:
198 198
            scenePos = self.mapToScene(event.pos())
199 199
            self.command.execute(['mouseMoveEvent', event, scenePos])
200
            self.scene.update()
201
            return
200
            if self.command.isTreated == True: return
202 201

  
203
        super(QtImageViewer, self).mouseMoveEvent(event)
202
        QGraphicsView.mouseMoveEvent(self, event)
204 203

  
205 204
    def mousePressEvent(self, event):
206 205
        """ Start mouse pan or zoom mode.
207 206
        """
208
        scenePos = self.mapToScene(event.pos())
209 207
        if self.command is not None:
208
            scenePos = self.mapToScene(event.pos())
210 209
            self.command.execute(['mousePressEvent', event, scenePos])
211
            return
210
            if self.command.isTreated == True: return
212 211

  
213
        '''
214
        if event.button() == Qt.LeftButton:
215
            if self.canPan and self.currentMenuTool == self.MENU_HAND_TOOL:
216
                self.setDragMode(QGraphicsView.ScrollHandDrag)
217
            elif self.currentMenuTool == self.MENU_CROP_TOOL:
218
                self.setDragMode(QGraphicsView.RubberBandDrag)
219

  
220
            self.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y())
221
        elif event.button() == Qt.RightButton:
222
            if self.command is not None:
223
                self.command.execute(['mouseRightPressEvent', event.pos(), scenePos])
224
            self.rightMouseButtonPressed.emit(scenePos.x(), scenePos.y())
225
        '''
226 212
        QGraphicsView.mousePressEvent(self, event)
227 213

  
228 214
    def mouseReleaseEvent(self, event):
229 215
        """ Stop mouse pan or zoom mode (apply zoom if valid).
230 216
        """
231
        QGraphicsView.mouseReleaseEvent(self, event)
232
        scenePos = self.mapToScene(event.pos())
233

  
234 217
        if self.command is not None:
218
            scenePos = self.mapToScene(event.pos())
235 219
            instance = self.command.execute(['mouseReleaseEvent', event, scenePos])
236 220
            if instance is not None:
237 221
                self.scene.addItem(instance)
238
                self.scene.update()
239

  
240
        '''
241
        if event.button() == Qt.LeftButton:
242
            if self.currentMenuTool == self.MENU_CROP_TOOL:
243
                viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect()
244
                selectionBBox = self.scene.selectionArea().boundingRect().intersected(viewBBox)
245

  
246
                croppedImage = self.image().copy(selectionBBox.toAlignedRect())
247
                self.setImage(croppedImage)
248
            self.setDragMode(QGraphicsView.NoDrag)
249
            self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y())
250
        elif event.button() == Qt.RightButton:
251
            #if self.canZoom:
252
            #    viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect()
253
            #    selectionBBox = self.scene.selectionArea().boundingRect().intersected(viewBBox)
254
            #    self.scene.setSelectionArea(QPainterPath())  # Clear current selection area.
255
            #    if selectionBBox.isValid() and (selectionBBox != viewBBox):
256
            #        self.zoomStack.append(selectionBBox)
257
            #        self.updateViewer()
258
            self.setDragMode(QGraphicsView.NoDrag)
259
            self.rightMouseButtonReleased.emit(scenePos.x(), scenePos.y())
260
        '''
222
                if self.command.isTreated == True: return
223
        
224
        QGraphicsView.mouseReleaseEvent(self, event)
261 225

  
262 226
    def mouseDoubleClickEvent(self, event):
263 227
        """ Show entire image.
......
306 270
        try:
307 271
            super(QtImageViewer, self).paintEvent(event)
308 272

  
309
            if (self.command is not None) and ('CreateCommand' == self.command.__class__.__name__):
310
                self.command.template.paint(QPainter(self))
273
            #if (self.command is not None) and ('CreateCommand' == self.command.__class__.__name__):
274
            #    self.command.template.paint(QPainter(self))
311 275
        except Exception as ex:
312 276
            print('Error occurs', ex)
313 277

  
DTI_PID/DTI_PID/Shapes/QEngineeringLineItem.py
1
# coding: utf-8
2
import os.path
3
import copy
4
try:
5
    from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
6
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen
7
    from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem
8
except ImportError:
9
    try:
10
        from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR
11
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog
12
    except ImportError:
13
        raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
14

  
15
from QGraphicsPolylineItem import QGraphicsPolylineItem
16

  
17
class QEngineeringLineItem(QGraphicsPolylineItem):
18
    def __init__(self, parent=None):
19
        QGraphicsPolylineItem.__init__(self, parent)
20

  
21
    '''
22
        @brief  construct a ProcessLineItem
23
    '''
24
    def process(self, param):
25
        if ('mousePressEvent' == param[0]) and (param[1].button() == Qt.LeftButton):
26
            self._vertices.append(self._pt)
27
        elif ('mouseMoveEvent' == param[0]):
28
            if len(self._vertices) > 0:
29
                dx = abs(self._vertices[len(self._vertices)-1].x() - param[2].x())
30
                dy = abs(self._vertices[len(self._vertices)-1].y() - param[2].y())
31
                if dx < dy:
32
                    self._pt = QPointF(self._vertices[len(self._vertices)-1].x(), param[2].y())
33
                    #self._pt.__init__(self._vertices[len(self._vertices)-1].x(), param[2].y())
34
                else:
35
                    self._pt = QPointF(param[2].x(), self._vertices[len(self._vertices)-1].y())
36
                    #self._pt.__init__(param[2].x(), self._vertices[len(self._vertices)-1].y())
37
            else:
38
                self._pt = param[2]
39
        elif ('mouseReleaseEvent' == param[0]) and (param[1].button() == Qt.RightButton):
40
            self.isCreated = True
41

  
42
    '''
43
        @brief  clone an object
44
    '''
45
    def clone(self):
46
        clone = QEngineeringLineItem()
47
        clone._vertices = copy.deepcopy(self._vertices)
48
        clone.isCreated = self.isCreated
49

  
50
        return clone
DTI_PID/DTI_PID/Shapes/QGraphicsBoundingBoxItem.py
1
import os.path
2
import copy
3
try:
4
    from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR
5
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen
6
    from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsRectItem
7
except ImportError:
8
    try:
9
        from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR
10
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog
11
    except ImportError:
12
        raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
13

  
14
class QGraphicsBoundingBoxItem(QGraphicsRectItem):
15
    def __init__(self, x, y, width, height):
16
        QGraphicsRectItem.__init__(self, x, y, width, height)
17
        self.setAcceptHoverEvents(True)
18
        self.isEntered = False
19

  
20
    '''
21
        @brief  clone an object
22
    '''
23
    def clone(self):
24
        clone = QGraphicsBoundingBoxItem(self.rect().x(), self.rect().y(), self.rect().width(), self.rect().height())
25
        clone.isCreated = True
26
        return clone
27

  
28
    def hoverEnterEvent(self, event):
29
        self.isEntered = True
30
        self.scene().update()
31

  
32
    def hoverLeaveEvent(self, event):
33
        self.isEntered = False
34
        self.scene().update()
35

  
36
    '''
37
        @brief  override paint
38
    '''
39
    def paint(self, painter, options=None, widget=None):
40
        QGraphicsRectItem.paint(self, painter, options, widget)
41

  
42
        if self.isEntered == True:
43
            painter.setPen(self.pen())
44
            center = self.rect().center()
45
            painter.drawEllipse(center, 5, 5)
DTI_PID/DTI_PID/Shapes/SymbolSvg.py
1
#!/usr/bin/env/python3
2
# coding: utf-8
3

  
4
import sys
5
import os
6
from PyQt5.QtGui import *
7
from PyQt5.QtCore import *
8
from PyQt5.QtSvg import *
9
from PyQt5.QtWidgets import (QGraphicsItem)
10

  
11
class SymbolSvg(QGraphicsSvgItem):
12
    def __init__(self):
13
        super(SymbolSvg, self).__init__(os.path.dirname(os.path.realpath(__file__)) + '\\..\\res\\Heckert_GNU_white.svg')
14

  
15
        self.setFlags(QGraphicsItem.ItemIsSelectable)
16
                      #QGraphicsItem.ItemIsMovable)
17

  
18
        self.setAcceptHoverEvents(True)
19

  
20
    def hoverEnterEvent(self, event):
21
        print('Enter')
22

  
23
    def hoverLeaveEvent(self, event):
24
        print('Leave')
25

  
26
    def hoverMoveEvent(self, event):
27
        return #print('Moving')
DTI_PID/DTI_PID/SymbolSvg.py
1
#!/usr/bin/env/python3
2
# coding: utf-8
3

  
4
import sys
5
import os
6
from PyQt5.QtGui import *
7
from PyQt5.QtCore import *
8
from PyQt5.QtSvg import *
9
from PyQt5.QtWidgets import (QGraphicsItem)
10

  
11
class SymbolSvg(QGraphicsSvgItem):
12
    def __init__(self):
13
        super(SymbolSvg, self).__init__(os.path.dirname(os.path.realpath(__file__)) + '\\res\\Heckert_GNU_white.svg')
14

  
15
        self.setFlags(QGraphicsItem.ItemIsSelectable)
16
                      #QGraphicsItem.ItemIsMovable)
17

  
18
        self.setAcceptHoverEvents(True)
19

  
20
    def hoverEnterEvent(self, event):
21
        print('Enter')
22

  
23
    def hoverLeaveEvent(self, event):
24
        print('Leave')
25

  
26
    def hoverMoveEvent(self, event):
27
        return #print('Moving')
DTI_PID/DTI_PID/UI/DTI__PID.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>MainWindow</class>
4
 <widget class="QMainWindow" name="MainWindow">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>1031</width>
10
    <height>855</height>
11
   </rect>
12
  </property>
13
  <property name="font">
14
   <font>
15
    <family>맑은 고딕</family>
16
    <weight>75</weight>
17
    <bold>true</bold>
18
   </font>
19
  </property>
20
  <property name="windowTitle">
21
   <string>MainWindow</string>
22
  </property>
23
  <widget class="QWidget" name="centralwidget">
24
   <layout class="QGridLayout" name="gridLayout">
25
    <item row="0" column="0">
26
     <layout class="QVBoxLayout" name="verticalLayout">
27
      <property name="sizeConstraint">
28
       <enum>QLayout::SetMaximumSize</enum>
29
      </property>
30
     </layout>
31
    </item>
32
   </layout>
33
  </widget>
34
  <widget class="QMenuBar" name="menubar">
35
   <property name="geometry">
36
    <rect>
37
     <x>0</x>
38
     <y>0</y>
39
     <width>1031</width>
40
     <height>21</height>
41
    </rect>
42
   </property>
43
   <widget class="QMenu" name="menu">
44
    <property name="title">
45
     <string>파일</string>
46
    </property>
47
    <addaction name="actionOpen"/>
48
    <addaction name="separator"/>
49
    <addaction name="actionClose"/>
50
   </widget>
51
   <addaction name="menu"/>
52
  </widget>
53
  <widget class="QStatusBar" name="statusbar"/>
54
  <widget class="QToolBar" name="toolBar">
55
   <property name="font">
56
    <font>
57
     <family>맑은 고딕</family>
58
     <weight>75</weight>
59
     <bold>true</bold>
60
    </font>
61
   </property>
62
   <property name="windowTitle">
63
    <string>toolBar</string>
64
   </property>
65
   <attribute name="toolBarArea">
66
    <enum>TopToolBarArea</enum>
67
   </attribute>
68
   <attribute name="toolBarBreak">
69
    <bool>false</bool>
70
   </attribute>
71
   <addaction name="actionOpen"/>
72
   <addaction name="actionRecognition"/>
73
   <addaction name="separator"/>
74
   <addaction name="actionEqpNozzle"/>
75
   <addaction name="actionLine"/>
76
   <addaction name="separator"/>
77
   <addaction name="actionValidate"/>
78
  </widget>
79
  <widget class="QDockWidget" name="dockWidget">
80
   <attribute name="dockWidgetArea">
81
    <number>2</number>
82
   </attribute>
83
   <widget class="QWidget" name="dockWidgetContents">
84
    <layout class="QGridLayout" name="gridLayout_2">
85
     <item row="0" column="0">
86
      <widget class="QTabWidget" name="tabWidget">
87
       <property name="currentIndex">
88
        <number>0</number>
89
       </property>
90
       <widget class="QWidget" name="Symbol">
91
        <attribute name="title">
92
         <string>심볼</string>
93
        </attribute>
94
       </widget>
95
       <widget class="QWidget" name="Property">
96
        <attribute name="title">
97
         <string>속성</string>
98
        </attribute>
99
       </widget>
100
      </widget>
101
     </item>
102
    </layout>
103
   </widget>
104
  </widget>
105
  <action name="actionOpen">
106
   <property name="text">
107
    <string>열기</string>
108
   </property>
109
   <property name="font">
110
    <font>
111
     <family>맑은 고딕</family>
112
    </font>
113
   </property>
114
  </action>
115
  <action name="actionClose">
116
   <property name="text">
117
    <string>종료</string>
118
   </property>
119
   <property name="font">
120
    <font>
121
     <family>맑은 고딕</family>
122
    </font>
123
   </property>
124
  </action>
125
  <action name="actionRecognition">
126
   <property name="text">
127
    <string>인식</string>
128
   </property>
129
   <property name="toolTip">
130
    <string>인식</string>
131
   </property>
132
  </action>
133
  <action name="actionLine">
134
   <property name="text">
135
    <string>라인 생성</string>
136
   </property>
137
   <property name="toolTip">
138
    <string>라인 생성</string>
139
   </property>
140
  </action>
141
  <action name="actionEqpNozzle">
142
   <property name="text">
143
    <string>장치와 노즐 연계</string>
144
   </property>
145
   <property name="toolTip">
146
    <string>장치와 노즐 연계</string>
147
   </property>
148
  </action>
149
  <action name="actionValidate">
150
   <property name="text">
151
    <string>검사</string>
152
   </property>
153
   <property name="toolTip">
154
    <string>검사</string>
155
   </property>
156
  </action>
157
 </widget>
158
 <resources/>
159
 <connections/>
160
</ui>
DTI_PID/DTI_PID/XmlGenerator.py
51 51
    path = os.path.dirname(os.path.realpath(__file__)) + "/res/Result/"+pidName+".xml"
52 52
    ElementTree(xmlData).write(path)
53 53

  
54
    return path
55

  
54 56
def generateXml(pidName, pidWidth, pidHeight, searchedSymbolList, textInfoList, imgLineList):
55 57
    xml = Element(ROOT_NODE_NAME) # Root Node
56 58
    SubElement(xml, ROOT_DWGNAME_NODE_NAME).text = pidName

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)