Ejemplo n.º 1
0
 def notifyWrite(self, eventType, value):
     e = event()
     e.thisown = False
     e.type = eventType
     try:
         e.value = RCVariant(Variant(value))
     except Exception as error:
         print 'report.fragments.notifyWrite ', error, value
         e.value = RCVariant(Variant(""))
     self.notify(e)
Ejemplo n.º 2
0
 def __notifyOverallProgress(self):
   buff = ""
   if self.total_files > 0:
     percent = (float(self.extracted_files) * 100) / self.total_files
     buff += "extracted file(s):   " + str(self.extracted_files) + "/" + str(self.total_files) + " (" + str(round(percent, 2)) + "%)\n"
   if self.total_folders > 0:
     percent = (float(self.extracted_folders) * 100) / self.total_folders
     buff += "extracted folder(s): " + str(self.extracted_folders) + "/" + str(self.total_folders) + " (" + str(round(percent, 2)) + "%)\n"
   if self.files_errors > 0 and self.total_files > 0:
     percent = (float(self.files_errors) * 100) / self.total_files
     buff += "file(s) error:       " + str(self.files_errors) + "/" + str(self.total_files) + " (" + str(round(percent, 2)) + "%)\n"
   if self.folders_errors > 0 and self.total_folders > 0:
     percent = (float(self.folders_errors) * 100) / self.total_folders
     buff += "folder(s) error:     " + str(self.folders_errors) + "/" + str(self.total_folders) + " (" + str(round(percent, 2)) + "%)\n"
   if self.ommited_files > 0 and self.total_files > 0:
     percent = (float(self.ommited_files) * 100) / self.total_files
     buff += "ommited file(s):     " + str(self.ommited_files) + "/" + str(self.total_files) + " (" + str(round(percent, 2)) + "%)\n"
   if self.ommited_folders > 0 and self.total_folders > 0:
     percent = (float(self.ommited_folders) * 100) / self.total_folders
     buff += "ommited folder(s):   " + str(self.ommited_folders) + "/" + str(self.total_folders) + " (" + str(round(percent, 2)) + "%)\n"
   e = event()
   e.type = Extract.OverallProgress
   e.value = RCVariant(Variant(buff))
   e.thisown = False
   self.notify(e)
Ejemplo n.º 3
0
 def __notifyFailure(self, src, ftype, tb):
     e = event()
     e.thisown = False
     e.type = ftype
     vl = VList()
     vl.append(Variant(src))
     vl.append(Variant(str(tb)))
     e.value = RCVariant(Variant(vl))
     self.notify(e)
Ejemplo n.º 4
0
 def __notifyFileProgress(self, node, percent):
     e = event()
     e.thisown = False
     e.type = Extract.FileProgress
     vl = VList()
     vl.append(Variant(node))
     vl.append(Variant(int(percent)))
     e.value = RCVariant(Variant(vl))
     self.notify(e)
Ejemplo n.º 5
0
 def __notifyRename(self, src, dst):
     e = event()
     e.thisown = False
     e.type = Extract.RenameOccured
     vl = VList()
     vl.append(Variant(src))
     vl.append(Variant(dst))
     e.value = RCVariant(Variant(vl))
     self.notify(e)
Ejemplo n.º 6
0
  def __notify(self, eventType, value):
      """Sent event evenType containing value
 """
      e = event()
      e.thisown = False
      e.type = eventType
      if type(value) == unicode:
          value = value.encode('UTF-8')
      e.value = RCVariant(Variant(value))
      self.notify(e)
Ejemplo n.º 7
0
Archivo: menu.py Proyecto: kzwkt/dff
    def acceptBookmark(self):
        selectedCategory = self.getSelectedCategory()
        # Check is is new or existing category
        try:
            i = BookmarkManager.categories.index(selectedCategory)
        except ValueError:
            if not self.manager.createCategory(selectedCategory):
                return
        selectedBookName = selectedCategory
        selectedBookmark = self.vfs.getnode('/Bookmarks/' +
                                            str(selectedBookName.toUtf8()))

        selected = self.manager.getSelectedNodes()

        for node in selected:
            if node:
                n = VLink(node, selectedBookmark)
                n.__disown__()
        e = event()
        e.thisown = False
        e.value = RCVariant(Variant(selectedBookmark))
        self.VFS.notify(e)
Ejemplo n.º 8
0
Archivo: page.py Proyecto: vertrex/DFF
 def __notify(self, eventType, value):
     e = event()
     e.thisown = False
     e.type = eventType
     e.value = RCVariant(Variant(value))
     self.notify(e)
Ejemplo n.º 9
0
    def exportClick(self, clickState):
        rect = self.timeline.ploter.selectionRect.rect()
        exportSelDateMin = self.timeline.draw.findXTime(rect.x())
        exportSelDateMax = self.timeline.draw.findXTime(rect.x() +
                                                        rect.width())

        for family in self.configuration:
            for time in family[1]:
                if time[1][0][1]:
                    nodes = []
                    everyNodes = self.timeline.elementsInRangeToNodeList(
                        time[1][5][1], self.timeline.toUSec(exportSelDateMin),
                        self.timeline.toUSec(exportSelDateMax))
                    for oneGroupNode in everyNodes:
                        for node in oneGroupNode:
                            nodes.append(node)
                    if len(nodes):
                        if not self.exportedNode:
                            # Create /timeline if needed
                            root = vfs.vfs().getnode('/Bookmarks')
                            baseNode = Node('timeline', 0, root)
                            baseNode.__disown__()
                            baseNode.setDir()
                            e = event()
                            e.thisown = False
                            e.value = RCVariant(Variant(baseNode))
                            self.VFS.notify(e)

                            # Create /timeline/<ParentName>
                            self.exportedNode = Node(self.timeline.node.name(),
                                                     0, baseNode)
                            self.exportedNode.__disown__()
                            self.exportedNode.setDir()
                        timeBaseName = self.exportedNode.absolute(
                        ) + '/' + str(
                            exportSelDateMin.strftime('%d.%m.%Y %H:%M:%S')
                        ) + ' to ' + str(
                            exportSelDateMax.strftime('%d.%m.%Y %H:%M:%S'))
                        timeBaseNode = vfs.vfs().getnode(timeBaseName)
                        if not timeBaseNode:
                            # Create /timeline/<ParentName>/dateStart to dateEnd/<Module:FullTimestampAttributePath>/
                            timeBaseNode = Node(
                                str(
                                    exportSelDateMin.strftime(
                                        '%d.%m.%Y %H:%M:%S')) + ' to ' + str(
                                            exportSelDateMax.strftime(
                                                '%d.%m.%Y %H:%M:%S')), 0,
                                self.exportedNode)
                            timeBaseNode.__disown__()
                            timeBaseNode.setDir()

                        baseFamilyName = timeBaseNode.absolute(
                        ) + '/' + ':'.join([family[0]] + time[0])
                        baseFamilyNode = vfs.vfs().getnode(baseFamilyName)
                        if not baseFamilyNode:
                            # Create /timeline/<ParentName>/dateStart to dateEnd//<Module:FullTimestampAttributePath> if needed
                            baseFamilyNode = Node(
                                ':'.join([family[0]] + time[0]), 0,
                                timeBaseNode)
                            baseFamilyNode.__disown__()
                            baseFamilyNode.setDir()

                        for node in nodes:
                            # Add each node in array as child
                            l = VLink(node, baseFamilyNode)
                            l.__disown__()