Skip to content

Commit

Permalink
Python3-related bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mltony committed Dec 31, 2019
1 parent 185c818 commit d1f15f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions addon/globalPlugins/textNav.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ def fancyBeep(self, chord, length, left=10, right=10):
buf = ctypes.create_string_buffer(bufSize)
NVDAHelper.generateBeep(buf, freq, beepLen, right, left)
bytes = bytearray(buf)
unpacked = struct.unpack("<%dQ" % (bufSize / intSize), bytes)
unpacked = struct.unpack("<%dQ" % (bufSize // intSize), bytes)
result = map(operator.add, result, unpacked)
maxInt = 1 << (8 * intSize)
result = map(lambda x : x %maxInt, result)
packed = struct.pack("<%dQ" % (bufSize / intSize), *result)
packed = struct.pack("<%dQ" % (bufSize // intSize), *result)
tones.player.feed(packed)

def uniformSample(self, a, m):
Expand All @@ -247,7 +247,7 @@ def uniformSample(self, a, m):
# Here assume n > m
result = []
for i in range(0, m*n, n):
result.append(a[i / m])
result.append(a[i // m])
return result

BASE_FREQ = speech.IDT_BASE_FREQUENCY
Expand All @@ -257,7 +257,7 @@ def getPitch(self, indent):
BEEP_LEN = 10 # millis
PAUSE_LEN = 5 # millis
MAX_CRACKLE_LEN = 400 # millis
MAX_BEEP_COUNT = MAX_CRACKLE_LEN / (BEEP_LEN + PAUSE_LEN)
MAX_BEEP_COUNT = MAX_CRACKLE_LEN // (BEEP_LEN + PAUSE_LEN)

def fancyCrackle(self, levels, volume):
levels = self.uniformSample(levels, self.MAX_BEEP_COUNT )
Expand Down
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("""TextNav allows you to find text that you want to read on a web page in just a single keystroke."""),
# version
"addon_version" : "1.3",
"addon_version" : "1.4",
# Author(s)
"addon_author" : u"Tony Malykh <anton.malykh@gmail.com>",
# URL for the add-on documentation support
Expand Down

0 comments on commit d1f15f9

Please sign in to comment.