Making text on lists more thumb friendly
[watersofshiloah] / src / windows / scriptures.py
index 5847ad8..58fe5ee 100644 (file)
@@ -18,8 +18,8 @@ _moduleLogger = logging.getLogger(__name__)
 
 class ScripturesWindow(windows._base.ListWindow):
 
-       def __init__(self, player, store, node):
-               windows._base.ListWindow.__init__(self, player, store, node)
+       def __init__(self, app, player, store, node):
+               windows._base.ListWindow.__init__(self, app, player, store, node)
                self._window.set_title(self._node.title)
 
        @classmethod
@@ -27,7 +27,9 @@ class ScripturesWindow(windows._base.ListWindow):
                yield gobject.TYPE_PYOBJECT, None
 
                textrenderer = gtk.CellRendererText()
+               hildonize.set_cell_thumb_selectable(textrenderer)
                column = gtk.TreeViewColumn("Scripture")
+               column.set_property("sizing", gtk.TREE_VIEW_COLUMN_FIXED)
                column.pack_start(textrenderer, expand=True)
                column.add_attribute(textrenderer, "text", 1)
                yield gobject.TYPE_STRING, column
@@ -59,7 +61,7 @@ class ScripturesWindow(windows._base.ListWindow):
                self._errorBanner.push_message(str(exception))
 
        def _window_from_node(self, node):
-               booksWindow = ScriptureBooksWindow(self._player, self._store, node)
+               booksWindow = ScriptureBooksWindow(self._app, self._player, self._store, node)
                booksWindow.window.set_modal(True)
                booksWindow.window.set_transient_for(self._window)
                booksWindow.window.set_default_size(*self._window.get_size())
@@ -81,8 +83,8 @@ gobject.type_register(ScripturesWindow)
 
 class ScriptureBooksWindow(windows._base.ListWindow):
 
-       def __init__(self, player, store, node):
-               windows._base.ListWindow.__init__(self, player, store, node)
+       def __init__(self, app, player, store, node):
+               windows._base.ListWindow.__init__(self, app, player, store, node)
                self._window.set_title(self._node.title)
 
        @classmethod
@@ -90,7 +92,9 @@ class ScriptureBooksWindow(windows._base.ListWindow):
                yield gobject.TYPE_PYOBJECT, None
 
                textrenderer = gtk.CellRendererText()
+               hildonize.set_cell_thumb_selectable(textrenderer)
                column = gtk.TreeViewColumn("Book")
+               column.set_property("sizing", gtk.TREE_VIEW_COLUMN_FIXED)
                column.pack_start(textrenderer, expand=True)
                column.add_attribute(textrenderer, "text", 1)
                yield gobject.TYPE_STRING, column
@@ -122,7 +126,7 @@ class ScriptureBooksWindow(windows._base.ListWindow):
                self._errorBanner.push_message(str(exception))
 
        def _window_from_node(self, node):
-               booksWindow = ScriptureChaptersWindow(self._player, self._store, node)
+               booksWindow = ScriptureChaptersWindow(self._app, self._player, self._store, node)
                booksWindow.window.set_modal(True)
                booksWindow.window.set_transient_for(self._window)
                booksWindow.window.set_default_size(*self._window.get_size())
@@ -144,8 +148,8 @@ gobject.type_register(ScriptureBooksWindow)
 
 class ScriptureChaptersWindow(windows._base.ListWindow):
 
-       def __init__(self, player, store, node):
-               windows._base.ListWindow.__init__(self, player, store, node)
+       def __init__(self, app, player, store, node):
+               windows._base.ListWindow.__init__(self, app, player, store, node)
                self._window.set_title(self._node.title)
 
        @classmethod
@@ -153,7 +157,9 @@ class ScriptureChaptersWindow(windows._base.ListWindow):
                yield gobject.TYPE_PYOBJECT, None
 
                textrenderer = gtk.CellRendererText()
+               hildonize.set_cell_thumb_selectable(textrenderer)
                column = gtk.TreeViewColumn("Chapter")
+               column.set_property("sizing", gtk.TREE_VIEW_COLUMN_FIXED)
                column.pack_start(textrenderer, expand=True)
                column.add_attribute(textrenderer, "text", 1)
                yield gobject.TYPE_STRING, column
@@ -185,7 +191,7 @@ class ScriptureChaptersWindow(windows._base.ListWindow):
                self._errorBanner.push_message(str(exception))
 
        def _window_from_node(self, node):
-               booksWindow = ScriptureChapterWindow(self._player, self._store, node)
+               booksWindow = ScriptureChapterWindow(self._app, self._player, self._store, node)
                booksWindow.window.set_modal(True)
                booksWindow.window.set_transient_for(self._window)
                booksWindow.window.set_default_size(*self._window.get_size())
@@ -207,8 +213,8 @@ gobject.type_register(ScriptureChaptersWindow)
 
 class ScriptureChapterWindow(windows._base.BasicWindow):
 
-       def __init__(self, player, store, node):
-               windows._base.BasicWindow.__init__(self, player, store)
+       def __init__(self, app, player, store, node):
+               windows._base.BasicWindow.__init__(self, app, player, store)
                self._node = node
                self._playerNode = self._player.node
                self._nextSearch = None
@@ -282,8 +288,10 @@ class ScriptureChapterWindow(windows._base.BasicWindow):
 
        @misc_utils.log_exception(_moduleLogger)
        def _on_player_update_seek(self):
+               if self._isDestroyed:
+                       return False
                self._seekbar.set_value(self._player.percent_elapsed * 100)
-               return True if not self._isDestroyed else False
+               return True
 
        @misc_utils.log_exception(_moduleLogger)
        def _on_player_state_change(self, player, newState):
@@ -294,8 +302,9 @@ class ScriptureChapterWindow(windows._base.BasicWindow):
                        self._updateSeek.start(seconds=1)
                else:
                        self._seekbar.hide()
-                       self._updateSeek.cancel()
-                       self._updateSeek = None
+                       if self._updateSeek is not None:
+                               self._updateSeek.cancel()
+                               self._updateSeek = None
 
                if not self._presenterNavigation.is_active():
                        self._set_context(newState)