Codebase list sugar-write-activity / d3bc975
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
7 changed file(s) with 13 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
261261 return True
262262
263263 pixbuf.save_to_callbackv(save_func, preview_data, 'png', [], [])
264 preview_data = ''.join(preview_data)
264 preview_data = ''.join(map(str,preview_data)).encode()
265265
266266 return preview_data
267267
00 [Activity]
11 name = Write
22 bundle_id = org.laptop.AbiWordActivity
3 exec = sugar-activity AbiWordActivity.AbiWordActivity
3 exec = sugar-activity3 AbiWordActivity.AbiWordActivity
44 icon = activity-write
55 activity_version = 100
66 max_participants = 6
7474 else:
7575 subcell_size = 11
7676 radius = 2 * subcell_size
77 theme = "GtkButton {border-radius: %dpx;}" % radius
77 theme = b"GtkButton {border-radius: %dpx;}" % radius
7878 css_provider = Gtk.CssProvider()
7979 css_provider.load_from_data(theme)
8080 style_context = bt.get_style_context()
247247 hbox.pack_start(self._size_up, False, False, 5)
248248
249249 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,
251251 radius)
252252 css_provider_up = Gtk.CssProvider()
253253 css_provider_up.load_from_data(theme_up)
256256 style_context.add_provider(css_provider_up,
257257 Gtk.STYLE_PROVIDER_PRIORITY_USER)
258258
259 theme_down = "GtkButton {border-radius: %dpx 0px 0px %dpx;}" % (radius,
259 theme_down = b"GtkButton {border-radius: %dpx 0px 0px %dpx;}" % (radius,
260260 radius)
261261 css_provider_down = Gtk.CssProvider()
262262 css_provider_down.load_from_data(theme_down)
131131 self.show_all()
132132
133133 def __create_table(self, grid_creator, rows, columns):
134 print 'rows %d columns %d' % (rows, columns)
134 print('rows %d columns %d' % (rows, columns))
135135
136136 if __name__ == '__main__':
137137 GridCreateTest()
2626 Gst.ElementFactory.make('espeak', None)
2727 from speech_gst import *
2828 _logger.error('use gst-plugins-espeak')
29 except Exception, e:
29 except Exception as e:
3030 _logger.error('disable gst-plugins-espeak: %s' % e)
3131 try:
3232 from speech_dispatcher import *
3333 _logger.error('use speech-dispatcher')
34 except Exception, e:
34 except Exception as e:
3535 supported = False
3636 _logger.error('disable speech: %s' % e)
3737
3232 voices = client.list_synthesis_voices()
3333 client.close()
3434 return voices
35 except Exception, e:
35 except Exception as e:
3636 _logger.warning('speech dispatcher not started: %s' % e)
3737 return []
3838
4545 client.set_language(speech.voice[1])
4646 client.speak(words)
4747 client.close()
48 except Exception, e:
48 except Exception as e:
4949 _logger.warning('speech dispatcher not running: %s' % e)
5050
5151
9090 time.sleep(0.1)
9191 self.cancel()
9292 self.client.close()
93 except Exception, e:
93 except Exception as e:
9494 _logger.warning('speech-dispatcher client not created: %s' % e)
9595
9696 def cancel(self):
9797 if self.client:
9898 try:
9999 self.client.cancel()
100 except Exception, e:
100 except Exception as e:
101101 _logger.warning('speech dispatcher cancel failed: %s' % e)
102102
103103 def next_word_cb(self, type, **kargs):
2424
2525 import os
2626 import tempfile
27 from urlparse import urlparse
27 from urllib.parse import urlparse
2828
2929 from sugar3.graphics.toolbutton import ToolButton
3030 from sugar3.graphics.toolcombobox import ToolComboBox