프로젝트

일반

사용자정보

개정판 91654294

ID9165429484933791cb53c558e3820fa89007769f
상위 1c2871f8
하위 94cc331f

함의성이(가) 약 6년 전에 추가함

issue #637: d

차이점 보기:

DTI_PID/DTI_PID/SpecBreakDialog.py
61 61
        except Exception as ex:
62 62
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
63 63

  
64
    '''
65
        @brief  select equipment desc area
66
        @author humkyung
67
        @date   2018.06.29
68
    '''
69
    def onSelectEquipmentDescArea(self):
70
        self._cmd.tag = self.ui.lineEditEquipmentDescArea
71
        self.parent().graphicsView.command = self._cmd
72

  
73
    def onSelectTypicalArea(self):
74
        '''
75
        @brief  select typical area
76
        @author humkyung
77
        @date   2018.12.14
78
        '''
79
        self._cmd.tag = self.ui.lineEditTypicalArea
80
        self.parent().graphicsView.command = self._cmd
81

  
82
    '''
83
        @brief  remove box area from scene
84
        @author humkyung
85
        @date   2018.06.29
86
        @history    2018.11.09      euisung     change name removeEquipmentDescArea -> removeArea for title block
87
                                                change remove process
88
                    2018.11.20      euisung     change brief remove equipment desc. area from graphicsview -> 
89
    '''
90
    def removeArea(self, box):
91
        import re
92
        try:
93
            self.parent().graphicsView.scene.removeItem(box)
94
        except Exception as ex:
95
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
96

  
97
    '''
98
        @brief  delete selected equipment desc area
99
        @author humkyung
100
        @date   2018.06.29
101
    '''
102
    def onDeleteEquipmentDescArea(self):
103
        try:
104
            row = self.ui.tableWidgetSpec.currentRow()
105
            if row is -1:
106
                return
107
            self.removeArea(self.ui.tableWidgetSpec.item(row, 1).tag)
108
            self.ui.tableWidgetSpec.removeRow(row)
109
        except Exception as ex:
110
            from App import App
111
            from AppDocData import MessageType
112

  
113
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
114
            App.mainWnd().addMessage.emit(MessageType.Error, message)
115

  
116
    def onDeleteTypicalArea(self):
117
        '''
118
        @brief  delete selected typical area
119
        @author humkyung
120
        @date   2018.12.14
121
        '''
122
        try:
123
            row = self.ui.tableWidgetTypicalArea.currentRow()
124
            if row is -1:
125
                return
126
            self.removeArea(self.ui.tableWidgetTypicalArea.item(row, 1).tag)
127
            self.ui.tableWidgetTypicalArea.removeRow(row)
128
        except Exception as ex:
129
            from App import App
130
            from AppDocData import MessageType
131

  
132
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
133
            App.mainWnd().addMessage.emit(MessageType.Error, message)
134

  
135
    '''
136
        @brief      called when area is created
137
        @history    humkyung 2018.06.29 add equipment desc. area
138
    '''
139
    def onAreaCreated(self, x, y , width, height):
140
        import uuid
141
        THICKNESS = 5
142

  
143
        if self._cmd.tag is self.ui.lineEditDrawing:
144
            if self.ui.lineEditDrawing.tag is None:
145
                item = QGraphicsBoundingBoxItem(x, y, width, height)
146
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
147
                self.parent().graphicsView.scene.addItem(item)
148

  
149
                self.ui.lineEditDrawing.tag = item
150
            else:
151
                self.ui.lineEditDrawing.tag.setRect(x, y, width, height)
152

  
153
            self.ui.lineEditDrawing.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
154
        elif self._cmd.tag is self.ui.lineEditNote:
155
            if self.ui.lineEditNote.tag is None:
156
                item = QGraphicsBoundingBoxItem(x, y, width, height)
157
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
158
                self.parent().graphicsView.scene.addItem(item)
159

  
160
                self.ui.lineEditNote.tag = item
161
            else:
162
                self.ui.lineEditNote.tag.setRect(x, y, width, height)
163

  
164
            self.ui.lineEditNote.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
165
        elif self._cmd.tag is self.ui.lineEditHistoryData:
166
            if self.ui.lineEditHistoryData.tag is None:
167
                item = QGraphicsBoundingBoxItem(x, y, width, height)
168
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
169
                self.parent().graphicsView.scene.addItem(item)
170

  
171
                self.ui.lineEditHistoryData.tag = item
172
            else:
173
                self.ui.lineEditHistoryData.tag.setRect(x, y, width, height)
174

  
175
            self.ui.lineEditHistoryData.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
176
        elif self._cmd.tag is self.ui.lineEditUnitArea:
177
            if self.ui.lineEditUnitArea.tag is None:
178
                item = QGraphicsBoundingBoxItem(x, y, width, height)
179
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
180
                self.parent().graphicsView.scene.addItem(item)
181

  
182
                self.ui.lineEditUnitArea.tag = item
183
            else:
184
                self.ui.lineEditUnitArea.tag.setRect(x, y, width, height)
185

  
186
            self.ui.lineEditUnitArea.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
187
        elif self._cmd.tag is self.ui.lineEditDrawingNo:
188
            if self.ui.lineEditDrawingNo.tag is None:
189
                item = QGraphicsBoundingBoxItem(x, y, width, height)
190
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
191
                self.parent().graphicsView.scene.addItem(item)
192

  
193
                self.ui.lineEditDrawingNo.tag = item
194
            else:
195
                self.ui.lineEditDrawingNo.tag.setRect(x, y, width, height)
196

  
197
            self.ui.lineEditDrawingNo.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
198
        elif self._cmd.tag is self.ui.lineEditRevNo:
199
            if self.ui.lineEditRevNo.tag is None:
200
                item = QGraphicsBoundingBoxItem(x, y, width, height)
201
                item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
202
                self.parent().graphicsView.scene.addItem(item)
203

  
204
                self.ui.lineEditRevNo.tag = item
205
            else:
206
                self.ui.lineEditRevNo.tag.setRect(x, y, width, height)
207

  
208
            self.ui.lineEditRevNo.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
209
        elif self._cmd.tag is self.ui.lineEditEquipmentDescArea:
210
            x, y = round(x), round(y)
211
            width, height = round(width), round(height)
212

  
213
            boundingBox = QGraphicsBoundingBoxItem(x, y, width, height)
214
            boundingBox.transfer.onSizeChanged.connect(self.onBoundingBoxChanged)
215
            boundingBox.setPen(QPen(Qt.darkGray, THICKNESS, Qt.SolidLine))
216
            self.parent().graphicsView.scene.addItem(boundingBox)
217

  
218
            strArea = '({},{}),({},{})'.format(x, y, width, height)
219
            self.ui.lineEditEquipmentDescArea.setText(strArea)
220

  
221
            # add item to table widget
222
            docData = AppDocData.instance()
223
            row = self.ui.tableWidgetSpec.rowCount()
224
            self.ui.tableWidgetSpec.setRowCount(row + 1)
225
            item = QTableWidgetItem(docData.imgName)
226
            item.setFlags(Qt.ItemIsEnabled)
227
            self.ui.tableWidgetSpec.setItem(row, 0, item)
228
            item = QTableWidgetItem(strArea)
229
            item.setFlags(Qt.ItemIsEnabled)
230
            item.tag = boundingBox
231
            self.ui.tableWidgetSpec.setItem(row, 1, item)
232
            self.ui.tableWidgetSpec.resizeColumnsToContents()
233
            # up to here
234
        elif self._cmd.tag is self.ui.tableWidgetTitleBlockArea:
235
            x, y = round(x), round(y)
236
            width, height = round(width), round(height)
237

  
238
            boundingBox = QGraphicsBoundingBoxItem(x, y, width, height)
239
            boundingBox.transfer.onSizeChanged.connect(self.onBoundingBoxChanged)
240
            boundingBox.setPen(QPen(Qt.darkCyan, THICKNESS, Qt.SolidLine))
241
            self.parent().graphicsView.scene.addItem(boundingBox)
242

  
243
            # add item to table widget
244
            strArea = '({},{}),({},{})'.format(x, y, width, height)
245
            docData = AppDocData.instance()
246
            row = self.ui.tableWidgetTitleBlockArea.rowCount()
247
            self.ui.tableWidgetTitleBlockArea.setRowCount(row + 1)
248
            item = QTableWidgetItem(str(uuid.uuid4()))
249
            self.ui.tableWidgetTitleBlockArea.setItem(row, 0, item)
250
            item = QTableWidgetItem()
251
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsEditable)
252
            self.ui.tableWidgetTitleBlockArea.setItem(row, 1, item)
253
            item = QTableWidgetItem(strArea)
254
            item.setFlags(Qt.ItemIsEnabled)
255
            item.tag = boundingBox
256
            self.ui.tableWidgetTitleBlockArea.setItem(row, 2, item)
257
            self.ui.tableWidgetTitleBlockArea.resizeColumnsToContents()
258
            # up to here
259
        elif self._cmd.tag is self.ui.lineEditTypicalArea:
260
            x, y = round(x), round(y)
261
            width, height = round(width), round(height)
262

  
263
            boundingBox = QGraphicsBoundingBoxItem(x, y, width, height)
264
            boundingBox.transfer.onSizeChanged.connect(self.onBoundingBoxChanged)
265
            boundingBox.setPen(QPen(Qt.darkCyan, THICKNESS, Qt.SolidLine))
266
            self.parent().graphicsView.scene.addItem(boundingBox)
267

  
268
            # add item to table widget
269
            docData = AppDocData.instance()
270
            row = self.ui.tableWidgetTypicalArea.rowCount()
271
            self.ui.tableWidgetTypicalArea.setRowCount(row + 1)
272
            item = QTableWidgetItem(docData.imgName)
273
            self.ui.tableWidgetTypicalArea.setItem(row, 0, item)
274
            item = QTableWidgetItem(str(uuid.uuid4()))
275
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsEditable)
276
            self.ui.tableWidgetTypicalArea.setItem(row, 1, item)
277
            strArea = '({},{}),({},{})'.format(x, y, width, height)
278
            item = QTableWidgetItem(strArea)
279
            item.setFlags(Qt.ItemIsEnabled)
280
            item.tag = boundingBox
281
            self.ui.tableWidgetTypicalArea.setItem(row, 2, item)
282
            self.ui.tableWidgetTypicalArea.resizeColumnsToContents()
283
            # up to here
284

  
285
        self.parent().graphicsView.command = None
286

  
287
    '''
288
        @brief      display boundingbox's coords when boundingbox's size is changed
289
        @author     humkyung
290
        @date       2018.08.30
291
    '''
292
    def onBoundingBoxChanged(self, boundingBox):
293
        x = boundingBox.rect().left()
294
        y = boundingBox.rect().top()
295
        width = boundingBox.rect().width()
296
        height = boundingBox.rect().height()
297
        if boundingBox is self.ui.lineEditDrawing.tag:
298
            self.ui.lineEditDrawing.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
299
        elif boundingBox is self.ui.lineEditNote.tag:
300
            self.ui.lineEditNote.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
301
        elif boundingBox is self.ui.lineEditHistoryData.tag:
302
            self.ui.lineEditHistoryData.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
303
        elif boundingBox is self.ui.lineEditUnitArea.tag:
304
            self.ui.lineEditUnitArea.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
305
        elif boundingBox is self.ui.lineEditDrawingNo.tag:
306
            self.ui.lineEditDrawingNo.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
307
        elif boundingBox is self.ui.lineEditRevNo.tag:
308
            self.ui.lineEditRevNo.setText('({},{}),({},{})'.format(round(x), round(y), round(width), round(height)))
309
        else:
310
            for row in range(self.ui.tableWidgetSpec.rowCount()):
311
                item = self.ui.tableWidgetSpec.item(row, 1)
312
                if boundingBox == item.tag:
313
                    strArea = '({},{}),({},{})'.format(round(x), round(y), round(width), round(height))
314
                    item.setText(strArea)
315
                    break
316
            for row in range(self.ui.tableWidgetTitleBlockArea.rowCount()):
317
                item = self.ui.tableWidgetTitleBlockArea.item(row, 2)
318
                if boundingBox == item.tag:
319
                    strArea = '({},{}),({},{})'.format(round(x), round(y), round(width), round(height))
320
                    item.setText(strArea)
321
                    break
322

  
64
    
323 65
    '''
324 66
        @brief  accept dialog
325 67
    '''
DTI_PID/DTI_PID/SpecBreak_UI.py
33 33
        self.verticalLayout_3.setObjectName("verticalLayout_3")
34 34
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
35 35
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
36
        self.tableWidgetTitleBlockArea = QtWidgets.QTableWidget(self.groupBoxTitleBlock)
37
        self.tableWidgetTitleBlockArea.setColumnCount(2)
38
        self.tableWidgetTitleBlockArea.setObjectName("tableWidgetTitleBlockArea")
39
        self.tableWidgetTitleBlockArea.setRowCount(0)
40
        self.horizontalLayout_4.addWidget(self.tableWidgetTitleBlockArea)
36
        self.tableWidgetSpec = QtWidgets.QTableWidget(self.groupBoxTitleBlock)
37
        self.tableWidgetSpec.setColumnCount(2)
38
        self.tableWidgetSpec.setObjectName("tableWidgetSpec")
39
        self.tableWidgetSpec.setRowCount(0)
40
        self.horizontalLayout_4.addWidget(self.tableWidgetSpec)
41 41
        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
42 42
        self.gridLayout_4.addLayout(self.verticalLayout_3, 1, 0, 1, 1)
43 43
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
44 44
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
45 45
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
46 46
        self.horizontalLayout_3.addItem(spacerItem)
47
        self.pushButtonAddTitleBlockProp = QtWidgets.QPushButton(self.groupBoxTitleBlock)
48
        self.pushButtonAddTitleBlockProp.setMinimumSize(QtCore.QSize(22, 0))
49
        self.pushButtonAddTitleBlockProp.setMaximumSize(QtCore.QSize(22, 16777215))
50
        self.pushButtonAddTitleBlockProp.setObjectName("pushButtonAddTitleBlockProp")
51
        self.horizontalLayout_3.addWidget(self.pushButtonAddTitleBlockProp)
52
        self.pushButtonDelTitleBlockProp = QtWidgets.QPushButton(self.groupBoxTitleBlock)
53
        self.pushButtonDelTitleBlockProp.setMinimumSize(QtCore.QSize(22, 0))
54
        self.pushButtonDelTitleBlockProp.setMaximumSize(QtCore.QSize(22, 16777215))
55
        self.pushButtonDelTitleBlockProp.setObjectName("pushButtonDelTitleBlockProp")
56
        self.horizontalLayout_3.addWidget(self.pushButtonDelTitleBlockProp)
47
        self.pushButtonAddSpec = QtWidgets.QPushButton(self.groupBoxTitleBlock)
48
        self.pushButtonAddSpec.setMinimumSize(QtCore.QSize(22, 0))
49
        self.pushButtonAddSpec.setMaximumSize(QtCore.QSize(22, 16777215))
50
        self.pushButtonAddSpec.setObjectName("pushButtonAddSpec")
51
        self.horizontalLayout_3.addWidget(self.pushButtonAddSpec)
52
        self.pushButtonDelSpec = QtWidgets.QPushButton(self.groupBoxTitleBlock)
53
        self.pushButtonDelSpec.setMinimumSize(QtCore.QSize(22, 0))
54
        self.pushButtonDelSpec.setMaximumSize(QtCore.QSize(22, 16777215))
55
        self.pushButtonDelSpec.setObjectName("pushButtonDelSpec")
56
        self.horizontalLayout_3.addWidget(self.pushButtonDelSpec)
57 57
        self.gridLayout_4.addLayout(self.horizontalLayout_3, 0, 0, 1, 1)
58 58
        self.gridLayout.addWidget(self.groupBoxTitleBlock, 1, 0, 1, 1)
59 59

  
......
66 66
        _translate = QtCore.QCoreApplication.translate
67 67
        SpecBreak.setWindowTitle(_translate("SpecBreak", "SpecBreak"))
68 68
        self.groupBoxTitleBlock.setTitle(_translate("SpecBreak", "Specs"))
69
        self.pushButtonAddTitleBlockProp.setText(_translate("SpecBreak", "+"))
70
        self.pushButtonDelTitleBlockProp.setText(_translate("SpecBreak", "-"))
69
        self.pushButtonAddSpec.setText(_translate("SpecBreak", "+"))
70
        self.pushButtonDelSpec.setText(_translate("SpecBreak", "-"))
71 71

  
72 72
import MainWindow_rc
73 73

  
DTI_PID/DTI_PID/UI/SpecBreak.ui
44 44
        <item>
45 45
         <layout class="QHBoxLayout" name="horizontalLayout_4">
46 46
          <item>
47
           <widget class="QTableWidget" name="tableWidgetTitleBlockArea">
47
           <widget class="QTableWidget" name="tableWidgetSpec">
48 48
            <property name="columnCount">
49 49
             <number>2</number>
50 50
            </property>
......
72 72
         </spacer>
73 73
        </item>
74 74
        <item>
75
         <widget class="QPushButton" name="pushButtonAddTitleBlockProp">
75
         <widget class="QPushButton" name="pushButtonAddSpec">
76 76
          <property name="minimumSize">
77 77
           <size>
78 78
            <width>22</width>
......
91 91
         </widget>
92 92
        </item>
93 93
        <item>
94
         <widget class="QPushButton" name="pushButtonDelTitleBlockProp">
94
         <widget class="QPushButton" name="pushButtonDelSpec">
95 95
          <property name="minimumSize">
96 96
           <size>
97 97
            <width>22</width>

내보내기 Unified diff

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