X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fmobilegtd.git;a=blobdiff_plain;f=src%2Fgui%2Fgui.py;h=b2656177865ccbbe4945700d11fb06a1463c2d46;hp=ec0a7cb6f04decbb502b0698fa242bd85ef22d8f;hb=218b74c5e7d16bc6aef987d2a74caf0169c121dc;hpb=573aa2fe332293b1a645071a6cf46481b08b32fd diff --git a/src/gui/gui.py b/src/gui/gui.py index ec0a7cb..b265617 100644 --- a/src/gui/gui.py +++ b/src/gui/gui.py @@ -192,7 +192,20 @@ class WidgetBasedListView(ListView): class KeyBindingView(object): - def __init__(self,binding_map): + def __init__(self): + self.binding_map = {} + + def set_keybindings(self, binding_map): + """ + Set a new map of key bindings. This map maps method names to a + tuple of keyname and description. + + The method name refers to a method on the selected item, or the + current view. + + Example: { 'search_item' : ('0', 'Search item') } + + """ self.binding_map = binding_map def get_menu_entries(self): @@ -242,8 +255,8 @@ class SearchableListView(WidgetBasedListView): class EditableListView(SearchableListView,KeyBindingView): - def __init__(self,title,entry_filters,binding_map): - KeyBindingView.__init__(self,binding_map) + def __init__(self,title,entry_filters): + KeyBindingView.__init__(self) super(EditableListView, self).__init__(title,entry_filters) def key_and_menu_bindings(self,selected_index):