개정판 5239ded3
issue #1244 : General Equation
Change-Id: Id00a68d1f8359028a550fe3a27ce10ab7c42b750
HYTOS/HYTOS/RoughnessDialog.py | ||
---|---|---|
34 | 34 |
self.unit = None |
35 | 35 |
|
36 | 36 |
self.ui.tableWidget_Roughness.cellDoubleClicked.connect(self.double_clicked) |
37 |
self.init_roughness() |
|
38 | 37 |
|
39 | 38 |
def double_clicked(self, row): |
40 | 39 |
QDialog.accept(self) |
41 | 40 |
|
42 |
def show_dialog(self, unit):
|
|
43 |
self.unit = unit
|
|
44 |
self.ui.label_current_unit.setText('Current Unit : {}'.format(unit))
|
|
41 |
def show_dialog(self): |
|
42 |
self.init_units()
|
|
43 |
self.init_roughness()
|
|
45 | 44 |
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) |
46 | 45 |
self.exec_() |
47 | 46 |
|
48 | 47 |
return self.get_selected_item() |
49 | 48 |
|
49 |
def init_units(self): |
|
50 |
active_drawing = AppDocData.instance().activeDrawing |
|
51 |
|
|
52 |
for attr in active_drawing.attrs: |
|
53 |
if attr[0] == 'Units': |
|
54 |
self.unit = attr[1]['Roughness'] |
|
55 |
|
|
50 | 56 |
def get_selected_item(self): |
51 | 57 |
|
52 | 58 |
if self.unit == 'm': |
... | ... | |
66 | 72 |
self.ui.tableWidget_Roughness.setColumnCount(6) |
67 | 73 |
self.ui.tableWidget_Roughness.hideColumn(0) |
68 | 74 |
self.ui.tableWidget_Roughness.setHorizontalHeaderLabels( |
69 |
['UID', 'Material', 'Meter (m)', 'Inch (in)', 'Feet (ft)', 'Milimeter (mm)'])
|
|
75 |
['UID', 'Material', 'Roughness', 'Roughness', 'Roughness', 'Roughness'])
|
|
70 | 76 |
self.ui.tableWidget_Roughness.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
71 | 77 |
self.ui.tableWidget_Roughness.horizontalHeader().setStretchLastSection(True) |
72 | 78 |
self.ui.tableWidget_Roughness.setEditTriggers(QAbstractItemView.NoEditTriggers) |
... | ... | |
74 | 80 |
self.ui.tableWidget_Roughness.setSelectionMode(QAbstractItemView.SingleSelection) |
75 | 81 |
self.ui.tableWidget_Roughness.setSelectionBehavior(QAbstractItemView.SelectRows) |
76 | 82 |
|
83 |
if self.unit == 'm': |
|
84 |
self.ui.tableWidget_Roughness.hideColumn(3) |
|
85 |
self.ui.tableWidget_Roughness.hideColumn(4) |
|
86 |
self.ui.tableWidget_Roughness.hideColumn(5) |
|
87 |
elif self.unit == 'in': |
|
88 |
self.ui.tableWidget_Roughness.hideColumn(2) |
|
89 |
self.ui.tableWidget_Roughness.hideColumn(4) |
|
90 |
self.ui.tableWidget_Roughness.hideColumn(5) |
|
91 |
elif self.unit == 'ft': |
|
92 |
self.ui.tableWidget_Roughness.hideColumn(2) |
|
93 |
self.ui.tableWidget_Roughness.hideColumn(3) |
|
94 |
self.ui.tableWidget_Roughness.hideColumn(5) |
|
95 |
elif self.unit == 'mm': |
|
96 |
self.ui.tableWidget_Roughness.hideColumn(2) |
|
97 |
self.ui.tableWidget_Roughness.hideColumn(3) |
|
98 |
self.ui.tableWidget_Roughness.hideColumn(4) |
|
99 |
|
|
77 | 100 |
roughness_list = AppDocData.instance().getRoughness() |
78 | 101 |
for roughness in roughness_list: |
79 | 102 |
row_count = self.ui.tableWidget_Roughness.rowCount() |
80 | 103 |
self.ui.tableWidget_Roughness.setRowCount(row_count + 1) |
81 | 104 |
|
82 | 105 |
self.ui.tableWidget_Roughness.setItem(row_count, 0, set_table_widget_item_properties(roughness[0], |
83 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
106 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
84 | 107 |
self.ui.tableWidget_Roughness.setItem(row_count, 1, set_table_widget_item_properties(roughness[1], |
85 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
108 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
86 | 109 |
self.ui.tableWidget_Roughness.setItem(row_count, 2, set_table_widget_item_properties(roughness[2], |
87 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
110 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
88 | 111 |
self.ui.tableWidget_Roughness.setItem(row_count, 3, set_table_widget_item_properties(roughness[3], |
89 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
112 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
90 | 113 |
self.ui.tableWidget_Roughness.setItem(row_count, 4, set_table_widget_item_properties(roughness[4], |
91 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
114 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
92 | 115 |
self.ui.tableWidget_Roughness.setItem(row_count, 5, set_table_widget_item_properties(roughness[5], |
93 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
116 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
94 | 117 |
|
95 | 118 |
self.ui.tableWidget_Roughness.resizeColumnToContents(1) |
96 | 119 |
|
HYTOS/HYTOS/Roughness_UI.py | ||
---|---|---|
13 | 13 |
class Ui_RoughnessDialog(object): |
14 | 14 |
def setupUi(self, RoughnessDialog): |
15 | 15 |
RoughnessDialog.setObjectName("RoughnessDialog") |
16 |
RoughnessDialog.resize(579, 305)
|
|
16 |
RoughnessDialog.resize(317, 277)
|
|
17 | 17 |
font = QtGui.QFont() |
18 | 18 |
font.setFamily("맑은 고딕") |
19 | 19 |
RoughnessDialog.setFont(font) |
... | ... | |
32 | 32 |
self.tableWidget_Roughness.setRowCount(0) |
33 | 33 |
self.gridLayout.addWidget(self.tableWidget_Roughness, 1, 0, 1, 1) |
34 | 34 |
self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1) |
35 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
36 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
37 |
self.label_current_unit = QtWidgets.QLabel(RoughnessDialog) |
|
38 |
self.label_current_unit.setText("") |
|
39 |
self.label_current_unit.setObjectName("label_current_unit") |
|
40 |
self.horizontalLayout.addWidget(self.label_current_unit) |
|
41 | 35 |
self.buttonBox = QtWidgets.QDialogButtonBox(RoughnessDialog) |
42 | 36 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
43 | 37 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
44 | 38 |
self.buttonBox.setObjectName("buttonBox") |
45 |
self.horizontalLayout.addWidget(self.buttonBox) |
|
46 |
self.gridLayout_2.addLayout(self.horizontalLayout, 3, 0, 1, 1) |
|
39 |
self.gridLayout_2.addWidget(self.buttonBox, 2, 0, 1, 1) |
|
47 | 40 |
|
48 | 41 |
self.retranslateUi(RoughnessDialog) |
49 | 42 |
self.buttonBox.accepted.connect(RoughnessDialog.accept) |
HYTOS/HYTOS/UI/Roughness.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>579</width>
|
|
10 |
<height>305</height>
|
|
9 |
<width>317</width>
|
|
10 |
<height>277</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="font"> |
... | ... | |
37 | 37 |
</item> |
38 | 38 |
</layout> |
39 | 39 |
</item> |
40 |
<item row="3" column="0"> |
|
41 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
42 |
<item> |
|
43 |
<widget class="QLabel" name="label_current_unit"> |
|
44 |
<property name="text"> |
|
45 |
<string/> |
|
46 |
</property> |
|
47 |
</widget> |
|
48 |
</item> |
|
49 |
<item> |
|
50 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
51 |
<property name="orientation"> |
|
52 |
<enum>Qt::Horizontal</enum> |
|
53 |
</property> |
|
54 |
<property name="standardButtons"> |
|
55 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
56 |
</property> |
|
57 |
</widget> |
|
58 |
</item> |
|
59 |
</layout> |
|
40 |
<item row="2" column="0"> |
|
41 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
42 |
<property name="orientation"> |
|
43 |
<enum>Qt::Horizontal</enum> |
|
44 |
</property> |
|
45 |
<property name="standardButtons"> |
|
46 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
47 |
</property> |
|
48 |
</widget> |
|
60 | 49 |
</item> |
61 | 50 |
</layout> |
62 | 51 |
</widget> |
내보내기 Unified diff