개정판 5f53ed4b
spec shortcut added
Change-Id: I28dbe60ddb4f1f24a238b7086ec13cf74cfcf9bb
DTI_PID/DTI_PID/Commands/SelectAttributeBatchCommand.py | ||
---|---|---|
41 | 41 |
scenePos = param[2] |
42 | 42 |
|
43 | 43 |
try: |
44 |
from App import App |
|
44 | 45 |
self.isTreated = False |
45 | 46 |
|
46 | 47 |
if not self.lineNo: |
... | ... | |
69 | 70 |
item = self.selection_order.pop(0) |
70 | 71 |
stream = [item for item in self.selection_order if issubclass(type(item), SymbolSvgItem) or type(item) is QEngineeringLineItem] |
71 | 72 |
values = [item for item in self.selection_order if issubclass(type(item), QEngineeringTextItem)] |
73 |
|
|
74 |
if item and not stream and not values: |
|
75 |
App.mainWnd().on_connect_spec_breaks([item]) |
|
76 |
return |
|
72 | 77 |
if len(stream) != 2 or len(values) % 2 != 0: |
73 | 78 |
return |
74 | 79 |
|
... | ... | |
211 | 216 |
self.onSuccess.emit(item) |
212 | 217 |
|
213 | 218 |
except Exception as ex: |
214 |
from App import App
|
|
219 |
from App import App |
|
215 | 220 |
from AppDocData import MessageType |
216 | 221 |
|
217 | 222 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
1086 | 1086 |
elif (event.key() == Qt.Key_C) and (event.modifiers() & Qt.ControlModifier): |
1087 | 1087 |
self.copy_cells_to_clipboard() |
1088 | 1088 |
event.accept() |
1089 |
elif type(self.mainWindow.graphicsView.command) is SelectAttributeBatchCommand.SelectAttributeBatchCommand and event.key() == Qt.Key_Return: |
|
1090 |
self.mainWindow.graphicsView.keyPressEvent(event) |
|
1089 | 1091 |
|
1090 | 1092 |
super(QItemPropertyTableWidget, self).keyPressEvent(event) |
1091 | 1093 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
779 | 779 |
"""connect line to symbol""" |
780 | 780 |
from LineDetector import LineDetector |
781 | 781 |
from shapely.geometry import Point |
782 |
from CodeTables import CodeTable |
|
783 | 782 |
#from RecognitionDialog import Worker |
784 | 783 |
|
785 | 784 |
if not self.graphicsView.hasImage(): |
... | ... | |
878 | 877 |
self.addMessage.emit(MessageType.Error, message) |
879 | 878 |
# up to here |
880 | 879 |
|
881 |
# connect end break |
|
882 |
usedItemPairs = [] |
|
883 |
for end_break in end_breaks: |
|
884 |
if end_break.prop('Freeze') or end_break.owner or end_break.prop('Connected Item'): |
|
885 |
usedItemPairs.append([end_break.owner, end_break.prop('Connected Item')]) |
|
886 |
|
|
887 |
for end_break in end_breaks: |
|
888 |
if end_break.prop('Freeze') or end_break.owner or end_break.prop('Connected Item'): |
|
889 |
continue |
|
890 |
|
|
891 |
originPoint = Point(end_break.origin[0], end_break.origin[1]) |
|
892 |
minD = sys.maxsize |
|
893 |
ownerItem = None |
|
894 |
connectedItem = None |
|
895 |
|
|
896 |
for symbol in symbols: |
|
897 |
for conn in symbol.connectors: |
|
898 |
dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1])) |
|
899 |
if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \ |
|
900 |
[pair for pair in usedItemPairs if symbol in pair and conn.connectedItem in pair] or dist > 3 * toler or dist > minD: |
|
901 |
continue |
|
880 |
try: |
|
881 |
# connect end break |
|
882 |
usedItemPairs = [] |
|
883 |
for end_break in end_breaks: |
|
884 |
if end_break.prop('Freeze') or end_break.owner or end_break.prop('Connected Item'): |
|
885 |
usedItemPairs.append([end_break.owner, end_break.prop('Connected Item')]) |
|
886 |
|
|
887 |
for end_break in end_breaks: |
|
888 |
if end_break.prop('Freeze') or end_break.owner or end_break.prop('Connected Item'): |
|
889 |
continue |
|
902 | 890 |
|
903 |
minD = dist |
|
904 |
ownerItem = symbol |
|
905 |
connectedItem = conn.connectedItem |
|
891 |
originPoint = Point(end_break.origin[0], end_break.origin[1]) |
|
892 |
minD = sys.maxsize |
|
893 |
ownerItem = None |
|
894 |
connectedItem = None |
|
895 |
|
|
896 |
for symbol in symbols: |
|
897 |
for conn in symbol.connectors: |
|
898 |
dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1])) |
|
899 |
if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \ |
|
900 |
[pair for pair in usedItemPairs if symbol in pair and conn.connectedItem in pair] or dist > 3 * toler or dist > minD: |
|
901 |
continue |
|
902 |
|
|
903 |
minD = dist |
|
904 |
ownerItem = symbol |
|
905 |
connectedItem = conn.connectedItem |
|
906 |
|
|
907 |
for line in lines: |
|
908 |
for conn in line.connectors: |
|
909 |
dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1])) |
|
910 |
if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \ |
|
911 |
conn._connected_at != QEngineeringAbstractItem.CONNECTED_AT_BODY or \ |
|
912 |
[pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 3 * toler or dist > minD: |
|
913 |
continue |
|
914 |
|
|
915 |
minD = dist |
|
916 |
ownerItem = line |
|
917 |
connectedItem = conn.connectedItem |
|
918 |
|
|
919 |
if ownerItem and connectedItem: |
|
920 |
end_break.set_property('Connected Item', connectedItem) |
|
921 |
end_break.setToolTip('owner : ' + str(ownerItem)) |
|
922 |
end_break.owner = ownerItem |
|
923 |
end_break.set_property('Freeze', True) |
|
924 |
|
|
925 |
usedItemPairs.append([ownerItem, connectedItem]) |
|
926 |
# up to here |
|
906 | 927 |
|
907 |
for line in lines:
|
|
908 |
for conn in line.connectors:
|
|
909 |
dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
|
|
910 |
if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
|
|
911 |
conn._connected_at != QEngineeringAbstractItem.CONNECTED_AT_BODY or \
|
|
912 |
[pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 3 * toler or dist > minD:
|
|
913 |
continue
|
|
928 |
# connect spec break
|
|
929 |
self.on_connect_spec_breaks(spec_breaks, texts, symbols, lines)
|
|
930 |
# up to here
|
|
931 |
except Exception as ex:
|
|
932 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
933 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
934 |
self.addMessage.emit(MessageType.Error, message)
|
|
914 | 935 |
|
915 |
minD = dist |
|
916 |
ownerItem = line |
|
917 |
connectedItem = conn.connectedItem |
|
936 |
QMessageBox.information(self, self.tr('Information'), self.tr('Connecting between symbols and lines is complete')) |
|
918 | 937 |
|
919 |
if ownerItem and connectedItem: |
|
920 |
end_break.set_property('Connected Item', connectedItem) |
|
921 |
end_break.setToolTip('owner : ' + str(ownerItem)) |
|
922 |
end_break.owner = ownerItem |
|
923 |
end_break.set_property('Freeze', True) |
|
938 |
def on_connect_spec_breaks(self, spec_breaks, texts=None, symbols=None, lines=None): |
|
939 |
from CodeTables import CodeTable |
|
940 |
from shapely.geometry import Point |
|
924 | 941 |
|
925 |
usedItemPairs.append([ownerItem, connectedItem]) |
|
926 |
# up to here |
|
942 |
app_doc_data = AppDocData.instance() |
|
943 |
|
|
944 |
try: |
|
945 |
if not texts or not symbols or not lines: |
|
946 |
texts = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringTextItem and item.owner is None] |
|
947 |
symbols = [item for item in self.graphicsView.scene().items() if issubclass(type(item), SymbolSvgItem) and type(item) is not QEngineeringEndBreakItem and item not in spec_breaks] |
|
948 |
lines = sorted([item for item in self.graphicsView.scene().items() if type(item) is QEngineeringLineItem], key=lambda param: param.length(), reverse=True) |
|
927 | 949 |
|
928 |
# connect spec break |
|
929 | 950 |
usedTexts = [] |
930 | 951 |
attribute_table_item_list = [] |
931 | 952 |
dist_range = None |
... | ... | |
1106 | 1127 |
stream_line[index].add_assoc_item(up_down_find[index], |
1107 | 1128 |
key.AttrAt, force=True) |
1108 | 1129 |
up_down_find[index].owner = stream_line[index] |
1109 |
#key.Freeze = True
|
|
1130 |
key.Freeze = True |
|
1110 | 1131 |
break |
1111 |
# up to here |
|
1132 |
except Exception as ex: |
|
1133 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
1134 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
1135 |
self.addMessage.emit(MessageType.Error, message) |
|
1112 | 1136 |
|
1113 |
QMessageBox.information(self, self.tr('Information'), self.tr('Connecting between symbols and lines is complete')) |
|
1114 | 1137 |
|
1115 | 1138 |
def on_recognize_line(self): |
1116 | 1139 |
"""recognize lines in selected area""" |
내보내기 Unified diff