From ef0c8950bd60818b5fa807609f95fc330cc5e8c0 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Tue, 2 May 2023 16:46:46 +0200 Subject: [PATCH] renamed val_gap to option_gap, updated docs/changelog --- docs/changelog.txt | 2 +- docs/dev/Lua API.rst | 2 +- library/lua/gui/widgets.lua | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index e3ec3ca40..792d09167 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -70,7 +70,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua - ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget - ``gui.ZScreenModal``: ZScreen subclass for modal dialogs -- ``widgets.CycleHotkeyLabel``: exposed "key_sep" and "val_gap" attributes for improved stylistic control. +- ``widgets.CycleHotkeyLabel``: exposed "key_sep" and "option_gap" attributes for improved stylistic control. ## Removed - `title-version`: replaced by an `overlay` widget diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 8ebb752c9..85e51d11d 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -4920,7 +4920,7 @@ It has the following attributes: aligning a column of ``CycleHotkeyLabel`` labels). :label_below: If ``true``, then the option value will appear below the label instead of to the right of it. Defaults to ``false``. -:val_gap: The size of the gap between the label text and the option value. +:option_gap: The size of the gap between the label text and the option value. Default is ``1``. If set to ``0``, there'll be no gap between the strings. If ``label_below`` == ``true``, negative values will shift the value leftwards. :options: A list of strings or tables of diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 2e1732f11..7aa79cbc3 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -1491,7 +1491,7 @@ CycleHotkeyLabel.ATTRS{ key=DEFAULT_NIL, key_back=DEFAULT_NIL, key_sep=': ', - val_gap=1, + option_gap=1, label=DEFAULT_NIL, label_width=DEFAULT_NIL, label_below=false, @@ -1504,7 +1504,7 @@ function CycleHotkeyLabel:init() self:setOption(self.initial_option) if self.label_below then - self.val_gap = self.val_gap + (self.key_back and 1 or 0) + (self.key and 2 or 0) + self.option_gap = self.option_gap + (self.key_back and 1 or 0) + (self.key and 2 or 0) end self:setText{ @@ -1512,7 +1512,7 @@ function CycleHotkeyLabel:init() {key=self.key, key_sep=self.key_sep, text=self.label, width=self.label_width, on_activate=self:callback('cycle')}, self.label_below and NEWLINE or '', - {gap=self.val_gap, text=self:callback('getOptionLabel'), + {gap=self.option_gap, text=self:callback('getOptionLabel'), pen=self:callback('getOptionPen')}, } end