Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/infoslicer/widgets/Journal_Gallery_View.py
diff options
context:
space:
mode:
Diffstat (limited to 'infoslicer/widgets/Journal_Gallery_View.py')
-rw-r--r--infoslicer/widgets/Journal_Gallery_View.py60
1 files changed, 29 insertions, 31 deletions
diff --git a/infoslicer/widgets/Journal_Gallery_View.py b/infoslicer/widgets/Journal_Gallery_View.py
index 5358d05..022cb6e 100644
--- a/infoslicer/widgets/Journal_Gallery_View.py
+++ b/infoslicer/widgets/Journal_Gallery_View.py
@@ -10,10 +10,8 @@
# along with this library; if not, write to the Free Software
# Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA
-from gi.repository import Gtk
-from gi.repository import Gdk
-from gi.repository import GObject
-from gi.repository import GdkPixbuf
+import gtk
+import gobject
import os
import cPickle
import pickle
@@ -31,7 +29,7 @@ logger = logging.getLogger('infoslicer')
IMG_WIDTH = 400
IMG_HEIGHT = 300
-class Journal_Gallery_View( Gtk.HBox ):
+class Journal_Gallery_View( gtk.HBox ):
"""
Created by Aneesh Dogra
Journal Gallery View
@@ -48,47 +46,47 @@ class Journal_Gallery_View( Gtk.HBox ):
def __init__(self):
self.image_list = []
- GObject.GObject.__init__(self)
+ gtk.HBox.__init__(self)
+
self.current_index = -1
self.source_article_id = -1
- left_button = Gtk.Button(label="\n\n << \n\n")
- right_button = Gtk.Button(label="\n\n >> \n\n")
- self.imagenumberlabel = Gtk.Label()
- self.image = Gtk.Image()
- self.imagebox = Gtk.EventBox()
+ left_button = gtk.Button("\n\n << \n\n")
+ right_button = gtk.Button("\n\n >> \n\n")
+ self.imagenumberlabel = gtk.Label()
+ self.image = gtk.Image()
+ self.imagebox = gtk.EventBox()
self.imagebox.add(self.image)
- self.imagebox.drag_source_set(Gdk.ModifierType.BUTTON1_MASK,
+ self.imagebox.drag_source_set(gtk.gdk.BUTTON1_MASK,
[],
- Gdk.DragAction.COPY)
+ gtk.gdk.ACTION_COPY)
self.imagebox.drag_source_add_image_targets()
self.imagebox.connect("drag-begin", self.drag_begin_event, None)
logging.debug('##################### Galler_View.connect')
self.imagebox.connect("drag-data-get", self.drag_data_get_event, None)
- self.caption = Gtk.Label(label="")
+ self.caption = gtk.Label("")
self.caption.set_line_wrap(True)
- self.image_drag_container = Gtk.VBox()
+ self.image_drag_container = gtk.VBox()
self.image_drag_container.pack_start(self.imagenumberlabel, expand=False,
fill=False, padding=0)
self.image_drag_container.pack_start(self.imagebox, False, True, 0)
self.image_drag_container.pack_start(self.caption, False, True, 0)
- image_container = Gtk.VBox()
- image_container.pack_start(Gtk.Label(" "), True, True, 0)
+ image_container = gtk.VBox()
+ image_container.pack_start(gtk.Label(" "), True, True, 0)
image_container.pack_start(self.image_drag_container, False, True, 0)
- image_container.pack_start(Gtk.Label(" "), True, True, 0)
+ image_container.pack_start(gtk.Label(" "), True, True, 0)
- left_button_container = Gtk.VBox()
- left_button_container.pack_start(Gtk.Label(" "), True, True, 0)
+ left_button_container = gtk.VBox()
+ left_button_container.pack_start(gtk.Label(" "), True, True, 0)
left_button_container.pack_start(left_button, False, True, 0)
- left_button_container.pack_start(Gtk.Label(" "), True, True, 0)
+ left_button_container.pack_start(gtk.Label(" "), True, True, 0)
- right_button_container = Gtk.VBox()
- right_button_container.pack_start(Gtk.Label(" "), True, True, 0)
+ right_button_container = gtk.VBox()
+ right_button_container.pack_start(gtk.Label(" "), True, True, 0)
right_button_container.pack_start(right_button, False, True, 0)
- right_button_container.pack_start(Gtk.Label(" "), True, True, 0)
-
+ right_button_container.pack_start(gtk.Label(" "), True, True, 0)
self.pack_start(left_button_container, False, True, 0)
self.pack_start(image_container, True, True, 0)
@@ -107,9 +105,9 @@ class Journal_Gallery_View( Gtk.HBox ):
self.current_index += 1
if self.current_index == len(self.image_list):
self.current_index = 0
- self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0])
+ self.imagebuf = gtk.gdk.pixbuf_new_from_file(self.image_list[self.current_index][0])
self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT,
- GdkPixbuf.InterpType.BILINEAR)
+ gtk.gdk.INTERP_BILINEAR)
self.image.set_from_pixbuf(self.imagebuf)
self.caption.set_text("\n" + self.image_list[self.current_index][1])
self.imagenumberlabel.set_text("(%d / %d)\n" % (self.current_index+1, len(self.image_list)))
@@ -122,9 +120,9 @@ class Journal_Gallery_View( Gtk.HBox ):
if self.current_index == 0:
self.current_index = len(self.image_list)
self.current_index -= 1
- self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0])
+ self.imagebuf = gtk.gdk.pixbuf_new_from_file(self.image_list[self.current_index][0])
self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT,
- GdkPixbuf.InterpType.BILINEAR)
+ gtk.gdk.INTERP_BILINEAR)
self.image.set_from_pixbuf(self.imagebuf)
self.caption.set_text("\n" + self.image_list[self.current_index][1])
self.imagenumberlabel.set_text("(%d / %d)\n" % (self.current_index+1, len(self.image_list)))
@@ -135,9 +133,9 @@ class Journal_Gallery_View( Gtk.HBox ):
self.image.clear()
return
self.current_index = 0
- self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0])
+ self.imagebuf = gtk.gdk.pixbuf_new_from_file(self.image_list[self.current_index][0])
self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT,
- GdkPixbuf.InterpType.BILINEAR)
+ gtk.gdk.INTERP_BILINEAR)
self.image.set_from_pixbuf(self.imagebuf)
self.caption.set_text("\n" + self.image_list[self.current_index][1])
logger.debug("setting text to:")