-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChromeQuery.py
More file actions
59 lines (48 loc) · 1.91 KB
/
ChromeQuery.py
File metadata and controls
59 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# ----------------------------------------------------------------
# Author: wayneferdon wayneferdon@hotmail.com
# Date: 2022-10-05 17:07:35
# LastEditors: WayneFerdon wayneferdon@hotmail.com
# LastEditTime: 2023-04-05 07:41:43
# FilePath: \Plugins\WoxPluginBase_ChromeQuery\ChromeQuery.py
# ----------------------------------------------------------------
# Copyright (c) 2022 by Wayne Ferdon Studio. All rights reserved.
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# ----------------------------------------------------------------
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from WoxBasePluginQuery import *
import webbrowser
from ChromeCache import *
class ChromeQuery(QueryPlugin):
PlatformCaches = dict[Platform, Cache]()
def __getDatas__(self) -> list[ChromeData]:
return None
def __getResult__(self, regex:RegexList, data:ChromeData):
return None
def __extraContextMenu__(self, data:ChromeData):
return []
def query(self, query:str):
results = list()
regex = RegexList(query)
self.__datas__ = self.__getDatas__()
for data in self.__datas__:
result = self.__getResult__(regex, data)
if result is None:
continue
results.append(result)
return results
def context_menu(self, index:int):
self.query('')
data = self.__datas__[index]
results = [
self.getCopyDataResult('URL', data.url, data.icon),
self.getCopyDataResult('Title', data.title, data.icon)
]
results += self.__extraContextMenu__(data)
return results
def openUrl(self, url:str):
webbrowser.open(url)
if __name__ == "__main__":
InstallationCheck()