Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Option Update Display #447

Closed
wants to merge 2 commits into from

Conversation

LEOYoon-Tsaw
Copy link
Member

@LEOYoon-Tsaw LEOYoon-Tsaw commented Feb 20, 2021

Option updates will use the states string as display string. Thus users who customize switches can see the proper switch message.
Also eliminates localization need.

Known issue: the message will start with a "!", since I couldn't find the source of it, currently I handle it in frontend.

(cherry picked from commit f42b68a6fe10c0ab6663d4a41efc588979f853e9)
Copy link
Member

@lotem lotem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me try to simplify the solution.
updating option states is generally inefficient.

@LEOYoon-Tsaw
Copy link
Member Author

Check after anniversary

Copy link
Member

@lotem lotem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisiting this PR.

Copy link
Member

@lotem lotem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我打算这么改:
option update notifier 不变,继续传有更新的option name。
增加一个API函数让前端查询option name对应的状态及说明文字;查询时访问初始化时拿到的states配置列表。

lotem added a commit to lotem/librime that referenced this pull request Jun 9, 2022
enable the frontend to display a message when an arbitrary option defined in the
schema is updated.

Closes rime#447

the option name eg. ascii_mode is passed to the notification handler function,
there, get_state_label gives IME frontend the access to the human readable label
for the current state of the option defined in *.schema:/switches/@*/states.

when selection is changed in a radio group, more than one option in the group is
updated so it only returns a non-empty label while querying the selected option.
lotem added a commit to lotem/librime that referenced this pull request Jun 9, 2022
enable the frontend to display a message when an arbitrary option defined in the
schema is updated.

Closes rime#447

the option name eg. ascii_mode is passed to the notification handler function,
there, get_state_label gives IME frontend the access to the human readable label
for the current state of the option defined in *.schema:/switches/@*/states.

when selection is changed in a radio group, more than one option in the group is
updated so it only returns a non-empty label while querying the selected option.
lotem added a commit to lotem/librime that referenced this pull request Jun 9, 2022
enable the frontend to display a message when an arbitrary option defined in the
schema is updated.

Closes rime#447

the option name eg. ascii_mode is passed to the notification handler function,
there, get_state_label gives IME frontend the access to the human readable label
for the current state of the option defined in *.schema:/switches/@*/states.

when selection is changed in a radio group, more than one option in the group is
updated so it only returns a non-empty label while querying the selected option.
@lotem
Copy link
Member

lotem commented Jun 9, 2022

做出来了。请过目。
#553

新的接口函数读取状态文字的逻辑是:
直接遍历方案中 switches 配置,找到查询的 option 对应的状态文字。
通常 switches 定义的项目很少,遍历配置节点速度应该不慢。

按快捷键或者程序自动触发状态改变时会返回方案里定义的文字。
通过方案选单修改选项状态则取不到,因为 Switcher 是另一个 Engine 实例,读不到方案配置。
交互上这正合适:操作方案选单不需要再提示了。

@LEOYoon-Tsaw
Copy link
Member Author

創建session和消session可以經常操作嗎,每次查狀態文字的時候創建一次session如何?

@lotem
Copy link
Member

lotem commented Jun 10, 2022

創建session和消session可以經常操作嗎,每次查狀態文字的時候創建一次session如何?

有开销的,只能尽力减小开销。另外还可能丢失状态。

应该区分几个不同的作用域,这个session对应着与一个输入法客户端的连接;比他更小的范围有(加载、切换)输入方案的生命周期;再小是以清空输入串为界的一次输入过程,而有些上下文数据是持续记录的,比如上屏历史、状态等;更小的还有一次按键处理的过程~
这些等到R2ime再用代码详细定义。

@lotem lotem closed this in #553 Jun 10, 2022
lotem added a commit that referenced this pull request Jun 10, 2022
enable the frontend to display a message when an arbitrary option defined in the
schema is updated.

Closes #447

the option name eg. ascii_mode is passed to the notification handler function,
there, get_state_label gives IME frontend the access to the human readable label
for the current state of the option defined in *.schema:/switches/@*/states.

when selection is changed in a radio group, more than one option in the group is
updated so it only returns a non-empty label while querying the selected option.
@LEOYoon-Tsaw LEOYoon-Tsaw deleted the OptionDisplay branch June 11, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants