개정판 01e6af3a
issue global search
Change-Id: I8a9beb5d2915ec97d45e29946b37d187fe903185
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
75 | 75 |
self.ui.lineEditReplaceText.setEnabled(True) |
76 | 76 |
self.ui.label_2.setText('Text : ') |
77 | 77 | |
78 |
def find_symbol_global(self): |
|
79 |
try: |
|
80 |
text = self.ui.lineEditFindText.text() |
|
81 |
if not text: return |
|
82 | ||
83 |
result = [] |
|
84 | ||
85 |
app_doc_data = AppDocData.instance() |
|
86 |
project = app_doc_data.getCurrentProject() |
|
87 |
path = project.getTempPath() |
|
88 |
xmlList = os.listdir(path) |
|
89 |
nonXmlList = [] |
|
90 | ||
91 |
targetText = '' |
|
92 |
if self.ui.checkBoxUID.isChecked(): |
|
93 |
targetText = '<UID>' + text |
|
94 |
elif self.ui.checkBoxSymbol.isChecked(): |
|
95 |
targetText = '<NAME>' + text |
|
96 |
else: |
|
97 |
targetText = '<VALUE>' + text |
|
98 | ||
99 |
for index in range(len(xmlList)): |
|
100 |
if xmlList[index][-3:] != 'xml': |
|
101 |
nonXmlList.append(index) |
|
102 | ||
103 |
nonXmlList.sort(reverse=True) |
|
104 |
for index in nonXmlList: |
|
105 |
xmlList.pop(index) |
|
106 | ||
107 |
for xml in xmlList: |
|
108 |
xmlPath = os.path.join(path, xml) |
|
109 |
fw = open(xmlPath, 'r', encoding='utf8') |
|
110 |
xmlCon = fw.read() |
|
111 |
fw.close() |
|
112 | ||
113 |
number = 0 |
|
114 |
for target in targetText: |
|
115 |
while xmlCon.find(target) != -1: |
|
116 |
xmlCon = xmlCon.replace(target, '', 1) |
|
117 |
number += 1 |
|
118 | ||
119 |
if number > 0: |
|
120 |
result.append(xml + ' : ' + str(number)) |
|
121 | ||
122 |
return result |
|
123 | ||
124 |
except Exception as ex: |
|
125 |
from App import App |
|
126 |
from AppDocData import MessageType |
|
127 | ||
128 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
129 |
sys.exc_info()[-1].tb_lineno) |
|
130 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
131 | ||
78 | 132 |
def find_text(self): |
79 | 133 |
"""find user input text""" |
80 | 134 |
DTI_PID/DTI_PID/UI/TextItemEdit.ui | ||
---|---|---|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
14 |
<string>Text Find / Replace</string>
|
|
14 |
<string>Find / Replace</string> |
|
15 | 15 |
</property> |
16 | 16 |
<property name="sizeGripEnabled"> |
17 | 17 |
<bool>true</bool> |
... | ... | |
98 | 98 |
</widget> |
99 | 99 |
</item> |
100 | 100 |
<item> |
101 |
<widget class="QCheckBox" name="checkBoxGlobal"> |
|
102 |
<property name="text"> |
|
103 |
<string>Global</string> |
|
104 |
</property> |
|
105 |
</widget> |
|
106 |
</item> |
|
107 |
<item> |
|
101 | 108 |
<widget class="QDialogButtonBox" name="buttonBox"> |
102 | 109 |
<property name="orientation"> |
103 | 110 |
<enum>Qt::Horizontal</enum> |
내보내기 Unified diff