Example #1
0
 def item(self):
     return ShortcutResultItem('kw',
                               'name',
                               'http://site/?q=%s',
                               'icon_path',
                               is_default_search=True,
                               run_without_argument=False)
Example #2
0
    def handle_query(self, query):
        """
        @return Action object
        """
        shortcut = self._get_active_shortcut(query)
        if not shortcut:
            raise Exception('No active shortcut. This line should not be entered')

        return RenderResultListAction([ShortcutResultItem(**shortcut)])
Example #3
0
 def test_on_enter__run_file(self, ActionList, RunScriptAction):
     item = ShortcutResultItem('kw', 'name', '/usr/bin/something',
                               'icon_path')
     assert item.on_enter(Query('kw query')) is ActionList.return_value
     RunScriptAction.assert_called_once_with('/usr/bin/something', 'query')
Example #4
0
 def item(self):
     return ShortcutResultItem('kw',
                               'name',
                               'http://site/?q=%s',
                               'icon_path',
                               is_default_search=True)
Example #5
0
 def _create_items(self, shortcuts, default_search=False):
     return [ShortcutResultItem(default_search=default_search, **s) for s in shortcuts]
 def test_on_enter__run_file(self, ActionList, RunScriptAction):
     item = ShortcutResultItem('kw', 'name', '/usr/bin/something', 'icon_path')
     assert item.on_enter(Query('kw query')) is ActionList.return_value
     RunScriptAction.assert_called_once_with('/usr/bin/something', 'query')