개정판 b887508e
issue #481: 검증 - upload ValidateCommand.py file
Change-Id: I83900260c115fc15d16eeea58198d68bd4caebad
DTI_PID/DTI_PID/Commands/ValidateCommand.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is validate command module """ |
|
3 |
|
|
4 |
import os.path |
|
5 |
import AbstractCommand |
|
6 |
try: |
|
7 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
|
8 |
from PyQt5.QtGui import QApplication, QImage, QPixmap, QPainterPath, QCursor |
|
9 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog |
|
10 |
except ImportError: |
|
11 |
try: |
|
12 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
|
13 |
from PyQt4.QtGui import QApplication, QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor |
|
14 |
except ImportError: |
|
15 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
16 |
|
|
17 |
class ValidateCommand(AbstractCommand.AbstractCommand): |
|
18 |
def __init__(self, imageViewer): |
|
19 |
super(ValidateCommand, self).__init__(imageViewer) |
|
20 |
self.name = 'Validate' |
|
21 |
|
|
22 |
def execute(self, param): |
|
23 |
""" valite all items in scene """ |
|
24 |
from EngineeringLineItem import QEngineeringLineItem |
|
25 |
from SymbolSvgItem import SymbolSvgItem |
|
26 |
|
|
27 |
QApplication.setOverrideCursor(Qt.WaitCursor) |
|
28 |
|
|
29 |
errors = [] |
|
30 |
try: |
|
31 |
for item in param: |
|
32 |
if type(item) is QEngineeringLineItem or issubclass(type(item), SymbolSvgItem): |
|
33 |
errors.extend(item.validate()) |
|
34 |
finally: |
|
35 |
QApplication.restoreOverrideCursor() |
|
36 |
|
|
37 |
return errors |
|
38 |
|
|
39 |
def undo(self): |
|
40 |
pass |
|
41 |
|
|
42 |
def redo(self): |
|
43 |
pass |
내보내기 Unified diff