Skip to content

Commit

Permalink
fix somthing
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingfengdev committed Jun 29, 2024
2 parents 21c6d5a + 76fc969 commit d0d81d9
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 35 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
python-version: "3.11"
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Install Build Dependencies
run: pip install nuitka imageio
- name: Build
run: python build.py
- name: Auto release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,6 @@ testing/
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
*.stackdump
*.stackdump
/pse.dist
*.exe
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/PluginSearchEngine.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

## 注意事项

* 搜索关键词不应该包含插件,比如我想搜索优化插件,我应该输入`优化`而不是`优化插件`
* 搜索关键词不应该包含插件,比如我想搜索`优化插件`,我应该输入`优化`而不是`优化插件`
* 搜索的时候千万不可以开启 VPN。
* 由于搜索工具底层是基于 Bing,所以可能会搜索出来一些无关于插件或者与关键词没有太大关联的东西
* 由于搜索工具底层是基于 Bing (中国版),所以可能会搜出一些与插件或关键词无关的东西
* 输出顺序为公平起见会被打乱。

## GUI

GUI 版本目前主要由[氿月](https://github.com/Lafcadia)进行维护,支持原版的所有功能,并且同步更新。对于萌新相对较友好。

### 环境配置
1. 第三方模块要求参考 requirements.txt。
2. 请使用 PyCharm(不使用其它IDE的理由见 Issue #7 #8)。
5 changes: 2 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

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

if os.path.exists("dist"):
shutil.rmtree("dist")

os.mkdir("build")
os.mkdir("dist")

Expand All @@ -35,6 +32,8 @@ def build(file):
args.append("--macos-app-icon=favicon.png")
if platform.system() == 'Linux':
args.append("--linux-icon=favicon.png")
args.append("--windows-console-mode=disable")
args.append("--enable-plugin=pyside6")
subprocess.call(args)
filename = os.path.splitext(file)[0]
for f in os.listdir(os.path.join(os.getcwd(), "build")):
Expand Down
28 changes: 16 additions & 12 deletions gui/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from core.search import search
from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox, QTreeWidgetItem
from PySide6.QtCore import QObject, QThread, Signal, Slot
# from PySide6 import QtCore
from PySide6.QtCore import QObject, QThread, Signal
import sys
from gui.ui import Ui_MainWindow
import pyperclip
Expand All @@ -12,12 +11,16 @@ class Worker(QObject):

def __init__(self):
super().__init__()
print("000")
# print("000")

def work(self, keyword):
print(111)
results = search(keyword)
self._signal.emit(results)
try:
results = search(keyword)
print("searching...")
self._signal.emit(results)
print("emitted signal _")
except Exception as e:
print(e)


class MainWindow(QMainWindow):
Expand All @@ -32,28 +35,29 @@ def __init__(self):
self.worker._signal.connect(self.shower)
self.worker.moveToThread(self.worker_thread)
self.a.connect(self.worker.work)
self.ui.searchButton.clicked.connect(self.search)
self.ui.outputTreeWidget.itemDoubleClicked.connect(self.copyUrl)
self.ui.searchButton.clicked.connect(self.searcher)
self.ui.outputTreeWidget.itemDoubleClicked.connect(self.copyurl)
self.worker_thread.start()

def search(self):
def searcher(self):
keyword = self.ui.searchLine.text()
self.ui.outputTreeWidget.clear()
self.a.emit(keyword)

def shower(self, results):
for result in results:
num = results.index(result)
title = QTreeWidgetItem(self.ui.outputTreeWidget, [result.title, result.url, result.summary])

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


if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
QMessageBox.information(window, "Usage", """1. 在搜索框中输入关键字,点击搜索按钮。
2. 双击链接将其复制到剪贴板。""")
window.show()
sys.exit(app.exec())
27 changes: 14 additions & 13 deletions gui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,19 @@
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
QCursor, QFont, QFontDatabase, QGradient,
QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QAbstractScrollArea, QApplication, QFrame, QGridLayout,
QGroupBox, QHBoxLayout, QHeaderView, QLineEdit,
QMainWindow, QPushButton, QSizePolicy, QTreeWidget,
QTreeWidgetItem, QVBoxLayout, QWidget)
from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize, Qt)
from PySide6.QtGui import (QAction, QFont, QIcon)
from PySide6.QtWidgets import (QAbstractScrollArea, QFrame, QGridLayout,
QGroupBox, QHBoxLayout, QLineEdit, QProgressBar, QPushButton, QSizePolicy,
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget)

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(779, 594)
icon = QIcon()
icon.addFile(u"icons/icon.png", QSize(), QIcon.Normal, QIcon.Off)
icon.addFile(u"o.ico", QSize(), QIcon.Normal, QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setStyleSheet(u"QTreeView {\n"
" border:none\n"
Expand Down Expand Up @@ -104,6 +97,13 @@ def setupUi(self, MainWindow):

self.verticalLayout.addLayout(self.gridLayout)

self.progressBar = QProgressBar(self.groupBox)
self.progressBar.setObjectName(u"progressBar")
self.progressBar.setMaximum(100)
self.progressBar.setValue(0)

self.verticalLayout.addWidget(self.progressBar)


self.horizontalLayout.addWidget(self.groupBox)

Expand Down Expand Up @@ -183,6 +183,7 @@ def retranslateUi(self, MainWindow):
self.groupBox.setTitle("")
self.searchButton.setText(QCoreApplication.translate("MainWindow", u"\u641c\u7d22", None))
self.searchLine.setPlaceholderText(QCoreApplication.translate("MainWindow", u"\u8bf7\u8f93\u5165\u4f60\u60f3\u67e5\u8be2\u7684\u63d2\u4ef6", None))
self.progressBar.setFormat(QCoreApplication.translate("MainWindow", u" \u672a\u5f00\u59cb", None))
___qtreewidgetitem = self.outputTreeWidget.headerItem()
___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", u"\u7b80\u4ecb", None));
___qtreewidgetitem.setText(1, QCoreApplication.translate("MainWindow", u"URL", None));
Expand Down
15 changes: 14 additions & 1 deletion gui/ui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff>icons/icon.png</normaloff>icons/icon.png</iconset>
<normaloff>o.ico</normaloff>o.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true">QTreeView {
Expand Down Expand Up @@ -106,6 +106,19 @@
</item>
</layout>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="format">
<string> 未开始</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ pyperclip~=1.9.0
colorama~=0.4.6
requests~=2.32.3
lxml~=5.2.2
nuitka
imageio
PySide6~=6.7.2
PySide6~=6.7.2

0 comments on commit d0d81d9

Please sign in to comment.