개정판 ba773394
add find match exactly option
Change-Id: I09cf0929ff0aa00e779615fed176e77395f12414
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
111 | 111 |
targetText = '' |
112 | 112 |
if self.ui.checkBoxUID.isChecked(): |
113 | 113 |
targetText = '<UID>' + text |
114 |
if self.ui.checkBoxMatch.isChecked(): |
|
115 |
targetText = targetText + '</UID>' |
|
114 | 116 |
targetText = targetText.upper() |
115 | 117 |
elif self.ui.checkBoxSymbol.isChecked(): |
116 | 118 |
targetText = '<NAME>' + text |
119 |
if self.ui.checkBoxMatch.isChecked(): |
|
120 |
targetText = targetText + '</NAME>' |
|
117 | 121 |
targetText = targetText.upper() |
118 | 122 |
else: |
119 | 123 |
targetText = '<VALUE>' + text |
120 |
targetTexts.append('<TEXT>' + text) |
|
124 |
if self.ui.checkBoxMatch.isChecked(): |
|
125 |
targetText = targetText + '</VALUE>' |
|
126 |
targetTexts.append('<TEXT>' + text if not self.ui.checkBoxMatch.isChecked() else '<TEXT>' + text + '</TEXT>') |
|
121 | 127 |
targetTexts.append(targetText) |
122 | 128 |
|
123 | 129 |
for index in range(len(xmlList)): |
... | ... | |
166 | 172 |
if not self.ui.checkBoxGlobal.isChecked(): |
167 | 173 |
if self.ui.checkBoxUID.isChecked(): |
168 | 174 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
169 |
if hasattr(item, 'uid') and str(item.uid).count(text)]
|
|
175 |
if hasattr(item, 'uid') and (str(item.uid).upper().count(text.upper()) if not self.ui.checkBoxMatch.isChecked() else str(item.uid).upper() == text.upper())]
|
|
170 | 176 |
else: |
171 | 177 |
if not self.ui.checkBoxSymbol.isChecked(): |
172 | 178 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
173 |
if issubclass(type(item), QEngineeringTextItem) and item.text().count(text)]
|
|
179 |
if issubclass(type(item), QEngineeringTextItem) and (item.text().upper().count(text.upper()) if not self.ui.checkBoxMatch.isChecked() else item.text().upper() == text.upper())]
|
|
174 | 180 |
else: |
175 | 181 |
if text.upper() == 'PACKAGE': |
176 | 182 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
177 | 183 |
if issubclass(type(item), QEngineeringVendorItem)] |
178 | 184 |
else: |
179 | 185 |
text_items = [item for item in self.mainWindow.graphicsView.scene().items() |
180 |
if issubclass(type(item), SymbolSvgItem) and text.upper() in item.name.upper()]
|
|
186 |
if issubclass(type(item), SymbolSvgItem) and (text.upper() in item.name.upper() if not self.ui.checkBoxMatch.isChecked() else text.upper() == item.name.upper())]
|
|
181 | 187 |
else: |
182 | 188 |
text_items = self.find_symbol_global() |
183 | 189 |
|
DTI_PID/DTI_PID/TextItemEdit_UI.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
# Form implementation generated from reading ui file './UI/TextItemEdit.ui' |
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.9.2
|
|
5 |
# Created by: PyQt5 UI code generator 5.15.4
|
|
6 | 6 |
# |
7 |
# WARNING! All changes made in this file will be lost! |
|
7 |
# WARNING: Any manual changes made to this file will be lost when pyuic5 is |
|
8 |
# run again. Do not edit this file unless you know what you are doing. |
|
9 |
|
|
8 | 10 |
|
9 | 11 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 | 12 |
|
13 |
|
|
11 | 14 |
class Ui_TextItemEditDialog(object): |
12 | 15 |
def setupUi(self, TextItemEditDialog): |
13 | 16 |
TextItemEditDialog.setObjectName("TextItemEditDialog") |
... | ... | |
58 | 61 |
self.checkBoxGlobal = QtWidgets.QCheckBox(TextItemEditDialog) |
59 | 62 |
self.checkBoxGlobal.setObjectName("checkBoxGlobal") |
60 | 63 |
self.horizontalLayout.addWidget(self.checkBoxGlobal) |
64 |
self.checkBoxMatch = QtWidgets.QCheckBox(TextItemEditDialog) |
|
65 |
self.checkBoxMatch.setObjectName("checkBoxMatch") |
|
66 |
self.horizontalLayout.addWidget(self.checkBoxMatch) |
|
61 | 67 |
self.buttonBox = QtWidgets.QDialogButtonBox(TextItemEditDialog) |
62 | 68 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
63 | 69 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close) |
... | ... | |
81 | 87 |
self.checkBoxUID.setText(_translate("TextItemEditDialog", "UID")) |
82 | 88 |
self.checkBoxSymbol.setText(_translate("TextItemEditDialog", "Symbol")) |
83 | 89 |
self.checkBoxGlobal.setText(_translate("TextItemEditDialog", "Global")) |
84 |
|
|
90 |
self.checkBoxMatch.setText(_translate("TextItemEditDialog", "Match")) |
|
85 | 91 |
import MainWindow_rc |
86 | 92 |
|
93 |
|
|
87 | 94 |
if __name__ == "__main__": |
88 | 95 |
import sys |
89 | 96 |
app = QtWidgets.QApplication(sys.argv) |
... | ... | |
92 | 99 |
ui.setupUi(TextItemEditDialog) |
93 | 100 |
TextItemEditDialog.show() |
94 | 101 |
sys.exit(app.exec_()) |
95 |
|
DTI_PID/DTI_PID/UI/TextItemEdit.ui | ||
---|---|---|
105 | 105 |
</widget> |
106 | 106 |
</item> |
107 | 107 |
<item> |
108 |
<widget class="QCheckBox" name="checkBoxMatch"> |
|
109 |
<property name="text"> |
|
110 |
<string>Match</string> |
|
111 |
</property> |
|
112 |
</widget> |
|
113 |
</item> |
|
114 |
<item> |
|
108 | 115 |
<widget class="QDialogButtonBox" name="buttonBox"> |
109 | 116 |
<property name="orientation"> |
110 | 117 |
<enum>Qt::Horizontal</enum> |
내보내기 Unified diff