iDvel / rime-ice

Rime 配置:雾凇拼音 | 长期维护的简体词库
https://dvel.me/posts/rime-ice/
GNU General Public License v3.0
8.97k stars 607 forks source link

[Bug]: 在 python 编写的 gui 程序中,程序有地方规律性的“吃掉了”字母“y” #1028

Open WangWei90 opened 2 days ago

WangWei90 commented 2 days ago

摘要

在英文状态,点击“y”,输入窗口出现"y"

基本检查

系统信息

Windows 10 最新版

应用信息

Weasel 0.16.1

复现办法和预期行为

# abc.py
import PySimpleGUI as sg
from pynput import keyboard

gui_event = ""

def on_release_withevent(key):
    print(f"gg -- {key=}")
    if gui_event.startswith("ui_"):
        print(f"uu -- {key=}")
        print(f"Key type : {type(key)}")
        print(f"Key repr : {repr(key)}")
        print(f"Key str  : {str(key)}")
        # if str(key) == "'y'":
        #     print("press Esc")
        #     keypad.press(keyboard.Key.esc)
        # if key == keyboard.Key.shift:
        #     keypad.press(keyboard.Key.esc)

keypad = keyboard.Controller()
listener = keyboard.Listener(on_release=on_release_withevent)
listener.start()

sg.set_options(font=("Courier New", 16))
layout = [[sg.Multiline("", key="ui_textzone", size=(40, 10), enable_events=True)]]
window = sg.Window("Test", layout)

while True:
    gui_event, values = window.read()
    print("-"*60)
    print(f"{gui_event=}")
    if gui_event == sg.WIN_CLOSED:
        break

window.close()

运行代码 python abc.py

补充信息

No response

自定义配置

default.custom.yaml

customization:
  distribution_code_name: Weasel
  distribution_version: 0.16.1
  generator: "Rime::SwitcherSettings"
  modified_time: "Mon Sep 16 05:22:49 2024"
  rime_version: 1.11.2
patch:
  ascii_composer:
    good_old_caps_lock: false
    switch_key: { Caps_Lock: commit_code, Control_L: noop, Control_R: noop, Shift_L: noop, Shift_R: noop }
  key_binder:
    bindings:
      [
        { accept: bracketleft, send: Page_Up, when: has_menu },
        { accept: bracketright, send: Page_Down, when: has_menu },
        { accept: "Control+Shift+F11", toggle: ascii_punct, when: always },
      ]
  menu:
    page_size: 5
  schema_list:
    - { schema: rime_ice }
    - { schema: luna_pinyin }
  switcher:
    caption: "「方案选单」"
    hotkeys: ["Control+Shift+F12"]
  punctuator:
    full_shape:
      "-": -
      "_": ——
      '\': 、
      "|": \|

weasel.custom.yaml

customization:
  distribution_code_name: Weasel
  distribution_version: 0.16.1
  generator: "Weasel::UIStyleSettings"
  modified_time: "Sun Sep 15 01:59:08 2024"
  rime_version: 1.11.2
patch:
  "style/color_scheme": aqua
  "style/display_tray_icon": true
  "style/horizontal": true
  "style/inline_preedit": false
  # global_ascii: true
WangWei90 commented 2 days ago

image

调试信息已经写到代码中了,我是搞不懂 :<

mirtlebot commented 21 hours ago

我没复现这个问题:

一般配置集不会影响这种底层的按键、上屏逻辑,特别是这种仅在某个框架下才能触发的 bug 不太可能是配置的问题。

因为我没法复现,请你尝试使用 Weasel 默认配置(备份后,删掉用户目录所有文件),选明月拼音,重新部署