개정판 c1940c78
issue #2104 HMB TableView Sorted 수정 완료
HYTOS/HYTOS/HMBTable.py | ||
---|---|---|
69 | 69 |
self._liquid_viscosity = None |
70 | 70 |
self.isDeleted = False |
71 | 71 |
self._input_flowrate_type = None # save flowrate type by user input |
72 |
|
|
73 |
def __repr__(self): |
|
74 |
""" return string represents stream line item """ |
|
75 |
return f"<{self.stream_no},{self.stream_no_text}>" |
|
72 | 76 |
''' |
73 | 77 |
@author humkyung |
74 | 78 |
@date 2018.07.12 |
... | ... | |
133 | 137 |
self._stream_no_text = str(value) |
134 | 138 |
|
135 | 139 |
@property |
140 |
def stream_no_extract_number(self): |
|
141 |
import re |
|
142 |
import math |
|
143 |
|
|
144 |
result = "" |
|
145 |
try: |
|
146 |
if self.stream_no_text: |
|
147 |
result = re.sub(r'[^0-9]', '', self.stream_no_text) |
|
148 |
|
|
149 |
if len(result) ==0: |
|
150 |
result = int(sys.maxsize) |
|
151 |
else: |
|
152 |
result = int(result) |
|
153 |
except Exception as ex: |
|
154 |
from App import App |
|
155 |
from AppDocData import MessageType |
|
156 |
|
|
157 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
158 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
159 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
160 |
finally: |
|
161 |
return result |
|
162 |
|
|
163 |
@property |
|
136 | 164 |
def phase_type(self): |
137 | 165 |
return self._phase_type |
138 | 166 |
|
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
2976 | 2976 |
self.tableWidgetHMB.clearContents() |
2977 | 2977 |
self.tableWidgetHMB.setColumnCount(0) |
2978 | 2978 |
|
2979 |
|
|
2979 | 2980 |
def load_HMB(self) -> None: |
2980 | 2981 |
""" display hmb data to table widget """ |
2981 | 2982 |
from CalculationValidation import QCalculationValidation |
2982 |
|
|
2983 |
import re |
|
2983 | 2984 |
drawing = AppDocData.instance().activeDrawing |
2984 | 2985 |
if drawing is None: return |
2985 | 2986 |
|
... | ... | |
2988 | 2989 |
if hmbs is not None: |
2989 | 2990 |
model = self.tableWidgetHMB.model() |
2990 | 2991 |
model.setColumnCount(2) |
2991 |
|
|
2992 |
#숫자(1) -> 문자(2) |
|
2992 | 2993 |
col_names = ['Stream No.\n', 'Unit\n'] |
2993 |
_hmbs = sorted(hmbs, key=lambda hmb: hmb.stream_no)
|
|
2994 |
_hmbs = sorted(hmbs, key=lambda hmb: (hmb.stream_no_extract_number, hmb.stream_no_text))
|
|
2994 | 2995 |
for hmb in _hmbs: |
2995 | 2996 |
columnCount = model.columnCount() |
2996 | 2997 |
# self.tableWidgetHMB.setColumnCount(columnCount + 1) |
2997 |
col_names.append(str(hmb.stream_no) + '\n(' + str( |
|
2998 |
hmb.stream_no_text if hmb.stream_no_text else hmb._stream_no) + ')') |
|
2998 |
col_names.append(hmb.stream_no_text) |
|
2999 | 2999 |
|
3000 | 3000 |
item = set_item_properties(hmb.uid, Qt.AlignHCenter | Qt.AlignVCenter) |
3001 | 3001 |
model.setItem(0, columnCount, item) |
내보내기 Unified diff