本文整理汇总了Python中Core.Organizer.searchAndReplace方法的典型用法代码示例。如果您正苦于以下问题:Python Organizer.searchAndReplace方法的具体用法?Python Organizer.searchAndReplace怎么用?Python Organizer.searchAndReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Organizer
的用法示例。
在下文中一共展示了Organizer.searchAndReplace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply
# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import searchAndReplace [as 别名]
def apply(self):
self.checkCompleters()
self.reFillCompleters()
getMainTable().createHistoryPoint()
searchStrings = str(self.leSearch.text()).split(";")
replaceStrings = str(self.leReplace.text()).split(";")
for filterNo in range(0, len(searchStrings)):
if self.specialTools.btChange.isChecked():
pass
elif self.specialTools.tbAddToBefore.isChecked():
replaceStrings[filterNo] += searchStrings[filterNo]
elif self.specialTools.tbAddToAfter.isChecked():
replaceStrings[filterNo] = searchStrings[filterNo] + replaceStrings[filterNo]
while len(replaceStrings) != len(searchStrings):
replaceStrings.append("")
selectedColumnKey = self.columns.currentData()
if selectedColumnKey == "all":
columnKeys = getMainTable().getWritableColumnKeys()
else:
columnKeys = [selectedColumnKey]
for columnKey in columnKeys:
columnNo = getMainTable().getColumnNoFromKey(columnKey)
if getMainTable().checkReadOnlyColumn(columnKey) is False:
continue
if getMainTable().checkHiddenColumn(columnKey, False) is False:
continue
for rowNo in range(getMainTable().rowCount()):
if getMainTable().isChangeableItem(rowNo, columnKey, None, True):
newString = str(getMainTable().item(rowNo, columnNo).text())
newString = uni.trUnicode(newString)
myString = ""
informationSectionX = self.specialTools.cbInformationSectionX.value()
informationSectionY = self.specialTools.cbInformationSectionY.value()
isCaseInsensitive = self.cckbCaseInsensitive.isChecked()
isRegExp = self.cckbRegExp.isChecked()
if self.specialTools.cbInformationSection.currentIndex() == 0:
myString = Organizer.searchAndReplace(newString, searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
elif self.specialTools.cbInformationSection.currentIndex() == 1:
myString = Organizer.searchAndReplace(newString[:informationSectionX], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
myString += newString[informationSectionX:]
elif self.specialTools.cbInformationSection.currentIndex() == 2:
myString = newString[:informationSectionX]
myString += Organizer.searchAndReplace(newString[informationSectionX:], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
elif self.specialTools.cbInformationSection.currentIndex() == 3:
myString = Organizer.searchAndReplace(newString[:-informationSectionX], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
myString += newString[-informationSectionX:]
elif self.specialTools.cbInformationSection.currentIndex() == 4:
myString = newString[:-informationSectionX]
myString += Organizer.searchAndReplace(newString[-informationSectionX:], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
elif self.specialTools.cbInformationSection.currentIndex() == 5:
myString = newString[:informationSectionX]
myString += Organizer.searchAndReplace(newString[informationSectionX:informationSectionY],
searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
myString += newString[informationSectionY:]
elif self.specialTools.cbInformationSection.currentIndex() == 6:
myString = Organizer.searchAndReplace(newString[:informationSectionX], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
myString += newString[informationSectionX:informationSectionY]
myString += Organizer.searchAndReplace(newString[informationSectionY:], searchStrings,
replaceStrings, isCaseInsensitive, isRegExp)
getMainTable().item(rowNo, columnNo).setText(str(myString))