프로젝트

일반

사용자정보

개정판 5f7d5696

ID5f7d5696b9a5dc4c41d2ab7ed808e21983a42cab
상위 09677d4f
하위 08184d28, 5b07e04b

김연진이(가) 5년 이상 전에 추가함

issue #1048 : 화면/메뉴/툴바 개발 - Exception 발생 시 MainWindow 의 Logs 에 기록

Change-Id: If9767060d1f756e183c3669d067f1f0dd9299f9d

차이점 보기:

HYTOS/HYTOS/AppDocData.py
185 185
                conn.commit()
186 186
        # Catch the exception
187 187
        except Exception as ex:
188
            from App import App
188 189
            # Roll back any change if something goes wrong
189 190
            conn.rollback()
190
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
191

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

  
192 195
    '''
193 196
        @brief  load app style
......
231 234
                    res.append((row[0], row[1], row[2], row[3], row[4], row[5]))
232 235
            # Catch the exception
233 236
            except Exception as ex:
237
                from App import App
234 238
                # Roll back any change if something goes wrong
235 239
                conn.rollback()
236
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
240

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

  
238 244
        return res
239 245

  
......
259 265
                res.append((row[0], row[1], row[2]))
260 266
        # Catch the exception
261 267
        except Exception as ex:
268
            from App import App
262 269
            # Roll back any change if something goes wrong
263 270
            conn.rollback()
264
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
271

  
272
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
273
            App.mainWnd().addMessage.emit(MessageType.Error, message)
265 274
        finally:
266 275
            # Close the db connection
267 276
            conn.close()
......
285 294
                    res.append((row[0], row[1]))
286 295
            # Catch the exception
287 296
            except Exception as ex:
297
                from App import App
288 298
                # Roll back any change if something goes wrong
289 299
                conn.rollback()
290
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
291 300

  
301
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
302
                App.mainWnd().addMessage.emit(MessageType.Error, message)
292 303
        return res
293 304

  
294 305
    def getNominalDiameter(self):        
......
309 320
                    res.append((row[0], row[1], row[2]))
310 321
            # Catch the exception
311 322
            except Exception as ex:
323
                from App import App
324

  
312 325
                # Roll back any change if something goes wrong
313 326
                conn.rollback()
314
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
315 327

  
328
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
329
                App.mainWnd().addMessage.emit(MessageType.Error, message)
316 330
        return res
317 331

  
318 332
    
......
346 360
                res.append(Config(row[0], row[1], row[2]))
347 361
        # Catch the exception
348 362
        except Exception as ex:
363
            from App import App
349 364
            # Roll back any change if something goes wrong
350 365
            conn.rollback()
351
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
366

  
367
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
368
            App.mainWnd().addMessage.emit(MessageType.Error, message)
352 369
        finally:
353 370
            # Close the db connection
354 371
            conn.close()
......
384 401
                res.append(Config(row[0], row[1], row[2]))
385 402
        # Catch the exception
386 403
        except Exception as ex:
404
            from App import App
405
            
387 406
            # Roll back any change if something goes wrong
388 407
            conn.rollback()
389
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
408

  
409
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
410
            App.mainWnd().addMessage.emit(MessageType.Error, message)
390 411
        finally:
391 412
            # Close the db connection
392 413
            conn.close()
......
420 441
            conn.commit()
421 442
        # Catch the exception
422 443
        except Exception as ex:
444
            from App import App
423 445
            # Roll back any change if something goes wrong
424 446
            conn.rollback()
425
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
447

  
448
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
449
            App.mainWnd().addMessage.emit(MessageType.Error, message)
426 450
        finally:
427 451
            # Close the db connection
428 452
            conn.close()
......
453 477
            conn.commit()
454 478
        # Catch the exception
455 479
        except Exception as ex:
480
            from App import App
456 481
            # Roll back any change if something goes wrong
457 482
            conn.rollback()
458
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
483

  
484
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
485
            App.mainWnd().addMessage.emit(MessageType.Error, message)
459 486
        finally:
460 487
            # Close the db connection
461 488
            conn.close()
......
474 501
            conn.commit()
475 502
        # Catch the exception
476 503
        except Exception as ex:
504
            from App import App
477 505
            # Roll back any change if something goes wrong
478 506
            conn.rollback()
479
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
507
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
508
            App.mainWnd().addMessage.emit(MessageType.Error, message)
480 509
        finally:
481 510
            # Close the db connection
482 511
            conn.close()
......
497 526
                conn.commit()
498 527
            # Catch the exception
499 528
            except Exception as ex:
529
                from App import App
500 530
                # Roll back any change if something goes wrong
501 531
                conn.rollback()
502
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
503 532

  
533
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
534
                App.mainWnd().addMessage.emit(MessageType.Error, message)
504 535
    
505 536
    def deleteAppConfigs(self, section, key=None):
506 537
        """
......
526 557
            conn.commit()
527 558
        # Catch the exception
528 559
        except Exception as ex:
560
            from App import App
561

  
529 562
            # Roll back any change if something goes wrong
530 563
            conn.rollback()
531
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
564

  
565
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
566
            App.mainWnd().addMessage.emit(MessageType.Error, message)
532 567
        finally:
533 568
            # Close the db connection
534 569
            conn.close()
......
563 598
                    symbolTuple = rows[0]
564 599
                    ret = symbol.SymbolBase(symbolTuple[0], symbolTuple[1], symbolTuple[2], symbolTuple[3], symbolTuple[4], symbolTuple[5]) 
565 600
            except Exception as ex:
566
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
601
                from App import App
602

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

  
568 606
        return ret
569 607

  
......
596 634
                                                
597 635
                        ret.append(sym)
598 636
            except Exception as ex:
599
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
637
                from App import App
638

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

  
601 642
        return ret
602 643

  
......
629 670
                res.append((row[0], row[1], row[2], row[3], row[4], row[5]))
630 671
        # Catch the exception
631 672
        except Exception as ex:
673
            from App import App
674

  
632 675
            # Roll back any change if something goes wrong
633 676
            conn.rollback()
634
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
677

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

  
635 681
        finally:
636 682
            # Close the db connection
637 683
            conn.close()
......
674 720
                conn.rollback()
675 721

  
676 722
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
677
                print(message)
678
                print(sql)
679
                App.mainWnd().addMessage.emit(MessageType.Error, message)
723
                App.mainWnd().addMessage.emit(MessageType.Error, message)                
680 724

  
681 725
   
682 726
    def getDrawings(self):
......
1004 1048
                if rows is not None and len(rows) > 0:
1005 1049
                    category = rows[0][0]
1006 1050
            except Exception as ex:
1007
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
1051
                from App import App
1052

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

  
1009 1056
        return category
1010 1057

  
HYTOS/HYTOS/Commands/DefaultCommand.py
227 227

  
228 228
            QApplication.instance().setOverrideCursor(QCursor(Qt.DragCopyCursor))
229 229
        except Exception as ex:
230
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
231
        
230
            from App import App
231
            from AppDocData import MessageType
232
            
233
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
234
            App.mainWnd().addMessage.emit(MessageType.Error, message)
235
            
HYTOS/HYTOS/Commands/HydroCalculationCommand.py
45 45
            for loop in self.loops:
46 46
                loop.calculate()
47 47
        except Exception as ex:
48
            from App import App
49
            from AppDocData import MessageType
50

  
48 51
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
49
            print('{}'.format(message))
52
            App.mainWnd().addMessage.emit(MessageType.Error, message)            
50 53

  
51 54
    def make_loop(self, loop):
52 55
        """ make a loop """
......
77 80
                        else:
78 81
                            break
79 82
        except Exception as ex:
83
            from App import App
84
            from AppDocData import MessageType
85
            
80 86
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
81
            print('{}'.format(message)) 
87
            App.mainWnd().addMessage.emit(MessageType.Error, message)
82 88
        finally:
83 89
            loop.name = 'Loop{}'.format(len(self.loops) + 1)
84 90
            self.loops.append(loop)
HYTOS/HYTOS/Commands/SaveWorkCommand.py
45 45
                drawing[0][2] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
46 46
                appDocData.updateDrawing(drawing)
47 47
        except Exception as ex:
48
            from AppDocData import MessageType
48
            from App import App
49 49

  
50 50
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
51
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
52
            self.display_message.emit(MessageType.Error, message)
53

  
51
            App.mainWnd().addMessage.emit(MessageType.Error, message)
52
            
54 53
    @staticmethod
55 54
    def save_to_database():
56 55
        """ save recognized items to database """
......
98 97
            self.resultStr = SaveWorkCommand.save_to_database()
99 98

  
100 99
        except Exception as ex:
101
            from AppDocData import MessageType
100
            from App import App
102 101

  
103
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
104
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
105
            self.display_message.emit(MessageType.Error, message)
102
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
103
                App.mainWnd().addMessage.emit(MessageType.Error, message)
HYTOS/HYTOS/ConfigurationDialog.py
125 125
            self.ui.comboBox_Decimal.setCurrentIndex(9)
126 126

  
127 127
        except Exception as ex:
128
            from App import App
129
            from AppDocData import MessageType
130

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

  
131 134

  
132 135
    def load_data(self):
......
195 198
                        if index > -1:
196 199
                            self.ui.comboBox_Roughness.setCurrentIndex(index)
197 200
        except Exception as ex:
201
            from App import App
202
            from AppDocData import MessageType
203
            
198 204
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
199
            self.addMessage.emit(MessageType.Error, message)
205
            App.mainWnd().addMessage.emit(MessageType.Error, message)
200 206

  
201 207

  
202 208
    def getIndexByValue(self, control, value):
HYTOS/HYTOS/HMBTable.py
480 480
                        self._hmbs.append(hmb)
481 481
                # Catch the exception
482 482
                except Exception as ex:
483
                    from App import App
484
                    from AppDocData import MessageType
485

  
483 486
                    # Roll back any change if something goes wrong
484 487
                    conn.rollback()
485
                    print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
488
                    
489
                    message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
490
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
486 491

  
487 492
        return self._hmbs
488 493
        
......
530 535
                conn.commit()
531 536
            # Catch the exception
532 537
            except Exception as ex:
538
                from App import App
539
                from AppDocData import MessageType
540

  
533 541
                # Roll back any change if something goes wrong
534 542
                conn.rollback()
535
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
543
                
544
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
545
                App.mainWnd().addMessage.emit(MessageType.Error, message)
536 546

  
537 547
    '''
538 548
        @brief      return stream no collection which are not duplicated 
HYTOS/HYTOS/MainWindow.py
68 68
            self._label_mouse = QLabel(self.statusbar)
69 69
            self._label_mouse.setText(self.tr('mouse pos : ({},{})'.format(0,0)))
70 70
            self.statusbar.addWidget(self._label_mouse)
71
            self.addMessage.connect(self.onAddMessage)
71 72
            self.showMaximized()
72 73

  
73 74
            self.setMainWindowTitle()
......
105 106
            self.actionZoom.triggered.connect(self.onAreaZoom)
106 107
            self.actionFitWindow.triggered.connect(self.fitWindow)           
107 108
            self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged)        
108
            self.addMessage.connect(self.onAddMessage)
109
            
109 110
            
110 111
            self.treeWidgetDrawingList.setContextMenuPolicy(Qt.CustomContextMenu)
111 112
            self.treeWidgetDrawingList.customContextMenuRequested.connect(self.openContextMenu)
......
118 119
            self.load_stylesheet_file()
119 120
            self.load_language_file()        
120 121
        except Exception as ex:
121
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
122
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
123
            self.addMessage.emit(MessageType.Error, message)
122 124
        
123 125
    def load_stylesheet_file(self):
124 126
        # load stylesheet file list
......
238 240

  
239 241
        return QWidget.eventFilter(self, source, event)
240 242

  
241
    def inconsistencyTableKeyPressEvent(self, event):
242
        try:
243
            row = self.tableWidgetHMB.selectedIndexes()[0].row()
244
            col = self.tableWidgetHMB.selectedIndexes()[0].column()
245
            from HighlightCommand import HighlightCommand
246
            if event.key() == Qt.Key_Up:
247
                if row is not 0:
248
                    errorItem = self.tableWidgetHMB.item(row - 1, 1).tag
249
                    HighlightCommand(self.graphicsView).execute(errorItem)
250
            elif event.key() == Qt.Key_Down:
251
                if row is not self.tableWidgetHMB.rowCount() - 1:
252
                    errorItem = self.tableWidgetHMB.item(row + 1, 1).tag
253
                    HighlightCommand(self.graphicsView).execute(errorItem)
254
        except Exception as ex:
255
            pass
256
        #finally:
257
        #    return QTableView.keyPressEvent(self.tableWidgetHMB, event)
258
   
259

  
260 243
    def load_stylesheet(self, file):
261 244
        """
262 245
        @brief  load stylesheets
HYTOS/HYTOS/MainWindow_UI.py
2 2

  
3 3
# Form implementation generated from reading ui file '.\UI\MainWindow.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.12.3
5
# Created by: PyQt5 UI code generator 5.13.0
6 6
#
7 7
# WARNING! All changes made in this file will be lost!
8 8

  
HYTOS/HYTOS/QEquipmentDataListDialog.py
72 72

  
73 73
            docData.setEquipmentDataList(dataList)
74 74
        except Exception as ex:
75
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
75
            from App import App
76
            from AppDocData import MessageType
77
            
78
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
79
            App.mainWnd().addMessage.emit(MessageType.Error, message)
76 80

  
77 81
        QDialog.accept(self)
HYTOS/HYTOS/QInstrumentDataListDialog.py
72 72

  
73 73
            docData.setEquipmentDataList(dataList)
74 74
        except Exception as ex:
75
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
75
            from App import App
76
            from AppDocData import MessageType
77
            
78
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
79
            App.mainWnd().addMessage.emit(MessageType.Error, message)
76 80

  
77 81
        QDialog.accept(self)
HYTOS/HYTOS/QLineDataListDialog.py
72 72

  
73 73
            docData.setEquipmentDataList(dataList)
74 74
        except Exception as ex:
75
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
75
            from App import App
76
            from AppDocData import MessageType
77
            
78
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
79
            App.mainWnd().addMessage.emit(MessageType.Error, message)
76 80

  
77 81
        QDialog.accept(self)
HYTOS/HYTOS/QtImageViewer.py
178 178
            self.setSceneRect(QRectF(pixmap.rect()))  # Set scene size to image size.
179 179
            self.updateViewer()
180 180
        except Exception as ex:
181
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
181
            from App import App
182
            from AppDocData import MessageType
183
            
184
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
185
            App.mainWnd().addMessage.emit(MessageType.Error, message)
182 186

  
183 187
    '''
184 188
        @brief  open a image file selected by user
......
202 206
                image = QImage(fileName, format = None)
203 207
                self.setImage(image)
204 208
        except Exception as ex:
205
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
209
            from App import App
210
            from AppDocData import MessageType
211
            
212
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
213
            App.mainWnd().addMessage.emit(MessageType.Error, message)
206 214

  
207 215
        return fileName
208 216

  
......
286 294
                    QGraphicsView.mouseMoveEvent(self, event)
287 295
                if self.command.isTreated == True: return
288 296
        except Exception as ex:
289
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
297
            from App import App
298
            from AppDocData import MessageType
299
            
300
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
301
            App.mainWnd().addMessage.emit(MessageType.Error, message)
290 302

  
291 303
        if self.guidesEnabled:
292 304
            self.coords = self.mapToScene(event.pos())
......
307 319
                self.command.execute(['mousePressEvent', event, scenePos])
308 320
                if self.command.isTreated == True: return
309 321
        except Exception as ex:
310
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
322
            from App import App
323
            from AppDocData import MessageType
324
            
325
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
326
            App.mainWnd().addMessage.emit(MessageType.Error, message)
311 327

  
312 328
        if event.button() != Qt.RightButton:
313 329
            QGraphicsView.mousePressEvent(self, event)
......
333 349
                    QApplication.instance().setOverrideCursor(cursor)
334 350
                    return
335 351
        except Exception as ex:
336
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
352
            from App import App
353
            from AppDocData import MessageType
354
            
355
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
356
            App.mainWnd().addMessage.emit(MessageType.Error, message)
337 357

  
338 358
        QGraphicsView.mouseReleaseEvent(self, event)
339 359
    
......
357 377
        QGraphicsView.mouseDoubleClickEvent(self, event)
358 378

  
359 379
    '''
360
        @brief      key press event
361
        @author     Jeongwoo
362
        @date       2018.??.??
363
        @history    send escape key event to command
364
    
365
    def keyPressEvent(self, event):
366
        try:
367
            if event.key() == Qt.Key_Delete:
368
                for item in [item for item in self.scene.selectedItems() if hasattr(item, 'transfer')]:
369
                    item.transfer.onRemoved.emit(item)
370
            elif event.key() == Qt.Key_Escape:
371
                if self.command is not None:
372
                    self.command.execute(['keyPressEvent', event, []])
373
                    if self.command.isTreated: return
374
            else:
375
                if self.command is not None:
376
                    self.command.execute(['keyPressEvent', event, []])
377
                    if self.command.isTreated: return
378
            
379
            QGraphicsView.keyPressEvent(self, event)
380
        except Exception as ex:
381
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
382
    '''
383

  
384
    '''
385 380
        @brief  key release event
386 381
        @author Jeongwoo
387 382
        @date   2018.??.??
......
627 622
            from PyQt4.QtGui import QApplication
628 623
        except ImportError:
629 624
            raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
630
    print('Using Qt ' + QT_VERSION_STR)
631 625

  
632 626
    def handleLeftClick(x, y):
633 627
        row = int(y)
634 628
        column = int(x)
635
        print("Clicked on image pixel (row="+str(row)+", column="+str(column)+")")
636 629

  
637 630
    # Create the application.
638 631
    app = QApplication(sys.argv)
HYTOS/HYTOS/Shapes/EngineeringGuidelineItem.py
49 49
            pen.setWidthF(0.5)
50 50
            self.setPen(pen)
51 51
        except Exception as ex:
52
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
52
            from App import App
53
            from AppDocData import MessageType
54
            
55
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
56
            App.mainWnd().addMessage.emit(MessageType.Error, message)
53 57

  
54 58
    '''
55 59
        @brief  return start point
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py
55 55

  
56 56
                self.press_drops[self.items[i]] = self.items[i].press_drop
57 57
        except Exception as ex:
58
            from App import App
59
            from AppDocData import MessageType
60
            
58 61
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
59
            print('{}'.format(message))
62
            App.mainWnd().addMessage.emit(MessageType.Error, message)
60 63

  
61 64
class Transfer(QObject):
62 65
    onRemoved = pyqtSignal(QGraphicsItem)
HYTOS/HYTOS/Shapes/EngineeringPolylineItem.py
54 54
            self._drawing_mode = QEngineeringPolylineItem.AXIS_MODE
55 55

  
56 56
        except Exception as ex:
57
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
57
            from App import App
58
            from AppDocData import MessageType
59
            
60
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
61
            App.mainWnd().addMessage.emit(MessageType.Error, message)
58 62

  
59 63
    @property
60 64
    def drawing_mode(self):
HYTOS/HYTOS/Shapes/EngineeringRunItem.py
146 146

  
147 147
            if maxLengthItem is not None: maxLengthItem.addFlowArrow()
148 148
        except Exception as ex:
149
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
149
            from App import App
150
            from AppDocData import MessageType
151
            
152
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
153
            App.mainWnd().addMessage.emit(MessageType.Error, message)
150 154

  
151 155
    '''
152 156
        @brief  write to xml
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py
56 56
            self.transfer.onRemoved.connect(self.on_item_removed)
57 57
            self.setZValue(QEngineeringStreamlineItem.ZVALUE)
58 58
        except Exception as ex:
59
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
59
            from App import App
60
            from AppDocData import MessageType
61
            
62
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
63
            App.mainWnd().addMessage.emit(MessageType.Error, message)
60 64

  
61 65
    def __repr__(self):
62 66
        """ return string represents stream line item """
HYTOS/HYTOS/Shapes/EngineeringTextItem.py
433 433
                        if (conn is not None) and (conn not in visited): pool.append(conn)
434 434
                # up to here
435 435
        except Exception as ex:
436
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
436
            from App import App
437
            from AppDocData import MessageType
438
            
439
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
440
            App.mainWnd().addMessage.emit(MessageType.Error, message)
437 441

  
438 442
        return visited
439 443
    
HYTOS/HYTOS/Shapes/SymbolSvgItem.py
78 78

  
79 79
            self._color = self.get_attribute('fill')
80 80
        except Exception as ex:
81
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
81
            from App import App
82
            from AppDocData import MessageType
83
            
84
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
85
            App.mainWnd().addMessage.emit(MessageType.Error, message)
82 86
        finally:
83 87
            f.close()
84 88

  
......
860 864

  
861 865
            app_doc_data = AppDocData.instance()
862 866
            svgFilePath = os.path.join(app_doc_data.symbol_file_path, category, _type, name + '.svg')
867

  
863 868
            if os.path.isfile(svgFilePath):
864 869
                item = SymbolSvgItem.createItem(_type, svgFilePath, uid)
865 870
                item.setVisible(False)
HYTOS/HYTOS/TextItemFactory.py
212 212
            else:
213 213
                return (False,)
214 214
        except Exception as ex:
215
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))       
215
            from App import App
216
            from AppDocData import MessageType
217
            
218
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
219
            App.mainWnd().addMessage.emit(MessageType.Error, message)
216 220
            
217 221
    '''
218 222
        @brief      Check Number
......
251 255
            else:
252 256
                return (False,)
253 257
        except Exception as ex:
254
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))       
258
            from App import App
259
            from AppDocData import MessageType
260
            
261
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
262
            App.mainWnd().addMessage.emit(MessageType.Error, message)
255 263

  
256 264
    '''
257 265
        @brief      Check if given text is Note No Text (ex : NOTE 1, NOTE 2, ...)

내보내기 Unified diff

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