def begin_search(self, root_path, file_type, ignore_case, keyword):
counts = 0
for root, dirs, files in os.walk(root_path):
for each_file in files:
if is_valid_file_type(each_file, file_type):
path = root + os.sep + each_file
line_content = search_keyword_infile(path, keyword, ignore_case)
if line_content:
self.result_table.insertRow(counts)
content_path = QTableWidgetItem(".{}".format(path[len(root_path):]))
self.result_table.setItem(counts, 0, content_path)
content = QTableWidgetItem(line_content.strip())
self.result_table.setItem(counts, 1, content)
counts += 1
self.result_table.setRowCount(counts)
self.state_label.setText("????")
评论列表
文章目录