add desc as an official Overlay API property

develop
Myk Taylor 2023-12-30 20:17:01 -08:00
parent d3ac6ef0fb
commit 50a447061d
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

@ -89,11 +89,14 @@ The ``overlay.OverlayWidget`` superclass defines the following class attributes:
- ``name`` - ``name``
This will be filled in with the display name of your widget, in case you This will be filled in with the display name of your widget, in case you
have multiple widgets with the same implementation but different have multiple widgets with the same implementation but different
configurations. configurations. You should not set this property yourself.
- ``version`` - ``version``
You can set this to any string. If the version string of a loaded widget You can set this to any string. If the version string of a loaded widget
does not match the saved settings for that widget, then the configuration does not match the saved settings for that widget, then the configuration
for the widget (position, enabled status) will be reset to defaults. for the widget (position, enabled status) will be reset to defaults.
- ``desc``
A short (<100 character) description of what the overlay does. This text
will be displayed in `gui/control-panel` on the "Overlays" tab.
- ``default_pos`` (default: ``{x=-2, y=-2}``) - ``default_pos`` (default: ``{x=-2, y=-2}``)
Override this attribute with your desired default widget position. See Override this attribute with your desired default widget position. See
the `overlay` docs for information on what positive and negative numbers the `overlay` docs for information on what positive and negative numbers

@ -553,6 +553,7 @@ end
OverlayWidget = defclass(OverlayWidget, widgets.Panel) OverlayWidget = defclass(OverlayWidget, widgets.Panel)
OverlayWidget.ATTRS{ OverlayWidget.ATTRS{
name=DEFAULT_NIL, -- this is set by the framework to the widget name name=DEFAULT_NIL, -- this is set by the framework to the widget name
desc=DEFAULT_NIL, -- add a short description (<100 chars); displays in control panel
default_pos={x=DEFAULT_X_POS, y=DEFAULT_Y_POS}, -- 1-based widget screen pos default_pos={x=DEFAULT_X_POS, y=DEFAULT_Y_POS}, -- 1-based widget screen pos
default_enabled=false, -- initial enabled state if not in config default_enabled=false, -- initial enabled state if not in config
overlay_only=false, -- true if there is no widget to reposition overlay_only=false, -- true if there is no widget to reposition
@ -581,6 +582,7 @@ end
TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget) TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget)
TitleVersionOverlay.ATTRS{ TitleVersionOverlay.ATTRS{
desc='Show DFHack version number and quick links on the DF title page.',
default_pos={x=11, y=1}, default_pos={x=11, y=1},
version=2, version=2,
default_enabled=true, default_enabled=true,