Merge branch 'master' of makar:/var/www/git/pgfw into HEAD

This commit is contained in:
Frank 2015-08-16 19:19:49 -04:00
commit 580d31ead2
2 changed files with 19 additions and 3 deletions

View File

@ -6,6 +6,7 @@ from distutils.command.install import install
from pprint import pprint from pprint import pprint
from fileinput import FileInput from fileinput import FileInput
from re import sub, match from re import sub, match
from fnmatch import fnmatch
from Configuration import * from Configuration import *
@ -48,8 +49,9 @@ class Setup:
def remove_excluded(self, paths, root, exclude): def remove_excluded(self, paths, root, exclude):
removal = [] removal = []
for path in paths: for path in paths:
if normpath(join(root, path)) in exclude: for pattern in exclude:
removal.append(path) if fnmatch(normpath(join(root, path)), pattern):
removal.append(path)
for path in removal: for path in removal:
paths.remove(path) paths.remove(path)
return paths return paths

View File

@ -1,7 +1,8 @@
from random import randint from random import randint
from math import sin, cos, atan2, radians, sqrt from math import sin, cos, atan2, radians, sqrt
from pygame import Surface from pygame import Surface, PixelArray
from pygame.mixer import get_num_channels, Channel
from pygame.locals import * from pygame.locals import *
def get_step(start, end, speed): def get_step(start, end, speed):
@ -128,3 +129,16 @@ def render_box(font, text, antialias, color, background=None, border=None,
bordered_surface.blit(surface, rect) bordered_surface.blit(surface, rect)
surface = bordered_surface surface = bordered_surface
return surface return surface
def get_color_swapped_surface(surface, current, replacement):
swapped = surface.copy()
pixels = PixelArray(swapped)
pixels.replace(current, replacement)
del pixels
return swapped
def get_busy_channel_count():
count = 0
for index in xrange(get_num_channels()):
count += Channel(index).get_busy()
return count