[Sugar-devel] [PATCH] Added ability to export Journal items.

James Cameron quozl at laptop.org
Thu Jun 2 00:48:20 EDT 2011


On Thu, Jun 02, 2011 at 09:25:46AM +0500, Sebastian Silva wrote:
> From: Sebastian Silva <icarito at sugarlabs.org>
> 
> We don't ship rainbow everywhere so it's worth a try.

Heh.

> ---
>  sugarcommander.py |   36 ++++++++++++++++++++++++++++++++++--
>  1 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/sugarcommander.py b/sugarcommander.py
> index 781bce9..f9cdc3f 100755
> --- a/sugarcommander.py
> +++ b/sugarcommander.py
> @@ -16,7 +16,7 @@
>  # along with this program; if not, write to the Free Software
>  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>  import logging
> -import os
> +import os, shutil

Separate lines.

>  import time
>  import gtk
>  import pango
> @@ -233,8 +233,16 @@ class SugarCommander(activity.Activity):
>          self.resize_width_entry.hide()
>  
>          vbox = gtk.VBox(homogeneous=True,  spacing=5)
> +        self.export_button = gtk.Button(_("Export Item To The Filesystem"))
> +        self.export_button.connect('clicked',  self.export_journal_entry)
> +        self.export_button.show()

Seems verbose.  I suggest just "Export".

> +        target_path = os.path.join (target_dir, target_file)
> +        try:
> +            shutil.copyfile(file_path, target_path)
> +        except IOError:
> +            self.alert(_('Failure'), _('could not write %s to %s') % (target_file,target_dir))
> +        else:
> +            self.alert(_('Success'),  _('%s was copied to %s.') 
> +                    % (target_file, target_dir ))
> +

A few minor additional or missing spaces.

I like it.  A partial but adequate solution to a significant problem
that will help in finding the ultimate solution.

Reviewed-by: James Cameron <quozl at laptop.org>

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list