mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Implement #15
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
#encoding=utf8
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import json
|
||||
import webbrowser
|
||||
from wox import Wox
|
||||
from wox import Wox,WoxAPI
|
||||
|
||||
class HackerNews(Wox):
|
||||
|
||||
@@ -16,12 +14,16 @@ class HackerNews(Wox):
|
||||
for i in bs.select(".comhead"):
|
||||
title = i.previous_sibling.text
|
||||
url = i.previous_sibling["href"]
|
||||
results.append({"Title": title ,"IcoPath":"Images/app.ico","JsonRPCAction":{"method": "openUrl", "parameters": url}})
|
||||
#results.append({"Title": title ,"IcoPath":"Images/app.ico","JsonRPCAction":{"method": "Wox.ChangeQuery","parameters":[url,True]}})
|
||||
results.append({"Title": title ,"IcoPath":"Images/app.ico","JsonRPCAction":{"method": "openUrl","parameters":[url],"dontHideAfterAction":True}})
|
||||
#results.append({"Title": title ,"IcoPath":"Images/app.ico","JsonRPCAction":{"method": "Wox.ShowApp"}})
|
||||
|
||||
return results
|
||||
|
||||
def openUrl(self,url):
|
||||
webbrowser.open(url)
|
||||
#todo:doesn't work when move this line up
|
||||
WoxAPI.change_query(url)
|
||||
|
||||
if __name__ == "__main__":
|
||||
HackerNews()
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
d:\Personal\wox.jsonrpc\Output\Debug\PythonHome\python.exe main.py "{\"jsonrpc\": \"2.0\", \"method\": \"query\", \"params\": \"l\", \"id\": 1}
|
||||
..\..\PythonHome\python.exe main.py "{\"jsonrpc\": \"2.0\", \"method\": \"query\", \"params\": \"l\", \"id\": 1}
|
||||
REM ..\..\PythonHome\python.exe main.py "{\"method\":\"openUrl\",\"parameters\":[\"https://blog.pinboard.in/2014/07/pinboard_turns_five/\",2]}"
|
||||
|
||||
Reference in New Issue
Block a user