From 2996fc5d04b02c33bcb245c11f2e4b3eababefb0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:45:27 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/python-jsonschema/check-jsonschema: 0.29.2 → 0.29.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.2...0.29.3) - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 208bd78ba..d93eae187 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: # shared across repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -20,7 +20,7 @@ repos: args: ['--fix=lf'] - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.2 + rev: 0.29.3 hooks: - id: check-github-workflows - repo: https://github.com/Lucas-C/pre-commit-hooks @@ -34,6 +34,6 @@ repos: - json # specific to scripts: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: forbid-new-submodules From d5ab9f9b75df5355e9d356abd4cff653faa7b1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Obr=C4=99bski?= Date: Tue, 1 Oct 2024 18:48:45 +0200 Subject: [PATCH 2/2] Migrate scripts widgets constant to use getter/setter style --- gui/autodump.lua | 2 +- gui/teleport.lua | 2 +- internal/control-panel/registry.lua | 12 ++++++------ internal/journal/text_editor.lua | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gui/autodump.lua b/gui/autodump.lua index d3ec16c84..7bfa6c870 100644 --- a/gui/autodump.lua +++ b/gui/autodump.lua @@ -253,7 +253,7 @@ function Autodump:onInput(keys) end local now_ms = dfhack.getTickCount() if same_xyz(pos, self.last_map_click_pos) and - now_ms - self.last_map_click_ms <= widgets.DOUBLE_CLICK_MS then + now_ms - self.last_map_click_ms <= widgets.getDoubleClickMs() then self:reset_double_click() self:do_dump(pos) self.mark = nil diff --git a/gui/teleport.lua b/gui/teleport.lua index 068b41647..cf9bf30d5 100644 --- a/gui/teleport.lua +++ b/gui/teleport.lua @@ -296,7 +296,7 @@ function Teleport:onInput(keys) end local now_ms = dfhack.getTickCount() if same_xyz(pos, self.last_map_click_pos) and - now_ms - self.last_map_click_ms <= widgets.DOUBLE_CLICK_MS then + now_ms - self.last_map_click_ms <= widgets.getDoubleClickMs() then self:reset_double_click() self:do_teleport(pos) self.mark = nil diff --git a/internal/control-panel/registry.lua b/internal/control-panel/registry.lua index 4e0bdd2e6..33f8edb54 100644 --- a/internal/control-panel/registry.lua +++ b/internal/control-panel/registry.lua @@ -200,8 +200,8 @@ PREFERENCES_BY_IDX = { desc='How long to wait for the second click of a double click, in ms.', default=500, min=50, - get_fn=function() return widgets.DOUBLE_CLICK_MS end, - set_fn=function(val) widgets.DOUBLE_CLICK_MS = val end, + get_fn=widgets.getDoubleClickMs, + set_fn=widgets.setDoubleClickMs, }, { name='SCROLL_DELAY_MS', @@ -209,8 +209,8 @@ PREFERENCES_BY_IDX = { desc='The delay between events when holding the mouse button down on a scrollbar, in ms.', default=20, min=5, - get_fn=function() return widgets.SCROLL_DELAY_MS end, - set_fn=function(val) widgets.SCROLL_DELAY_MS = val end, + get_fn=widgets.getScrollDelayMs, + set_fn=widgets.setScrollDelayMs, }, { name='SCROLL_INITIAL_DELAY_MS', @@ -218,8 +218,8 @@ PREFERENCES_BY_IDX = { desc='The delay before scrolling quickly when holding the mouse button down on a scrollbar, in ms.', default=300, min=5, - get_fn=function() return widgets.SCROLL_INITIAL_DELAY_MS end, - set_fn=function(val) widgets.SCROLL_INITIAL_DELAY_MS = val end, + get_fn=widgets.getScrollInitialDelayMs, + set_fn=widgets.setScrollInitialDelayMs, }, } diff --git a/internal/journal/text_editor.lua b/internal/journal/text_editor.lua index 9815a2f12..b2319efcb 100644 --- a/internal/journal/text_editor.lua +++ b/internal/journal/text_editor.lua @@ -551,7 +551,7 @@ function TextEditorView:getMultiLeftClick(x, y) if ( self.last_click.x ~= x or self.last_click.y ~= y or - from_last_click_ms > widgets.DOUBLE_CLICK_MS + from_last_click_ms > widgets.getDoubleClickMs() ) then self.clicks_count = 0; end