X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fmobilegtd.git;a=blobdiff_plain;f=src%2Fgui%2Fgui.py;h=f03880854f2310bdccda1216bc322c4a60e1277a;hp=aadffa50c2da1041989c581cdeba7b9f215ef902;hb=90174cff443401af0ed99a7b7eb1203a1055b6fd;hpb=b51e8daff4c4f353a334992891e564d562d6e98d diff --git a/src/gui/gui.py b/src/gui/gui.py index aadffa5..f038808 100644 --- a/src/gui/gui.py +++ b/src/gui/gui.py @@ -138,12 +138,20 @@ class View(object): self.exit_flag = True self.lock.signal() + def update(self,subject=None): + """ + Update the current view (e.g., make sure refresh is called). We + can't call it directly, since we're in another thread. + """ + if self.lock: + self.lock.signal() + def refresh(self): """ - Update the gui after a change in model or some user interaction. - Should be filled by subclasses. + Called when the current view must be updated. Never call + directly. Subclasses should extend this method, not update. """ - pass + appuifw.app.menu=self.get_menu_entries() def get_menu_entries(self): """ Returns a list of menu entries to display. Will be @@ -164,14 +172,8 @@ 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)) - if self.lock: - self.lock.signal() - #pass - def index_changed(self,adjustment=None): if adjustment: index = self.selected_index() + adjustment @@ -183,9 +185,6 @@ class ListView(View): index = 0 self.set_bindings_for_selection(index) - def refresh(self): - appuifw.app.menu=self.get_menu_entries() - def set_index(self,index): if index > len(self.widgets): index = len(self.widgets)