diff options
author | Ignacio RodrÃguez <ignacio@sugarlabs.org> | 2014-01-04 15:40:51 (GMT) |
---|---|---|
committer | Ignacio RodrÃguez <ignacio@sugarlabs.org> | 2014-01-04 15:40:51 (GMT) |
commit | 2957902dcdd3b9f12fa251340187784f1a490764 (patch) | |
tree | b689e9bef0269b77e6e3711e66d7d9b43098f5e9 | |
parent | b048c6a8f46f14efd80b7af2685d87668407f762 (diff) |
-rw-r--r-- | StoryActivity.py | 21 | ||||
-rw-r--r-- | game.py | 12 |
2 files changed, 14 insertions, 19 deletions
diff --git a/StoryActivity.py b/StoryActivity.py index d119648..4158f02 100644 --- a/StoryActivity.py +++ b/StoryActivity.py @@ -14,8 +14,6 @@ from gi.repository import Gdk from gi.repository import Gtk from gi.repository import GObject -import subprocess -import cairo import os import time @@ -29,7 +27,7 @@ from sugar3.activity.widgets import StopButton from sugar3.graphics.alert import Alert -from toolbar_utils import button_factory, label_factory, separator_factory +from toolbar_utils import button_factory, separator_factory from utils import json_load, json_dump, play_audio_from_file from grecord import Grecord @@ -50,6 +48,7 @@ _logger = logging.getLogger('story-activity') SERVICE = 'org.sugarlabs.StoryActivity' IFACE = SERVICE +PATH = '/org/sugarlabs/Story' class StoryActivity(activity.Activity): @@ -63,7 +62,7 @@ class StoryActivity(activity.Activity): _logger.error(str(e)) self.path = activity.get_bundle_path() - print self.path + self.nick = profile.get_nick_name() if profile.get_color() is not None: self.colors = profile.get_color().to_string().split(',') @@ -79,7 +78,7 @@ class StoryActivity(activity.Activity): # Create a canvas canvas = Gtk.DrawingArea() - canvas.set_size_request(Gdk.Screen.width(), \ + canvas.set_size_request(Gdk.Screen.width(), Gdk.Screen.height()) self.set_canvas(canvas) canvas.show() @@ -99,7 +98,6 @@ class StoryActivity(activity.Activity): self.max_participants = 9 - toolbox = ToolbarBox() # Activity toolbar @@ -129,10 +127,9 @@ class StoryActivity(activity.Activity): self._record_cb, tooltip=_('Start recording')) self._playback_button = button_factory( - 'media-playback-start-insensitive', self.toolbar, + 'media-playback-start-insensitive', self.toolbar, self._playback_recording_cb, tooltip=_('Nothing to play')) - separator_factory(toolbox.toolbar, True, False) stop_button = StopButton(self) @@ -289,7 +286,7 @@ class StoryActivity(activity.Activity): if sharer: _logger.debug('This is my activity: making a tube...') - id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube( + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube( SERVICE, {}) else: _logger.debug('I am joining an activity: waiting for a tube...') @@ -314,14 +311,14 @@ params=%r state=%d' % (id, initiator, type, service, params, state)) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: - self.tubes_chan[ \ + self.tubes_chan[ telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) tube_conn = TubeConnection(self.conn, - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, \ + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) - self.chattube = ChatTube(tube_conn, self.initiating, \ + self.chattube = ChatTube(tube_conn, self.initiating, self.event_received_cb) def _setup_dispatch_table(self): @@ -18,7 +18,6 @@ import os import glob from random import uniform -from gettext import gettext as _ _HAVE_ARTS4APPS = True try: @@ -83,7 +82,7 @@ class Game(): yoffset = self._space * 2 # int(self._space / 2.) for y in range(3): for x in range(3): - xoffset = int((self._width - 3 * self._dot_size - \ + xoffset = int((self._width - 3 * self._dot_size - 2 * self._space) / 2.) if _HAVE_ARTS4APPS: @@ -236,7 +235,7 @@ class Game(): self._dot_size, self._dot_size) else: pixbuf = svg_str_to_pixbuf(svg_string, w=self._dot_size, - h = self._dot_size) + h=self._dot_size) else: if color in self._dot_cache: return self._dot_cache[color] @@ -245,11 +244,10 @@ class Game(): self._svg_width = self._dot_size self._svg_height = self._dot_size - i = self._colors.index(color) pixbuf = svg_str_to_pixbuf( - self._header() + \ + self._header() + self._circle(self._dot_size / 2., self._dot_size / 2., - self._dot_size / 2.) + \ + self._dot_size / 2.) + self._footer()) surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, @@ -292,7 +290,7 @@ class Game(): def svg_str_to_pixbuf(svg_string, w=None, h=None): ''' Load pixbuf from SVG string ''' # Admito que fue la parte mas dificil.. - pl = GdkPixbuf.PixbufLoader.new_with_type('svg') + pl = GdkPixbuf.PixbufLoader.new_with_type('svg') if w is not None: pl.set_size(w, h) pl.write(svg_string) |