minor cosmetics

This commit is contained in:
Miroslav Stampar 2010-10-25 19:45:53 +00:00
parent d7bf94d4d6
commit 73eea81b3a
2 changed files with 9 additions and 7 deletions

View File

@ -168,21 +168,27 @@ def checkDynamicContent(firstPage, secondPage):
while i < len(blocks): while i < len(blocks):
block = blocks[i] block = blocks[i]
(_, _, length) = block (_, _, length) = block
if length <= conf.minMatchBlock: if length <= conf.minMatchBlock:
blocks.remove(block) blocks.remove(block)
else: else:
i += 1 i += 1
if len(blocks) > 0: if len(blocks) > 0:
blocks.insert(0, None) blocks.insert(0, None)
blocks.append(None) blocks.append(None)
for i in xrange(len(blocks) - 1): for i in xrange(len(blocks) - 1):
prefix = firstPage[blocks[i][0]:blocks[i][0] + blocks[i][2]] if blocks[i] else None prefix = firstPage[blocks[i][0]:blocks[i][0] + blocks[i][2]] if blocks[i] else None
postfix = firstPage[blocks[i + 1][0]:blocks[i + 1][0] + blocks[i + 1][2]] if blocks[i + 1] else None postfix = firstPage[blocks[i + 1][0]:blocks[i + 1][0] + blocks[i + 1][2]] if blocks[i + 1] else None
if prefix is None and blocks[i + 1][0] == 0: if prefix is None and blocks[i + 1][0] == 0:
continue continue
if postfix is None and (blocks[i][0] + blocks[i][2] >= len(firstPage)): if postfix is None and (blocks[i][0] + blocks[i][2] >= len(firstPage)):
continue continue
kb.dynamicMarkings.append((prefix[-conf.dynMarkLength:] if prefix else None, postfix[:conf.dynMarkLength] if postfix else None)) kb.dynamicMarkings.append((prefix[-conf.dynMarkLength:] if prefix else None, postfix[:conf.dynMarkLength] if postfix else None))
if len(kb.dynamicMarkings) > 0: if len(kb.dynamicMarkings) > 0:

View File

@ -1503,13 +1503,9 @@ def beep():
if sys.platform=='linux2': if sys.platform=='linux2':
try: try:
audio=file('/dev/audio', 'wb') audio=file('/dev/audio', 'wb')
count=0 for i in xrange(250):
while count < 250: audio.write(chr(32) * 4)
beep=chr(32) * 4 audio.write(chr(0) * 4)
audio.write(beep)
beep=chr(0) * 4
audio.write(beep)
count=count + 1
audio.close() audio.close()
except: except:
print '\a' print '\a'