프로젝트

일반

사용자정보

개정판 a63b6383

IDa63b63837af48f25182d42b3565c3fdcb8faeb98
상위 338e7035
하위 a7a8773d

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

issue #49: auto fill allowable ongoing and fix line no determine without "

Change-Id: Ib8c1a0144891a2f4c2a10b75039c451070d45678

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1728 1728
                            res.append(pipeSize.metricStr)
1729 1729
                    else:
1730 1730
                        res.append(pipeSize)
1731

  
1732
                if sizeUnit == 'Inch':
1733
                    res = sorted(res, key=lambda param:len(param.inchStr), reverse=True)
1734
                else:
1735
                    res = sorted(res, key=lambda param:len(param.metricStr), reverse=True)
1731 1736
            # Catch the exception
1732 1737
            except Exception as ex:
1733 1738
                from App import App
DTI_PID/DTI_PID/CodeTableDialog.py
489 489
            print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
490 490
                                                       sys.exc_info()[-1].tb_lineno))
491 491

  
492
    def makeAllowable(self, code):
493
        ''' make allowable for code '''
494
        return ''
495
        from CodeTables import CodeTable
496
        import re
497

  
498
        allowable = ''
499
        for allowables in CodeTable:
500
            for allowable in allowables:
501
                remains = [remain for remain in remain if remain != allowable]
502
                f = '(' + '|'.join(remains) + ')'
503
                index = []
504
                for chars in re.finditer(f, code):
505
                    pass
506

  
492 507
    '''
493 508
        @brief      cellValueChange event
494 509
        @author     kyouho
495 510
        @date       2018.07.10
496 511
    '''
497

  
498 512
    def cellValueChanged(self, row, column):
499 513
        try:
500 514
            tabText = self.getTabText()
......
509 523
                    if result:
510 524
                        self.checkRowAndAddRow(tabText, table)
511 525
                        self.setCurrentCode(table, tabText)
526

  
527
                        # make allowable
528
                        if self.ui.checkBoxAllowable.isChecked():
529
                            table.setItem(row, 3, QTableWidgetItem(self.makeAllowable(code)))                            
512 530
                    else:
513 531
                        QMessageBox.warning(self, self.tr('Notice'),
514 532
                                            self.tr('The same code already exists in the table.'))
DTI_PID/DTI_PID/CodeTable_UI.py
23 23
        self.gridLayout.setObjectName("gridLayout")
24 24
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
25 25
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
26
        self.checkBoxAllowable = QtWidgets.QCheckBox(CodeTableDialog)
27
        self.checkBoxAllowable.setObjectName("checkBoxAllowable")
28
        self.horizontalLayout_2.addWidget(self.checkBoxAllowable)
29
        self.line_2 = QtWidgets.QFrame(CodeTableDialog)
30
        self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
31
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
32
        self.line_2.setObjectName("line_2")
33
        self.horizontalLayout_2.addWidget(self.line_2)
26 34
        self.label = QtWidgets.QLabel(CodeTableDialog)
27 35
        self.label.setObjectName("label")
28 36
        self.horizontalLayout_2.addWidget(self.label)
......
33 41
        self.pushButtonRead = QtWidgets.QPushButton(CodeTableDialog)
34 42
        self.pushButtonRead.setObjectName("pushButtonRead")
35 43
        self.horizontalLayout_2.addWidget(self.pushButtonRead)
44
        self.line = QtWidgets.QFrame(CodeTableDialog)
45
        self.line.setFrameShape(QtWidgets.QFrame.VLine)
46
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
47
        self.line.setObjectName("line")
48
        self.horizontalLayout_2.addWidget(self.line)
36 49
        self.pushButtonImport = QtWidgets.QPushButton(CodeTableDialog)
37 50
        self.pushButtonImport.setObjectName("pushButtonImport")
38 51
        self.horizontalLayout_2.addWidget(self.pushButtonImport)
......
45 58
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
46 59
        self.buttonBox.setObjectName("buttonBox")
47 60
        self.horizontalLayout_2.addWidget(self.buttonBox)
48
        self.gridLayout.addLayout(self.horizontalLayout_2, 2, 0, 1, 1)
61
        self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 1)
49 62
        self.tabWidget = QtWidgets.QTabWidget(CodeTableDialog)
50 63
        self.tabWidget.setFocusPolicy(QtCore.Qt.NoFocus)
51 64
        self.tabWidget.setObjectName("tabWidget")
......
234 247
        self.gridLayout_26.addWidget(self.tableWidgetDictionary, 0, 0, 1, 1)
235 248
        self.gridLayout_25.addWidget(self.groupBox_10, 0, 0, 1, 1)
236 249
        self.tabWidget.addTab(self.tabDIctionary, "")
237
        self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
250
        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1)
238 251

  
239 252
        self.retranslateUi(CodeTableDialog)
240 253
        self.tabWidget.setCurrentIndex(0)
......
245 258
    def retranslateUi(self, CodeTableDialog):
246 259
        _translate = QtCore.QCoreApplication.translate
247 260
        CodeTableDialog.setWindowTitle(_translate("CodeTableDialog", "Code Table"))
261
        self.checkBoxAllowable.setText(_translate("CodeTableDialog", "Auto Allowable"))
248 262
        self.label.setText(_translate("CodeTableDialog", "Line Height : "))
249 263
        self.pushButtonRead.setText(_translate("CodeTableDialog", "Read from Legend"))
250 264
        self.pushButtonImport.setText(_translate("CodeTableDialog", "Import"))
DTI_PID/DTI_PID/CodeTables.py
12 12
    TABLES = {}
13 13
    DEFAULTS = ['NOMINALDIAMETER', 'FLUIDCODE', 'PIPINGMATERIALSCLASS', 'UNITNUMBER', 'INSULATIONPURPOSE', 'PNIDNUMBER', \
14 14
                    'VALVEOPERCODES', 'RESERVEDWORDS', 'DICTIONARY', 'EQPTAGNAMES']
15
    ALLOWABLES = [('1', 'I', 'l'), ('0', 'O'), ('8', 'B'), ('2', 'Z')] # must sort long string first ex ('II', '"')
15 16

  
16 17
    def __init__(self, name, values):
17 18
        self.name = name
DTI_PID/DTI_PID/CustomCodeTables_UI.py
22 22
        self.gridLayout.setObjectName("gridLayout")
23 23
        self.horizontalLayout = QtWidgets.QHBoxLayout()
24 24
        self.horizontalLayout.setObjectName("horizontalLayout")
25
        self.checkBoxAllowable = QtWidgets.QCheckBox(CustomCodeTables)
26
        self.checkBoxAllowable.setObjectName("checkBoxAllowable")
27
        self.horizontalLayout.addWidget(self.checkBoxAllowable)
25 28
        self.buttonBox = QtWidgets.QDialogButtonBox(CustomCodeTables)
26 29
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
27 30
        self.buttonBox.setObjectName("buttonBox")
......
61 64
    def retranslateUi(self, CustomCodeTables):
62 65
        _translate = QtCore.QCoreApplication.translate
63 66
        CustomCodeTables.setWindowTitle(_translate("CustomCodeTables", "Custom Code Tables"))
67
        self.checkBoxAllowable.setText(_translate("CustomCodeTables", "Auto Allowable"))
64 68
        self.groupBoxTitleBlock.setTitle(_translate("CustomCodeTables", "Custom Tables"))
65 69
        self.pushButtonAdd.setText(_translate("CustomCodeTables", "+"))
66 70
        self.pushButtonDelete.setText(_translate("CustomCodeTables", "-"))
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
316 316
                    _attrs[attr] = attr.Expression if attr.Expression and not _attrs[attr] else _attrs[attr]
317 317

  
318 318
            """calculate attribute value for combined type"""
319
            p = re.compile('{[A-Za-z0-9]+}')
319
            p = re.compile('{[A-Za-z0-9_ ]+}')
320 320
            for attr in [_attr for _attr in targetAttrs if _attr.AttributeType == 'Combined']:
321 321
                value, pos = '', 0
322 322

  
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py
22 22
        editor = super(AttributeDelegate, self).createEditor(parent, option, index)
23 23
        if index.column() == 1:
24 24
            editor = QLineEdit(parent)
25
            validator = QRegExpValidator(QRegExp('^[A-Za-z0-9]+$'), parent)
25
            validator = QRegExpValidator(QRegExp('^[A-Za-z0-9_ ]+$'), parent)
26 26
            editor.setValidator(validator)
27 27
        elif index.column() == 4:
28 28
            editor = QLineEdit(parent)
DTI_PID/DTI_PID/UI/CodeTable.ui
26 26
   <bool>false</bool>
27 27
  </property>
28 28
  <layout class="QGridLayout" name="gridLayout">
29
   <item row="2" column="0">
29
   <item row="3" column="0">
30 30
    <layout class="QHBoxLayout" name="horizontalLayout_2">
31 31
     <item>
32
      <widget class="QCheckBox" name="checkBoxAllowable">
33
       <property name="text">
34
        <string>Auto Allowable</string>
35
       </property>
36
      </widget>
37
     </item>
38
     <item>
39
      <widget class="Line" name="line_2">
40
       <property name="orientation">
41
        <enum>Qt::Vertical</enum>
42
       </property>
43
      </widget>
44
     </item>
45
     <item>
32 46
      <widget class="QLabel" name="label">
33 47
       <property name="text">
34 48
        <string>Line Height : </string>
......
50 64
      </widget>
51 65
     </item>
52 66
     <item>
67
      <widget class="Line" name="line">
68
       <property name="orientation">
69
        <enum>Qt::Vertical</enum>
70
       </property>
71
      </widget>
72
     </item>
73
     <item>
53 74
      <widget class="QPushButton" name="pushButtonImport">
54 75
       <property name="text">
55 76
        <string>Import</string>
......
78 99
     </item>
79 100
    </layout>
80 101
   </item>
81
   <item row="0" column="0">
102
   <item row="1" column="0">
82 103
    <widget class="QTabWidget" name="tabWidget">
83 104
     <property name="focusPolicy">
84 105
      <enum>Qt::NoFocus</enum>
DTI_PID/DTI_PID/UI/CustomCodeTables.ui
26 26
   <item row="2" column="0">
27 27
    <layout class="QHBoxLayout" name="horizontalLayout">
28 28
     <item>
29
      <widget class="QCheckBox" name="checkBoxAllowable">
30
       <property name="text">
31
        <string>Auto Allowable</string>
32
       </property>
33
      </widget>
34
     </item>
35
     <item>
29 36
      <widget class="QDialogButtonBox" name="buttonBox">
30 37
       <property name="standardButtons">
31 38
        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>

내보내기 Unified diff

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