Skip to content

Commit

Permalink
Merge pull request #1 from lilingfengdev/master
Browse files Browse the repository at this point in the history
Merge Lilingfengdev's repo to mine
  • Loading branch information
Lafcadia authored Jun 29, 2024
2 parents d6070bf + bd76fa6 commit 386fd4f
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 29 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install Dependencies and Generate Bundle
run: |
python generate-bundle.py
- 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
42 changes: 42 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
import shutil
import subprocess
import sys
import urllib.request
import zipfile
import platform

if platform.system() == 'Windows':
urllib.request.urlretrieve("https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip",
"upx.zip")
zip = zipfile.ZipFile("upx.zip")
zip.extract("upx-4.2.4-win64/upx.exe", path=os.getcwd())
shutil.move("upx-4.2.4-win64/upx.exe", os.path.join(os.getcwd(), "upx.exe"))

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


def build(filepath):
args = ["python", "-m", "nuitka", "--onefile", filepath, "--assume-yes-for-downloads", "--output-dir=build"]
if platform.system() == 'Windows':
args.append("--windows-icon-from-ico=favicon.png")
args.append("--enable-plugins=upx")
args.append("--upx-binary=upx.exe")
if platform.system() == 'MacOS':
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(os.path.basename(filepath))[0]
for f in os.listdir(os.path.join(os.getcwd(), "build")):
if f.startswith(filename) and not os.path.isdir(os.path.join(os.getcwd(), "build", f)):
shutil.move(os.path.join(os.getcwd(), "build", f), os.path.join(os.getcwd(), "dist", f))


build("gui/main.py")

# 傻逼
# 狗屎代碼
1 change: 0 additions & 1 deletion compile.bat

This file was deleted.

1 change: 0 additions & 1 deletion dev.env

This file was deleted.

Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions generate-bundle.py

This file was deleted.

8 changes: 4 additions & 4 deletions gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox, QTreeWidgetItem
from PySide6.QtCore import QObject, QThread, Signal
import sys
from ui import Ui_MainWindow
from gui.ui import Ui_MainWindow
import pyperclip


Expand Down Expand Up @@ -55,13 +55,13 @@ def shower(self, results):
def copyurl(self, item):
# copy a text to the clipboard.
pyperclip.copy(item.text(1))
QMessageBox.information(self, "Copied!", "Copied the link to the clipboard!")
QMessageBox.information(self, "Copied!", "已将链接复制到剪贴板!")


if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
QMessageBox.information(window, "Usage", """1. Enter a keyword in the search box and click the search button.
2. Double click on the link to copy it to the clipboard.""")
QMessageBox.information(window, "Usage", """1. 在搜索框中输入关键字,点击搜索按钮。
2. 双击链接将其复制到剪贴板。""")
window.show()
sys.exit(app.exec())
Binary file removed o.ico
Binary file not shown.
Binary file removed pse.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pyperclip~=1.9.0
colorama~=0.4.6
requests~=2.32.3
lxml~=5.2.2
PySide6
PySide6~=6.7.2

0 comments on commit 386fd4f

Please sign in to comment.