프로젝트

일반

사용자정보

개정판 eea44d8f

IDeea44d8f06ad8946253d5a1678c7f15ea7125b7d
상위 5c59ae39
하위 e57134bc, 6b3cb476

백흠경이(가) 5년 이상 전에 추가함

issue #663: fixed a routine recognizing text from image

Change-Id: I6360bae8fe30c0863a5fb0dfa15fee64f2970af3

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
217 217
        self.actionSpecialItemTypes.triggered.connect(self.on_show_special_item_types)  # show special item types dialog
218 218
        self.actionDataTransfer.triggered.connect(self.on_show_data_transfer)  # show data transfer dialog
219 219
        self.actionDataExport.triggered.connect(self.on_show_data_export)
220
        self.actionExportEqpDatasheet.triggered.connect(self.on_show_eqp_datasheet_export)  # show eqp datasheet export dialog
220
        self.actionExportEqpDatasheet.triggered.connect(
221
            self.on_show_eqp_datasheet_export)  # show eqp datasheet export dialog
221 222
        self.actionOPCRelation.triggered.connect(self.on_show_opc_relation)  # show OPC Relation dialog
222 223
        self.actionCodeTable.triggered.connect(self.onShowCodeTable)
223 224
        self.actionImage_Drawing.triggered.connect(self.onViewImageDrawing)
......
308 309
        return QWidget.eventFilter(self, source, event)
309 310

  
310 311
    def closeEvent(self, event):
312
        """ close main window """
311 313
        AppDocData.instance().clear()
312 314

  
313 315
    def inconsistencyTableKeyPressEvent(self, event):
......
480 482

  
481 483
            appDocData.saveDrawings(drawings)
482 484
        except Exception as ex:
483
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
485
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
484 486
                                                          sys.exc_info()[-1].tb_lineno)
485 487
            self.addMessage.emit(MessageType.Error, message)
486 488

  
......
841 843
            dialog = QSymbolThicknessDialog(self)
842 844
            dialog.exec_()
843 845
        except Exception as ex:
844
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
846
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
847
                                                          sys.exc_info()[-1].tb_lineno)
845 848
            self.addMessage.emit(MessageType.Error, message)
846
        
849

  
847 850
    def on_help(self):
848 851
        """ open help file """
849 852
        import os
......
1228 1231
        from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse
1229 1232

  
1230 1233
        try:
1231
            appDocData = AppDocData.instance()
1232
            project = appDocData.getCurrentProject()
1234
            app_doc_data = AppDocData.instance()
1235
            project = app_doc_data.getCurrentProject()
1233 1236

  
1234 1237
            self.path = self.graphicsView.loadImageFromFile(project.getDrawingFilePath(),
1235 1238
                                                            path if type(path) is str else '')
1236 1239
            if os.path.isfile(self.path):
1237 1240
                self.onCommandRejected()
1238
                appDocData.clear()
1241
                app_doc_data.clear()
1239 1242

  
1240
                appDocData.setImgFilePath(self.path)
1241
                appDocData.activeDrawing = Drawing(None, appDocData.imgName, None)
1242
                if not appDocData.set_occupying_drawing(appDocData.activeDrawing.UID):
1243
                app_doc_data.setImgFilePath(self.path)
1244
                app_doc_data.activeDrawing = Drawing(None, app_doc_data.imgName, None)
1245
                if not app_doc_data.set_occupying_drawing(app_doc_data.activeDrawing.UID):
1243 1246
                    QMessageBox.about(self.graphicsView, self.tr("Notice"),
1244 1247
                                      self.tr("The drawing is locked for editing by another user"))
1245 1248
                    return
1246
                appDocData.activeDrawing.set_pid_source(Image.open(self.path))
1247
                self.itemTreeWidget.setCurrentPID(appDocData.activeDrawing.name)
1249
                app_doc_data.activeDrawing.set_pid_source(Image.open(self.path))
1250
                self.itemTreeWidget.setCurrentPID(app_doc_data.activeDrawing.name)
1248 1251

  
1249 1252
                drawingList = self.treeWidgetDrawingList.topLevelItem(0)
1250 1253
                for childIdex in range(drawingList.childCount()):
1251 1254
                    drawingList.child(childIdex).setCheckState(0, Qt.Unchecked)
1252 1255
                for childIdex in range(drawingList.childCount()):
1253 1256
                    child = drawingList.child(childIdex)
1254
                    if child.text(0).replace('.png', '') == appDocData.activeDrawing.name:
1257
                    if child.text(0).replace('.png', '') == app_doc_data.activeDrawing.name:
1255 1258
                        child.setCheckState(0, Qt.Checked)
1256 1259
                        break
1257 1260

  
1258 1261
                try:
1259 1262
                    self.show_Progress_bar()
1260
                    ## Load data
1261
                    path = os.path.join(appDocData.getCurrentProject().getTempPath(), appDocData.imgName + '.xml')
1262
                    configs = appDocData.getConfigs('Data Load', 'Xml First')
1263
                    # Load data
1264
                    path = os.path.join(app_doc_data.getCurrentProject().getTempPath(), app_doc_data.imgName + '.xml')
1265
                    configs = app_doc_data.getConfigs('Data Load', 'Xml First')
1263 1266
                    if configs and int(configs[0].value) is 1 and os.path.isfile(path):
1264 1267
                        self.loadRecognitionResultFromXml(path)
1265 1268
                    else:
1266
                        self.load_drawing(appDocData.activeDrawing)
1269
                        self.load_drawing(app_doc_data.activeDrawing)
1267 1270
                finally:
1268 1271
                    if hasattr(self, 'progress'):
1269 1272
                        self.progress.setValue(self.progress.maximum())
......
1271 1274

  
1272 1275
                self.changeViewCheckedState(True)
1273 1276
        except Exception as ex:
1274
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1275
                                                          sys.exc_info()[-1].tb_lineno)
1277
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1278
                                                           sys.exc_info()[-1].tb_lineno)
1276 1279
            self.addMessage.emit(MessageType.Error, message)
1277 1280

  
1278 1281
        return self.path

내보내기 Unified diff

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