mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-09-07 11:52:21 +08:00
初步完成了快捷键添加的GUI
This commit is contained in:
parent
99cdec7ad6
commit
ea7c456620
@ -1,3 +0,0 @@
|
|||||||
[
|
|
||||||
["ctrl", "alt", "j", "'{programPath}/key/sendkeys.sh' a QQ 4"]
|
|
||||||
]
|
|
85
UI/KeyAddGui.py
Normal file
85
UI/KeyAddGui.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'KeyAddGui.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(692, 314)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.tips.setObjectName("tips")
|
||||||
|
self.verticalLayout.addWidget(self.tips)
|
||||||
|
self.keyBoardList = QtWidgets.QListView(self.centralwidget)
|
||||||
|
self.keyBoardList.setObjectName("keyBoardList")
|
||||||
|
self.verticalLayout.addWidget(self.keyBoardList)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.addButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.addButton.setObjectName("addButton")
|
||||||
|
self.horizontalLayout.addWidget(self.addButton)
|
||||||
|
self.editButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.editButton.setObjectName("editButton")
|
||||||
|
self.horizontalLayout.addWidget(self.editButton)
|
||||||
|
self.saveButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.saveButton.setObjectName("saveButton")
|
||||||
|
self.horizontalLayout.addWidget(self.saveButton)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menuBar = QtWidgets.QMenuBar(MainWindow)
|
||||||
|
self.menuBar.setGeometry(QtCore.QRect(0, 0, 692, 33))
|
||||||
|
self.menuBar.setObjectName("menuBar")
|
||||||
|
self.menu = QtWidgets.QMenu(self.menuBar)
|
||||||
|
self.menu.setObjectName("menu")
|
||||||
|
MainWindow.setMenuBar(self.menuBar)
|
||||||
|
self.action = QtWidgets.QAction(MainWindow)
|
||||||
|
self.action.setObjectName("action")
|
||||||
|
self.serverTips = QtWidgets.QAction(MainWindow)
|
||||||
|
self.serverTips.setEnabled(False)
|
||||||
|
self.serverTips.setObjectName("serverTips")
|
||||||
|
self.startServer = QtWidgets.QAction(MainWindow)
|
||||||
|
self.startServer.setObjectName("startServer")
|
||||||
|
self.stopServer = QtWidgets.QAction(MainWindow)
|
||||||
|
self.stopServer.setObjectName("stopServer")
|
||||||
|
self.setAutoStart = QtWidgets.QAction(MainWindow)
|
||||||
|
self.setAutoStart.setObjectName("setAutoStart")
|
||||||
|
self.setUnautoStart = QtWidgets.QAction(MainWindow)
|
||||||
|
self.setUnautoStart.setObjectName("setUnautoStart")
|
||||||
|
self.menu.addAction(self.serverTips)
|
||||||
|
self.menu.addSeparator()
|
||||||
|
self.menu.addAction(self.startServer)
|
||||||
|
self.menu.addAction(self.stopServer)
|
||||||
|
self.menu.addSeparator()
|
||||||
|
self.menu.addAction(self.setAutoStart)
|
||||||
|
self.menu.addAction(self.setUnautoStart)
|
||||||
|
self.menuBar.addAction(self.menu.menuAction())
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "编辑快捷键"))
|
||||||
|
self.tips.setText(_translate("MainWindow", "<html><head/><body><p>此工具可以用于设置快捷键到 Wine 容器的映射,以便 Wine 程序可以正常的使用快捷键<br/>Deepin/UOS将会使用默认的快捷键服务,其它发行版将使用此运行器提供的快捷键服务<br>Deepin/UOS将只会提供快捷键添加功能,请在控制中心进行快捷键的修改管理</p></body></html>"))
|
||||||
|
self.addButton.setText(_translate("MainWindow", "添加"))
|
||||||
|
self.editButton.setText(_translate("MainWindow", "编辑"))
|
||||||
|
self.saveButton.setText(_translate("MainWindow", "保存"))
|
||||||
|
self.menu.setTitle(_translate("MainWindow", "设置快捷键服务"))
|
||||||
|
self.action.setText(_translate("MainWindow", "关于"))
|
||||||
|
self.serverTips.setText(_translate("MainWindow", "此内容只支持非Deepin/UOS发行版"))
|
||||||
|
self.startServer.setText(_translate("MainWindow", "启动服务"))
|
||||||
|
self.stopServer.setText(_translate("MainWindow", "停止服务"))
|
||||||
|
self.setAutoStart.setText(_translate("MainWindow", "设置开机自启"))
|
||||||
|
self.setUnautoStart.setText(_translate("MainWindow", "关闭开机自启动"))
|
||||||
|
|
127
UI/KeyAddGui.ui
Normal file
127
UI/KeyAddGui.ui
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>692</width>
|
||||||
|
<height>314</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>编辑快捷键</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="tips">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>此工具可以用于设置快捷键到 Wine 容器的映射,以便 Wine 程序可以正常的使用快捷键<br/>Deepin/UOS将会使用默认的快捷键服务,其它发行版将使用此运行器提供的快捷键服务<br>Deepin/UOS将只会提供快捷键添加功能,请在控制中心进行快捷键的修改管理</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="keyBoardList"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>编辑</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>保存</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>692</width>
|
||||||
|
<height>33</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="title">
|
||||||
|
<string>设置快捷键服务</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="serverTips"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="startServer"/>
|
||||||
|
<addaction name="stopServer"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="setAutoStart"/>
|
||||||
|
<addaction name="setUnautoStart"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
</widget>
|
||||||
|
<action name="action">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="serverTips">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>此内容只支持非Deepin/UOS发行版</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="startServer">
|
||||||
|
<property name="text">
|
||||||
|
<string>启动服务</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="stopServer">
|
||||||
|
<property name="text">
|
||||||
|
<string>停止服务</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="setAutoStart">
|
||||||
|
<property name="text">
|
||||||
|
<string>设置开机自启</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="setUnautoStart">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭开机自启动</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
76
UI/KeyAddKeyboardGui.py
Normal file
76
UI/KeyAddKeyboardGui.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'KeyAddKeyboardGui.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(800, 195)
|
||||||
|
icon = QtGui.QIcon.fromTheme("..")
|
||||||
|
MainWindow.setWindowIcon(icon)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.addTips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.addTips.setObjectName("addTips")
|
||||||
|
self.verticalLayout.addWidget(self.addTips)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.localTips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.localTips.setObjectName("localTips")
|
||||||
|
self.horizontalLayout.addWidget(self.localTips)
|
||||||
|
self.localKeyboardChoose = QtWidgets.QComboBox(self.centralwidget)
|
||||||
|
self.localKeyboardChoose.setObjectName("localKeyboardChoose")
|
||||||
|
self.horizontalLayout.addWidget(self.localKeyboardChoose)
|
||||||
|
self.addTips_2 = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.addTips_2.setObjectName("addTips_2")
|
||||||
|
self.horizontalLayout.addWidget(self.addTips_2)
|
||||||
|
self.localKey = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.localKey.setObjectName("localKey")
|
||||||
|
self.horizontalLayout.addWidget(self.localKey)
|
||||||
|
self.wineTips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.wineTips.setObjectName("wineTips")
|
||||||
|
self.horizontalLayout.addWidget(self.wineTips)
|
||||||
|
self.wineKeyboardChoose = QtWidgets.QComboBox(self.centralwidget)
|
||||||
|
self.wineKeyboardChoose.setObjectName("wineKeyboardChoose")
|
||||||
|
self.horizontalLayout.addWidget(self.wineKeyboardChoose)
|
||||||
|
self.addTipsWine = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.addTipsWine.setObjectName("addTipsWine")
|
||||||
|
self.horizontalLayout.addWidget(self.addTipsWine)
|
||||||
|
self.wineKey = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.wineKey.setObjectName("wineKey")
|
||||||
|
self.horizontalLayout.addWidget(self.wineKey)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem1)
|
||||||
|
self.addButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.addButton.setObjectName("addButton")
|
||||||
|
self.horizontalLayout_2.addWidget(self.addButton)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "添加快捷键"))
|
||||||
|
self.addTips.setText(_translate("MainWindow", "暂时只支持 Ctrl+Alt+? 和 Alt+? 的组合\n"
|
||||||
|
"文本框内的只能输入单字母"))
|
||||||
|
self.localTips.setText(_translate("MainWindow", "本地映射:"))
|
||||||
|
self.addTips_2.setText(_translate("MainWindow", "+"))
|
||||||
|
self.wineTips.setText(_translate("MainWindow", "Wine 容器映射内容:"))
|
||||||
|
self.addTipsWine.setText(_translate("MainWindow", "+"))
|
||||||
|
self.addButton.setText(_translate("MainWindow", "添加快捷键"))
|
||||||
|
|
115
UI/KeyAddKeyboardGui.ui
Normal file
115
UI/KeyAddKeyboardGui.ui
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>195</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>添加快捷键</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset theme=".."/>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="addTips">
|
||||||
|
<property name="text">
|
||||||
|
<string>暂时只支持 Ctrl+Alt+? 和 Alt+? 的组合
|
||||||
|
文本框内的只能输入单字母</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="localTips">
|
||||||
|
<property name="text">
|
||||||
|
<string>本地映射:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="localKeyboardChoose"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="addTips_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="localKey"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="wineTips">
|
||||||
|
<property name="text">
|
||||||
|
<string>Wine 容器映射内容:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="wineKeyboardChoose"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="addTipsWine">
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="wineKey"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加快捷键</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
BIN
UI/__pycache__/KeyAddGui.cpython-37.pyc
Normal file
BIN
UI/__pycache__/KeyAddGui.cpython-37.pyc
Normal file
Binary file not shown.
76
key/UI/AutoConfig.py
Normal file
76
key/UI/AutoConfig.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'AutoConfig.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(800, 600)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.searchTips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.searchTips.setObjectName("searchTips")
|
||||||
|
self.horizontalLayout.addWidget(self.searchTips)
|
||||||
|
self.searchThings = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.searchThings.setObjectName("searchThings")
|
||||||
|
self.horizontalLayout.addWidget(self.searchThings)
|
||||||
|
self.saerchBotton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.saerchBotton.setObjectName("saerchBotton")
|
||||||
|
self.horizontalLayout.addWidget(self.saerchBotton)
|
||||||
|
self.verticalLayout_3.addLayout(self.horizontalLayout)
|
||||||
|
self.searchList = QtWidgets.QListView(self.centralwidget)
|
||||||
|
self.searchList.setObjectName("searchList")
|
||||||
|
self.verticalLayout_3.addWidget(self.searchList)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem)
|
||||||
|
self.runBotton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.runBotton.setObjectName("runBotton")
|
||||||
|
self.horizontalLayout_2.addWidget(self.runBotton)
|
||||||
|
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36))
|
||||||
|
self.menubar.setObjectName("menubar")
|
||||||
|
self.menu = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menu.setObjectName("menu")
|
||||||
|
MainWindow.setMenuBar(self.menubar)
|
||||||
|
self.about = QtWidgets.QAction(MainWindow)
|
||||||
|
self.about.setObjectName("about")
|
||||||
|
self.exitProgram = QtWidgets.QAction(MainWindow)
|
||||||
|
self.exitProgram.setObjectName("exitProgram")
|
||||||
|
self.help = QtWidgets.QAction(MainWindow)
|
||||||
|
self.help.setObjectName("help")
|
||||||
|
self.openFile = QtWidgets.QAction(MainWindow)
|
||||||
|
self.openFile.setObjectName("openFile")
|
||||||
|
self.menu.addAction(self.openFile)
|
||||||
|
self.menu.addSeparator()
|
||||||
|
self.menu.addAction(self.exitProgram)
|
||||||
|
self.menubar.addAction(self.menu.menuAction())
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "自动部署脚本"))
|
||||||
|
self.searchTips.setText(_translate("MainWindow", "搜索内容(为空代表显示所有内容):"))
|
||||||
|
self.saerchBotton.setText(_translate("MainWindow", "搜索"))
|
||||||
|
self.runBotton.setText(_translate("MainWindow", "部署此方案"))
|
||||||
|
self.menu.setTitle(_translate("MainWindow", "程序"))
|
||||||
|
self.about.setText(_translate("MainWindow", "关于"))
|
||||||
|
self.exitProgram.setText(_translate("MainWindow", "退出程序"))
|
||||||
|
self.help.setText(_translate("MainWindow", "帮助"))
|
||||||
|
self.openFile.setText(_translate("MainWindow", "打开本地部署脚本"))
|
||||||
|
|
110
key/UI/AutoConfig.ui
Normal file
110
key/UI/AutoConfig.ui
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>自动部署脚本</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="searchTips">
|
||||||
|
<property name="text">
|
||||||
|
<string>搜索内容(为空代表显示所有内容):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="searchThings"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saerchBotton">
|
||||||
|
<property name="text">
|
||||||
|
<string>搜索</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="searchList"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="runBotton">
|
||||||
|
<property name="text">
|
||||||
|
<string>部署此方案</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>36</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="title">
|
||||||
|
<string>程序</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="openFile"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="exitProgram"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
</widget>
|
||||||
|
<action name="about">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="exitProgram">
|
||||||
|
<property name="text">
|
||||||
|
<string>退出程序</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="help">
|
||||||
|
<property name="text">
|
||||||
|
<string>帮助</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="openFile">
|
||||||
|
<property name="text">
|
||||||
|
<string>打开本地部署脚本</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
85
key/UI/KeyAddGui.py
Normal file
85
key/UI/KeyAddGui.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'KeyAddGui.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(692, 314)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.tips = QtWidgets.QLabel(self.centralwidget)
|
||||||
|
self.tips.setObjectName("tips")
|
||||||
|
self.verticalLayout.addWidget(self.tips)
|
||||||
|
self.keyBoardList = QtWidgets.QListView(self.centralwidget)
|
||||||
|
self.keyBoardList.setObjectName("keyBoardList")
|
||||||
|
self.verticalLayout.addWidget(self.keyBoardList)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.addButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.addButton.setObjectName("addButton")
|
||||||
|
self.horizontalLayout.addWidget(self.addButton)
|
||||||
|
self.editButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.editButton.setObjectName("editButton")
|
||||||
|
self.horizontalLayout.addWidget(self.editButton)
|
||||||
|
self.saveButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.saveButton.setObjectName("saveButton")
|
||||||
|
self.horizontalLayout.addWidget(self.saveButton)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menuBar = QtWidgets.QMenuBar(MainWindow)
|
||||||
|
self.menuBar.setGeometry(QtCore.QRect(0, 0, 692, 33))
|
||||||
|
self.menuBar.setObjectName("menuBar")
|
||||||
|
self.menu = QtWidgets.QMenu(self.menuBar)
|
||||||
|
self.menu.setObjectName("menu")
|
||||||
|
MainWindow.setMenuBar(self.menuBar)
|
||||||
|
self.action = QtWidgets.QAction(MainWindow)
|
||||||
|
self.action.setObjectName("action")
|
||||||
|
self.serverTips = QtWidgets.QAction(MainWindow)
|
||||||
|
self.serverTips.setEnabled(False)
|
||||||
|
self.serverTips.setObjectName("serverTips")
|
||||||
|
self.startServer = QtWidgets.QAction(MainWindow)
|
||||||
|
self.startServer.setObjectName("startServer")
|
||||||
|
self.stopServer = QtWidgets.QAction(MainWindow)
|
||||||
|
self.stopServer.setObjectName("stopServer")
|
||||||
|
self.setAutoStart = QtWidgets.QAction(MainWindow)
|
||||||
|
self.setAutoStart.setObjectName("setAutoStart")
|
||||||
|
self.setUnautoStart = QtWidgets.QAction(MainWindow)
|
||||||
|
self.setUnautoStart.setObjectName("setUnautoStart")
|
||||||
|
self.menu.addAction(self.serverTips)
|
||||||
|
self.menu.addSeparator()
|
||||||
|
self.menu.addAction(self.startServer)
|
||||||
|
self.menu.addAction(self.stopServer)
|
||||||
|
self.menu.addSeparator()
|
||||||
|
self.menu.addAction(self.setAutoStart)
|
||||||
|
self.menu.addAction(self.setUnautoStart)
|
||||||
|
self.menuBar.addAction(self.menu.menuAction())
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "编辑快捷键"))
|
||||||
|
self.tips.setText(_translate("MainWindow", "<html><head/><body><p>此工具可以用于设置快捷键到 Wine 容器的映射,以便 Wine 程序可以正常的使用快捷键<br/>Deepin/UOS将会使用默认的快捷键服务,其它发行版将使用此运行器提供的快捷键服务<br>Deepin/UOS将只会提供快捷键添加功能,请在控制中心进行快捷键的修改管理</p></body></html>"))
|
||||||
|
self.addButton.setText(_translate("MainWindow", "添加"))
|
||||||
|
self.editButton.setText(_translate("MainWindow", "编辑"))
|
||||||
|
self.saveButton.setText(_translate("MainWindow", "保存"))
|
||||||
|
self.menu.setTitle(_translate("MainWindow", "设置快捷键服务"))
|
||||||
|
self.action.setText(_translate("MainWindow", "关于"))
|
||||||
|
self.serverTips.setText(_translate("MainWindow", "此内容只支持非Deepin/UOS发行版"))
|
||||||
|
self.startServer.setText(_translate("MainWindow", "启动服务"))
|
||||||
|
self.stopServer.setText(_translate("MainWindow", "停止服务"))
|
||||||
|
self.setAutoStart.setText(_translate("MainWindow", "设置开机自启"))
|
||||||
|
self.setUnautoStart.setText(_translate("MainWindow", "关闭开机自启动"))
|
||||||
|
|
120
key/UI/KeyAddGui.ui
Normal file
120
key/UI/KeyAddGui.ui
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>692</width>
|
||||||
|
<height>314</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>编辑快捷键</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="tips">
|
||||||
|
<property name="text">
|
||||||
|
<string>此工具可以用于设置快捷键到 Wine 容器的映射,以便 Wine 程序可以正常的使用快捷键<br>Deepin/UOS将会使用默认的快捷键服务,其它发行版将使用此运行器提供的快捷键服务</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="keyBoardList"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>编辑</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>保存</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>692</width>
|
||||||
|
<height>33</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="title">
|
||||||
|
<string>设置快捷键服务</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="serverTips"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="startServer"/>
|
||||||
|
<addaction name="stopServer"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="setAutoStart"/>
|
||||||
|
<addaction name="setUnautoStart"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
</widget>
|
||||||
|
<action name="action">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="serverTips">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>此内容只支持非Deepin/UOS发行版</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="startServer">
|
||||||
|
<property name="text">
|
||||||
|
<string>启动服务</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="stopServer">
|
||||||
|
<property name="text">
|
||||||
|
<string>停止服务</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="setAutoStart">
|
||||||
|
<property name="text">
|
||||||
|
<string>设置开机自启</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="setUnautoStart">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭开机自启动</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
BIN
key/UI/__pycache__/AutoConfig.cpython-310.pyc
Normal file
BIN
key/UI/__pycache__/AutoConfig.cpython-310.pyc
Normal file
Binary file not shown.
BIN
key/UI/__pycache__/AutoConfig.cpython-37.pyc
Normal file
BIN
key/UI/__pycache__/AutoConfig.cpython-37.pyc
Normal file
Binary file not shown.
BIN
key/UI/__pycache__/KeyAddGui.cpython-37.pyc
Normal file
BIN
key/UI/__pycache__/KeyAddGui.cpython-37.pyc
Normal file
Binary file not shown.
44
key/key-add-gui.py
Normal file
44
key/key-add-gui.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
|
sys.path.append(f"{programPath}/..")
|
||||||
|
|
||||||
|
import dbus
|
||||||
|
import threading
|
||||||
|
from UI.KeyAddGui import *
|
||||||
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
|
|
||||||
|
class Check:
|
||||||
|
def VersionCheck():
|
||||||
|
try:
|
||||||
|
bus = dbus.SessionBus()
|
||||||
|
bus.get_object("com.deepin.daemon.Keybinding", "/com/deepin/daemon/Keybinding").List()
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
print("无法检测到 Deepin/UOS 快捷键服务")
|
||||||
|
return False
|
||||||
|
def CheckThreading():
|
||||||
|
if Check.VersionCheck():
|
||||||
|
ui.startServer.setDisabled(True)
|
||||||
|
ui.stopServer.setDisabled(True)
|
||||||
|
ui.setAutoStart.setDisabled(True)
|
||||||
|
ui.setUnautoStart.setDisabled(True)
|
||||||
|
ui.editButton.setDisabled(True)
|
||||||
|
ui.keyBoardList.setDisabled(True)
|
||||||
|
ui.saveButton.setDisabled(True)
|
||||||
|
|
||||||
|
class Click:
|
||||||
|
def AddButton():
|
||||||
|
pass
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
window = QtWidgets.QMainWindow()
|
||||||
|
ui = Ui_MainWindow()
|
||||||
|
ui.setupUi(window)
|
||||||
|
# 连接槽
|
||||||
|
ui.addButton.clicked.connect(Click.AddButton)
|
||||||
|
window.show()
|
||||||
|
threading.Thread(target=Check.CheckThreading).start()
|
||||||
|
sys.exit(app.exec_())
|
@ -7,9 +7,6 @@ import threading
|
|||||||
import traceback
|
import traceback
|
||||||
import pynput.keyboard as keyboard
|
import pynput.keyboard as keyboard
|
||||||
keyList = []
|
keyList = []
|
||||||
'''keyMap = [
|
|
||||||
[keyboard.Key.ctrl, keyboard.Key.alt, "j", "ls"]
|
|
||||||
]'''
|
|
||||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
keyChangeMap = [
|
keyChangeMap = [
|
||||||
["ctrl", keyboard.Key.ctrl],
|
["ctrl", keyboard.Key.ctrl],
|
||||||
@ -17,8 +14,16 @@ keyChangeMap = [
|
|||||||
["esc", keyboard.Key.esc],
|
["esc", keyboard.Key.esc],
|
||||||
["enter", keyboard.Key.enter]
|
["enter", keyboard.Key.enter]
|
||||||
]
|
]
|
||||||
file = open(f"{programPath}/KeyList.json", "r")
|
keyMap = []
|
||||||
keyMap = json.loads(file.read())
|
for i in os.listdir(f"{programPath}/key/list"):
|
||||||
|
try:
|
||||||
|
file = open(f"{programPath}/key/list/{i}", "r")
|
||||||
|
keyMapTemp = json.loads(file.read())
|
||||||
|
except:
|
||||||
|
print(f"{programPath}/key/list/{i} 读取失败!")
|
||||||
|
continue
|
||||||
|
for i in keyMapTemp:
|
||||||
|
keyMap.append(i)
|
||||||
for i in range(len(keyMap)):
|
for i in range(len(keyMap)):
|
||||||
for k in range(len(keyMap[i])):
|
for k in range(len(keyMap[i])):
|
||||||
for j in keyChangeMap:
|
for j in keyChangeMap:
|
||||||
@ -71,18 +76,27 @@ def ReadKey():
|
|||||||
def Read():
|
def Read():
|
||||||
while True:
|
while True:
|
||||||
ReadKey()
|
ReadKey()
|
||||||
|
if os.path.exists("/tmp/deepin-wine-runner-keyboard-exit"):
|
||||||
|
# 移除文件
|
||||||
|
try:
|
||||||
|
os.remove("/tmp/deepin-wine-runner-keyboard-exit")
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
listener.stop()
|
||||||
|
break
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
# Lock 锁防止多次调用
|
# Lock 锁防止多次调用
|
||||||
'''if os.path.exists("/tmp/deepin-wine-runner-keyboard-lock"):
|
if os.path.exists("/tmp/deepin-wine-runner-keyboard-lock"):
|
||||||
print("不可多次调用")
|
print("不可多次调用")
|
||||||
print("锁 /tmp/deepin-wine-runner-keyboard-lock 已存在")
|
print("锁 /tmp/deepin-wine-runner-keyboard-lock 已存在")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
os.mknod("/tmp/deepin-wine-runner-keyboard-lock")'''
|
os.mknod("/tmp/deepin-wine-runner-keyboard-lock")
|
||||||
threading.Thread(target=Read).start()
|
threading.Thread(target=Read).start()
|
||||||
# Collect events until released
|
# Collect events until released
|
||||||
with keyboard.Listener(
|
with keyboard.Listener(
|
||||||
on_press=on_press,
|
on_press=on_press,
|
||||||
on_release=on_release) as listener:
|
on_release=on_release) as listener:
|
||||||
listener.join()
|
listener.join()
|
||||||
|
#listener.stop()
|
||||||
os.remove("/tmp/deepin-wine-runner-keyboard-lock")
|
os.remove("/tmp/deepin-wine-runner-keyboard-lock")
|
3
key/list/KeyList.json
Normal file
3
key/list/KeyList.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
["ctrl", "alt", "j", "'{programPath}/key/sendkeys.sh' a WeChat.exe 3"]
|
||||||
|
]
|
2
key/stop.sh
Executable file
2
key/stop.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
touch /tmp/deepin-wine-runner-keyboard-exit
|
2
key/unlock.sh
Executable file
2
key/unlock.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
rm /tmp/deepin-wine-runner-keyboard-lock
|
Loading…
x
Reference in New Issue
Block a user