Myk Taylor
21f137644f
remove trailing whitespace
2022-12-30 22:35:08 -08:00
Myk Taylor
3a76fc086f
fix keyboard movement of Panel widgets
2022-12-30 22:35:08 -08:00
Myk Taylor
6871bc20c4
use new KEYBOARD interface keys in move delta
2022-12-30 22:35:08 -08:00
Myk Taylor
04f2d555c6
implement context-aware mouse wheel scrolling
2022-12-30 22:35:08 -08:00
Myk Taylor
38b525bdb5
adapt lua library widgets to new keyboard keybindings
2022-12-30 22:35:08 -08:00
Myk Taylor
1d7a7c8a49
Don't leave artifats behind when dimissing mboxes
2022-12-30 22:20:50 -08:00
Myk Taylor
dd0cc087d5
Revert "consolidate full refresh logic in widgets.Panel"
...
This reverts commit 33787473f0
.
I've already found another use case where we need a more general
implementation -- modal dialogs that inherit from FramedScreen that
appear and disappear
2022-12-30 22:13:53 -08:00
Myk Taylor
33787473f0
consolidate full refresh logic in widgets.Panel
2022-12-30 20:44:15 -08:00
Myk Taylor
88dcdfd158
move trigger code from Window to Panel
...
where the drag/resize code actually is. Panels can be dragged around the
parent screen without them being a Window
2022-12-30 20:01:09 -08:00
Myk Taylor
70a0f4a718
only do a full refresh when needed
...
this significantly reduces CPU utilization when DFHack-owned screens are
visible.
2022-12-30 17:06:41 -08:00
Myk Taylor
3aac79fe4f
skin our scrollbars to look and hover like DF's
2022-12-30 05:33:17 -08:00
Myk Taylor
cff603e243
allow Labels to write tile textures
2022-12-28 23:16:13 -08:00
Myk Taylor
d7b67e9528
remove cached USE_GRAPHICS from gui.lua
...
it's no longer constant
2022-12-28 16:27:44 -08:00
Myk Taylor
99ffe769fa
rendering the parent now involves a full refresh
...
in order to get the background
2022-12-27 15:23:34 -08:00
Myk Taylor
033eb2aefd
use default background colors
...
and ensure texpos_lower doesn't peek through
2022-12-27 15:05:13 -08:00
Myk Taylor
75afa88790
use tiles for our default frame
2022-12-27 14:40:35 -08:00
lethosor
6a61c750e9
widgets.render_text(): error early if key is invalid
...
This helps identify _which_ key is invalid - otherwise, getKeyDisplay()
complains that it was called with `nil`, which is less helpful.
2022-12-23 13:17:26 -05:00
Myk Taylor
663e1dd541
ascii is now in color
2022-12-20 16:33:11 -08:00
Myk
42203b13f4
Merge pull request #2500 from myk002/myk_panel_drag
...
Support resizing for DFHack Panel widgets
2022-12-15 14:36:33 -08:00
Myk Taylor
06346c6269
implement double clicking on the title to maximize
...
also double click on a maximized window to jump to the minimum size
the location of the window isn't guaranteed to be the same after
maximizing and un-maximizing, but we could implement that if there is
call for it.
2022-12-14 19:03:38 -08:00
Myk Taylor
434e9322cc
fix error in error message formatting
2022-12-14 17:51:07 -08:00
Myk Taylor
4c6daf30d9
add widgets.Window and fix paint_frame offset
2022-12-14 12:04:29 -08:00
Myk Taylor
12e62c7f9d
highlight anchor point when resizing with keyboard
2022-12-14 10:34:06 -08:00
Myk Taylor
c030704705
implement panel resizing
2022-12-14 10:34:04 -08:00
Myk Taylor
99b599e9ab
add docs for panel dragging
2022-12-13 13:01:49 -08:00
Myk Taylor
3f43f72731
fix the math
2022-12-13 12:39:17 -08:00
Myk Taylor
38a3bec953
dragging logic
2022-12-12 18:07:05 -08:00
Myk Taylor
ffd646462a
ensure `enable` doesn't miss newly-added scripts
...
and add some more documentation
2022-12-10 22:13:38 -08:00
myk002
e88b1fdfe5
move script-manager into core
2022-12-10 21:59:51 -08:00
myk002
2b87307e11
allow visible and active to be dynamic properties
2022-12-04 15:46:19 -08:00
Myk
aac89d4942
Merge branch 'develop' into myk_default_search_key
2022-11-29 15:07:12 -08:00
Myk
5b311163a9
Merge pull request #2431 from myk002/myk_widget_fixes
...
fix minor errors in ResizablePanel, Label, and HotkeyLabel widgets
2022-11-29 15:06:15 -08:00
myk002
726771c8d3
supply default search key for tokenized text
2022-11-28 16:02:47 -08:00
myk002
adb9c5ea12
fix frame size calculation when frame_inset is set
...
also fix error when clicking on HotkeyLabels where no on_activate
callback has been set
2022-11-28 15:12:22 -08:00
myk002
fb6483fe6c
allow frames to be drawn without DFHack signature
2022-11-28 15:04:28 -08:00
myk002
c9cf5ecca8
we kept editfield as MOUSE_L for click and drag
2022-11-21 17:51:24 -08:00
myk002
24dc879888
adapt library code to newly correct mouse events
2022-11-21 17:36:46 -08:00
myk002
5b1ebdf72a
don't return list idx when mouse is on scrollbar
2022-11-11 10:40:10 -08:00
Myk
ccd43f1710
Merge pull request #2381 from myk002/myk_framed_panel
...
[widgets.Panel] support frames around panel widgets
2022-11-09 10:32:23 -08:00
Myk
9fed02435e
Merge pull request #2378 from myk002/myk_list_mouse
...
Allow widgets.List to report hover target and respond to shift-click
2022-11-09 10:32:06 -08:00
myk002
32dc80729a
support drawing frames around panels
2022-11-07 16:50:21 -08:00
myk002
83f560a6f4
allow shift-click to trigger submit2 for List
2022-11-07 16:14:16 -08:00
myk002
1b7b75d8ab
factor out detection of the list index under mouse
2022-11-07 16:13:45 -08:00
myk002
28aadea6af
allow an alternate ViewRect for getMousePos
2022-11-07 15:54:56 -08:00
myk002
be18f4e900
return self from Screen:show() as a convenience
2022-11-07 15:54:55 -08:00
Myk
a854e379b2
Merge pull request #2354 from myk002/myk_scrollbars_redux
...
make scrollbars more responsive when dragging
2022-10-22 20:28:52 -07:00
myk002
64b923b9eb
make the materials dialog filter lcase only
...
this allows the capital letter hotkeys to be processed by the list
widget without the special-casing of the ignore_keys attribute.
2022-10-21 12:43:53 -07:00
myk002
593b80cfa0
make scrollbars more responsive when dragging
2022-10-21 12:22:57 -07:00
myk002
1e21e6546e
fix materials selection dialog
...
where the filter was swallowing the sublist hotkeys
2022-10-19 17:31:28 -07:00
myk002
142b45ef49
move list item hotkey hint left by one tile
...
so it doesn't get covered by the scrollbar
2022-10-19 17:30:51 -07:00
myk002
d650ba2377
ensure scrollbar can never get ahead of the cursor
2022-10-10 16:42:32 -07:00
myk002
ba36e72b33
support click and drag for scrollbars
2022-10-07 16:27:19 -07:00
myk002
35eb4e08dd
hold down the mouse button to continue scrolling
2022-10-07 15:40:05 -07:00
myk002
2bff70a290
add unit tests for widgets.Scrollbar
2022-10-07 13:14:52 -07:00
myk002
5722d6914b
transition Label to use the new generic Scrollbar
2022-10-07 12:45:43 -07:00
myk002
24232e894a
create Scrollbar widget and integrate with List
2022-10-06 11:13:16 -07:00
myk002
9817106c30
add --exclude option for ls
2022-10-05 13:30:14 -07:00
myk002
dc535004e9
better formatting for ls output for tags
2022-10-05 12:51:30 -07:00
myk002
278b7528ac
implement basic domain index structure
2022-09-23 08:46:50 -07:00
myk002
fae26b2375
replace die's underline with tombstones
...
easter egg suggested by thurin : )
2022-09-23 08:34:22 -07:00
Myk
b07f3b5b6c
stub help formatted same as real help
2022-09-22 17:43:56 -07:00
Myk
4d662adfe5
Fix marker checking for ruby help text
2022-09-22 17:39:54 -07:00
Myk Taylor
3b650c8d0b
don't let changes to the lua cursor bleed through
...
before, we could end up changing the state of whoever last called
guidm.setCursorPos()
2022-09-18 08:20:33 -07:00
myk002
6fff83de5a
fix EditField rendering with TWBT
2022-09-16 15:24:33 -07:00
myk002
b88d343ddd
fix off-by-one error on scrollbar click detection
2022-09-14 09:25:43 -07:00
myk002
bb52e7bac8
list tools in categories with tags builtin
2022-09-13 23:17:19 -07:00
myk002
d4914e7511
implement mouse click reactions for scrollbar
2022-09-11 19:33:01 -07:00
myk002
e2fbade219
fix scrollbar display when all text is visible
...
also align behavior with documentation when 'left' or 'right' is
explicitly specified (i.e. always show the scrollbar)
2022-09-11 18:56:43 -07:00
myk002
f71f034d1d
show full scrollbars instead of just scroll icons
2022-09-11 17:58:10 -07:00
myk002
23994d4f4c
dynamically wrap helpdb long help text (default 80)
2022-09-11 13:41:20 -07:00
myk002
3c99a7214f
ensure params are strings when invoking scripts
2022-09-10 10:10:28 -07:00
lethosor
2fdbcaebf5
Accept negative indices, add vector tests
2022-09-07 09:14:09 -07:00
lethosor
483652e193
Rewrite utils.df_expr_to_ref() for consistency, add tests
2022-09-07 09:14:09 -07:00
myk002
b1a8662c4a
Merge branch 'develop' into docs
2022-08-31 23:00:39 -07:00
myk002
074a6ec5cd
allow EditFields to ignore specified keys
...
like "+" and "-", so you can use them as hotkeys in the parent view
2022-08-31 10:22:41 -07:00
myk002
27e189fef2
no cursor position reset when updating list filter
2022-08-29 15:17:17 -07:00
myk002
4a1a322cd7
adapt to the new summary layout
2022-08-26 16:51:42 -07:00
myk002
0d3aa0fb28
Merge remote-tracking branch 'upstream/develop' into docs
2022-08-25 21:59:01 -07:00
myk002
8acda4d6c8
Interpret '4' & '6' as strings, not movement keys
2022-08-19 22:40:53 -07:00
myk002
751c2eb7d1
fix detection of short description start
...
now that labels are no longer bolded in the text rendering, the header
detection code needs updating
2022-08-19 16:19:19 -07:00
myk002
df9c37a8b7
Merge branch 'develop' into docs
2022-08-15 17:09:36 -07:00
myk002
8672282fd8
add helpdb, unit test, and document API
...
note that we have to dynamically sort some of the expected lists for
locale agnosticism
2022-08-15 16:31:52 -07:00
myk002
7f0791f6c3
use setText() accessor method instead of direct access
2022-08-15 16:24:34 -07:00
myk002
22f9f3b042
add unit tests for new widget functionality
2022-08-15 16:24:34 -07:00
myk002
0ae4fed3cf
add mouse support for CycleHotkeyLabel widgets
2022-08-15 16:24:34 -07:00
myk002
79b6cd13e9
support scrolling by half pages in Label
2022-08-15 16:24:34 -07:00
myk002
a5af5a1373
don't bork on no frame, set cursor to end of text
2022-08-15 16:24:34 -07:00
myk002
4e382c7b3b
make HotkeyLabels react to clicking
...
also be better about initializing EditField frame height
2022-08-15 16:24:34 -07:00
myk002
8de8b22566
click to correct cursor position on long strings
...
where the left side of the string has been trimmed
2022-08-15 16:24:34 -07:00
myk002
b7f74fe2ce
allow mouse lclick to select a List item
2022-08-15 16:24:34 -07:00
myk002
1dd3d6656b
move the cursor in an EditField on mouse lclick
2022-08-15 16:24:34 -07:00
myk002
0aa9a187cf
support cursor movement in EditFields
2022-08-15 16:24:34 -07:00
myk002
43b1abcdcf
support submit2 for EditFields
2022-08-15 16:24:34 -07:00
myk002
214dd3c579
reset scroll position when the text is changed
2022-08-15 16:24:34 -07:00
myk002
23ced99131
fix call to new functions in existing coord fn
2022-08-15 16:15:41 -07:00
myk002
a4c8535977
add argparse int checking methods, more docs
2022-08-15 16:15:41 -07:00
myk002
ef56addb14
prep for new format; accept pipe as tag separator
2022-08-07 22:13:46 -07:00
myk002
a8d0cc7980
support scrolling by half pages in Label
2022-08-06 23:48:25 -07:00
myk002
625b4d439d
fix typo in API function name
2022-08-05 22:31:39 -07:00
myk002
1a777257b4
add get_entry_types API method to helpdb
2022-08-05 22:06:02 -07:00
myk002
ebfe00b112
editing pass of short descriptions
...
and fix some short description parsing
2022-08-05 10:08:23 -07:00
myk002
aa3a389b6f
fix parsing bold text and indenting of ls output
2022-07-29 17:37:50 -07:00
myk002
10f8417cc2
create helpdb entries for all plugins
...
even those that have no commands and are not enableable
2022-07-26 22:22:43 -07:00
myk002
8cf7f59c39
wrap ls and tags output
2022-07-25 17:48:39 -07:00
Myk
3c92d4f195
Fix typo
2022-07-23 16:35:40 -07:00
myk002
9b7cc6180d
don't create entries for non-enableable plugins
2022-07-22 21:21:38 -07:00
myk002
4b1696f783
add '?' alias for help
2022-07-21 22:36:17 -07:00
myk002
2ce7518562
read plugin command docs from single plugin file
2022-07-21 22:33:43 -07:00
myk002
64b793b409
support EditField:setText() so scripts can use it
...
and be compatible with both the develop and docs branch
2022-07-20 15:40:49 -07:00
myk002
9dcb63da53
don't bork on no frame, set cursor to end of text
2022-07-20 15:36:17 -07:00
myk002
048b20ac45
no help entries for non-enableable plugins
2022-07-20 13:34:29 -07:00
myk002
0dd153cc0d
ensure we pick up the plugin help entry
...
even when it has a command and that command is not equal to the plugin
name
2022-07-20 12:34:40 -07:00
myk002
954e246140
reformat builtins and properly read tags
2022-07-19 23:01:25 -07:00
myk002
ddcb9b4921
add missing 'man' builtin
2022-07-19 22:35:08 -07:00
myk002
e3588cf49c
return entire tag data structure for iterating
2022-07-19 22:13:53 -07:00
myk002
301c8e93a1
move builtin docs to individual files
2022-07-18 10:58:35 -07:00
myk002
7f302888ec
make HotkeyLabels react to clicking
...
also be better about initializing EditField frame height
2022-07-17 16:04:36 -07:00
myk002
5723b76585
click to correct cursor position on long strings
...
where the left side of the string has been trimmed
2022-07-17 15:43:58 -07:00
myk002
805456e82b
allow mouse lclick to select a List item
2022-07-16 22:18:38 -07:00
myk002
f65f36ffee
move the cursor in an EditField on mouse lclick
2022-07-16 22:03:39 -07:00
myk002
27425e47f6
support cursor movement in EditFields
2022-07-15 22:22:51 -07:00
myk002
9b340a7630
support submit2 for EditFields
2022-07-15 13:46:01 -07:00
myk002
e926e1116e
replace more Core cpp code with calls to helpdb
...
also document devel/dump-rpc builtin
2022-07-14 13:19:30 -07:00
myk002
185f49976c
ensure scripts get their entry type set
2022-07-11 17:24:53 -07:00
myk002
a5da3c18f9
reset scroll position when the text is changed
2022-07-11 17:23:23 -07:00
myk002
4ed15ffcc4
fix parsing of first line as the short_help
2022-07-10 20:48:24 -07:00
myk002
a58b56abc4
don't error out if files cannot be read
2022-07-10 20:19:12 -07:00
Myk
e899510b8b
Use helpdb to implement help and ls built-in commands and dfhack.script_help() ( #2242 )
...
* use helpdb to implement the help and ls builtins
* use helpdb to implement dfhack.script_help()
2022-07-10 20:17:54 -07:00
Myk
4ad8e7199a
Support builtin commands in helpdb ( #2241 )
...
* support builtin commands in helpdb, implement list API, document api
2022-07-10 20:17:52 -07:00
myk002
35a4d19ac9
implement listing functions for helpdb
2022-07-10 20:14:21 -07:00
Myk
64aba7a8a3
Myk rendered help ( #2240 )
...
* implement help db
* add initial list of tags
* read tags fr help, read script short desc, filter
2022-07-10 20:14:21 -07:00
Timur Kelman
9788a8a22a
Add default selection handler to `materials.ItemTraitsDialog` ( #2211 )
...
* add forward compatibility for future `job_item_flags`
* add default selection handler to `materials.ItemTraitsDialog`
* add a call to `error()` in 'unknown'-branch inside `setTrait`
* add `ItemTraitsDialog` improvement description to changelog.txt
2022-06-28 16:27:18 -07:00
quarque2
f33c9bc881
Update tile-material.lua ( #2218 )
...
* Update tile-material.lua
* Update changelog.txt
* Update changelog.txt
* Update changelog.txt
* Update tile-material.lua
2022-06-20 12:38:37 -07:00
Timur Kelman
1a629a26bf
add `ItemTraitsDialog` to materials.lua ( #2199 )
...
* add `ItemTraitDialog` to materials.lua
* rename `ItemTraitDialog` to `ItemTraitsDialog` (plural)
* Update changelog.txt
2022-06-12 07:03:04 -07:00
Myk
89d3d45e87
Allow EditField widgets to manage their own activation and keyboard focus ( #2147 )
...
* use new focus subsystem in widgets.EditField
* always eat the enter key if we have an on_submit
* add modal attribute
* give EditFields a default height of 1
so they can be autoarranged
2022-06-01 21:48:21 -07:00
Myk
ad2d9cad03
[lua] implement keyboard focus subsystem ( #2160 )
...
* implement keyboard focus subsystem
* Fix error in focus group combining
* documentation for the inputToSubviews decision
* modify unit tests to catch that last bug
2022-06-01 17:42:13 -07:00
myk002
ea7fe2b926
account for scroll bars when sizing message boxes
2022-05-27 15:38:13 -07:00
Timur Kelman
07f54deb0b
fix wrong `Label.frame_body.x2` value ( #2134 )
...
* fix wrong `Label.frame_body.x2` value
`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.
* add tests for Label
* add missing `local`, remove code in comments
* move `TestFramedScreen` outside test functions
2022-05-27 15:25:17 -07:00
lethosor
888c531774
Add mock.observe_func(), improve mock.lua documentation
...
observe_func() is similar to func() but passes through all calls to a specified
function.
2022-05-27 00:33:44 -04:00
myk002
18628ff5b8
make key_sep more configurable
...
and add more configuration to HotkeyLabel and EditField to take
advantage of it
2022-05-18 16:46:33 -07:00
myk002
53609db1f9
let CycleHotkeyLabels take numeric initial_options
...
even if all of the option values are non-numeric
2022-05-18 15:39:52 -07:00
Myk
e2fb15a3a5
add dwarfmode.MenuOverlay:renderMapOverlay() ( #2119 )
...
* add dwarfmode.MenuOverlay:renderMapOverlay()
* ensure we move with the viewport when bounds_rect is nil
2022-04-29 20:32:22 -07:00
myk002
e603fee3ce
move sidebar mode management code to init
...
from onAboutToShow(). this allows the frames to be calculated correctly
during widget instantiation. otherwise widgets can end up with -1 width
2022-04-29 12:10:05 -07:00
myk002
af47434f52
protect against 0 width in string:wrap()
2022-04-29 11:29:19 -07:00
Tachytaenius
b9c36c1e63
Added custom-raw-tokens utility ( #2038 )
...
* Added (chain) for [CHAIN_METAL_TEXT] armours in gui/materials.lua used by gui/create-item-- again (oops)
* Added customRawData utility
* Oops, whitespace
* Revised rawStringsFieldNames
* Dialed down on lua trickery and fixed wrongly formatted changelog entry
* Fixed changelog in wrong place and made customRawData a proper module
* Fixed not caching not-present tags, revised examples and fixed error
* Fixed whitespace. Changing settings in editor!
* customRawData docs
* Added getCreatureTag for respecting caste tags, "fixed" bizarre caching error (quotes because I don't even know what was causing it) and updated docs
* Added line limiting for docs, I guess
* Added missing string convert argument
* docs indent fix, code block fix, and revision
* Major revision
* gdi, docs error
* Another? But... huh.
* ...
* Made requested changes
* Whoops
* Rearrange docs lines
* Followed example, should fix linter issues
* fix typo. linted offline this time......
* Make it so that last instance of tag is what is read from
* Added requested change
* eventful key change
* i to lenArgs
* change eventful key
* add test for broken caste selection
* Major redesign
* tags --> tokens
* Added plant growth behaviour and did some requested changes
* More error handling
* fix docs
* Added basic error suppression
* Docs clarification.
* Docs registering example and fix error
* Strip errors on frame after onWorldLoad, not on map load
* Revert "Strip errors on frame after onWorldLoad, not on map load"
This reverts commit e20a0ef8d3743f79d961077f46910b77b16f36b9.
* Revert "Docs registering example and fix error"
This reverts commit 9c848c54c3f84e0ecc1dc421137c8a8b4a52280d.
* Revert "Docs clarification."
This reverts commit 6b4b6a1aa40c50398504f37ecf1ff0f93d6459b1.
* Revert "Added basic error suppression"
This reverts commit d11cb1438cf1e56ff700469e944f0b9af64651d7.
* Use more eventful key more consistent with other files
* use onStateChange instead of eventful and remove redundant utils require
* Code review stuff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs/Lua API.rst
committing a suggestion
Co-authored-by: Alan <lethosor@users.noreply.github.com>
* Prepend examples with DFHACK_
* Remove unused parameters
* Use new ensure_key global
* Named a couple of unnamed arguments (untested)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-04-29 08:39:59 -07:00
Timur Kelman
f08a268e8a
add scroll icons to Label widget ( #2101 )
...
* WIP: add scroll icons to Label widget
It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction.
WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it
* gui.lua: expose the `parse_inset()` function
* refactor Label's scroll icon code
* since `render_scroll_icons` only works with a label, it's now a class function
* `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons`
* `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`.
* make `render_scroll_icons` always draw icons
The check now happens in `onRenderFrame`
* draw frame's background
calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason
* remove trailing spaces
* fix scroll icons placed far above/below text
With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above,
but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame
instead of near the first and last rendered text line.
* always `update_scroll_inset` to react to resized window
* draw scroll icons next to text
* update `Lua API.rst` with new `Label` parameters
* move comment separator up
This way every scroll related parameter is in one group
* list default values for new parameters in docs
* add missing description of `Label.scroll_keys`
2022-04-29 06:55:08 -07:00
myk002
dcadde38d7
add new global function: ensure_key
2022-04-27 17:35:49 -07:00
myk002
6ad362d698
return a reference to the created dialogs
2022-04-27 11:51:46 -07:00
myk002
ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel
2022-04-22 09:53:10 -07:00
myk002
809f9316fd
make frame inset configurable for ListBox list
2022-04-22 08:30:53 -07:00
myk002
07761e1d5d
add some more handy widgets to the library
...
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -07:00
Timur Kelman
cb123e5076
default unset `frame_inset` values to 0 ( #2100 )
...
* default unset `frame_inset` values to 0
This change allows writing `frame_inset = {r=1}` instead of `frame_inset = {l=0, r=1, t=0, b=0}`
2022-04-16 08:17:35 -07:00
lethosor
0f464b13b3
Merge remote-tracking branch 'lethosor/pre-commit' into develop
2022-04-12 21:17:15 -04:00
lethosor
d1f0edd33b
Apply initial pre-commit config
2022-04-12 14:48:19 -04:00
Myk
fd1ee233a2
automatically manage sidebar modes in MenuOverlay ( #2083 )
2022-04-11 20:58:54 -07:00
Myk
10f22ecc27
add ResizingPanel class and autolayout for Panels ( #2086 )
...
* add autolayout for Panels and new ResizingPanel
2022-04-11 18:25:00 -07:00
Myk
e6299700bf
Handle punctuation in FilteredList filter matching ( #2085 )
...
* allow punctuation to be typed into a filter
and allow the filter to match keys with punctuation
2022-04-11 18:22:31 -07:00
myk002
4a383b1c84
handle number-indexed lua maps in safe_index
2022-04-11 18:02:57 -07:00
Myk
4f9608da13
Document and update argparse module ( #2089 )
...
also add unit tests and use new string fns in processArgs and allow it to recognize parameters with two dashes instead of just one
2022-04-11 16:16:55 -07:00
Myk
9a8fd12785
ensure ListBoxes always have enough height ( #2084 )
...
so they can always display an error message if the filter doesn't match anything
2022-04-11 16:15:50 -07:00
Myk
96b5b4420b
Add string:escape_pattern() utility function ( #2082 )
...
* add string:escape_pattern() to dfhack.lua
stolen from devel/query.lua. will migrate scripts to use the common implementation later
2022-04-10 21:18:01 -07:00
myk002
db5e7d55c1
fix guidm.enterSidebarMode(DesignateMine)
...
it would end up in DesignateChopTrees if you happened to be looking at
the surface z-level.
2022-03-28 16:57:24 -07:00
Tachytaenius
19c0a4fe06
Added (chain) for [CHAIN_METAL_TEXT] armours in library/gui/materials.lua used by the gui/create-item script ( #2037 )
2022-03-19 15:32:16 -07:00
myk002
faa2410058
fix typos in argparse
2022-02-18 14:54:45 -08:00
myk002
e531346968
make a (shallow) copy of table params
...
this improves introspection capabilities since the table is snapshotted
at the time of the mock call
2022-02-18 13:33:08 -08:00
myk002
42ae45dd5f
support designate for enterSidebarMode
2021-10-02 09:26:32 -07:00
myk002
ecdfca89d1
support nil to indicate no short param name
2021-09-25 22:00:49 -07:00
myk002
fc556c9e5d
implement non-alias long form params
...
now long form parameters can exist by themselves without being an alias
for a required equivalent short form param
2021-09-25 22:00:49 -07:00
lethosor
d5be63823d
Merge remote-tracking branch 'TymurGubayev/patch-1' into develop
2021-08-31 00:55:36 -04:00
myk002
691e54dfc6
rename expect.find to expect.str_find
2021-08-24 21:06:12 -07:00
myk002
b2f44f00f1
add pattern matching expect.find() for unit tests
...
settled on `find()` since the string method of the same name has the
same semantics. other options: `str_find()` since it fails on non-string
or `match()` (but that might imply that the pattern needs to match the
entire string).
2021-08-23 22:59:30 -07:00
lethosor
10db894d99
Merge remote-tracking branch 'myk002/myk_printall_nontable' into develop
2021-08-21 22:51:35 -04:00
lethosor
d4e40b260e
Merge remote-tracking branches 'TymurGubayev/patch-2' and 'TymurGubayev/patch-3' into develop
2021-08-21 11:30:36 -04:00
Timur Kelman
ca8d89df5a
alt_getopt.lua: allow `?` as an option
...
This makes it possible to call `script -?`
2021-08-21 13:39:10 +02:00
Timur Kelman
bd423ca47c
argparse.lua: `hasArgument` in a comment refers to `hasArg` everywhere else
2021-08-21 13:27:09 +02:00
myk002
86b2329b7f
fix hardcoded call to pairs, add test
2021-08-20 22:55:07 -07:00
myk002
d9c6c2dde3
add safe_pairs, update unit tests
2021-08-19 21:57:16 -07:00
myk002
6d0f7e40a9
be silent if iteration fails for printall
2021-08-19 21:57:16 -07:00
myk002
3f2795e80a
unit tests first draft
2021-08-19 21:56:44 -07:00
myk002
9fc71ef6e1
printall and printall_ipairs handle all iterables
2021-08-19 21:56:43 -07:00
myk002
4606d5742e
ensure printall, ~, and @ behave in lua 5.3.6
2021-08-19 21:56:41 -07:00
lethosor
e8d9a9d184
Fix out-of-bounds access in memscan.field_offset()
...
Fixes #1907
2021-08-10 11:26:06 -04:00
Timur Kelman
15d8a0bea2
rename `dismiss_on_submit|2` to `dismiss_on_select|2`
...
to avoid confusion
2021-07-30 17:25:01 +02:00
Timur Kelman
ffecdf3b53
ListBox attributes controlling self:dismiss()
...
`dismiss_on_submit = false` makes it easier to implement toggleable options, where we don't want the list to disappear on selection. Like work order conditions' trait selection.
2021-07-29 19:00:19 +02:00
lethosor
898d4621da
Merge remote-tracking branch 'myk002/myk_view_unit' into develop
2021-07-05 20:42:49 -04:00
myk002
87c7d02e09
support view unit mode for guidm.enterSidebarMode
2021-07-05 16:02:19 -07:00
myk002
17d4be14f3
fix formatting of coords error message
2021-07-05 16:01:07 -07:00
myk002
f62ff3ecc0
migrate existing lua code to use new library fns
2021-07-05 15:48:51 -07:00
lethosor
2f36404da7
Merge remote-tracking branch 'origin/lua_label_input_fix' into develop
2021-07-05 15:42:06 -04:00
lethosor
3e6cecbbc6
Merge remote-tracking branch 'myk002/myk_argparse' into develop
2021-07-05 15:21:59 -04:00
lethosor
fb7560d8bf
Merge remote-tracking branch 'wolfboyft/patch-2' into develop
2021-07-05 11:41:37 -04:00
myk002
0ef5134a33
add optional coordinate validation to coords
2021-07-04 07:32:29 -07:00
myk002
56a1c8b4d5
coordinates can be 0
2021-07-03 16:26:39 -07:00
myk002
3a8f564cd2
forward old processArgs fns to new locations
2021-07-02 23:21:40 -07:00
myk002
9535ff82bb
add argparse library functions
2021-07-02 23:11:17 -07:00
myk002
36b2d05ff6
add dfhack string functions and tests
...
added string:split
added string:trim
added a default value for wrap width
added function comments
added tests for all string functions (the tests for string:split will be commented out until we remove the competing implementation in gui/load-screen
2021-07-02 13:21:54 -07:00
myk002
eafa6e86f7
add utils.normalizePath()
2021-06-29 12:22:05 -07:00
lethosor
e070f4d9d8
Merge remote-tracking branch 'myk002/myk_sidebar' into develop
2021-06-28 01:03:13 -04:00
lethosor
4945018e92
Merge remote-tracking branch 'myk002/myk_multi_mock' into develop
2021-06-25 01:27:46 -04:00
lethosor
1b167e7898
Also add quotes in expect.ne()
...
Extension of #1886
2021-06-24 01:15:15 -04:00
lethosor
72998cddd5
Merge remote-tracking branch 'myk002/myk_expect_quotes' into develop
2021-06-24 01:11:21 -04:00
myk002
67840c033c
add quotes around printed unequal values
...
so you can see confusing hidden trailing spaces
2021-06-23 14:04:16 -07:00
myk002
5b12c64cba
add new string function: wrap()
...
refactored and improved from the implementation in quickfort's dialog.lua
2021-06-23 13:59:39 -07:00
myk002
000b589e3a
add dwarfmode library function: enterSidebarMode()
...
refactored from quickfort. this common implementation will replace the
now redundant functions in quickfort, gui/mass-remove, and gui/blueprint
2021-06-23 12:29:37 -07:00
Warmist
b7069a5ebd
Fix label early key detection in scrolling logic
...
Current logic is because @myk002 fixed it so label would allow other widgets control when label(s) are present. However that breaks label key detection for default scroll keys. This can be worked around by setting scrollkeys to empty.
TBH: label is quite complicated and used everwhere so i'm reluctant to touch it and would love for someone to look over if i'm correct.
2021-06-22 11:31:00 +03:00
Tachytaenius
990c153a9a
Show adjective in item prompt
...
Useful for high boot/low boot etc.
2021-06-19 13:59:38 +01:00
myk002
b7a970a309
allow mock.func() to return multiple values
2021-06-15 13:16:05 -07:00
myk002
59b08e99f6
fix -- handling and required arg detection
2021-05-07 15:21:45 -07:00
myk002
fd735d4b42
treat negative numbers as non-options in getopt
2021-05-07 15:21:45 -07:00
lethosor
ee8e10429d
Add initial implementation of mock.restore()
...
Like mock.patch() but only restores original values instead of also setting
new values initially.
2021-04-16 00:34:46 -04:00
lethosor
757736728d
Add a mock.func() helper for mocking functions
2021-04-10 01:22:03 -04:00
lethosor
5424392273
mock.patch(): propagate return values
2021-04-09 00:41:39 -04:00
lethosor
f25b8a0d14
Fix patching value with nil
2021-04-09 00:35:54 -04:00
lethosor
7b2f01d45b
Add initial mock.patch() implementation for tests
2021-04-09 00:32:10 -04:00
myk002
642d8cbe4b
handle nil values sent to printerr
2021-04-05 01:37:43 -07:00
myk002
13ca7f8c9e
move expect.lua from internal/ to test_util/
2021-04-04 17:37:37 -07:00
myk002
5af1b627cb
add tests, move expect.lua
...
I moved expect.lua from library/lua/test/ to library/lua/internal since
luacov is configured to ignore any file with /test/ in its path
2021-04-04 17:37:36 -07:00
myk002
a6561911c1
error on unmatched printerr output during a test
...
- provides expect,printerr_match for matching printerr output
- fails tests if printerr is called outside the printerr_match wrapper
- changes api of expect.error_match to mirror the new printerr_match api
2021-04-04 17:37:33 -07:00
myk002
4e844f39ae
undo formatting change in script_environment
2021-03-29 12:29:15 -07:00
myk002
54a1e8d98a
move script_environment changes to test.lua
2021-03-29 12:23:53 -07:00
myk002
e4cab1b1c6
load scripts into different namespace for testing
2021-03-29 11:26:28 -07:00
lethosor
2332009825
Merge remote-tracking branch 'myk002/myk_enable_luacov' into develop
2021-03-28 00:38:36 -04:00
lethosor
5e09fd882d
Fix Painter:viewport()
...
This works because Painter inherits from ViewRect. Unsure how this went unnoticed.
2021-03-27 16:55:48 -04:00
lethosor
62776f5568
Move `expect` functions to a separate file
...
This allows tests to test these functions without needing to include the test
wrapper directly (now ci/test.lua, formerly test/main.lua). Hopefully this
location is also more stable, similar to other libraries that are already tested.
2021-03-24 00:48:52 -04:00
myk002
754baa45b3
remove io overrides
...
they were causing side effects when writing luacov reports
2021-03-07 08:16:24 -08:00
myk002
ba6a02eb59
call luacov.runner.init directly and clean up dbg
2021-03-07 08:16:24 -08:00
myk002
418a8c5d21
propagate luacov debug hook through coroutines
2021-03-07 08:16:24 -08:00
lethosor
7e12f3fd3d
Fix off-by-one, adjust changelog, move scroll keys to consistent place
...
Ref #1748
2021-01-30 19:40:15 -05:00
lethosor
8967e98a33
Merge remote-tracking branch 'myk002/myk_scrollable_labels' into develop
2021-01-30 19:33:04 -05:00
lethosor
4126585573
Merge remote-tracking branch 'lethosor/lua-runcommand' into develop
2021-01-29 20:27:38 -05:00
lethosor
de6f9183fd
Fix changelog, replace a couple qerror calls with error
...
Ref #1746
2021-01-29 00:04:10 -05:00
myk002
5a2181d55e
don't render overflow text
2021-01-13 22:02:22 -08:00
myk002
39d274b00e
address review comments
2021-01-12 23:42:53 -08:00
myk002
d4fbf4261f
address review comments
2021-01-12 23:27:14 -08:00
myk002
dac9538fd9
let navigation keys propagate
...
so other components can use them for simultaneous control
2021-01-11 15:02:12 -08:00
Myk Taylor
2797061b04
scroll Label text when height exceeds viewrect
2021-01-11 14:47:05 -08:00
Myk Taylor
175776812e
implement a nice API wrapper for getopt
2021-01-10 16:51:46 -08:00
Myk Taylor
3b45878d41
allow non-options in commandlines and return them
...
also call qerror() on error, not os.exit
2021-01-10 16:51:45 -08:00
Myk Taylor
20276be50f
check in unaltered version of alt_getopt
2021-01-10 16:51:45 -08:00
lethosor
614ea739d0
Merge branch 'develop' into lua-runcommand
2021-01-08 20:45:23 -05:00
myk002
3ba984c22c
only reset extents if they are unusable
...
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.
this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
2020-12-16 11:10:47 -08:00
lethosor
a9bb11c145
Optimize Lua's internal.runCommand() when printing directly to the console
...
This also makes commands run with `run_command()` detect the console properly (notably used by `df2console()`)
2020-11-20 17:57:54 -05:00
lethosor
fb44b26b47
Make utils.addressof() work for raw userdata
2020-11-19 21:32:42 -05:00
Myk Taylor
186f28a94b
filters for altars, display cases, and bookcases
2020-10-23 09:11:07 -07:00
Myk Taylor
3c51bb51ab
remove references to non-existent vector ids
2020-09-28 23:14:13 -07:00
Myk Taylor
6cc1428199
Merge remote-tracking branch 'upstream/develop' into buildings_vectors
2020-09-28 23:13:13 -07:00
lethosor
dfac5bc143
Update gui.Painter docs, add sections to dfhack.screen, add more links, etc
2020-09-23 22:00:39 -04:00
Myk Taylor
f837532b42
use more precise item vectors for bld item filters
2020-09-13 17:12:29 -07:00
lethosor
3b5a82cc05
Change color of ListBox.select2_hint to grey to indicate enabled
...
Ref dfhack/scripts#185
2020-08-27 00:08:28 -04:00
lethosor
c034276af5
Merge remote-tracking branch 'myk002/quickfort_filter' into develop
2020-08-21 00:34:34 -04:00