Skip to content

Commit d0d81d9

Browse files
author
lilingfengdev
committed
fix somthing
2 parents 21c6d5a + 76fc969 commit d0d81d9

File tree

14 files changed

+104
-35
lines changed

14 files changed

+104
-35
lines changed

.github/workflows/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
python-version: "3.11"
2525
- name: Install Dependencies
2626
run: pip install -r requirements.txt
27+
- name: Install Build Dependencies
28+
run: pip install nuitka imageio
29+
- name: Build
30+
run: python build.py
2731
- name: Auto release
2832
uses: "marvinpinto/action-automatic-releases@latest"
2933
with:

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,6 @@ testing/
154154
Thumbs.db
155155
ehthumbs.db
156156
ehthumbs_vista.db
157-
*.stackdump
157+
*.stackdump
158+
/pse.dist
159+
*.exe

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/PluginSearchEngine.iml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44

55
## 注意事项
66

7-
* 搜索关键词不应该包含插件,比如我想搜索优化插件,我应该输入`优化`而不是`优化插件`
7+
* 搜索关键词不应该包含插件,比如我想搜索`优化插件`,我应该输入`优化`而不是`优化插件`
88
* 搜索的时候千万不可以开启 VPN。
9-
* 由于搜索工具底层是基于 Bing,所以可能会搜索出来一些无关于插件或者与关键词没有太大关联的东西
9+
* 由于搜索工具底层是基于 Bing (中国版),所以可能会搜出一些与插件或关键词无关的东西
1010
* 输出顺序为公平起见会被打乱。
11+
12+
## GUI
13+
14+
GUI 版本目前主要由[氿月](https://github.com/Lafcadia)进行维护,支持原版的所有功能,并且同步更新。对于萌新相对较友好。
15+
16+
### 环境配置
17+
1. 第三方模块要求参考 requirements.txt。
18+
2. 请使用 PyCharm(不使用其它IDE的理由见 Issue #7 #8)。

build.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
os.system("python3 -m pip install pyyaml install-jdk tqdm psutil requests imageio pygithub rtoml nuitka")
1818

19-
if os.path.exists("dist"):
20-
shutil.rmtree("dist")
21-
2219
os.mkdir("build")
2320
os.mkdir("dist")
2421

@@ -35,6 +32,8 @@ def build(file):
3532
args.append("--macos-app-icon=favicon.png")
3633
if platform.system() == 'Linux':
3734
args.append("--linux-icon=favicon.png")
35+
args.append("--windows-console-mode=disable")
36+
args.append("--enable-plugin=pyside6")
3837
subprocess.call(args)
3938
filename = os.path.splitext(file)[0]
4039
for f in os.listdir(os.path.join(os.getcwd(), "build")):

gui/main.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from core.search import search
22
from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox, QTreeWidgetItem
3-
from PySide6.QtCore import QObject, QThread, Signal, Slot
4-
# from PySide6 import QtCore
3+
from PySide6.QtCore import QObject, QThread, Signal
54
import sys
65
from gui.ui import Ui_MainWindow
76
import pyperclip
@@ -12,12 +11,16 @@ class Worker(QObject):
1211

1312
def __init__(self):
1413
super().__init__()
15-
print("000")
14+
# print("000")
1615

1716
def work(self, keyword):
18-
print(111)
19-
results = search(keyword)
20-
self._signal.emit(results)
17+
try:
18+
results = search(keyword)
19+
print("searching...")
20+
self._signal.emit(results)
21+
print("emitted signal _")
22+
except Exception as e:
23+
print(e)
2124

2225

2326
class MainWindow(QMainWindow):
@@ -32,28 +35,29 @@ def __init__(self):
3235
self.worker._signal.connect(self.shower)
3336
self.worker.moveToThread(self.worker_thread)
3437
self.a.connect(self.worker.work)
35-
self.ui.searchButton.clicked.connect(self.search)
36-
self.ui.outputTreeWidget.itemDoubleClicked.connect(self.copyUrl)
38+
self.ui.searchButton.clicked.connect(self.searcher)
39+
self.ui.outputTreeWidget.itemDoubleClicked.connect(self.copyurl)
3740
self.worker_thread.start()
3841

39-
def search(self):
42+
def searcher(self):
4043
keyword = self.ui.searchLine.text()
4144
self.ui.outputTreeWidget.clear()
4245
self.a.emit(keyword)
4346

4447
def shower(self, results):
4548
for result in results:
46-
num = results.index(result)
4749
title = QTreeWidgetItem(self.ui.outputTreeWidget, [result.title, result.url, result.summary])
4850

49-
def copyUrl(self, item):
51+
def copyurl(self, item):
5052
# copy a text to the clipboard.
5153
pyperclip.copy(item.text(1))
52-
QMessageBox.information(self, "Copied!", "已将该插件链接复制到剪贴板。")
54+
QMessageBox.information(self, "Copied!", "已将链接复制到剪贴板!")
5355

5456

5557
if __name__ == "__main__":
5658
app = QApplication(sys.argv)
5759
window = MainWindow()
60+
QMessageBox.information(window, "Usage", """1. 在搜索框中输入关键字,点击搜索按钮。
61+
2. 双击链接将其复制到剪贴板。""")
5862
window.show()
5963
sys.exit(app.exec())

gui/ui.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,19 @@
88
## WARNING! All changes made in this file will be lost when recompiling UI file!
99
################################################################################
1010

11-
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12-
QMetaObject, QObject, QPoint, QRect,
13-
QSize, QTime, QUrl, Qt)
14-
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
15-
QCursor, QFont, QFontDatabase, QGradient,
16-
QIcon, QImage, QKeySequence, QLinearGradient,
17-
QPainter, QPalette, QPixmap, QRadialGradient,
18-
QTransform)
19-
from PySide6.QtWidgets import (QAbstractScrollArea, QApplication, QFrame, QGridLayout,
20-
QGroupBox, QHBoxLayout, QHeaderView, QLineEdit,
21-
QMainWindow, QPushButton, QSizePolicy, QTreeWidget,
22-
QTreeWidgetItem, QVBoxLayout, QWidget)
11+
from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize, Qt)
12+
from PySide6.QtGui import (QAction, QFont, QIcon)
13+
from PySide6.QtWidgets import (QAbstractScrollArea, QFrame, QGridLayout,
14+
QGroupBox, QHBoxLayout, QLineEdit, QProgressBar, QPushButton, QSizePolicy,
15+
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget)
2316

2417
class Ui_MainWindow(object):
2518
def setupUi(self, MainWindow):
2619
if not MainWindow.objectName():
2720
MainWindow.setObjectName(u"MainWindow")
2821
MainWindow.resize(779, 594)
2922
icon = QIcon()
30-
icon.addFile(u"icons/icon.png", QSize(), QIcon.Normal, QIcon.Off)
23+
icon.addFile(u"o.ico", QSize(), QIcon.Normal, QIcon.Off)
3124
MainWindow.setWindowIcon(icon)
3225
MainWindow.setStyleSheet(u"QTreeView {\n"
3326
" border:none\n"
@@ -104,6 +97,13 @@ def setupUi(self, MainWindow):
10497

10598
self.verticalLayout.addLayout(self.gridLayout)
10699

100+
self.progressBar = QProgressBar(self.groupBox)
101+
self.progressBar.setObjectName(u"progressBar")
102+
self.progressBar.setMaximum(100)
103+
self.progressBar.setValue(0)
104+
105+
self.verticalLayout.addWidget(self.progressBar)
106+
107107

108108
self.horizontalLayout.addWidget(self.groupBox)
109109

@@ -183,6 +183,7 @@ def retranslateUi(self, MainWindow):
183183
self.groupBox.setTitle("")
184184
self.searchButton.setText(QCoreApplication.translate("MainWindow", u"\u641c\u7d22", None))
185185
self.searchLine.setPlaceholderText(QCoreApplication.translate("MainWindow", u"\u8bf7\u8f93\u5165\u4f60\u60f3\u67e5\u8be2\u7684\u63d2\u4ef6", None))
186+
self.progressBar.setFormat(QCoreApplication.translate("MainWindow", u" \u672a\u5f00\u59cb", None))
186187
___qtreewidgetitem = self.outputTreeWidget.headerItem()
187188
___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", u"\u7b80\u4ecb", None));
188189
___qtreewidgetitem.setText(1, QCoreApplication.translate("MainWindow", u"URL", None));

gui/ui.ui

+14-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</property>
1616
<property name="windowIcon">
1717
<iconset>
18-
<normaloff>icons/icon.png</normaloff>icons/icon.png</iconset>
18+
<normaloff>o.ico</normaloff>o.ico</iconset>
1919
</property>
2020
<property name="styleSheet">
2121
<string notr="true">QTreeView {
@@ -106,6 +106,19 @@
106106
</item>
107107
</layout>
108108
</item>
109+
<item>
110+
<widget class="QProgressBar" name="progressBar">
111+
<property name="maximum">
112+
<number>100</number>
113+
</property>
114+
<property name="value">
115+
<number>0</number>
116+
</property>
117+
<property name="format">
118+
<string> 未开始</string>
119+
</property>
120+
</widget>
121+
</item>
109122
</layout>
110123
</widget>
111124
</item>

requirements.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ pyperclip~=1.9.0
33
colorama~=0.4.6
44
requests~=2.32.3
55
lxml~=5.2.2
6-
nuitka
7-
imageio
8-
PySide6~=6.7.2
6+
PySide6~=6.7.2

0 commit comments

Comments
 (0)