Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Python 3 #15

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion activity/activity.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = AEIOU
activity_version = 6
license = GPLv3
bundle_id = org.sugarlabs.AEIOU.NI
exec = sugar-activity aeiou.AEIOU
exec = sugar-activity3 aeiou.AEIOU
icon = activity-aeiou
show_launcher = yes
summary = learn the vowel sounds
Expand Down
6 changes: 3 additions & 3 deletions page.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _play_target_sound(self):
def _button_press_cb(self, win, event):
''' Either a card or list entry was pressed. '''
win.grab_focus()
x, y = map(int, event.get_coords())
x, y = list(map(int, event.get_coords()))

spr = self._sprites.find_sprite((x, y))
self._press = spr
Expand All @@ -257,7 +257,7 @@ def _button_release_cb(self, win, event):
''' Play a sound or video or jump to a card as indexed in the list. '''
win.grab_focus()

x, y = map(int, event.get_coords())
x, y = list(map(int, event.get_coords()))
spr = self._sprites.find_sprite((x, y))
if spr is None:
return
Expand Down Expand Up @@ -377,7 +377,7 @@ def _clear_all(self):
def svg_str_to_pixbuf(svg_string):
''' Load pixbuf from SVG string. '''
pl = GdkPixbuf.PixbufLoader.new_with_type('svg')
pl.write(svg_string)
pl.write(bytes(svg_string.encode()))
pl.close()
return pl.get_pixbuf()

Expand Down
2 changes: 1 addition & 1 deletion utils/aplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

import logging
from Queue import Queue
from queue import Queue
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Expand Down
10 changes: 5 additions & 5 deletions utils/sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def redraw_sprites(self, area=None, cr=None):
else:
self.cr = cr
if cr is None:
print 'sprites.redraw_sprites: no Cairo context'
print('sprites.redraw_sprites: no Cairo context')
return
for spr in self.list:
if area == None:
Expand Down Expand Up @@ -251,7 +251,7 @@ def set_layer(self, layer=None):
def set_label(self, new_label, i=0):
''' Set the label drawn on the sprite '''
self._extend_labels_array(i)
if type(new_label) is str or type(new_label) is unicode:
if type(new_label) is str or type(new_label) is str:
# pango doesn't like nulls
self.labels[i] = new_label.replace("\0", " ")
else:
Expand Down Expand Up @@ -329,7 +329,7 @@ def draw(self, cr=None):
if cr is None:
cr = self._sprites.cr
if cr is None:
print 'sprite.draw: no Cairo context.'
print('sprite.draw: no Cairo context.')
return
for i, img in enumerate(self.images):
if isinstance(img, GdkPixbuf.Pixbuf):
Expand All @@ -350,7 +350,7 @@ def draw(self, cr=None):
self.rect[3])
cr.fill()
else:
print 'sprite.draw: source not a pixbuf (%s)' % (type(img))
print('sprite.draw: source not a pixbuf (%s)' % (type(img)))
if len(self.labels) > 0:
self.draw_label(cr)

Expand Down Expand Up @@ -462,5 +462,5 @@ def get_pixel(self, pos, i=0):
else:
return(-1, -1, -1, -1)
except IndexError:
print "Index Error: %d %d" % (len(array), offset)
print("Index Error: %d %d" % (len(array), offset))
return(-1, -1, -1, -1)