예제 #1
0
 def walk(self, query, ignoredot = False, maxdepth = -1, user_data = None):
     # cancel any existing request
     self._enumerate.cancel()
     self._enumerate.reset()
     self._userData = user_data
     
     # call the clear callback
     self._clear()
     
     # consider doing query_info_async to determine if this is
     # a directory without potential blocking for slow disks.
     if not query or not os.path.isdir(query):
         False
     
     # build a unique stamp for this query
     stamp = self._stamp = str(time.time()) + query
     
     # build our state and file objects
     # state => (
     #   unique query stamp,
     #   dirs to traverse,
     #   ignore dot files/dirs
     #   max depth to traverse
     #   current traversal depth
     # )
     state = [stamp, [], ignoredot, maxdepth, 0]
     vfs = gio.vfs_get_default()
     gfile = vfs.get_file_for_path(query)
     
     # asynchronously get the list of children
     attrs = ','.join([_NAME_ATTRIBUTE, _TYPE_ATTRIBUTE])
     gfile.enumerate_children_async(attrs, self._walk, 0, 0,
                                    self._enumerate, state)
     
     return True
예제 #2
0
 def setUp(self):
     self.vfs = gio.vfs_get_default()
예제 #3
0
 def setUp(self):
     self.vfs = gio.vfs_get_default()