Ejemplo n.º 1
0
 def fillTree(self):
     self.tree.clear()
     entries = ProcessingLog.getLogEntries()
     names = {}
     icons = {}
     groupItem = QTreeWidgetItem()
     groupItem.setText(0, 'ALGORITHM')
     groupItem.setIcon(0, self.groupIcon)
     for entry in entries:
         icon = self.keyIcon
         name = ''
         match = re.search('processing.run\\("(.*?)"', entry.text)
         if match.group:
             algorithm_id = match.group(1)
             if algorithm_id not in names:
                 algorithm = QgsApplication.processingRegistry(
                 ).algorithmById(algorithm_id)
                 if algorithm:
                     names[algorithm_id] = algorithm.displayName()
                     icons[
                         algorithm_id] = QgsApplication.processingRegistry(
                         ).algorithmById(algorithm_id).icon()
                 else:
                     names[algorithm_id] = ''
                     icons[algorithm_id] = self.keyIcon
             name = names[algorithm_id]
             icon = icons[algorithm_id]
         item = TreeLogEntryItem(entry, True, name)
         item.setIcon(0, icon)
         groupItem.insertChild(0, item)
     self.tree.addTopLevelItem(groupItem)
     groupItem.setExpanded(True)
Ejemplo n.º 2
0
 def fillTree(self):
     self.tree.clear()
     entries = ProcessingLog.getLogEntries()
     groupItem = QTreeWidgetItem()
     groupItem.setText(0, 'ALGORITHM')
     groupItem.setIcon(0, self.groupIcon)
     for entry in entries:
         item = TreeLogEntryItem(entry, True)
         item.setIcon(0, self.keyIcon)
         groupItem.insertChild(0, item)
     self.tree.addTopLevelItem(groupItem)
Ejemplo n.º 3
0
 def fillTree(self):
     self.tree.clear()
     elements = ProcessingLog.getLogEntries()
     for category in elements.keys():
         groupItem = QTreeWidgetItem()
         groupItem.setText(0,category)
         groupItem.setIcon(0, self.groupIcon)
         for entry in elements[category]:
             item = TreeLogEntryItem(entry, category==ProcessingLog.LOG_ALGORITHM)
             item.setIcon(0, self.keyIcon)
             groupItem.insertChild(0,item)
         self.tree.addTopLevelItem(groupItem)
Ejemplo n.º 4
0
 def fillTree(self):
     self.tree.clear()
     elements = ProcessingLog.getLogEntries()
     for category in elements.keys():
         groupItem = QTreeWidgetItem()
         groupItem.setText(0,category)
         groupItem.setIcon(0, self.groupIcon)
         for entry in elements[category]:
             item = TreeLogEntryItem(entry, category==ProcessingLog.LOG_ALGORITHM)
             item.setIcon(0, self.keyIcon)
             groupItem.insertChild(0,item)
         self.tree.addTopLevelItem(groupItem)
Ejemplo n.º 5
0
    def fillTree(self):
        self.tree.clear()
        entries = ProcessingLog.getLogEntries()

        if not entries:
            return

        names = {}
        icons = {}
        group_items = []
        current_group_item = -1
        current_date = ''
        for entry in entries:
            date = self.contextDateString(entry.date[0:10])
            if date != current_date:
                current_date = date
                current_group_item += 1
                group_items.append(QTreeWidgetItem())
                group_items[current_group_item].setText(0, date)
                group_items[current_group_item].setIcon(0, self.groupIcon)
            icon = self.keyIcon
            name = ''
            match = re.search('processing.run\\("(.*?)"', entry.text)
            if match.group:
                algorithm_id = match.group(1)
                if algorithm_id not in names:
                    algorithm = QgsApplication.processingRegistry(
                    ).algorithmById(algorithm_id)
                    if algorithm:
                        names[algorithm_id] = algorithm.displayName()
                        icons[
                            algorithm_id] = QgsApplication.processingRegistry(
                            ).algorithmById(algorithm_id).icon()
                    else:
                        names[algorithm_id] = ''
                        icons[algorithm_id] = self.keyIcon
                name = names[algorithm_id]
                icon = icons[algorithm_id]
            item = TreeLogEntryItem(entry, True, name)
            item.setIcon(0, icon)
            group_items[current_group_item].insertChild(0, item)

        self.tree.addTopLevelItems(reversed(group_items))
        self.tree.topLevelItem(0).setExpanded(True)