Skip to content

Commit 64c07c7

Browse files
1 parent 6cc0cb8 commit 64c07c7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

assets/js/search-data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
},"56": {
394394
"doc": "Python",
395395
"title": "Writing Python plugins",
396-
"content": "An Albert Python plugin is a Python module having an interface defined in the Albert stub file. At runtime the stub file is written to your user Python plugin directory, where it serves as inline documentation and coding assistance in your IDE while development. A minimal trigger query handler plugin: . from albert import * md_iid = '3.0' md_version = '1.0' md_name = 'My plugin' md_description = 'Does things' class Plugin(PluginInstance, TriggerQueryHandler): def __init__(self): PluginInstance.__init__(self) TriggerQueryHandler.__init__(self) def handleTriggerQuery(self, query): # query.add(StandardItem(…)) . Next, skim through the Python stub file. For reference see the official plugins. In case of questions see the C++ API. ",
396+
"content": "An Albert Python plugin is a Python module having an interface defined in the Albert stub file. At runtime the stub file is written to your user Python plugin directory, where it serves as inline documentation and coding assistance in your IDE while development. A minimal trigger query handler plugin: . from albert import * md_iid = '5.0' md_version = '1.0' md_name = 'My plugin' md_description = 'Does things' class Plugin(PluginInstance, TriggerQueryHandler): def __init__(self): PluginInstance.__init__(self) TriggerQueryHandler.__init__(self) def handleTriggerQuery(self, query): # query.add(StandardItem(…)) . Next, skim through the Python stub file. For reference see the official plugins. In case of questions see the C++ API. ",
397397
"url": "/gettingstarted/extension/python/#writing-python-plugins",
398398

399399
"relUrl": "/gettingstarted/extension/python/#writing-python-plugins"

gettingstarted/extension/python/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <link rel="stylesheet" href="/assets/css/just-the-docs-default.css"> <link rel="stylesheet" href="/assets/css/just-the-docs-head-nav.css" id="jtd-head-nav-stylesheet"> <style id="jtd-nav-activation"> .site-nav > ul.nav-list:first-child > li > a, .site-nav > ul.nav-list:first-child > li > ul > li > a, .site-nav > ul.nav-list:first-child > li > ul > li > ul > li:not(:nth-child(2)) > a, .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > ul > li a { background-image: none; } .site-nav > ul.nav-list:not(:first-child) a, .site-nav li.external a { background-image: none; } .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(3) > ul > li:nth-child(2) > a { font-weight: 600; text-decoration: none; }.site-nav > ul.nav-list:first-child > li:nth-child(1) > button svg, .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(3) > button svg, .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(3) > ul > li:nth-child(2) > button svg { transform: rotate(-90deg); }.site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list, .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(3) > ul.nav-list, .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(3) > ul.nav-list > li.nav-list-item:nth-child(2) > ul.nav-list { display: block; } </style> <script src="/assets/js/vendor/lunr.min.js"></script> <script src="/assets/js/just-the-docs.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="/img/favicon.ico" type="image/x-icon"> <!-- Begin Jekyll SEO tag v2.8.0 --> <title>Python | Albert</title> <meta name="generator" content="Jekyll v4.4.1" /> <meta property="og:title" content="Python" /> <meta property="og:locale" content="en_US" /> <meta name="description" content="Albert is a unified and efficient access to your machine. Technically it is a keyboard launcher written in C++/Qt. The plugin based architecture makes it extremely flexible and powerful. Plugins can be used to create frontends or functional extensions. Extensions can also be implemented using embedded Python modules or via a CGI approach in any language you want." /> <meta property="og:description" content="Albert is a unified and efficient access to your machine. Technically it is a keyboard launcher written in C++/Qt. The plugin based architecture makes it extremely flexible and powerful. Plugins can be used to create frontends or functional extensions. Extensions can also be implemented using embedded Python modules or via a CGI approach in any language you want." /> <link rel="canonical" href="https://albertlauncher.github.io/gettingstarted/extension/python/" /> <meta property="og:url" content="https://albertlauncher.github.io/gettingstarted/extension/python/" /> <meta property="og:site_name" content="Albert" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary" /> <meta property="twitter:title" content="Python" /> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"WebPage","description":"Albert is a unified and efficient access to your machine. Technically it is a keyboard launcher written in C++/Qt. The plugin based architecture makes it extremely flexible and powerful. Plugins can be used to create frontends or functional extensions. Extensions can also be implemented using embedded Python modules or via a CGI approach in any language you want.","headline":"Python","url":"https://albertlauncher.github.io/gettingstarted/extension/python/"}</script> <!-- End Jekyll SEO tag --> <head> <link rel="stylesheet" href="/assets/css/just-the-docs-albertdark.css" media="(prefers-color-scheme: dark)" /> <link rel="stylesheet" href="/assets/css/just-the-docs-albert.css" media="(prefers-color-scheme: light)" /> </head> </head> <body> <a class="skip-to-main" href="#main-content">Skip to main content</a> <svg xmlns="http://www.w3.org/2000/svg" class="d-none"> <symbol id="svg-link" viewBox="0 0 24 24"> <title>Link</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"> <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path> </svg> </symbol> <symbol id="svg-menu" viewBox="0 0 24 24"> <title>Menu</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"> <line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line> </svg> </symbol> <symbol id="svg-arrow-right" viewBox="0 0 24 24"> <title>Expand</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"> <polyline points="9 18 15 12 9 6"></polyline> </svg> </symbol> <!-- Feather. MIT License: https://github.com/feathericons/feather/blob/master/LICENSE --> <symbol id="svg-external-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"> <title id="svg-external-link-title">(external link)</title> <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line> </symbol> <symbol id="svg-doc" viewBox="0 0 24 24"> <title>Document</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"> <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline> </svg> </symbol> <symbol id="svg-search" viewBox="0 0 24 24"> <title>Search</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"> <circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </symbol> <!-- Bootstrap Icons. MIT License: https://github.com/twbs/icons/blob/main/LICENSE.md --> <symbol id="svg-copy" viewBox="0 0 16 16"> <title>Copy</title> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16"> <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/> <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/> </svg> </symbol> <symbol id="svg-copied" viewBox="0 0 16 16"> <title>Copied</title> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard-check-fill" viewBox="0 0 16 16"> <path d="M6.5 0A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3Zm3 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3Z"/> <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1A2.5 2.5 0 0 1 9.5 5h-3A2.5 2.5 0 0 1 4 2.5v-1Zm6.854 7.354-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708.708Z"/> </svg> </symbol> </svg> <header class="side-bar"> <div class="site-header"> <a href="/" class="site-title lh-tight"> Albert </a> <button id="menu-button" class="site-button btn-reset" aria-label="Menu" aria-expanded="false"> <svg viewBox="0 0 24 24" class="icon" aria-hidden="true"><use xlink:href="#svg-menu"></use></svg> </button> </div> <nav aria-label="Main" id="site-nav" class="site-nav"> <ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="Getting started submenu" aria-expanded="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/gettingstarted/" class="nav-list-link">Getting started</a><ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="Installation submenu" aria-expanded="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/gettingstarted/installation/" class="nav-list-link">Installation</a><ul class="nav-list"><li class="nav-list-item"><a href="/gettingstarted/installation/macos/" class="nav-list-link">macOS</a></li><li class="nav-list-item"><a href="/gettingstarted/installation/linux/" class="nav-list-link">Linux</a></li><li class="nav-list-item"><a href="/gettingstarted/installation/source/" class="nav-list-link">From source</a></li></ul></li><li class="nav-list-item"><a href="/gettingstarted/basics/" class="nav-list-link">Basics</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="Extension submenu" aria-expanded="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/gettingstarted/extension/" class="nav-list-link">Extension</a><ul class="nav-list"><li class="nav-list-item"><a href="/gettingstarted/extension/cplusplus/" class="nav-list-link">C++</a></li><li class="nav-list-item"><a href="/gettingstarted/extension/python/" class="nav-list-link">Python</a></li></ul></li><li class="nav-list-item"><a href="/gettingstarted/contributing/" class="nav-list-link">Contributing</a></li><li class="nav-list-item"><a href="/gettingstarted/help/" class="nav-list-link">Help</a></li><li class="nav-list-item"><a href="/gettingstarted/faq/" class="nav-list-link">FAQ</a></li></ul></li><li class="nav-list-item"><a href="/gallery" class="nav-list-link">Gallery</a></li><li class="nav-list-item"><a href="/news/" class="nav-list-link">News</a></li><li class="nav-list-item"><a href="/donation/" class="nav-list-link">Donating</a></li></ul> <ul class="nav-list"><li class="nav-list-item external"> <a href="https://albertlauncher.github.io/reference/topics.html" class="nav-list-link external" > API reference <svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg> </a> </li><li class="nav-list-item external"> <a href="https://github.com/albertlauncher/albert" class="nav-list-link external" > GitHub <svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg> </a> </li></ul> </nav> <div class="d-md-block d-xs-none"> <footer class="site-footer"> <!-- intentionally empty to avois showing this: This site uses <a href="https://github.com/just-the-docs/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.--> </footer> </div> </header> <div class="main" id="top"> <div id="main-header" class="main-header"> <div class="search" role="search"> <div class="search-input-wrap"> <input type="text" id="search-input" class="search-input" tabindex="0" placeholder="Search Albert" autocomplete="off"> <label for="search-input" class="search-label"> <span class="sr-only">Search Albert</span> <svg viewBox="0 0 24 24" class="search-icon" aria-hidden="true"><use xlink:href="#svg-search"></use></svg> </label> </div> <div id="search-results" class="search-results"></div> </div> </div> <div class="main-content-wrap"> <nav aria-label="Breadcrumb" class="breadcrumb-nav"> <ol class="breadcrumb-nav-list"> <li class="breadcrumb-nav-list-item"><a href="/gettingstarted/">Getting started</a></li> <li class="breadcrumb-nav-list-item"><a href="/gettingstarted/extension/">Extension</a></li> <li class="breadcrumb-nav-list-item"><span>Python</span></li> </ol> </nav> <div id="main-content" class="main-content"> <main> <h1 class="no_toc" id="extending-albert-using-python"> <a href="#extending-albert-using-python" class="anchor-heading" aria-labelledby="extending-albert-using-python"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Extending Albert using Python </h1> <p class="note">This page focuses on the practical aspects of extending Albert using Python and its peculiarities. To get an overview of the API refer to the general <a href="/gettingstarted/extension/">extension</a> section.</p> <h2 id="writing-python-plugins"> <a href="#writing-python-plugins" class="anchor-heading" aria-labelledby="writing-python-plugins"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Writing Python plugins </h2> <p>An Albert Python plugin is a Python module having an interface defined in the <a href="https://github.com/albertlauncher/albert-plugin-python/blob/main/albert.pyi"><strong>Albert stub file</strong></a>. At runtime the stub file is written to your <em>user Python plugin directory</em>, where it serves as inline documentation and coding assistance in your IDE while development.</p> <p>A minimal trigger query handler plugin:</p> <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="n">albert</span> <span class="kn">import</span> <span class="o">*</span>
22

3-
<span class="n">md_iid</span> <span class="o">=</span> <span class="sh">'</span><span class="s">3.0</span><span class="sh">'</span>
3+
<span class="n">md_iid</span> <span class="o">=</span> <span class="sh">'</span><span class="s">5.0</span><span class="sh">'</span>
44
<span class="n">md_version</span> <span class="o">=</span> <span class="sh">'</span><span class="s">1.0</span><span class="sh">'</span>
55
<span class="n">md_name</span> <span class="o">=</span> <span class="sh">'</span><span class="s">My plugin</span><span class="sh">'</span>
66
<span class="n">md_description</span> <span class="o">=</span> <span class="sh">'</span><span class="s">Does things</span><span class="sh">'</span>

0 commit comments

Comments
 (0)