개정판 c2deb69e
issue #563: block close before done
Change-Id: I36b6505e0d32bba25d73129d7dddc04742b58f13
DTI_PID/DTI_PID/CodeTables.py | ||
---|---|---|
57 | 57 |
matches = [x for x in value[3] if x and text == x] |
58 | 58 |
if matches: return value[1] |
59 | 59 |
|
60 |
return None |
|
61 |
|
|
60 | 62 |
@staticmethod |
61 | 63 |
def instance(table_name, symbol_attribute_uid=None): |
62 | 64 |
""" return instance has given table name """ |
DTI_PID/DTI_PID/ConnectAttrDialog.py | ||
---|---|---|
122 | 122 |
''' |
123 | 123 |
def startThread(self): |
124 | 124 |
import timeit |
125 |
from LineNoTracer import connectAttrImpl |
|
126 | 125 |
|
127 | 126 |
try: |
128 | 127 |
self.ui.buttonBox.setDisabled(True) |
... | ... | |
154 | 153 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
155 | 154 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
156 | 155 |
finally: |
157 |
self.ui.buttonBox.setDisabled(False)
|
|
156 |
pass
|
|
158 | 157 |
|
159 | 158 |
''' |
160 | 159 |
@brief set buttonbox's enabled flag |
... | ... | |
168 | 167 |
|
169 | 168 |
try: |
170 | 169 |
self.ui.progressBar.setValue(self.ui.progressBar.maximum()) |
171 |
self.ui.buttonBox.setEnabled(True) |
|
172 | 170 |
except Exception as ex: |
173 | 171 |
from App import App |
174 | 172 |
|
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
550 | 550 |
found = True |
551 | 551 |
break |
552 | 552 |
if found: break |
553 |
if not found and (type(text) is QEngineeringSizeTextItem or type(text) is QEngineeringValveOperCodeTextItem or type(text) is QEngineeringTagNoTextItem): |
|
553 |
if not found and (type(text) is QEngineeringSizeTextItem or type(text) is QEngineeringValveOperCodeTextItem or \ |
|
554 |
type(text) is QEngineeringTagNoTextItem or type(text) is QEngineeringTextItem): |
|
554 | 555 |
targetText.append(text) |
555 | 556 |
|
556 | 557 |
for text in targetText: |
... | ... | |
1225 | 1226 |
# lineNo.update_flow_mark(position, length) |
1226 | 1227 |
|
1227 | 1228 |
except Exception as ex: |
1228 |
from App import App
|
|
1229 |
from App import App |
|
1229 | 1230 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
1230 | 1231 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1231 | 1232 |
except: |
1232 | 1233 |
(type1, value, traceback) = sys.exc_info() |
1233 | 1234 |
sys.excepthook(type1, value, traceback) |
1234 | 1235 |
finally: |
1236 |
from App import App |
|
1235 | 1237 |
worker.finished.emit() |
1238 |
App.mainWnd().dlgConnectAttr.ui.buttonBox.setEnabled(True) |
|
1239 |
|
|
1236 | 1240 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1977 | 1977 |
|
1978 | 1978 |
try: |
1979 | 1979 |
self.dlgConnectAttr = QConnectAttrDialog(self, self.graphicsView) |
1980 |
self.dlgConnectAttr.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowContextHelpButtonHint) |
|
1980 | 1981 |
self.dlgConnectAttr.exec_() |
1981 | 1982 |
if self.dlgConnectAttr.isRunned: |
1982 | 1983 |
self.itemTreeWidget.InitLineNoItems() |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
689 | 689 |
|
690 | 690 |
return node |
691 | 691 |
|
692 |
def findOwner(self, symbols): |
|
693 |
import math |
|
694 |
|
|
695 |
try: |
|
696 |
minDist = None |
|
697 |
selected = None |
|
698 |
|
|
699 |
configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio') |
|
700 |
ratio = float(configs[0].value) if 1 == len(configs) else 1.5 |
|
701 |
|
|
702 |
dist = (self.sceneBoundingRect().height() + self.sceneBoundingRect().width()) * ratio / 2 |
|
703 |
center = self.sceneBoundingRect().center() |
|
704 |
|
|
705 |
target_symbols = [] |
|
706 |
for symbol in symbols: |
|
707 |
attrs = symbol.getAttributes() |
|
708 |
for attr in attrs: |
|
709 |
ret = attr.Codes.find_match_exactly(self.text()) |
|
710 |
if ret: |
|
711 |
target_symbols.append(symbol) |
|
712 |
break |
|
713 |
|
|
714 |
for symbol in target_symbols: |
|
715 |
if type(symbol) is SymbolSvgItem or type(symbol) is QEngineeringInstrumentItem: |
|
716 |
dx = symbol.center().x() - center.x() |
|
717 |
dy = symbol.center().y() - center.y() |
|
718 |
|
|
719 |
offset = (symbol.sceneBoundingRect().width() + symbol.sceneBoundingRect().height()) / 4 |
|
720 |
length = math.sqrt(dx*dx + dy*dy) - offset |
|
721 |
|
|
722 |
if (length < dist) and (minDist is None or length < minDist): |
|
723 |
minDist = length |
|
724 |
selected = symbol |
|
725 |
|
|
726 |
if selected is not None: |
|
727 |
attrs = selected.getAttributes() |
|
728 |
target_attr = None |
|
729 |
for attr in attrs: |
|
730 |
ret = attr.Codes.find_match_exactly(self.text()) |
|
731 |
if ret: |
|
732 |
self.setPlainText(ret) |
|
733 |
target_attr = attr |
|
734 |
break |
|
735 |
if selected.add_assoc_item(self, at=int(target_attr.AttrAt)): |
|
736 |
self.owner = selected |
|
737 |
except Exception as ex: |
|
738 |
from App import App |
|
739 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
740 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
741 |
|
|
692 | 742 |
''' |
693 | 743 |
@brief Set Color. Override QEngineeringAbstractItem's |
694 | 744 |
@author Jeongwoo |
695 | 745 |
@date 2018.05.11 |
696 | 746 |
@history humkyung 2018.05.13 update after change color |
697 | 747 |
''' |
698 |
|
|
699 | 748 |
def setColor(self, color): |
700 | 749 |
if QColor.isValidColor(color): |
701 | 750 |
c = QColor() |
내보내기 Unified diff