コード例 #1
0
    def test_idle_iterate(self):
        # test using eventloop.idle_iterate()
        def foo(start, stop, step):
            for x in xrange(start, stop, step):
                self.current_value = x
                yield

        eventloop.idle_iterate(foo, "test idle iterator",
                args=(10, 20, 2))
        self.check_idle_iterator(10, 12, 14, 16, 18)
コード例 #2
0
ファイル: devices.py プロジェクト: codito/miro
 def copy_file(self, info, final_path):
     if (info, final_path) in self.copying:
         logging.warn('tried to copy %r twice', info)
         return
     file(final_path, 'w').close() # create the file so that future tries
                                   # will see it
     self.copying[final_path] = info
     self.total_size[info.id] = info.size
     if not self._copy_iter_running:
         self._copy_iter_running = True
         eventloop.idle_iterate(self._copy_as_iter,
                                'copying files to device')