프로젝트

일반

사용자정보

개정판 badd6ec9

IDbadd6ec907871d4be08d206e63eb3c42a24cd0c4
상위 92990c00
하위 02b4b5e7

백흠경이(가) 4년 이상 전에 추가함

issue #1054: 매뉴얼 입력 K 값을 수정할 수 있다

Change-Id: Iaf17dd37663424dbef77867c2be32216b714d5a0

차이점 보기:

HYTOS/HYTOS/FittingsDialog.py
31 31
    return item
32 32

  
33 33

  
34
class ManualKValueDelegate(QStyledItemDelegate):
35
    def createEditor(self, parent, option, index):
36
        editor = None
37
        if index.column() == 9 and parent.parent().item(index.row(), 2).text() == 'Manual':
38
            editor = QLineEdit(parent)
39
            validator = QtGui.QDoubleValidator(parent)
40
            editor.setValidator(validator)
41

  
42
        return editor
43

  
44
    def destroyEditor(self, editor, index):
45
        """apply modified manual K value"""
46
        editor.blockSignals(True)
47
        value = float(editor.text())
48
        name = editor.parent().parent().item(index.row(), 4).text()
49
        count = int(editor.parent().parent().item(index.row(), 5).text())
50
        selected_fitting = f"{name} x {value} = {int(count) * value}"
51
        editor.parent().parent().item(index.row(), 11).setText(selected_fitting)
52
        editor.blockSignals(False)
53

  
54

  
34 55
class QFittingsDialog(QDialog):
35 56
    def __init__(self, item):
36 57
        QDialog.__init__(self)
......
263 284

  
264 285
            self.ui.tableWidget_CraneK_SelectedFitting.setContextMenuPolicy(Qt.CustomContextMenu)
265 286
            self.ui.tableWidget_CraneK_SelectedFitting.customContextMenuRequested.connect(self.context_menu_del_crane_k)
287

  
288
            delegate = ManualKValueDelegate(self.ui.tableWidget_CraneK_SelectedFitting)
289
            self.ui.tableWidget_CraneK_SelectedFitting.setItemDelegate(delegate)
266 290
        except Exception as ex:
267 291
            from App import App
268 292
            from AppDocData import MessageType
......
1235 1259

  
1236 1260
    def update_crane_k_data(self, row, data, count, sub_size=None, angle=None):
1237 1261
        try:
1238
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 5, set_item_properties(count,
1239
                                                                                           Qt.AlignHCenter | Qt.AlignVCenter))
1262
            self.ui.tableWidget_CraneK_SelectedFitting.item(row, 5).setText(str(count))
1240 1263
            if sub_size:
1241
                self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 7,
1242
                                                                   set_item_properties(sub_size,
1243
                                                                                       Qt.AlignHCenter | Qt.AlignVCenter))
1264
                self.ui.tableWidget_CraneK_SelectedFitting.item(row, 7).setText(str(sub_size))
1244 1265
            if angle:
1245
                self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 8, set_item_properties(angle,
1246
                                                                                               Qt.AlignHCenter | Qt.AlignVCenter))
1266
                self.ui.tableWidget_CraneK_SelectedFitting.item(row, 8).setTextx(str(angle))
1247 1267

  
1248
            k = self.get_crane_k_resistance_coefficient(data[4], data[5], sub_size, angle)
1249
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 9, set_item_properties(k,
1250
                                                                                           Qt.AlignRight | Qt.AlignVCenter))
1268
            self.ui.tableWidget_CraneK_SelectedFitting.item(row, 5)
1251 1269

  
1252
            selected_fitting = '{} x {} = {}'.format(data[4], count, int(count) * k)
1253
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 11,
1254
                                                               set_item_properties(selected_fitting,
1255
                                                                                   Qt.AlignLeft | Qt.AlignVCenter))
1270
            value = None
1271
            if self.ui.tableWidget_CraneK_SelectedFitting.item(row, 9).text():
1272
                value = float(self.ui.tableWidget_CraneK_SelectedFitting.item(row, 9).text())
1273
            else:
1274
                value = data[5]
1256 1275

  
1257
            # total_k = int(count) * float(k)
1258
            # self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 11,
1259
            #                                                   set_table_widget_item_properties(total_k,
1260
            #                                                                                    Qt.AlignRight | Qt.AlignVCenter))
1276
            k = self.get_crane_k_resistance_coefficient(data[4], value, sub_size, angle)
1277
            self.ui.tableWidget_CraneK_SelectedFitting.item(row, 9).setText(str(k))
1278

  
1279
            selected_fitting = '{} x {} = {}'.format(data[4], count, int(count) * k)
1280
            self.ui.tableWidget_CraneK_SelectedFitting.item(row, 11).setText(selected_fitting)
1261 1281

  
1262 1282
            self.ui.tableWidget_CraneK_SelectedFitting.resizeRowsToContents()
1263 1283
        except Exception as ex:
......
1427 1447
                self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 8, set_item_properties(angle,
1428 1448
                                                                                               Qt.AlignHCenter | Qt.AlignVCenter))
1429 1449
            k = self.get_crane_k_resistance_coefficient(data[4], data[5], sub_size, angle)
1430

  
1431
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 9, set_item_properties(k,
1432
                                                                                           Qt.AlignRight | Qt.AlignVCenter))
1450
            cell = set_item_properties(k, Qt.AlignRight | Qt.AlignVCenter)
1451
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 9, cell)
1433 1452

  
1434 1453
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 10, set_item_properties(data[6],
1435 1454
                                                                                            Qt.AlignLeft | Qt.AlignVCenter))
1436 1455

  
1437 1456
            selected_fitting = '{} x {} = {}'.format(data[4], count, int(count) * k)
1438
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 11,
1439
                                                               set_item_properties(selected_fitting,
1440
                                                                                   Qt.AlignLeft | Qt.AlignVCenter))
1441

  
1442
            # total_k = int(count) * k
1443
            # self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 11,
1444
            #                                                   set_table_widget_item_properties(total_k,
1445
            #                                                                                    Qt.AlignRight | Qt.AlignVCenter))
1457
            cell = set_item_properties(selected_fitting, Qt.AlignLeft | Qt.AlignVCenter)
1458
            self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 11, cell)
1446 1459

  
1447 1460
            self.ui.tableWidget_CraneK_SelectedFitting.resizeRowsToContents()
1448 1461
        except Exception as ex:
......
1597 1610
        self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(10)  # Image
1598 1611
        # self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(11)  # Selected Fitting
1599 1612

  
1600
        self.ui.tableWidget_CraneK_SelectedFitting.setEditTriggers(QAbstractItemView.NoEditTriggers)
1613
        # self.ui.tableWidget_CraneK_SelectedFitting.setEditTriggers(QAbstractItemView.NoEditTriggers)
1601 1614

  
1602 1615
        col_names = ['UID', 'Method', 'Category', 'Type', 'Name', 'Count', 'Size(M)', 'Size(S)', 'Angle', 'K', 'Image',
1603 1616
                     'Selected Fitting']

내보내기 Unified diff

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