프로젝트

일반

사용자정보

개정판 e17d4c6f

IDe17d4c6f4dfd851d4590b15a094f0883033b5628
상위 8aee9f19
하위 81d2706d

함의성이(가) 7달 전에 추가함

add size text validation

Change-Id: Ia828d7abe03160f24cf50e30944dfb9e9f0abb02

차이점 보기:

DTI_PID/DTI_PID/Commands/ValidateCommand.py
41 41
    AssociationError = 1
42 42

  
43 43
    TextOverlappingWarning = 2
44
    NoOwnerWarning = 3
44 45

  
45 46
class LineValidation(Enum):
46 47
    LineTypeError = 1
DTI_PID/DTI_PID/Shapes/QEngineeringSizeTextItem.py
43 43
    @property
44 44
    def sizeDelimiter(self):
45 45
        return self._sizeDelimiter if len(self.mainSubSize) == 2 else ''
46
    
47
    def validate(self, rules):
48
        """ validation check """
49

  
50
        from EngineeringLineItem import QEngineeringLineItem
51
        from ValidateCommand import TextValidation
52

  
53
        errors = []
54

  
55
        try:
56
            app_doc_data = AppDocData.instance()
57
            dataPath = app_doc_data.getErrorItemSvgPath()
58

  
59
            _error = super().validate(rules)
60
            errors.extend(_error)
61

  
62
            if TextValidation.NoOwnerWarning in rules:
63
                if not self.owner:
64
                    error = SymbolSvgItem.createItem('Error', None, dataPath)
65
                    error.parent = self
66
                    error.msg = self.tr('No owner warning')
67
                    error.setToolTip(error.msg)
68
                    error.area = self.area
69
                    error.name = 'Warning'
70
                    errors.append(error)
71

  
72
                    error.setPosition([self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()])
73
        except Exception as ex:
74
            from App import App
75
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
76
                                                          sys.exc_info()[-1].tb_lineno)
77
            App.mainWnd().addMessage.emit(MessageType.Error, message)
78

  
79
        return errors
46 80

  
47 81
    def findOwner(self, symbols, force=False):
48 82
        import math
DTI_PID/DTI_PID/UI/Validation.ui
22 22
     <layout class="QGridLayout" name="gridLayout_7">
23 23
      <item row="0" column="0">
24 24
       <layout class="QGridLayout" name="gridLayout_6">
25
        <item row="1" column="0">
26
         <widget class="QCheckBox" name="checkBoxT_1">
27
          <property name="text">
28
           <string>Association error</string>
29
          </property>
30
         </widget>
31
        </item>
25 32
        <item row="0" column="0">
26 33
         <widget class="QLabel" name="label_3">
27 34
          <property name="font">
......
35 42
          </property>
36 43
         </widget>
37 44
        </item>
38
        <item row="1" column="0">
39
         <widget class="QCheckBox" name="checkBoxT_1">
40
          <property name="text">
41
           <string>Association error</string>
42
          </property>
43
         </widget>
44
        </item>
45 45
        <item row="2" column="0">
46 46
         <widget class="QLabel" name="label_4">
47 47
          <property name="font">
......
62 62
          </property>
63 63
         </widget>
64 64
        </item>
65
        <item row="3" column="1">
66
         <widget class="QCheckBox" name="checkBoxT_3">
67
          <property name="text">
68
           <string>No owner warning</string>
69
          </property>
70
         </widget>
71
        </item>
65 72
       </layout>
66 73
      </item>
67 74
     </layout>
......
494 501
  <tabstop>checkBoxS_16</tabstop>
495 502
  <tabstop>checkBoxT_1</tabstop>
496 503
  <tabstop>checkBoxT_2</tabstop>
504
  <tabstop>checkBoxT_3</tabstop>
497 505
  <tabstop>checkBoxL_1</tabstop>
498 506
  <tabstop>checkBoxL_2</tabstop>
499 507
  <tabstop>checkBoxL_3</tabstop>
DTI_PID/DTI_PID/UI/Validation_UI.py
23 23
        self.gridLayout_7.setObjectName("gridLayout_7")
24 24
        self.gridLayout_6 = QtWidgets.QGridLayout()
25 25
        self.gridLayout_6.setObjectName("gridLayout_6")
26
        self.checkBoxT_1 = QtWidgets.QCheckBox(self.groupBox_2)
27
        self.checkBoxT_1.setObjectName("checkBoxT_1")
28
        self.gridLayout_6.addWidget(self.checkBoxT_1, 1, 0, 1, 1)
26 29
        self.label_3 = QtWidgets.QLabel(self.groupBox_2)
27 30
        font = QtGui.QFont()
28 31
        font.setBold(False)
......
30 33
        self.label_3.setFont(font)
31 34
        self.label_3.setObjectName("label_3")
32 35
        self.gridLayout_6.addWidget(self.label_3, 0, 0, 1, 1)
33
        self.checkBoxT_1 = QtWidgets.QCheckBox(self.groupBox_2)
34
        self.checkBoxT_1.setObjectName("checkBoxT_1")
35
        self.gridLayout_6.addWidget(self.checkBoxT_1, 1, 0, 1, 1)
36 36
        self.label_4 = QtWidgets.QLabel(self.groupBox_2)
37 37
        font = QtGui.QFont()
38 38
        font.setBold(False)
......
43 43
        self.checkBoxT_2 = QtWidgets.QCheckBox(self.groupBox_2)
44 44
        self.checkBoxT_2.setObjectName("checkBoxT_2")
45 45
        self.gridLayout_6.addWidget(self.checkBoxT_2, 3, 0, 1, 1)
46
        self.checkBoxT_3 = QtWidgets.QCheckBox(self.groupBox_2)
47
        self.checkBoxT_3.setObjectName("checkBoxT_3")
48
        self.gridLayout_6.addWidget(self.checkBoxT_3, 3, 1, 1, 1)
46 49
        self.gridLayout_7.addLayout(self.gridLayout_6, 0, 0, 1, 1)
47 50
        self.gridLayout_2.addWidget(self.groupBox_2, 2, 0, 1, 1)
48 51
        self.groupBox_4 = QtWidgets.QGroupBox(ValidationDialog)
......
259 262
        ValidationDialog.setTabOrder(self.checkBoxS_15, self.checkBoxS_16)
260 263
        ValidationDialog.setTabOrder(self.checkBoxS_16, self.checkBoxT_1)
261 264
        ValidationDialog.setTabOrder(self.checkBoxT_1, self.checkBoxT_2)
262
        ValidationDialog.setTabOrder(self.checkBoxT_2, self.checkBoxL_1)
265
        ValidationDialog.setTabOrder(self.checkBoxT_2, self.checkBoxT_3)
266
        ValidationDialog.setTabOrder(self.checkBoxT_3, self.checkBoxL_1)
263 267
        ValidationDialog.setTabOrder(self.checkBoxL_1, self.checkBoxL_2)
264 268
        ValidationDialog.setTabOrder(self.checkBoxL_2, self.checkBoxL_3)
265 269
        ValidationDialog.setTabOrder(self.checkBoxL_3, self.checkBoxL_4)
......
278 282
        _translate = QtCore.QCoreApplication.translate
279 283
        ValidationDialog.setWindowTitle(_translate("ValidationDialog", "Validation"))
280 284
        self.groupBox_2.setTitle(_translate("ValidationDialog", "Text"))
281
        self.label_3.setText(_translate("ValidationDialog", "Error"))
282 285
        self.checkBoxT_1.setText(_translate("ValidationDialog", "Association error"))
286
        self.label_3.setText(_translate("ValidationDialog", "Error"))
283 287
        self.label_4.setText(_translate("ValidationDialog", "Warning"))
284 288
        self.checkBoxT_2.setText(_translate("ValidationDialog", "Text overlapping warning"))
289
        self.checkBoxT_3.setText(_translate("ValidationDialog", "No owner warning"))
285 290
        self.groupBox_4.setTitle(_translate("ValidationDialog", "Line No"))
286 291
        self.checkBoxN_2.setText(_translate("ValidationDialog", "Branch size error"))
287 292
        self.checkBoxN_1.setText(_translate("ValidationDialog", "Size change error"))
DTI_PID/DTI_PID/ValidationDialog.py
159 159

  
160 160
        if self.ui.checkBoxT_2.isChecked():
161 161
            self.rules.append(TextValidation.TextOverlappingWarning)
162
        if self.ui.checkBoxT_3.isChecked():
163
            self.rules.append(TextValidation.NoOwnerWarning)
162 164

  
163 165
        if self.ui.checkBoxL_1.isChecked():
164 166
            self.rules.append(LineValidation.LineTypeError)

내보내기 Unified diff

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