개정판 ed6dd360
issue #563: alarm can be sorted by using attrat value
Change-Id: I4b214123a9ae0f0b911c0f8c0fdf09081ae24520
DTI_PID/DTI_PID/CodeTables.py | ||
---|---|---|
60 | 60 |
return None, None |
61 | 61 |
|
62 | 62 |
def find_match_exactly(self, text): |
63 |
import re |
|
64 |
|
|
63 | 65 |
for value in self.values: |
64 | 66 |
if text == value[1]: |
65 | 67 |
return value[1] |
66 | 68 |
else: |
67 | 69 |
matches = [x for x in value[3] if x and text == x] |
68 |
if matches: return value[1] |
|
70 |
if matches: |
|
71 |
return value[1] |
|
72 |
else: |
|
73 |
if value[3][0]: |
|
74 |
match = re.search(value[3][0], text) |
|
75 |
if match: |
|
76 |
return value[1] |
|
69 | 77 |
|
70 | 78 |
return None |
71 | 79 |
|
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
572 | 572 |
targetText.append(text) |
573 | 573 |
|
574 | 574 |
worker.need_update_texts = [] |
575 |
targetText = sorted(targetText, key=lambda param:len(param.text()), reverse=True) |
|
575 | 576 |
for text in targetText: |
576 | 577 |
ret = text.findOwner(symbols) if type(text) is not QEngineeringTagNoTextItem else text.findOwner(symbols + equip_packages) |
577 | 578 |
if ret: |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
773 | 773 |
configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio') |
774 | 774 |
ratio = float(configs[0].value) if 1 == len(configs) else 1.5 |
775 | 775 |
|
776 |
dist = (self.sceneBoundingRect().height() + self.sceneBoundingRect().width()) * ratio / 2 |
|
776 |
if len(self.text()) > 3: |
|
777 |
width = self.sceneBoundingRect().width() |
|
778 |
elif len(self.text()) == 3: |
|
779 |
width = self.sceneBoundingRect().width() * 4 / 3 |
|
780 |
elif len(self.text()) == 2: |
|
781 |
width = self.sceneBoundingRect().width() * 2 |
|
782 |
else: |
|
783 |
width = self.sceneBoundingRect().width() * 4 |
|
784 |
dist = (self.sceneBoundingRect().height() + width) * ratio / 2 |
|
777 | 785 |
center = self.sceneBoundingRect().center() |
778 | 786 |
|
779 | 787 |
target_symbols = [] |
... | ... | |
786 | 794 |
freeze = True |
787 | 795 |
break |
788 | 796 |
if freeze: continue |
797 |
|
|
789 | 798 |
for attr in attrs: |
790 | 799 |
ret = attr.Codes.find_match_exactly(self.text()) |
791 | 800 |
if ret: |
... | ... | |
806 | 815 |
|
807 | 816 |
if selected is not None: |
808 | 817 |
attrs = selected.getAttributes() |
809 |
target_attr = None
|
|
818 |
target_attrs = []
|
|
810 | 819 |
for attr in attrs: |
811 | 820 |
ret = attr.Codes.find_match_exactly(self.text()) |
812 | 821 |
if ret: |
813 |
target_attr = attr |
|
814 |
break |
|
815 |
if target_attr.AssocItem is None and selected.add_assoc_item(self, at=int(target_attr.AttrAt)): |
|
816 |
target_attr.AssocItem = self |
|
817 |
self.owner = selected |
|
818 |
return ret |
|
819 |
else: |
|
820 |
return False |
|
822 |
target_attrs.append(attr) |
|
823 |
|
|
824 |
for target_attr in sorted(target_attrs, key=lambda param:int(param.AttrAt)): |
|
825 |
if target_attr.AssocItem is None and selected.add_assoc_item(self, at=int(target_attr.AttrAt)): |
|
826 |
target_attr.AssocItem = self |
|
827 |
self.owner = selected |
|
828 |
return ret |
|
829 |
|
|
830 |
return False |
|
821 | 831 |
except Exception as ex: |
822 | 832 |
from App import App |
823 | 833 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
DTI_PID/DTI_PID/SymbolAttrCodeTable_UI.py | ||
---|---|---|
11 | 11 |
class Ui_AttributeCodeTable(object): |
12 | 12 |
def setupUi(self, AttributeCodeTable): |
13 | 13 |
AttributeCodeTable.setObjectName("AttributeCodeTable") |
14 |
AttributeCodeTable.resize(496, 341)
|
|
14 |
AttributeCodeTable.resize(555, 384)
|
|
15 | 15 |
font = QtGui.QFont() |
16 | 16 |
font.setFamily("맑은 고딕") |
17 | 17 |
AttributeCodeTable.setFont(font) |
... | ... | |
22 | 22 |
self.gridLayout.setObjectName("gridLayout") |
23 | 23 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
24 | 24 |
self.horizontalLayout.setObjectName("horizontalLayout") |
25 |
self.checkBoxAllowable = QtWidgets.QCheckBox(AttributeCodeTable) |
|
26 |
self.checkBoxAllowable.setObjectName("checkBoxAllowable") |
|
27 |
self.horizontalLayout.addWidget(self.checkBoxAllowable) |
|
28 |
self.line = QtWidgets.QFrame(AttributeCodeTable) |
|
29 |
self.line.setFrameShape(QtWidgets.QFrame.VLine) |
|
30 |
self.line.setFrameShadow(QtWidgets.QFrame.Sunken) |
|
31 |
self.line.setObjectName("line") |
|
32 |
self.horizontalLayout.addWidget(self.line) |
|
25 | 33 |
self.label = QtWidgets.QLabel(AttributeCodeTable) |
26 | 34 |
self.label.setObjectName("label") |
27 | 35 |
self.horizontalLayout.addWidget(self.label) |
... | ... | |
60 | 68 |
def retranslateUi(self, AttributeCodeTable): |
61 | 69 |
_translate = QtCore.QCoreApplication.translate |
62 | 70 |
AttributeCodeTable.setWindowTitle(_translate("AttributeCodeTable", "Attribute Code Table")) |
71 |
self.checkBoxAllowable.setText(_translate("AttributeCodeTable", "Auto Allowable")) |
|
63 | 72 |
self.label.setText(_translate("AttributeCodeTable", "Line Height : ")) |
64 | 73 |
self.pushButtonRead.setText(_translate("AttributeCodeTable", "Read from Legend")) |
65 | 74 |
self.groupBoxTitleBlock.setTitle(_translate("AttributeCodeTable", "Table")) |
DTI_PID/DTI_PID/UI/SymbolAttrCodeTable.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>496</width>
|
|
10 |
<height>341</height>
|
|
9 |
<width>555</width>
|
|
10 |
<height>384</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="font"> |
... | ... | |
26 | 26 |
<item row="2" column="0"> |
27 | 27 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
28 | 28 |
<item> |
29 |
<widget class="QCheckBox" name="checkBoxAllowable"> |
|
30 |
<property name="text"> |
|
31 |
<string>Auto Allowable</string> |
|
32 |
</property> |
|
33 |
</widget> |
|
34 |
</item> |
|
35 |
<item> |
|
36 |
<widget class="Line" name="line"> |
|
37 |
<property name="orientation"> |
|
38 |
<enum>Qt::Vertical</enum> |
|
39 |
</property> |
|
40 |
</widget> |
|
41 |
</item> |
|
42 |
<item> |
|
29 | 43 |
<widget class="QLabel" name="label"> |
30 | 44 |
<property name="text"> |
31 | 45 |
<string>Line Height : </string> |
내보내기 Unified diff