mail[Wesnoth-commits] r33409 - in /trunk: src/gui/widgets/settings.cpp utils/wiki_grabber.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on March 08, 2009 - 11:24:
Author: mordante
Date: Sun Mar  8 11:24:37 2009
New Revision: 33409

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33409&view=rev
Log:
Cleaned up code for the window list.

Modified:
    trunk/src/gui/widgets/settings.cpp
    trunk/utils/wiki_grabber.py

Modified: trunk/src/gui/widgets/settings.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/settings.cpp?rev=33409&r1=33408&r2=33409&view=diff
==============================================================================
--- trunk/src/gui/widgets/settings.cpp (original)
+++ trunk/src/gui/widgets/settings.cpp Sun Mar  8 11:24:37 2009
@@ -210,10 +210,10 @@
  * @end_table
  *
  * <span id="window_list"></span>List of available windows:
- * @start_table = window_definition
- *     addon_connect                 The dialog to connect to the addon 
server
+ * @start_table = window_overview
+ *     Addon_connect                 The dialog to connect to the addon 
server
  *                                   and maintain locally installed addons.
- *     language_selection            The dialog to select the primairy 
language.
+ *     Language_selection            The dialog to select the primairy 
language.
  * @end_table
  *
  */

Modified: trunk/utils/wiki_grabber.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/wiki_grabber.py?rev=33409&r1=33408&r2=33409&view=diff
==============================================================================
--- trunk/utils/wiki_grabber.py (original)
+++ trunk/utils/wiki_grabber.py Sun Mar  8 11:24:37 2009
@@ -182,31 +182,6 @@
 
         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."""
-
-        #matches a line like
-        # button_definition             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 += "| " + res[i][0] + "\n"
-            result += "| " + format(res[i][1]) + "\n"
-        result += "|}"
-
-        return result
-
     def create_widget_overview_table(data):
         """Creates a table for all available widgets."""
         #matches a line like
@@ -233,16 +208,31 @@
 
         return result
 
-
-    def create_window_definition_table(data):
-        """Creates a table for a window definition."""
-
+    def create_window_overview_table(data):
+        """Creates a table for all available windows."""
         #matches a line like
-        # addon_connect                 The dialog to connect to the addon 
server
-
-        # atm we look the same as the widget table
-        return create_widget_definition_table(data)
-
+        # Addon_connect                 The dialog to connect to the addon 
server
+        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 += " ([[GUIWindowDefinitionWML#" 
+            result += res[i][0]
+            result += "|definition]])\n"
+            result += "| " + format(res[i][1]) + "\n"
+        result += "|}"
+
+        return result
 
     def create_container_table(data):
         """Creates a table for a container."""
@@ -316,8 +306,8 @@
             return create_variable_types_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 == "window_overview"):
+            return create_window_overview_table(table.group(2) + "\n")
         elif(type == "container"):
             return create_container_table(table.group(2) + "\n")
         else:




Related Messages


Powered by MHonArc, Updated Sun Mar 08 11:40:24 2009