def on_search_result(self, search_text, found, path, index, linenr, line):
     '''
     Slot to handle the signals for search result. This signals are forwarded used
     search_result_signal.
     '''
     if found and search_text == self.current_search_text:
         id = "%d:%s" % (index, path)
         self.search_results_fileset.add(path)
         item = (search_text, found, path, index)
         if item not in self.search_results:
             self.search_results.append((id, search_text, found, path, index, linenr, line))
         if self._wait_for_result:
             self._search_result_index += 1
             if index >= self._tabwidget.currentWidget().textCursor().position() or self._tabwidget.currentWidget().filename != path:
                 self._wait_for_result = False
                 self.search_result_signal.emit(search_text, found, path, index)
                 self.replace_button.setEnabled(True)
         pkg, rpath = package_name(os.path.dirname(path))
         itemstr = '%s [%s]' % (os.path.basename(path), pkg)
         if not self.found_files_list.findItems(itemstr, Qt.MatchExactly):
             list_item = QTreeWidgetItem(self.found_files_list)
             list_item.setText(0, itemstr)
             list_item.setToolTip(0, path)
             self.found_files_list.insertTopLevelItem(0, list_item)
             self.found_files_list.expandAll()
         for i in range(self.found_files_list.topLevelItemCount()):
             top_item = self.found_files_list.topLevelItem(i)
             if top_item.text(0) == itemstr:
                 sub_item_str = "%d: %s" % (linenr, line)
                 list_item2 = QTreeWidgetItem()
                 list_item2.setText(0, sub_item_str)
                 list_item2.setWhatsThis(0, id)
                 top_item.addChild(list_item2)
             #self.found_files_list.setVisible(len(self.search_results_fileset) > 0)
     self._update_label()
Example #2
0
    def update_one_item(self, row, info):
        twi = QTreeWidgetItem()
        for col, field in enumerate(self.out_fields):
            val = info[field]
            twi.setText(col, self.format_strs[col] % val)
        self._table_widget.insertTopLevelItem(row, twi)

        for col, (key, func) in self.tooltips.iteritems():
            twi.setToolTip(col, func(info[key]))

        with self._selected_node_lock:
            if twi.text(0) == self._selected_node:
                twi.setSelected(True)

        self._table_widget.setItemHidden(twi, len(self.name_filter.findall(info['node_name'])) == 0)
Example #3
0
    def update_one_item(self, row, info):
        twi = QTreeWidgetItem()
        for col, field in enumerate(self.out_fields):
            val = info[field]
            twi.setText(col, self.format_strs[col] % val)
        self._table_widget.insertTopLevelItem(row, twi)

        for col, (key, func) in self.tooltips.iteritems():
            twi.setToolTip(col, func(info[key]))

        with self._selected_node_lock:
            if twi.text(0) == self._selected_node:
                twi.setSelected(True)

        self._table_widget.setItemHidden(
            twi,
            len(self.name_filter.findall(info['node_name'])) == 0)
 def on_search_result(self, search_text, found, path, index, linenr, line):
     '''
     Slot to handle the signals for search result. This signals are forwarded used
     search_result_signal.
     '''
     if found and search_text == self.current_search_text:
         id = "%d:%s" % (index, path)
         self.search_results_fileset.add(path)
         item = (search_text, found, path, index)
         if item not in self.search_results:
             self.search_results.append(
                 (id, search_text, found, path, index, linenr, line))
         if self._wait_for_result:
             self._search_result_index += 1
             if index >= self._tabwidget.currentWidget().textCursor(
             ).position() or self._tabwidget.currentWidget(
             ).filename != path:
                 self._wait_for_result = False
                 self.search_result_signal.emit(search_text, found, path,
                                                index)
                 self.replace_button.setEnabled(True)
         pkg, rpath = package_name(os.path.dirname(path))
         itemstr = '%s [%s]' % (os.path.basename(path), pkg)
         if not self.found_files_list.findItems(itemstr, Qt.MatchExactly):
             list_item = QTreeWidgetItem(self.found_files_list)
             list_item.setText(0, itemstr)
             list_item.setToolTip(0, path)
             self.found_files_list.insertTopLevelItem(0, list_item)
             self.found_files_list.expandAll()
         for i in range(self.found_files_list.topLevelItemCount()):
             top_item = self.found_files_list.topLevelItem(i)
             if top_item.text(0) == itemstr:
                 sub_item_str = "%d: %s" % (linenr, line)
                 list_item2 = QTreeWidgetItem()
                 list_item2.setText(0, sub_item_str)
                 list_item2.setWhatsThis(0, id)
                 top_item.addChild(list_item2)
             #self.found_files_list.setVisible(len(self.search_results_fileset) > 0)
     self._update_label()