コード例 #1
0
 def get_items(self):
     try:
         for fname in os.listdir(self.directory):
             if self.show_hidden or not fname.startswith("."):
                 yield ConstructFileLeaf(path.join(self.directory, fname))
     except OSError, exc:
         self.output_error(exc)
コード例 #2
0
ファイル: tracker.py プロジェクト: jchtt/kupfer-adds
 def get_items(self):
     return (ConstructFileLeaf(f) for f in get_tracker_tag_items(self.tag))
コード例 #3
0
ファイル: tracker.py プロジェクト: jchtt/kupfer-adds
        # (i) offset, (i) max_hits
        # Returns array of strings for results
        try:
            file_hits = searchobj.Text(1, "Files", self.query, 0,
                                       self.max_items)
        except dbus.DBusException, exc:
            pretty.print_error(__name__, exc)
            return

        for filestr in file_hits:
            # A bit of encoding carousel
            # dbus strings are subclasses of unicode
            # but FileLeaf expects a filesystem encoded object
            bytes = filestr.decode("UTF-8", "replace")
            filename = gobject.filename_from_utf8(bytes)
            yield ConstructFileLeaf(filename)

    def get_description(self):
        return _('Results for "%s"') % self.query

    def get_icon_name(self):
        return "tracker"

    @classmethod
    def decorates_type(cls):
        return FileLeaf

    @classmethod
    def decorate_item(cls, leaf):
        # FIXME: Very simplified .savedSearch parsing, so far we only support
        # the query, without additional filtering. The simplest form of
コード例 #4
0
 def mkleaves(directory):
     files = utils.get_dirlist(directory,
                               depth=self.depth,
                               exclude=self._exclude_file)
     return (ConstructFileLeaf(f) for f in files)
コード例 #5
0
 def get_items(self):
     return (ConstructFileLeaf(d) for d in self._get_dirs())
コード例 #6
0
 def get_locate_output(proc, offset=0):
     out, ignored_err = proc.communicate()
     return (ConstructFileLeaf(kupferstring.fromlocale(f))
             for f in out.split(b'\x00')[offset:-1])
コード例 #7
0
		def get_locate_output(proc, offset=0):
			out, ignored_err = proc.communicate()
			return (ConstructFileLeaf(f) for f in out.split("\x00")[offset:-1])