Port to Python 3
Tested-by: Rahul Bothra <f2016015@pilani.bits-pilani.ac.in> # Ubuntu 16.04
Signed-off-by: James Cameron <quozl@laptop.org> # Ubuntu 18.04
Pro-Panda authored 6 years ago
James Cameron committed 4 years ago
261 | 261 |
return True
|
262 | 262 |
|
263 | 263 |
pixbuf.save_to_callbackv(save_func, preview_data, 'png', [], [])
|
264 | |
preview_data = ''.join(preview_data)
|
|
264 |
preview_data = ''.join(map(str,preview_data)).encode()
|
265 | 265 |
|
266 | 266 |
return preview_data
|
267 | 267 |
|
0 | 0 |
[Activity]
|
1 | 1 |
name = Write
|
2 | 2 |
bundle_id = org.laptop.AbiWordActivity
|
3 | |
exec = sugar-activity AbiWordActivity.AbiWordActivity
|
|
3 |
exec = sugar-activity3 AbiWordActivity.AbiWordActivity
|
4 | 4 |
icon = activity-write
|
5 | 5 |
activity_version = 100
|
6 | 6 |
max_participants = 6
|
74 | 74 |
else:
|
75 | 75 |
subcell_size = 11
|
76 | 76 |
radius = 2 * subcell_size
|
77 | |
theme = "GtkButton {border-radius: %dpx;}" % radius
|
|
77 |
theme = b"GtkButton {border-radius: %dpx;}" % radius
|
78 | 78 |
css_provider = Gtk.CssProvider()
|
79 | 79 |
css_provider.load_from_data(theme)
|
80 | 80 |
style_context = bt.get_style_context()
|
|
247 | 247 |
hbox.pack_start(self._size_up, False, False, 5)
|
248 | 248 |
|
249 | 249 |
radius = 2 * subcell_size
|
250 | |
theme_up = "GtkButton {border-radius:0px %dpx %dpx 0px;}" % (radius,
|
|
250 |
theme_up = b"GtkButton {border-radius:0px %dpx %dpx 0px;}" % (radius,
|
251 | 251 |
radius)
|
252 | 252 |
css_provider_up = Gtk.CssProvider()
|
253 | 253 |
css_provider_up.load_from_data(theme_up)
|
|
256 | 256 |
style_context.add_provider(css_provider_up,
|
257 | 257 |
Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
258 | 258 |
|
259 | |
theme_down = "GtkButton {border-radius: %dpx 0px 0px %dpx;}" % (radius,
|
|
259 |
theme_down = b"GtkButton {border-radius: %dpx 0px 0px %dpx;}" % (radius,
|
260 | 260 |
radius)
|
261 | 261 |
css_provider_down = Gtk.CssProvider()
|
262 | 262 |
css_provider_down.load_from_data(theme_down)
|
131 | 131 |
self.show_all()
|
132 | 132 |
|
133 | 133 |
def __create_table(self, grid_creator, rows, columns):
|
134 | |
print 'rows %d columns %d' % (rows, columns)
|
|
134 |
print('rows %d columns %d' % (rows, columns))
|
135 | 135 |
|
136 | 136 |
if __name__ == '__main__':
|
137 | 137 |
GridCreateTest()
|
26 | 26 |
Gst.ElementFactory.make('espeak', None)
|
27 | 27 |
from speech_gst import *
|
28 | 28 |
_logger.error('use gst-plugins-espeak')
|
29 | |
except Exception, e:
|
|
29 |
except Exception as e:
|
30 | 30 |
_logger.error('disable gst-plugins-espeak: %s' % e)
|
31 | 31 |
try:
|
32 | 32 |
from speech_dispatcher import *
|
33 | 33 |
_logger.error('use speech-dispatcher')
|
34 | |
except Exception, e:
|
|
34 |
except Exception as e:
|
35 | 35 |
supported = False
|
36 | 36 |
_logger.error('disable speech: %s' % e)
|
37 | 37 |
|
32 | 32 |
voices = client.list_synthesis_voices()
|
33 | 33 |
client.close()
|
34 | 34 |
return voices
|
35 | |
except Exception, e:
|
|
35 |
except Exception as e:
|
36 | 36 |
_logger.warning('speech dispatcher not started: %s' % e)
|
37 | 37 |
return []
|
38 | 38 |
|
|
45 | 45 |
client.set_language(speech.voice[1])
|
46 | 46 |
client.speak(words)
|
47 | 47 |
client.close()
|
48 | |
except Exception, e:
|
|
48 |
except Exception as e:
|
49 | 49 |
_logger.warning('speech dispatcher not running: %s' % e)
|
50 | 50 |
|
51 | 51 |
|
|
90 | 90 |
time.sleep(0.1)
|
91 | 91 |
self.cancel()
|
92 | 92 |
self.client.close()
|
93 | |
except Exception, e:
|
|
93 |
except Exception as e:
|
94 | 94 |
_logger.warning('speech-dispatcher client not created: %s' % e)
|
95 | 95 |
|
96 | 96 |
def cancel(self):
|
97 | 97 |
if self.client:
|
98 | 98 |
try:
|
99 | 99 |
self.client.cancel()
|
100 | |
except Exception, e:
|
|
100 |
except Exception as e:
|
101 | 101 |
_logger.warning('speech dispatcher cancel failed: %s' % e)
|
102 | 102 |
|
103 | 103 |
def next_word_cb(self, type, **kargs):
|
24 | 24 |
|
25 | 25 |
import os
|
26 | 26 |
import tempfile
|
27 | |
from urlparse import urlparse
|
|
27 |
from urllib.parse import urlparse
|
28 | 28 |
|
29 | 29 |
from sugar3.graphics.toolbutton import ToolButton
|
30 | 30 |
from sugar3.graphics.toolcombobox import ToolComboBox
|