From 268e87685297080e0138cf9fba544e42bc2cead3 Mon Sep 17 00:00:00 2001 From: Cedric Halbronn <387346+saidelike@users.noreply.github.com> Date: Sun, 7 Jan 2024 01:45:18 +0000 Subject: [PATCH] avoid warnings due to change of apis in talon (#1349) ``` 2024-01-03 09:31:45.551 WARNING C:\knausj_talon\tags\file_manager\file_manager.py:317: DeprecationWarning: SettingsDecl: setting.get() is deprecated. Use settings.get('user.file_manager_auto_show_pickers') if gui_folders.showing or setting_auto_show_pickers.get() >= 1: ``` --------- Co-authored-by: Cedric Halbronn Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- plugin/command_history/command_history.py | 4 ++-- plugin/paste_to_insert.py | 4 ++-- tags/file_manager/file_manager.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/command_history/command_history.py b/plugin/command_history/command_history.py index dc7e73bdc3..6f3dbd7164 100644 --- a/plugin/command_history/command_history.py +++ b/plugin/command_history/command_history.py @@ -1,6 +1,6 @@ from typing import Optional -from talon import Module, actions, imgui, speech_system +from talon import Module, actions, imgui, settings, speech_system # We keep command_history_size lines of history, but by default display only # command_history_display of them. @@ -23,7 +23,7 @@ def on_phrase(j): if text is not None: history.append(text) - history = history[-setting_command_history_size.get() :] + history = history[-settings.get("user.command_history_size") :] # todo: dynamic rect? diff --git a/plugin/paste_to_insert.py b/plugin/paste_to_insert.py index 599c3a3227..c51529982e 100644 --- a/plugin/paste_to_insert.py +++ b/plugin/paste_to_insert.py @@ -1,6 +1,6 @@ import logging -from talon import Context, Module, actions +from talon import Context, Module, actions, settings mod = Module() ctx = Context() @@ -18,7 +18,7 @@ @ctx.action_class("main") class MainActions: def insert(text): - threshold = paste_to_insert_threshold_setting.get() + threshold = settings.get("user.paste_to_insert_threshold") if 0 <= threshold < len(text): actions.user.paste(text) return diff --git a/tags/file_manager/file_manager.py b/tags/file_manager/file_manager.py index 40094a8819..35f575f9b0 100644 --- a/tags/file_manager/file_manager.py +++ b/tags/file_manager/file_manager.py @@ -314,7 +314,7 @@ def clear_lists(): def update_gui(): - if gui_folders.showing or setting_auto_show_pickers.get() >= 1: + if gui_folders.showing or settings.get("user.file_manager_auto_show_pickers") >= 1: gui_folders.show() gui_files.show()