X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=src%2Fgui%2Fgui.py;h=3d4e6fb9e605627ad789dcbe7ce00b4398c88b35;hb=44d266884b779d4273a224903dddf8f4def9e0c8;hp=a981b61111d5c44bd7daadbe7360cb9154294729;hpb=80501ced4dd4ccb5567283f16b49327140474fdf;p=matthijs%2Fupstream%2Fmobilegtd.git diff --git a/src/gui/gui.py b/src/gui/gui.py index a981b61..3d4e6fb 100644 --- a/src/gui/gui.py +++ b/src/gui/gui.py @@ -142,7 +142,9 @@ class View(object): self.refresh() self.lock.wait() except: - pass + # TODO: Find out which exceptions to catch here. Catching + # and silencing all exceptions is not a good idea. + raise restore_gui(self) def exit(self): @@ -249,6 +251,13 @@ class ListView(View): """ Changes the currently selected item to index. """ self.view.set_list(self.items(),index % len(self.items())) + def selected_item(self): + """ Returns the (title of the) currently selected list item. """ + if not self.items_cache: + return None # No items, so none is selected. + return self.items_cache[self.selected_index()] + + def selected_index(self): """ Returns the currently selected index. """ if not self.current_index is None: