示例#1
0
文件: find.py 项目: kzwkt/dff
    def start(self, args):
        self.nodes = []
        self.nodescount = 1
        self.oldcur = 0

        fname = args["filter_name"].value()
        expression = args["expression"].value()
        root_node = args["root_node"].value()
        if args.has_key("verbose"):
            self.verbose = True
        else:
            self.verbose = False
        if args.has_key("recursive"):
            recursive = True
        else:
            recursive = False
        f = Filter(fname)
        f.connection(self)
        try:
            f.compile(expression)
        except RuntimeError:
            self.res["error"] = Variant("provided expression is not valid")
        f.process(root_node, recursive)
        self.res["total of matching nodes"] = Variant(len(self.nodes))
        if args.has_key("save_result"):
            si_node = self.vfs.getnode("/Bookmarks")
            if si_node == None:
                root = self.vfs.getnode("/")
                si_node = Node("Bookmarks", 0, root)
                si_node.__disown__()
            fnode = Node(fname, 0, si_node)
            fnode.__disown__()
            for node in self.nodes:
                vl = VLink(node, fnode, node.name())
                vl.__disown__()
示例#2
0
文件: find.py 项目: udgover/modules
    def start(self, args):
        self.nodes = []
        self.nodescount = 1
        self.oldcur = 0

        fname = args["filter_name"].value()
        expression = args["expression"].value()
        root_node = args["root_node"].value()
        if args.has_key("verbose"):
            self.verbose = True
        else:
            self.verbose = False
        if args.has_key("recursive"):
            recursive = True
        else:
            recursive = False
        f = Filter(fname)
        f.connection(self)
        try:
            f.compile(expression)
        except RuntimeError:
            self.res["error"] = Variant("provided expression is not valid")
        f.process(root_node, recursive)
        self.res["total of matching nodes"] = Variant(len(self.nodes))
        if args.has_key("save_result"):
            si_node = self.vfs.getnode("/Bookmarks")
            if si_node == None:
                root = self.vfs.getnode("/")
                si_node = Node("Bookmarks", 0, root)
                si_node.__disown__()
            fnode = Node(fname, 0, si_node)
            fnode.__disown__()
            for node in self.nodes:
                vl = VLink(node, fnode, node.name())
                vl.__disown__()
示例#3
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__()
示例#4
0
文件: menu.py 项目: arxsys/dff-ui
  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)
示例#5
0
文件: menu.py 项目: 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)
示例#6
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__()