def show_search(self, query=None): '''Menu action to show the L{SearchDialog} @param query: the search query to show ''' from zim.gui.searchdialog import SearchDialog if query is None and hasattr(self.widget, 'pageview'): query = self.widget.pageview.get_selection() # XXX unauthorized access to pageview dialog = SearchDialog(self.widget, self.notebook, self.page, self.navigation) dialog.present() if query is not None: dialog.search(query)
def show_search(self, query=None, focus_results=False): '''Menu action to show the L{SearchDialog} @param query: the search query to show ''' from zim.gui.searchdialog import SearchDialog if query is None and hasattr(self.widget, 'pageview'): query = self.widget.pageview.get_selection() # XXX unauthorized access to pageview dialog = SearchDialog(self.widget, self.notebook, self.page, self.navigation) dialog.present() if query is not None: dialog.search(query) if focus_results: dialog.results_treeview.grab_focus() else: dialog.query_entry.grab_focus() dialog.query_entry.set_position(-1)