def show_completion_list(self, completions, completion_text=""): """Display the possible completions""" if not completions: return if not isinstance(completions[0], tuple): completions = [(c, '') for c in completions] if len(completions) == 1 and completions[0][0] == completion_text: return self.completion_text = completion_text # Sorting completion list (entries starting with underscore are # put at the end of the list): underscore = set([(comp, t) for (comp, t) in completions if comp.startswith('_')]) completions = sorted(set(completions) - underscore, key=lambda x: str_lower(x[0])) completions += sorted(underscore, key=lambda x: str_lower(x[0])) self.show_completion_widget(completions)