Skip to content

Added new slider widget to devel/hello-world #1363

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

Merged
merged 20 commits into from
Aug 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1b79147
Create helloSlider.lua
realSquidCoder Jan 1, 2025
9d68aca
Update helloSlider.lua to try and fix precommit EOF errors
realSquidCoder Jan 1, 2025
bbac6c4
Merge branch 'master' into squid-slider-widget
realSquidCoder Jan 16, 2025
81e5179
Move code to new files
realSquidCoder Jan 16, 2025
735f5d5
Clean up code
realSquidCoder Jan 20, 2025
9055dc8
Clean up the code and add a divider
realSquidCoder Jan 20, 2025
ca91203
Merge branch 'DFHack:master' into squid-slider-widget
realSquidCoder Jan 26, 2025
45c1997
Update hello-world.lua
realSquidCoder Jan 26, 2025
1e98d04
Merge branch 'master' into squid-slider-widget
realSquidCoder Feb 11, 2025
8f12b8a
Merge branch 'DFHack:master' into squid-slider-widget
realSquidCoder Feb 11, 2025
1bc3501
Update hello-world.lua
realSquidCoder Feb 11, 2025
2d6d854
Update changelog.txt
realSquidCoder Feb 11, 2025
a4a4ab3
Merge remote-tracking branch 'upstream/master' into squid-slider-widget
realSquidCoder Jul 3, 2025
952e0fb
Merge remote-tracking branch 'upstream/master' into squid-slider-widget
realSquidCoder Aug 17, 2025
ebacabd
Update changelog.txt
realSquidCoder Aug 17, 2025
efaf42e
Merge branch 'master' into squid-slider-widget
realSquidCoder Aug 17, 2025
7e37ac2
Merge remote-tracking branch 'upstream/master' into squid-slider-widget
realSquidCoder Aug 17, 2025
2a78083
Merge branch 'squid-slider-widget' of https://github.com/SquidCoderIn…
realSquidCoder Aug 17, 2025
56bca44
Update changelog.txt
realSquidCoder Aug 17, 2025
44bf3c6
Update changelog.txt
realSquidCoder Aug 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ Template for new versions:
## New Features

## Fixes

- `immortal-cravings`: prioritize high-value meals, properly split of portions, and don't go eating or drinking on a full stomach

## Misc Improvements
- `devel/hello-world`: updated to show off the new Slider widget

## Removed

Expand Down
38 changes: 35 additions & 3 deletions devel/hello-world.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ local HIGHLIGHT_PEN = dfhack.pen.parse{

HelloWorldWindow = defclass(HelloWorldWindow, widgets.Window)
HelloWorldWindow.ATTRS{
frame={w=20, h=14},
frame={w=25, h=25},
frame_title='Hello World',
autoarrange_subviews=true,
autoarrange_gap=1,
autoarrange_gap=2,
resizable=true,
resize_min={w=25, h=25},
}

function HelloWorldWindow:init()
local LEVEL_OPTIONS = {
{label='Low', value=1},
{label='Medium', value=2},
{label='High', value=3},
{label='Pro', value=4},
{label='Insane', value=5},
}

self:addviews{
widgets.Label{text={{text='Hello, world!', pen=COLOR_LIGHTGREEN}}},
widgets.HotkeyLabel{
frame={l=0, t=0},
frame={l=0},
label='Click me',
key='CUSTOM_CTRL_A',
on_activate=self:callback('toggleHighlight'),
Expand All @@ -32,6 +42,28 @@ function HelloWorldWindow:init()
frame={w=10, h=5},
frame_style=gui.INTERIOR_FRAME,
},
widgets.Divider{
frame={h=1},
frame_style_l=false,
frame_style_r=false,
},
widgets.CycleHotkeyLabel{
view_id='level',
frame={l=0, w=20},
label='Level:',
key_back='CUSTOM_SHIFT_C',
key='CUSTOM_SHIFT_V',
options=LEVEL_OPTIONS,
initial_option=LEVEL_OPTIONS[1].value,
},
widgets.Slider{
frame={l=1},
num_stops=#LEVEL_OPTIONS,
get_idx_fn=function()
return self.subviews.level:getOptionValue()
end,
on_change=function(idx) self.subviews.level:setOption(idx) end,
},
}
end

Expand Down
Loading