Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Lewis <jtl1728@rit.edu>2009-12-15 21:38:45 (GMT)
committer Justin Lewis <jtl1728@rit.edu>2009-12-15 21:38:45 (GMT)
commit36c207fad0660015e1728a709f457d4a5ebe1e0f (patch)
tree4d2d38885bc738da9613b5aa11deef5114ebf702
parent78ad9ac7c07c4359ec055d3f933128bb037f2160 (diff)
Added ability to install files back to the journal.
This will be useful for stored copies. It also allows you to transfer all the files by sending a saved version of the activity and then they can install back to the journal.
-rw-r--r--FileShare.activity/FileShareActivity.py34
1 files changed, 30 insertions, 4 deletions
diff --git a/FileShare.activity/FileShareActivity.py b/FileShare.activity/FileShareActivity.py
index ed6686b..dc6ba35 100644
--- a/FileShare.activity/FileShareActivity.py
+++ b/FileShare.activity/FileShareActivity.py
@@ -147,6 +147,21 @@ class FileShareActivity(Activity):
except:
_logger.warn("Could not remove file from system: %d",bundle_path)
+ def requestInsFile(self, widget, data=None):
+ _logger.info('Requesting to install file back to journal')
+
+ if self.treeview.get_selection().count_selected_rows() != 0:
+ model, iter = self.treeview.get_selection().get_selected()
+ key = model.get_value(iter, 0)
+
+ # Attempt to remove file from system
+ bundle_path = os.path.join(self._filepath, '%s.xoj' % key)
+
+ self._installBundle( bundle_path )
+ self._alert(_("Installed bundle to Jorunal"))
+
+
+
def requestDownloadFile(self, widget, data=None):
_logger.info('Requesting to Download file')
@@ -218,6 +233,10 @@ class FileShareActivity(Activity):
addFileButton.connect("clicked", self.requestAddFile, None)
hbbox.add(addFileButton)
+ insFileButton = gtk.Button(_("Copy to Journal"))
+ insFileButton.connect("clicked", self.requestInsFile, None)
+ hbbox.add(insFileButton)
+
remFileButton = gtk.Button(_("Remove Selected File"))
remFileButton.connect("clicked", self.requestRemFile, None)
hbbox.add(remFileButton)
@@ -452,14 +471,13 @@ class FileShareActivity(Activity):
return False
def _download_result_cb(self, getter, tmp_file, suggested_name, fileId):
- _logger.debug("Got document %s (%s)", tempfile, suggested_name)
+ _logger.debug("Got document %s (%s)", tmp_file, suggested_name)
# Set status to downloaded
self.progress_set( fileId, 100, _("Saving File"))
- bundle = journalentrybundle.JournalEntryBundle(tmp_file)
- _logger.debug("Saving %s to datastore...", tmp_file)
- bundle.install()
+ self._installBundle( tmp_file )
+
self._alert( _("File Downloaded"), bundle.get_metadata()['title'])
self.progress_set( fileId, 100, _("Download Complete"))
@@ -486,6 +504,14 @@ class FileShareActivity(Activity):
self._alert(_("Error getting document"), err)
#gobject.idle_add(self._get_document)
+
+ def _installBundle(self, tmp_file):
+ """Installs a file to the journal"""
+ _logger.debug("Saving %s to datastore...", tmp_file)
+ bundle = journalentrybundle.JournalEntryBundle(tmp_file)
+ bundle.install()
+
+
def write_file(self, file_path):
_logger.debug('Writing activity file')