コード例 #1
0
ファイル: search_widget.py プロジェクト: halbbob/dff
 def export(self):
   text, ok = QInputDialog.getText(self, "Advanced search", "Filter export name",\
                                     QLineEdit.Normal, "") 
   if ok and text != "":
     siNode = self.vfs.getnode("/Searched items")
     filtersNode = Node(str(text), 0, siNode, None)
     filtersNode.__disown__()
     filtersNode.setDir()
     e = event()
     e.thisown = False
     vnode = Variant(filtersNode)
     vnode.thisown = False
     e.value = vnode
     VFS.Get().notify(e)
     nb_row = self.model.rowCount()
     for i in range(0, nb_row):
       index = self.model.index(i, 0)
       if not index.isValid():
         continue
       data = self.model.data(index, Qt.CheckStateRole)
       if data == Qt.Checked or data == Qt.PartiallyChecked:
         n = VFS.Get().getNodeFromPointer(long(index.internalId()))
         l = VLink(n, filtersNode)
         l.__disown__()
   else:
     box = QMessageBox(QMessageBox.Warning, "Error", "Error node already exists", \
                         QMessageBox.NoButton, self)
     box.exec_()
コード例 #2
0
ファイル: nodeviewbox.py プロジェクト: halbbob/dff
  def bookmark(self):
    if len(self.parent.model.checkedNodes) == 0:
      QMessageBox.warning(self, "Bookmark", self.bookmarkWarningMessage, QMessageBox.Ok)
      return
    bookdiag = bookmarkDialog(self)
    iReturn = bookdiag.exec_()
    if iReturn == 1:
      selectedCategory = bookdiag.getSelectedCategory()
      # Check is is new or existing category
      try:
        i = self.bookmarkCategories.index(selectedCategory)
      except ValueError:
        if not self.createCategory(selectedCategory):
          return
      selectedBookName = selectedCategory
      selectedBookmark = self.vfs.getnode('/Bookmarks/' + str(selectedBookName.toUtf8()))

      for (pnode, state) in self.parent.model.checkedNodes:
        p = self.VFS.getNodeFromPointer(pnode)
        n = VLink(p, selectedBookmark)
        n.__disown__()
        if p.hasChildren and state == 1:
          childrenList = p.children()
          for child in childrenList:
	    c = VLink(child, n)
	    c.__disown__()
      self.parent.model.checkedNodes.clear()	
      e = event()
      self.VFS.notify(e)
コード例 #3
0
ファイル: find.py プロジェクト: halbbob/dff
 def matchFilter(self, node):
     for priority in [0, 1, 2, 3]:
         if priority in self.filters.keys():
             for filter in self.filters[priority]:
                 if not filter[0].match(node, filter[1]):
                     return False
     e = event()
     e.type = 0x202
     e.thisown = False
     vnode = Variant(node)
     vnode.thisown = False
     e.value = vnode
     self.notify(e)
     return True
コード例 #4
0
ファイル: options_layout.py プロジェクト: halbbob/dff
    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('/')
                  baseNode = Node('timeline', 0, root)
	          baseNode.__disown__()
                  baseNode.setDir()
		  e = event()
		  e.value = 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__()
コード例 #5
0
ファイル: unzip.py プロジェクト: halbbob/dff
 def makeZipTree(self, origin):
   self.origin = origin
   self.file = self.origin.open()
   self.zipcontent = mzipfile.ZipFile(self.file)
   for zipfile in self.zipcontent.namelist():
     idx = zipfile.rfind("/")
     if idx != -1:
       path = zipfile[:idx]
       filename = zipfile[idx+1:]
     else:
       path = ""
       filename = zipfile
     parent = self.vfs.getnode(self.origin.absolute() + "/" + path)
     if parent == None:
       parent = self.makeDirs(path)
     attr = self.zipcontent.getinfo(zipfile)
     node = ZipNode(filename, attr.file_size, parent, self, zipfile)
     node.__disown__()
   e = event()
   e.value = Variant(self.origin)
   self.VFS.notify(e)
コード例 #6
0
ファイル: find.py プロジェクト: halbbob/dff
 def process(self):
     matchedNodes = []
     e = event()
     e.thisown = False
     self.__stop = False
     if self.recursive:
         if self.root != None and len(self.filters) != 0:
             #if self.root & 0x0000ffffffffffff == 0:
             #    nodes = self.root.fsobj()
             count = 0
             totalnodes = self.root.totalChildrenCount()
             vmax = Variant(totalnodes)
             vmax.thisown = False
             e.type = 0x200
             e.value = vmax
             self.notify(e)
             #if self.matchFilter(self.root):
             #    count += 1
             #    matchedNodes.append(self.root.this)
             #fsobjs = self.libvfs.fsobjs()
             #for fsobj in fsobjs:
             #    nodes = fsobjs.nodes()
             #    for node in nodes:
             #        if self.matchFilter(node):
             #            matchedNodes.append(node.this)
             #        count += 1
             e.type = 0x201
             for (top, dirs, files) in self.vfs.walk(self.root):
                 if self.__stop:
                     return matchedNodes
                 for d in dirs:
                     if self.__stop:
                         return matchedNodes
                     if self.matchFilter(d):
                         matchedNodes.append(d.this)
                     count += 1
                     vcount = Variant(count)
                     vcount.thisown = False
                     e.value = vcount
                     self.notify(e)
                     #print count, "/", totalnodes
                 for f in files:
                     if self.__stop:
                         return matchedNodes
                     if self.matchFilter(f):
                         matchedNodes.append(f.this)
                     count += 1
                     vcount = Variant(count)
                     vcount.thisown = False
                     e.value = vcount
                     self.notify(e)
                     #print count, "/", totalnodes
     else:
         children = self.root.children()
         count = 0
         totalnodes = len(children)
         vmax = Variant(totalnodes)
         vmax.thisown = False
         e.type = 0x200
         e.value = vmax
         self.notify(e)
         for child in children:
             if self.__stop:
                 return matchedNodes
             if self.matchFilter(child):
                 matchedNodes.append(child.this)
             count += 1
             vcount = Variant(count)
             vcount.thisown = False
             e.value = vcount
             self.notify(e)
     return matchedNodes
コード例 #7
0
ファイル: search_widget.py プロジェクト: halbbob/dff
 def stopSearch(self):
   e = event()
   e.thisown = False
   e.type = Filter.StopProcessing
   e.value = None
   self.filters.Event(e)
コード例 #8
0
ファイル: process.py プロジェクト: halbbob/dff
 def killJob(self):
     e = event()
     e.thisown = False
     e.value = None
     e.type = Carver.Stop
     self.notify(e)