Exemple #1
0
 def doSearch(self, query):
     self.log.debug("Search query: %s" % query)
     try:
         self._syncOneChangeFromQuery(query)
     except Exception as e:
         return self.error(e.message)
     with self.db.getSession() as session:
         try:
             changes = session.getChanges(query)
         except gertty.search.SearchSyntaxError as e:
             return self.error(e.message)
         except sqlalchemy.exc.OperationalError as e:
             return self.error(e.message)
         except Exception as e:
             return self.error(str(e))
         change_key = None
         if len(changes) == 1:
             change_key = changes[0].key
     try:
         if change_key:
             view = view_change.ChangeView(self, change_key)
         else:
             view = view_change_list.ChangeListView(self, query)
         self.changeScreen(view)
     except gertty.view.DisplayError as e:
         return self.error(e.message)
Exemple #2
0
 def unhandledInput(self, key):
     # get commands from buffer
     keys = self.input_buffer + [key]
     commands = self.config.keymap.getCommands(keys)
     if keymap.PREV_SCREEN in commands:
         self.backScreen()
     elif keymap.TOP_SCREEN in commands:
         self.clearHistory()
         self.refresh(force=True)
     elif keymap.HELP in commands:
         self.help()
     elif keymap.QUIT in commands:
         self.quit()
     elif keymap.CHANGE_SEARCH in commands:
         self.searchDialog('')
     elif keymap.LIST_HELD in commands:
         self.doSearch("is:held")
     elif key in self.config.dashboards:
         d = self.config.dashboards[key]
         view = view_change_list.ChangeListView(self, d['query'], d['name'],
                                                sort_by=d.get('sort-by'),
                                                reverse=d.get('reverse'))
         self.changeScreen(view)
     elif keymap.FURTHER_INPUT in commands:
         self.input_buffer.append(key)
         self.status.update(message=''.join(self.input_buffer))
         return
     self.clearInputBuffer()
Exemple #3
0
 def onSelect(self, button, data):
     project_key, project_name = data
     self.app.changeScreen(
         view_change_list.ChangeListView(
             self.app,
             "_project_key:%s %s" %
             (project_key, self.app.config.project_change_list_query),
             project_name,
             unreviewed=True))
Exemple #4
0
 def unhandledInput(self, key):
     commands = self.config.keymap.getCommands(key)
     if keymap.PREV_SCREEN in commands:
         self.backScreen()
     elif keymap.HELP in commands:
         self.help()
     elif keymap.QUIT in commands:
         self.quit()
     elif keymap.CHANGE_SEARCH in commands:
         self.searchDialog()
     elif key in self.config.dashboards:
         d = self.config.dashboards[key]
         self.clearHistory()
         view = view_change_list.ChangeListView(self, d['query'], d['name'])
         self.changeScreen(view)
Exemple #5
0
 def unhandledInput(self, key):
     # get commands from buffer
     keys = self.input_buffer + [key]
     commands = self.config.keymap.getCommands(keys)
     if keymap.PREV_SCREEN in commands:
         self.backScreen()
     elif keymap.TOP_SCREEN in commands:
         self.clearHistory()
         self.refresh(force=True)
     elif keymap.HELP in commands:
         self.help()
     elif keymap.QUIT in commands:
         self.quit()
     elif keymap.CHANGE_SEARCH in commands:
         self.searchDialog('')
     elif keymap.LIST_HELD in commands:
         self.doSearch("is:held")
     elif key in self.config.dashboards:
         d = self.config.dashboards[key]
         view = view_change_list.ChangeListView(self,
                                                d['query'],
                                                d['name'],
                                                sort_by=d.get('sort-by'),
                                                reverse=d.get('reverse'))
         self.changeScreen(view)
     elif keymap.FURTHER_INPUT in commands:
         self.input_buffer.append(key)
         msg = ''.join(self.input_buffer)
         commands = dict(self.getGlobalCommands())
         if hasattr(self.frame.body, 'getCommands'):
             commands.update(dict(self.frame.body.getCommands()))
         further_commands = self.config.keymap.getFurtherCommands(keys)
         completions = []
         for (key, cmds) in further_commands:
             for cmd in cmds:
                 if cmd in commands:
                     completions.append(key)
         completions = ' '.join(completions)
         msg = '%s: %s' % (msg, completions)
         self.status.update(message=msg)
         return
     self.clearInputBuffer()