Wox-launcher / Wox

A cross-platform launcher that simply works
http://wox-launcher.github.io/Wox/
GNU General Public License v3.0
24.63k stars 2.37k forks source link

Is there any way to keep a python plugin in memory? #3499

Closed tchar closed 1 year ago

tchar commented 3 years ago

Hello, I am trying to integrate my plugin into wox but every type I type any key the plugin gets reset.

Suppose the following sample plugin

from wox import Wox
import random
rand = random.randint(1, 10000)

class Main(Wox):
    def query(self, key):
        return [{
            'Title': str(rand)
        }]

if __name__ == "__main__":
    Main()

Every time I type a single word I get a different output. Is there any way to persist the plugin into memory without reinstantiating it every time I type a single word? I can't block the main thread with requests every time I press a key.

Animeshz commented 3 years ago

I don't know exactly about these but since the plugin architecture is inside out, based on callbacks you should rely on the actual program to store the data https://github.com/Wox-launcher/Wox/blob/master/Plugins/Wox.Plugin.Folder/Main.cs has used PluginJsonStorage to store and retrieve data on demand...

tchar commented 3 years ago

Hi @Animeshz. Well the problem is that

qianlifeng commented 1 year ago

will support in v2