Cleaned up the widget list.

This commit is contained in:
Mark de Wever 2009-03-08 10:24:30 +00:00
parent 925e4242f6
commit 50a01f3376
2 changed files with 54 additions and 23 deletions

View file

@ -176,34 +176,37 @@ const std::string& tgui_definition::read(const config& cfg)
* @end_table
*
* <span id="widget_list"></span>List of available widgets:
* @start_table = widget_definition
* button_definition A push button.
* image_definition An image.
* horizontal_scrollbar_definition
* A horizontal scrollbar.
* menubar_definition A menubar which is used in menus and the
* tabbar in a tabcontrol.
* minimap_definition A minimap to show the gamemap, this only
* @start_table = widget_overview
* Button A push button.
* Image An image.
* Horizontal_scrollbar A horizontal scrollbar.
* Label A label without scrollbars.
* Listbox A listbox.
* Menubar A menubar which is used in menus and the
* tabbar in a tabcontrol. (NOTE this widget
* is still under heavy development.)
* Minimap A minimap to show the gamemap, this only
* shows the map and has no interaction
* options. This version is used for map
* previews, there will be a another version
* which allows interaction.
* label_definition A label.
* listbox_definition A listbox.
* panel_definition A panel.
* scroll_label_definition A scroll_label.
* slider_definition A slider.
* spacer_definition A spacer.
* text_box_definition A single line text box.
* toggle_button_definition A kind of button with two 'states' normal
* Panel A panel is a container with can have it's
* own visual attributes.
* Scroll_label A label which can have scrollbars.
* Slider A slider.
* Spacer A spacer is a dummy widget which can be
* used if a cell in a container needs to be
* empty or have a fixed size.
* Text_box A single line text box.
* Toggle_button A kind of button with two 'states' normal
* and selected. This is a more generic widget
* which is used for eg checkboxes and
* radioboxes.
* toggle_panel_definition Like a toggle button but then as panel so
* Toggle_panel Like a toggle button but then as panel so
* can hold multiple items in a grid.
* tooltip_definition A small tooltip with help.
* vertical_scrollbar_definition A vertical scrollbar.
* window_definition A window.
* Tooltip A small tooltip with help.
* Vertical_scrollbar A vertical scrollbar.
* Window A window.
* @end_table
*
* <span id="window_list"></span>List of available windows:

View file

@ -181,7 +181,8 @@ if __name__ == "__main__":
result += "|}"
return result
# FIXME remove after create_window_definition_table has been converted.
def create_widget_definition_table(data):
"""Creates a table for a widget definition."""
@ -206,6 +207,33 @@ if __name__ == "__main__":
return result
def create_widget_overview_table(data):
"""Creates a table for all available widgets."""
#matches a line like
# Button A push button.
variable = "(?:[a-z]|[A-Z])(?:[a-z]|[A-Z]|[0-9]|_)*"
regex = re.compile(" *(" + variable + ") +(.*)\n")
res = regex.findall(data)
# empty table
if(len(res) == 0):
sys.stderr.write("Empty table:\n" + data + "\n")
return "Empty table."
result = '{| border="1"'
result += "\n!Section\n!Description\n"
for i in range(len(res)):
result += "|-\n"
result += "| " + re.sub(r'_', ' ', res[i][0])
result += " ([[GUIWidgetDefinitionWML#"
result += res[i][0]
result += "|definition]])\n"
result += "| " + format(res[i][1]) + "\n"
result += "|}"
return result
def create_window_definition_table(data):
"""Creates a table for a window definition."""
@ -286,8 +314,8 @@ if __name__ == "__main__":
return create_formula_table(table.group(2) + "\n")
elif(type == "variable_types"):
return create_variable_types_table(table.group(2) + "\n")
elif(type == "widget_definition"):
return create_widget_definition_table(table.group(2) + "\n")
elif(type == "widget_overview"):
return create_widget_overview_table(table.group(2) + "\n")
elif(type == "window_definition"):
return create_window_definition_table(table.group(2) + "\n")
elif(type == "container"):