Skip to content
Merged

3.2.1 #238

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ body:
- ♻️清理缓存
- 🏳️‍🌈主题/样式
- 📄文档
- 🟦clickClean
- ❓其他/未知
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ body:
- ♻️清理缓存
- 📄文档
- 🏳️‍🌈主题/样式
- 🟦clickClean
- ❓其他/未知
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ body:
- ♻️清理缓存
- 📄文档
- 🏳️‍🌈主题/样式
- 🟦clickClean
- ❓其他/未知
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pip install -r requirements.txt
```powershell
make clickmouse # 编译clickmouse
make extension # 编译扩展
make clickclean # 如果你要编译精简版,请用这个。
```
7. 运行`dist/clickmouse/clickmouse/main.exe`就可以加载clickmouse了。
### 🥴头文件
Expand Down
2 changes: 1 addition & 1 deletion ClickMouse-old/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Clickmouse
>[!IMPORTANT]
> 本库已经停止更新,请转移到[pyClickMouse](https://github.com/xystudio889/pyClickMouse),C++代码写不动QAQ,转为python了
> 本库已经停止更新,请转移到[pyClickMouse](https://github.com/xystudiocode/pyClickMouse)来获取最新版本。

[更新日志](./updates.md)

Expand Down
18 changes: 16 additions & 2 deletions Gui/hooks/hotkey.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
from PySide6.QtCore import QObject, Signal
from PySide6.QtWidgets import QApplication
from pynput import keyboard
import sys
import re

count = 0

def multi_replace(text, replace_dict):
'''一次性替换多个子串'''
# 将字典键按长度降序排序,避免长词被短词部分覆盖
sorted_keys = sorted(replace_dict.keys(), key=len, reverse=True)
# 构建正则模式,注意转义特殊字符
pattern = '|'.join(re.escape(key) for key in sorted_keys)
return re.sub(pattern, lambda m: replace_dict[m.group(0)], text)

class HotkeyListener(QObject):
'''热键监听器类,用于在后台线程中监听全局热键'''
combination_pressed = Signal(list) # 新增信号,用于发送组合键信息
Expand Down Expand Up @@ -69,7 +77,13 @@ def combination_pressed(self, combination):
temp_combination = combination.copy()

for index, i in enumerate(temp_combination):
temp_combination[index] = i.replace('Key.', '').replace('_l', '').replace('_r', '').replace('_gr', '')
replacements = {
'Key.': '',
'_l': '',
'_r': '',
'_gr': ''
}
temp_combination[index] = multi_replace(i, replacements)
combination = temp_combination.copy()

print(combination)
Expand Down
37 changes: 18 additions & 19 deletions Gui/install_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@
import sys
app = QApplication(sys.argv)
from uiStyles.QUI import *
from uiStyles import PagesUI, UMessageBox, MessageButtonTemplate

from uiStyles import PagesUI, UMessageBox, MessageButtonTemplate, styles, maps, UCheckBox
import pyperclip
from sharelibs import (get_lang, settings, get_inst_lang, get_icon, system_lang, parse_system_language_to_lang_id, run_software, get_resource_path, is_admin, get_init_lang, QtThread, mem_id)
import win32com.client
import winreg
import zipfile
from shutil import rmtree
import traceback
import os
from pathlib import Path
import json
from txtinfo import StyleClass

# 系统api
import ctypes
from ctypes import wintypes

def import_package(package_id: str):
for i in packages_info:
Expand Down Expand Up @@ -742,6 +758,7 @@ def install(self):
create_shortcut(os.path.join(start_menu_path, 'ClickMouse.lnk'), fr'{install_path}\main.exe', 'Clickmouse')
create_shortcut(os.path.join(start_menu_path, 'Uninstall clickmouse.lnk'), fr'{install_path}\uninstall.exe', 'Uninstall clickmouse')
create_shortcut(os.path.join(start_menu_path, 'Repair clickmouse.lnk'), fr'{install_path}\repair.exe', 'Repair clickmouse')
create_shortcut(os.path.join(start_menu_path, 'Repair clickmouse.lnk'), fr'{install_path}\install_pack.exe', 'Modify clickmouse')
if self.create_desktop_shortcut:
create_shortcut(fr'{os.path.expanduser('~')}\Desktop\clickmouse.lnk', fr'{install_path}\main.exe', 'clickmouse')
self.set_page(self.PAGE_finish)
Expand Down Expand Up @@ -812,7 +829,6 @@ def closeEvent(self, event):
event.accept()

if __name__ == '__main__':
from sharelibs import mem_id
shared_memory = QSharedMemory(mem_id[2])
if shared_memory.attach():
# 已经有一个实例在运行
Expand All @@ -823,23 +839,6 @@ def closeEvent(self, event):
if is_running:
# 已经有一个实例在运行
sys.exit(2)

import pyperclip
from sharelibs import (get_lang, settings, get_inst_lang, get_icon, system_lang, parse_system_language_to_lang_id, run_software, get_resource_path, is_admin, get_init_lang, QtThread)
import win32com.client
import winreg
import zipfile
from shutil import rmtree
import traceback
from uiStyles import styles, maps, UCheckBox
import os
from pathlib import Path
import json
from txtinfo import StyleClass

# 系统api
import ctypes
from ctypes import wintypes

is_ipk = '--ipk' in app.arguments()
get_ipk_lang = get_inst_lang if is_ipk else get_init_lang
Expand Down
14 changes: 8 additions & 6 deletions Gui/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ def __init__(self, name):
# 控制台处理器 - 仅WARNING及以上级别
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.WARNING) # 设置控制台日志级别
format = {
'default_format': '%(asctime)s - %(levelname)s - %(message)s',
'simple_format': '%(message)s' # 仅输出消息
}
console_fmt = ConditionalFormatter(
'%(asctime)s-%(levelname)s-%(message)s',
simple_format='%(message)s' # 直接输出消息
**format
)
console_handler.setFormatter(console_fmt)

# 文件处理器 - 仅INFO及以上级别
file_handler = logging.FileHandler(folder_path / f'{log_id}.log', mode='a',encoding='utf-8')
file_handler.setLevel(logging.INFO) # 设置文件日志级别
file_fmt = ConditionalFormatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s',
simple_format='%(message)s' # 仅输出消息
**format
)
file_handler.setFormatter(file_fmt)

Expand All @@ -99,7 +101,7 @@ def __init__(self, name):
self.logger.addHandler(file_handler)

self.info(f'{"-" * 50}', extra={'simple_format': True})
self.info(f'logger启动')
self.info(f'logger Started')
remove_old_log(folder_path)

def debug(self, msg, extra=None):
Expand All @@ -118,4 +120,4 @@ def critical(self, msg, extra=None):
self.logger.critical(msg, extra=extra)

def exception(self, service, trace, msg='', extra=None):
self.critical(f'{msg}{service}发生错误:\n{trace}', extra=extra)
self.critical(f'{msg}: An error occurred in {service}:\n{trace}', extra=extra)
Loading
Loading