Also, make KeyBindingView call the next get_menu_entries method,
allowing for other classes to override the method as well.
"""
super(View, self).refresh()
"""
super(View, self).refresh()
+ def get_menu_entries(self):
+ """ Returns a list of menu entries to display. Will be
+ automatically updated on each refresh.
+
+ Each menu entry is a tuple of a title for the entry and a
+ function to call when the entry is selected.
+ """
+ return []
+
class ListView(View):
def __init__(self):
super(ListView, self).__init__()
class ListView(View):
def __init__(self):
super(ListView, self).__init__()
def selected_index(self):
return self.view.current()
def selected_index(self):
return self.view.current()
class WidgetBasedListView(ListView):
def __init__(self):
self.widgets = self.generate_widgets()
class WidgetBasedListView(ListView):
def __init__(self):
self.widgets = self.generate_widgets()
description=' '+description
menu_entries.append((description,function))
menu_entries.append((u'Exit', self.exit))
description=' '+description
menu_entries.append((description,function))
menu_entries.append((u'Exit', self.exit))
+ return menu_entries + super(KeyBindingView, self).get_menu_entries()
+
def set_bindings_for_selection(self,selected_index):
self.remove_all_key_bindings()
def set_bindings_for_selection(self,selected_index):
self.remove_all_key_bindings()