Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-07-19 20:19:03 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-07-19 20:19:03 (GMT)
commit5771b0c895d2b5646da0caccb4df7d991b313e36 (patch)
treef170fdd1219632e3d09edb2515041ce512eb2b70
parent138e0cfd7a56eb0c45b1800b8115530ab3615893 (diff)
Change xbook -> read
-rw-r--r--activity/activity.info3
-rw-r--r--readactivity.py (renamed from XbookActivity.py)19
-rw-r--r--readtoolbar.py (renamed from xbooktoolbar.py)4
3 files changed, 12 insertions, 14 deletions
diff --git a/activity/activity.info b/activity/activity.info
index 1ab62ef..ad5fb97 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -2,7 +2,8 @@
name = Read
service_name = org.laptop.sugar.ReadActivity
icon = activity-read
-class = XbookActivity.XbookActivity
+class = readactivity.ReadActivity
show_launcher = no
activity_version = 22
mime_types = application/pdf
+
diff --git a/XbookActivity.py b/readactivity.py
index 61efce0..a710d85 100644
--- a/XbookActivity.py
+++ b/readactivity.py
@@ -25,7 +25,7 @@ import os
from sugar.activity import activity
from sugar import network
-from xbooktoolbar import XbookToolbar
+from readtoolbar import ReadToolbar
_READ_PORT = 17982
@@ -38,14 +38,14 @@ class ReadHTTPServer(network.GlibTCPServer):
self._filepath = filepath
network.GlibTCPServer.__init__(self, server_address, ReadHTTPRequestHandler)
-class XbookActivity(activity.Activity):
+class ReadActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self._document = None
self._filepath = None
self._fileserver = None
- logging.debug('Starting xbook...')
+ logging.debug('Starting read...')
self.set_title(_('Read Activity'))
evince.job_queue_init()
@@ -53,7 +53,7 @@ class XbookActivity(activity.Activity):
toolbox = activity.ActivityToolbox(self)
- self._toolbar = XbookToolbar(self._view)
+ self._toolbar = ReadToolbar(self._view)
toolbox.add_toolbar(_('View'), self._toolbar)
self._toolbar.show()
@@ -74,7 +74,8 @@ class XbookActivity(activity.Activity):
if handle.uri:
self._load_document(handle.uri)
- elif self._shared_activity:
+
+ if self._shared_activity or not self._document:
self._tried_buddies = []
if self.get_shared():
# Already joined for some reason, just get the document
@@ -84,16 +85,12 @@ class XbookActivity(activity.Activity):
self.connect("joined", self._joined_cb)
def read_file(self, file_path):
- logging.debug('XbookActivity.read_file: ' + file_path)
+ logging.debug('ReadActivity.read_file: ' + file_path)
self._load_document('file://' + file_path)
def _download_result_cb(self, getter, tempfile, suggested_name, buddy):
del self._tried_buddies
logging.debug("Got document %s (%s) from %s (%s)" % (tempfile, suggested_name, buddy.props.nick, buddy.props.ip4_address))
- import shutil
- dest = os.path.join(os.path.expanduser("~"), suggested_name)
- shutil.copyfile(tempfile, dest)
- os.remove(tempfile)
self._load_document("file://%s" % dest)
def _download_error_cb(self, getter, err, buddy):
@@ -106,7 +103,7 @@ class XbookActivity(activity.Activity):
getter.connect("finished", self._download_result_cb, buddy)
getter.connect("error", self._download_error_cb, buddy)
logging.debug("Starting download...")
- getter.start()
+ getter.start(self.)
return False
def _get_document(self):
diff --git a/xbooktoolbar.py b/readtoolbar.py
index 297d64b..a5201ac 100644
--- a/xbooktoolbar.py
+++ b/readtoolbar.py
@@ -23,8 +23,8 @@ import gtk
from sugar.graphics.toolbutton import ToolButton
-class XbookToolbar(gtk.Toolbar):
- __gtype_name__ = 'XbookToolbar'
+class ReadToolbar(gtk.Toolbar):
+ __gtype_name__ = 'ReadToolbar'
def __init__(self, evince_view):
gtk.Toolbar.__init__(self)