X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=src%2Fgui%2Fgui.py;h=ea288a3d7ef8b876798824aaae955e6c5d78c053;hb=f4c5b327a5fb8541547d943f067623bafcad2645;hp=2661286b881b63d728b36526f7380113e80a36e5;hpb=f962d6e90c228ddf0bbaf2490884d059b52fc38d;p=matthijs%2Fupstream%2Fmobilegtd.git diff --git a/src/gui/gui.py b/src/gui/gui.py index 2661286..ea288a3 100644 --- a/src/gui/gui.py +++ b/src/gui/gui.py @@ -137,14 +137,22 @@ class View(object): def exit(self): self.exit_flag = True self.lock.signal() - super(View, self).exit() def refresh(self): """ Update the gui after a change in model or some user interaction. Should be filled by subclasses. """ - super(View, self).refresh() + pass + + 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): @@ -156,7 +164,7 @@ class ListView(View): This function is called when the user selects an an entry (e.g., navigates to it and push the ok button). """ - super(ListView).entry_selected() + pass def update(self,subject=None): #logger.log(u'Updated %s'%repr(self)) @@ -188,7 +196,6 @@ class ListView(View): def selected_index(self): return self.view.current() - class WidgetBasedListView(ListView): def __init__(self): self.widgets = self.generate_widgets() @@ -248,7 +255,8 @@ class KeyBindingView(View): description=' '+description menu_entries.append((description,function)) menu_entries.append((u'Exit', self.exit)) - return menu_entries + return menu_entries + super(KeyBindingView, self).get_menu_entries() + def set_bindings_for_selection(self,selected_index): self.remove_all_key_bindings()