mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
onlinelink
This commit is contained in:
parent
3c4fe69faf
commit
f9563995a1
@ -18,4 +18,9 @@ class goo(cishubase):
|
|||||||
|
|
||||||
xx = re.sub("</a>", "", xx)
|
xx = re.sub("</a>", "", xx)
|
||||||
|
|
||||||
return xx
|
return (
|
||||||
|
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||||
|
url
|
||||||
|
)
|
||||||
|
+ xx
|
||||||
|
)
|
||||||
|
@ -26,4 +26,9 @@ class weblio(cishubase):
|
|||||||
|
|
||||||
join = "<br>".join(_all)
|
join = "<br>".join(_all)
|
||||||
|
|
||||||
return join
|
return (
|
||||||
|
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||||
|
url
|
||||||
|
)
|
||||||
|
+ join
|
||||||
|
)
|
||||||
|
@ -25,4 +25,11 @@ class youdao(cishubase):
|
|||||||
proxies=getproxy(),
|
proxies=getproxy(),
|
||||||
).text
|
).text
|
||||||
fnd = re.findall('<section class="modules"(.*?)>([\\s\\S]*?)</section>', text)
|
fnd = re.findall('<section class="modules"(.*?)>([\\s\\S]*?)</section>', text)
|
||||||
return fnd[0][1]
|
return (
|
||||||
|
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div><br>'.format(
|
||||||
|
"https://dict.youdao.com/result?word={}&lang={}".format(
|
||||||
|
quote(word), self.srclang
|
||||||
|
)
|
||||||
|
)
|
||||||
|
+ fnd[0][1]
|
||||||
|
)
|
||||||
|
@ -17,7 +17,7 @@ from PyQt5.QtWidgets import (
|
|||||||
from PyQt5.QtGui import QPixmap, QImage
|
from PyQt5.QtGui import QPixmap, QImage
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
import requests, json, subprocess, time
|
import requests, json, subprocess, time
|
||||||
from PyQt5.QtCore import pyqtSignal, Qt
|
from PyQt5.QtCore import pyqtSignal, Qt, QUrl
|
||||||
import qtawesome, functools, os, base64
|
import qtawesome, functools, os, base64
|
||||||
import gobject, uuid, signal
|
import gobject, uuid, signal
|
||||||
from myutils.config import globalconfig, _TR, static_data
|
from myutils.config import globalconfig, _TR, static_data
|
||||||
@ -694,6 +694,15 @@ class searchwordW(closeashidewindow):
|
|||||||
self.setCentralWidget(ww)
|
self.setCentralWidget(ww)
|
||||||
|
|
||||||
textOutput = QTextBrowser(self)
|
textOutput = QTextBrowser(self)
|
||||||
|
|
||||||
|
def openlink(url):
|
||||||
|
try:
|
||||||
|
if url.url().lower().startswith("http"):
|
||||||
|
os.startfile(url.url())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
textOutput.anchorClicked.connect(openlink)
|
||||||
textOutput.setUndoRedoEnabled(False)
|
textOutput.setUndoRedoEnabled(False)
|
||||||
textOutput.setReadOnly(True)
|
textOutput.setReadOnly(True)
|
||||||
textOutput.setOpenLinks(False)
|
textOutput.setOpenLinks(False)
|
||||||
@ -755,6 +764,7 @@ class searchwordW(closeashidewindow):
|
|||||||
for i in range(self.tab.count()):
|
for i in range(self.tab.count()):
|
||||||
self.tab.removeTab(0)
|
self.tab.removeTab(0)
|
||||||
self.tabks.clear()
|
self.tabks.clear()
|
||||||
|
self.textOutput.clear()
|
||||||
self.cache_results.clear()
|
self.cache_results.clear()
|
||||||
for k, cishu in gobject.baseobject.cishus.items():
|
for k, cishu in gobject.baseobject.cishus.items():
|
||||||
cishu.callback = functools.partial(self.showtabsignal.emit, k)
|
cishu.callback = functools.partial(self.showtabsignal.emit, k)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user