Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/infoslicer
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-12-17 17:58:51 (GMT)
committer Aneesh Dogra <lionaneesh@gmail.com>2012-12-17 17:58:51 (GMT)
commit3a09ae6c3249a3151488d947e3d8052f551f633d (patch)
tree2c2768ef91dde19d8788302a9142bfb8e83ec358 /infoslicer
parent16581dda4e4a43bdebb9c8c0665918fef93752a4 (diff)
Use ObjectChooser to add images to Journal Gallery View.
Diffstat (limited to 'infoslicer')
-rw-r--r--infoslicer/processing/Journal_Getter.py29
-rw-r--r--infoslicer/widgets/Journal_Gallery_View.py10
-rw-r--r--infoslicer/widgets/Journal_Image_Pane.py2
3 files changed, 9 insertions, 32 deletions
diff --git a/infoslicer/processing/Journal_Getter.py b/infoslicer/processing/Journal_Getter.py
deleted file mode 100644
index a4cb4f3..0000000
--- a/infoslicer/processing/Journal_Getter.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (C) Aneesh Dogra <lionaneesh@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# You should have received a copy of the GNU General Public License
-# along with this library; if not, write to the Free Software
-# Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA
-
-from sugar3.datastore import datastore
-
-def get_starred_images():
- ''' Find all the Starred images in journal. '''
- images = []
- dsobjects, nobjects = datastore.find({'keep': '1'})
- print "Found %d starred images" % (nobjects,)
- for dsobj in dsobjects:
- if hasattr(dsobj, 'metadata') and 'mime_type' in dsobj.metadata and \
- dsobj.metadata['mime_type'][0:5] == 'image':
- if 'title' in dsobj.metadata:
- title = dsobj.metadata['title']
- else:
- title = ''
- images.append((str(dsobj.file_path), str(title)))
-
- return images
diff --git a/infoslicer/widgets/Journal_Gallery_View.py b/infoslicer/widgets/Journal_Gallery_View.py
index 078cba6..e18cf11 100644
--- a/infoslicer/widgets/Journal_Gallery_View.py
+++ b/infoslicer/widgets/Journal_Gallery_View.py
@@ -47,7 +47,7 @@ class Journal_Gallery_View( Gtk.HBox ):
"""
def __init__(self):
- self.image_list = journal.get_starred_images()
+ self.image_list = []
GObject.GObject.__init__(self)
self.current_index = -1
self.source_article_id = -1
@@ -133,7 +133,7 @@ class Journal_Gallery_View( Gtk.HBox ):
if self.image_list == []:
self.caption.set_text("No images were found in the journal.")
self.image.clear()
- return
+ return
self.current_index = 0
self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0])
self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT,
@@ -160,3 +160,9 @@ class Journal_Gallery_View( Gtk.HBox ):
sectionsdata = [Section_Data(0, self.source_article_id, 0, [paragraph1data, paragraph2data])]
string = cPickle.dumps(sectionsdata)
selection_data.set(atom, 8, string)
+
+ def add_image(self, image_path, title):
+ logger.debug('############# Journal_Journal_Gallery_View.add_image')
+ self.image_list.append((image_path, title))
+ logger.debug(self.image_list)
+ self.get_first_item()
diff --git a/infoslicer/widgets/Journal_Image_Pane.py b/infoslicer/widgets/Journal_Image_Pane.py
index 2666bf5..38c1c23 100644
--- a/infoslicer/widgets/Journal_Image_Pane.py
+++ b/infoslicer/widgets/Journal_Image_Pane.py
@@ -8,7 +8,7 @@ import logging
from gettext import gettext as _
from Editing_View import Editing_View
-from Journal_Gallery_View import Journal_Gallery_View
+from infoslicer.widgets.Journal_Gallery_View import Journal_Gallery_View
from infoslicer.processing.Article import Article
logger = logging.getLogger('infoslicer')