本文整理匯總了Python中Search.listFiles方法的典型用法代碼示例。如果您正苦於以下問題:Python Search.listFiles方法的具體用法?Python Search.listFiles怎麽用?Python Search.listFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Search
的用法示例。
在下文中一共展示了Search.listFiles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: findInFiles
# 需要導入模塊: import Search [as 別名]
# 或者: from Search import listFiles [as 別名]
def findInFiles(self):
names = []
pattern = self.findTxt.GetValue()
bRecursive = self.chkRecursiveSearch.GetValue()
file_filter = string.split(self.cmbFileFilter.GetValue(), ';')
folder = [self.cmbFolder.GetValue()]
self.engine.addFolder(folder[0])
self.engine.addSuffix(self.cmbFileFilter.GetValue())
dlg = wx.ProgressDialog(_("Building file list from directory '%s'") % (folder[0]),
_('Searching...'), 100, self.view,
wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
try:
iterDirFiles = Search.listFiles(folder, file_filter, 1, bRecursive)
iStep = 0
for sFile in iterDirFiles:
names.append(sFile)
if iStep < 100 and not dlg.Update(iStep):
#self.view.model.editor.setStatus('Search aborted')
break
iStep = iStep + 1
finally:
dlg.Destroy()
self.engine.findAllInFiles(names, self.view, pattern )
self.setComboBoxes('findInFiles')
if self.engine.closeOnFound:
self.EndModal(wx.ID_OK)