프로젝트

일반

사용자정보

개정판 dc5c5b3c

IDdc5c5b3c2ecd03bc2cfe6bd04ba8b77cf55d560b
상위 72e53dc5
하위 41566841

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

issue #49: fix nominal data import

Change-Id: I086332b7e7209269aab4c718bd60ecb2ff9d7b62

차이점 보기:

DTI_PID/DTI_PID/CodeTableDialog.py
242 242

  
243 243
    def fill_nominal_pipe_sizes(self, pipeSizes):
244 244
        try:
245
            self.ui.tableWidgetNominalDiameter.setColumnCount(7)
245
            self.ui.tableWidgetNominalDiameter.setColumnCount(8)
246 246
            self.ui.tableWidgetNominalDiameter.setHorizontalHeaderLabels(
247
                ['Code', 'Metric', 'Inch', 'InchStr', 'Inch Allowables', 'MetricStr', 'Metric Allowables'])
247
                ['UID', 'Code', 'Metric', 'Inch', 'InchStr', 'Inch Allowables', 'MetricStr', 'Metric Allowables'])
248
            self.ui.tableWidgetNominalDiameter.hideColumn(0)
248 249
            self.ui.tableWidgetNominalDiameter.setRowCount(len(pipeSizes))
249 250
            row = 0
250 251
            for pipeSize in pipeSizes:
251
                item = QTableWidgetItem(pipeSize.code)
252
                item = QTableWidgetItem(pipeSize.uid)
252 253
                item.setData(Qt.UserRole, pipeSize)
253 254
                self.ui.tableWidgetNominalDiameter.setItem(row, 0, item)
254
                self.ui.tableWidgetNominalDiameter.setItem(row, 1, QTableWidgetItem(
255
                    '' if pipeSize.metric is None else str(pipeSize.metric)))
255
                self.ui.tableWidgetNominalDiameter.setItem(row, 1, QTableWidgetItem(pipeSize.code))
256 256
                self.ui.tableWidgetNominalDiameter.setItem(row, 2, QTableWidgetItem(
257
                    '' if pipeSize.inch is None else str(pipeSize.inch)))
257
                    '' if pipeSize.metric is None else str(pipeSize.metric)))
258 258
                self.ui.tableWidgetNominalDiameter.setItem(row, 3, QTableWidgetItem(
259
                    '' if pipeSize.inchStr is None else pipeSize.inchStr))
259
                    '' if pipeSize.inch is None else str(pipeSize.inch)))
260 260
                self.ui.tableWidgetNominalDiameter.setItem(row, 4, QTableWidgetItem(
261
                    '' if pipeSize.allowable_inch_str is None else pipeSize.allowable_inch_str))
261
                    '' if pipeSize.inchStr is None else pipeSize.inchStr))
262 262
                self.ui.tableWidgetNominalDiameter.setItem(row, 5, QTableWidgetItem(
263
                    '' if pipeSize.metricStr is None else pipeSize.metricStr))
263
                    '' if pipeSize.allowable_inch_str is None else pipeSize.allowable_inch_str))
264 264
                self.ui.tableWidgetNominalDiameter.setItem(row, 6, QTableWidgetItem(
265
                    '' if pipeSize.metricStr is None else pipeSize.metricStr))
266
                self.ui.tableWidgetNominalDiameter.setItem(row, 7, QTableWidgetItem(
265 267
                    '' if pipeSize.allowable_metric_str is None else pipeSize.allowable_metric_str))
266 268
                row += 1
267 269

  
......
664 666
                        pipe_size = NominalPipeSize(None, None, None, None, None, None, None, None)
665 667
                        for col in range(sheet.max_column):
666 668
                            value = row[col].value
667
                            if 'Code' == headers[col]:
669
                            if 'UID' == headers[col]:
670
                                pipe_size.uid = value
671
                            elif 'Code' == headers[col]:
668 672
                                pipe_size.code = value
669 673
                            elif 'Metric' == headers[col]:
670 674
                                pipe_size.metric = value
......
822 826
            rowCount = table.rowCount()
823 827
            for row in range(rowCount):
824 828
                pipe_size = table.item(row, 0).data(Qt.UserRole)
825
                pipe_size.code = table.item(row, 0).text()
826
                pipe_size.metric = float(table.item(row, 1).text()) if table.item(row, 1).text() != '' else None
827
                pipe_size.inch = float(table.item(row, 2).text()) if table.item(row, 2).text() != '' else None
828
                pipe_size.inchStr = table.item(row, 3).text()
829
                pipe_size.allowable_inch_str = table.item(row, 4).text()
830
                pipe_size.metricStr = table.item(row, 5).text()
831
                pipe_size.allowable_metric_str = table.item(row, 6).text()
829
                pipe_size.code = table.item(row, 1).text()
830
                pipe_size.metric = float(table.item(row, 2).text()) if table.item(row, 2).text() != '' else None
831
                pipe_size.inch = float(table.item(row, 3).text()) if table.item(row, 3).text() != '' else None
832
                pipe_size.inchStr = table.item(row, 4).text()
833
                pipe_size.allowable_inch_str = table.item(row, 5).text()
834
                pipe_size.metricStr = table.item(row, 6).text()
835
                pipe_size.allowable_metric_str = table.item(row, 7).text()
832 836
                pipeSizes.append(pipe_size)
833 837

  
834 838
            docData.insertNomialPipeSize(pipeSizes)

내보내기 Unified diff

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