快捷键功能GUI初步

This commit is contained in:
2022-10-15 18:56:14 +08:00
parent 7a56a66f6c
commit 6d7cfc87bd
36 changed files with 339 additions and 41 deletions

0
key/UI/AutoConfig.py Normal file → Executable file
View File

0
key/UI/AutoConfig.ui Normal file → Executable file
View File

0
key/UI/KeyAddGui.py Normal file → Executable file
View File

0
key/UI/KeyAddGui.ui Normal file → Executable file
View File

0
key/UI/KeyAddKeyboardGui.py Normal file → Executable file
View File

0
key/UI/KeyAddKeyboardGui.ui Normal file → Executable file
View File

0
key/UI/__pycache__/AutoConfig.cpython-310.pyc Normal file → Executable file
View File

0
key/UI/__pycache__/AutoConfig.cpython-37.pyc Normal file → Executable file
View File

0
key/UI/__pycache__/KeyAddGui.cpython-37.pyc Normal file → Executable file
View File

0
key/UI/__pycache__/KeyAddKeyboardGui.cpython-37.pyc Normal file → Executable file
View File

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
X-Categories=System;Wine;
Exec=@programPath@/key-get.py
Icon=@programPath@/../deepin-wine-runner.svg
Name=Wine Runner
Name[zh]=Wine 运行器快捷键服务
Terminal=false
StartupNotify=true
Keywords=exe;scr;

9
key/key-add-gui.py Normal file → Executable file
View File

@@ -14,6 +14,7 @@ class Check:
try:
bus = dbus.SessionBus()
bus.get_object("com.deepin.daemon.Keybinding", "/com/deepin/daemon/Keybinding").List()
int("a")
return True
except:
print("无法检测到 Deepin/UOS 快捷键服务")
@@ -30,7 +31,9 @@ class Check:
class Click:
def AddButton():
pass
os.system(f"'{programPath}/keyboard-add-gui.py'")
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
@@ -39,6 +42,10 @@ if __name__ == "__main__":
ui.setupUi(window)
# 连接槽
ui.addButton.clicked.connect(Click.AddButton)
ui.startServer.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"nohup '{programPath}/key-get.py' &"]).start())
ui.stopServer.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"'{programPath}/stop.sh'"]).start())
ui.setAutoStart.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"'{programPath}/start-auto-server.sh'"]).start())
ui.setUnautoStart.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"'{programPath}/stop-auto-server.sh'"]).start())
window.show()
threading.Thread(target=Check.CheckThreading).start()
sys.exit(app.exec_())

0
key/key-get.py Normal file → Executable file
View File

0
key/keyboard-add-gui.py Normal file → Executable file
View File

2
key/list/KeyList.json Normal file → Executable file
View File

@@ -1 +1 @@
[["ctrl", "alt", "c", "'/home/gfdgd_xi/Desktop/deep-wine-runner/key/sendkeys.sh' b 'aa' 4"]]
[]

9
key/replace.py Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/python3
import os
import sys
file = open(sys.argv[1], "r")
things = file.read().replace(sys.argv[2], sys.argv[3])
file.close()
file = open(sys.argv[1], "w")
file.write(things)
file.close()

28
key/start-auto-server.sh Normal file → Executable file
View File

@@ -1,10 +1,18 @@
#!/bin/bash
# 使用系统默认的 Bash
#################################################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本2.3.0
# 更新时间2022年10月11日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Bash 制作
#################################################################################################################
echo Flag!
#!/bin/bash
# 使用系统默认的 Bash
#################################################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本2.4.0
# 更新时间2022年10月11日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Bash 制作
#################################################################################################################
programPath=$(cd "$(dirname "$0")";pwd)
echo $programPath
if [[ -f "/etc/xdg/autostart/deepin-wine-runner-keyboard.desktop" ]]; then
# 判断是否自启动,已经自启动就不再考虑
echo "文件已存在,取消"
exit 1
fi
sudo cp -rv desktop/deepin-wine-runner-keyboard.desktop /etc/xdg/autostart/deepin-wine-runner-keyboard.desktop
sudo ./replace.py /etc/xdg/autostart/deepin-wine-runner-keyboard.desktop @programPath@ "$programPath"

27
key/stop-auto-server.sh Normal file → Executable file
View File

@@ -1,10 +1,17 @@
#!/bin/bash
# 使用系统默认的 Bash
#################################################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本2.3.0
# 更新时间2022年10月11日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Bash 制作
#################################################################################################################
echo Flag!
#!/bin/bash
# 使用系统默认的 Bash
#################################################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本2.4.0
# 更新时间2022年10月11日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Bash 制作
#################################################################################################################
programPath=$(cd "$(dirname "$0")";pwd)
echo $programPath
if [[ ! -f "/etc/xdg/autostart/deepin-wine-runner-keyboard.desktop" ]]; then
# 判断是否自启动,已经自启动就不再考虑
echo "文件已存在,取消"
exit 1
fi
sudo rm -rfv /etc/xdg/autostart/deepin-wine-runner-keyboard.desktop