diff --git a/activity.py b/activity.py index 79c8455..584a492 100644 --- a/activity.py +++ b/activity.py @@ -13,7 +13,7 @@ import os import shutil import time -from ConfigParser import ConfigParser +from configparser import ConfigParser import json from gettext import gettext as _ @@ -42,10 +42,10 @@ from sugar3 import profile from sugar3.datastore import datastore -import telepathy +from dbus.gi_service import TelepathyGLib import dbus from dbus.service import signal -from dbus.gobject_service import ExportedGObject +from dbus.gi_service import ExportedGObject from sugar3.presence import presenceservice from sugar3.graphics.objectchooser import ObjectChooser @@ -734,11 +734,11 @@ def _shared_cb(self, activity): self.tubes_chan = self.shared_activity.telepathy_tubes_chan self.text_chan = self.shared_activity.telepathy_text_chan - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal( + self.tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].connect_to_signal( 'NewTube', self._new_tube_cb) _logger.debug('This is my activity: making a tube...') - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube( + self.tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].OfferDBusTube( SERVICE, {}) self.sharing = True @@ -762,11 +762,11 @@ def _joined_cb(self, activity): self.tubes_chan = self.shared_activity.telepathy_tubes_chan self.text_chan = self.shared_activity.telepathy_text_chan - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal( + self.tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].connect_to_signal( 'NewTube', self._new_tube_cb) _logger.debug('I am joining an activity: waiting for a tube...') - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes( + self.tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].ListTubes( reply_handler=self._list_tubes_reply_cb, error_handler=self._list_tubes_error_cb) @@ -790,7 +790,7 @@ def _new_tube_cb(self, 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[ - telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) + TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].AcceptDBusTube(id) self.collab = CollabWrapper(self) self.collab.message.connect(self.event_received_cb) diff --git a/activity/activity.info b/activity/activity.info index eae5519..0d1b7d2 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = Reflect -exec = sugar-activity activity.ReflectActivity +exec = sugar-activity3 activity.ReflectActivity bundle_id = org.sugarlabs.Reflect icon = reflect activity_version = 1.0 diff --git a/textchannelwrapper.py b/textchannelwrapper.py index a4c3fec..05ca567 100644 --- a/textchannelwrapper.py +++ b/textchannelwrapper.py @@ -68,7 +68,6 @@ def __message_cb(self, collab, buddy, message): CHANNEL_TYPE_TEXT, \ CHANNEL_TYPE_FILE_TRANSFER, \ CONN_INTERFACE_ALIASING, \ - CHANNEL, \ CLIENT from telepathy.constants import \ CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES, \ @@ -89,7 +88,7 @@ def __message_cb(self, collab, buddy, message): ACTION_INIT_REQUEST = '!!ACTION_INIT_REQUEST' ACTION_INIT_RESPONSE = '!!ACTION_INIT_RESPONSE' ACTIVITY_FT_MIME = 'x-sugar/from-activity' - +CHANNEL = TelepathyGLib.IFACE_CHANNEL class CollabWrapper(GObject.GObject): ''' diff --git a/utils.py b/utils.py index a52649a..94798fa 100644 --- a/utils.py +++ b/utils.py @@ -17,14 +17,14 @@ import stat import statvfs import glob -import urllib +import urllib.request, urllib.parse, urllib.error from random import uniform import tempfile import cairo import email.utils import re import time -from ConfigParser import ConfigParser +from configparser import ConfigParser from gi.repository import Vte from gi.repository import Gio @@ -360,7 +360,7 @@ def check_volume_suffix(volume_file): return TRAINING_DATA % volume_file[-13:] elif volume_file.endswith('.bin'): # See SEP-33 new_volume_file = volume_file[:-4] + TRAINING_SUFFIX - print new_volume_file + print(new_volume_file) os.rename(volume_file, new_volume_file) _logger.debug('return %s' % (TRAINING_DATA % new_volume_file[-13:])) return TRAINING_DATA % new_volume_file[-13:] @@ -534,7 +534,7 @@ def is_landscape(): def get_safe_text(text): - return urllib.pathname2url(text.encode('ascii', 'xmlcharrefreplace')) + return urllib.request.pathname2url(text.encode('ascii', 'xmlcharrefreplace')) def get_battery_level(): @@ -1095,7 +1095,7 @@ def uitree_dump(): try: return json.loads(dbus.Interface(proxy, _DBUS_SERVICE).Dump()) except Exception as e: - print ('ERROR calling Dump: %s' % e) + print('ERROR calling Dump: %s' % e) # _logger.error('ERROR calling Dump: %s' % e) return ''