Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/cover.py
diff options
context:
space:
mode:
Diffstat (limited to 'cover.py')
-rw-r--r--cover.py109
1 files changed, 36 insertions, 73 deletions
diff --git a/cover.py b/cover.py
index 3fe3ebf..6413aee 100644
--- a/cover.py
+++ b/cover.py
@@ -1,23 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# cover.py
+# Copyright 2012 S. Daniel Francis <francis@sugarlabs.org>
#
-# Copyright 2012 S. Daniel Francis <francis@sugarlabs.org>
+# 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.
#
-# 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.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
#
@@ -294,56 +292,6 @@ class CoverSlide(gtk.VPaned):
self.pack2(self.images_notebook)
self._ready = False
self.connect('expose-event', self._expose_event_cb)
- """
- images_editing_box = gtk.VBox()
- self.images_model = gtk.ListStore(str, bool, int)
- self.head_iter = self.images_model.append(["Head Image", False, 1])
- self.head_image_check.connect("toggled",
- self.check_display_image,
- self.head_iter)
- self.background_iter = self.images_model.append(["Background Image",
- False,
- 2])
- self.background_image_check.connect("toggled",
- self.check_display_image,
- self.background_iter)
- self.cover_iter = self.images_model.append(["Cover Image", False, 3])
- self.cover_image_check.connect("toggled",
- self.check_display_image,
- self.cover_iter)
- self.image_iters = [self.head_iter,
- self.background_iter,
- self.cover_iter]
- self.image_combo = gtk.ComboBox(self.images_model)
- cell = gtk.CellRendererText()
- self.image_combo.pack_start(cell)
- self.image_combo.add_attribute(cell, 'text', 0)
- self.image_combo.add_attribute(cell, 'sensitive', 1)
- self.image_combo.show()
- images_editing_box.pack_start(self.image_combo, False, True, 0)
- self.images_editing_notebook = gtk.Notebook()
- self.images_editing_notebook.set_show_tabs(False)
- self.images_editing_notebook.append_page(gtk.Label(), None)
- self.head_image_editor = ImageEditor()
- self.head_image_editor.show()
- self.images_editing_notebook.append_page(self.head_image_editor, None)
- self.background_image_editor = ImageEditor()
- self.background_image_editor.show()
- self.images_editing_notebook.append_page(self.background_image_editor,
- None)
- self.cover_image_editor = ImageEditor()
- self.cover_image_editor.show()
- self.images_editing_notebook.append_page(self.cover_image_editor, None)
- self.images_editing_notebook.show_all()
- self.images_editing_notebook.set_current_page(0)
- self.image_combo.connect("changed", self.change_image)
- images_editing_box.pack_start(self.images_editing_notebook,
- True,
- True,
- 0)
- images_editing_box.show()
- hbox.pack_start(images_editing_box, True, True, 0)
- """
self.slide_title = gtk.Entry()
self.slide_title.set_text("Cover Slide")
self.slide_title.show()
@@ -355,6 +303,10 @@ class CoverSlide(gtk.VPaned):
self.images_notebook.set_current_page(
self.images_check_model.get_value(_iter,
2))
+ page_num = self.images_notebook.get_current_page()
+ child = self.images_notebook.get_nth_page(page_num)
+ child.setup_toolbar()
+
return True
def _expose_event_cb(self, widget, event):
@@ -370,15 +322,26 @@ class CoverSlide(gtk.VPaned):
#FIXME, Need to select an active row or unselect all.
if not self.images_check_model[path][0]:
selection = self.images_check_view.get_selection()
- selection.unselect_iter(self.images_check_model.get_iter(path))
- self.images_notebook.set_current_page(0)
- _iter = self.images_check_model.get_iter_first()
- while _iter != None:
- if self.images_check_model[_iter][2]:
- selection.select_iter(_iter)
- break
- else:
- _iter = self.images_check_model.iter_next(_iter)
+ if self.images_notebook.get_current_page() !=\
+ self.images_check_model[path][2]:
+ _iter = self.imamages_check_model.get_iter_first()
+ while _iter != None:
+ if self.images_check_model[_iter][2] ==\
+ self.images_notebook.get_current_page():
+ selection.select_iter(_iter)
+ break
+ else:
+ self.images_check_model.iter_next(_iter)
+ else:
+ #selection.unselect_iter(self.images_check_model.get_iter(path))
+ self.images_notebook.set_current_page(0)
+ _iter = self.images_check_model.get_iter_first()
+ while _iter != None:
+ if self.images_check_model[_iter][2]:
+ selection.select_iter(_iter)
+ break
+ else:
+ _iter = self.images_check_model.iter_next(_iter)
def change_image(self, widget):
active_iter = self.image_combo.get_active_iter()