Metrick

Untitled

Apr 28th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1.     @ClassCaller.method
  2.     class ServerScreenShot():
  3.         busy = False
  4.         wad_size = 256
  5.  
  6.         def __call__(cls, self):
  7.             if cls.busy:
  8.                 print "ServerScreenShot() is busy, wait please."
  9.                 return
  10.             cls.busy = True
  11.             cls.width, cls.height, ScreenShot = BigWorld.getScreenCopy()
  12.             cls.counter = 0
  13.             cls.ScreenShot = zlib.compress(ScreenShot)
  14.             cls.__next__(self)
  15.  
  16.         @deferred(1.0)
  17.         def __next__(cls, self):
  18.             left_bound = cls.counter * cls.wad_size
  19.             right_bound = cls.counter * cls.wad_size
  20.             if right_bound > len(cls.ScreenShot):
  21.                 right_bound = len(cls.ScreenShot)
  22.             self.base.onScreenShot(cls.ScreenShot[left_bound:right_bound])
  23.             if right_bound > len(cls.ScreenShot):
  24.                 cls.busy = False
  25.                 return
  26.             cls.counter += 1
  27.             cls.__next__(self)
Advertisement
Add Comment
Please, Sign In to add comment