commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5789 - trunk/gnue-designer/src/base/tools


From: jcater
Subject: r5789 - trunk/gnue-designer/src/base/tools
Date: Sat, 8 May 2004 12:25:21 -0500 (CDT)

Author: jcater
Date: 2004-05-08 12:25:20 -0500 (Sat, 08 May 2004)
New Revision: 5789

Modified:
   trunk/gnue-designer/src/base/tools/PropertyEditor.py
Log:
Sort the property list by name displayed, not by XML attribute


Modified: trunk/gnue-designer/src/base/tools/PropertyEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/PropertyEditor.py        2004-05-08 
05:56:53 UTC (rev 5788)
+++ trunk/gnue-designer/src/base/tools/PropertyEditor.py        2004-05-08 
17:25:20 UTC (rev 5789)
@@ -161,7 +161,17 @@
       self.attributes = self.getAttributes(object)
 
       # Define our rows
-      self.rowList = self.attributes.keys()
+      self.rowList = []
+      for key, attributes in self.attributes.items():
+        try:
+          label = attributes['Label']
+        except KeyError:
+          # This little tidbit does mixed case w/'_' as separators
+          words = string.split(key.split(':',1)[-1],'_')
+          for j in range(len(words)):
+            words[j] = words[j].capitalize()
+          label = string.join(words)
+        self.rowList.append((label, key))
       self.rowList.sort()
 
       # Get rid of any old fields
@@ -174,7 +184,7 @@
       # Only show properties for nondeprecated values (unless set)
       i = 0
       while i < len(self.rowList):
-        key = self.rowList[i]
+        label, key = self.rowList[i]
         xkey = key.replace(':','__')
         if self.attributes[key].has_key ('Deprecated') and \
            self.attributes[key]['Deprecated'] and \
@@ -187,20 +197,12 @@
 
       y = 2
       maxLabel = 0
-      for key in self.rowList:
+      for text, key in self.rowList:
 
         xkey = key.replace(':','__')
 
         # If an attribute has a "Label", use it;
         # otherwise create one from its name.
-        try:
-          text = self.attributes[key]['Label']
-        except KeyError:
-          # This little tidbit does mixed case w/'_' as separators
-          words = string.split(key.split(':',1)[-1],'_')
-          for j in range(len(words)):
-            words[j] = words[j].capitalize()
-          text = string.join(words)
 
         if self.attributes[key]['Typecast'] == GTypecast.boolean:
           text += _('?')
@@ -255,9 +257,9 @@
   # Reset the values displayed based on the values on the object
   def resetValues(self, object):
     if object != self.object:
-      return 
+      return
     for i in range(len(self.fields)):
-      xkey = self.rowList[i].replace(':','__')
+      xkey = self.rowList[i][1].replace(':','__')
       field = self.fields[i]
       # Set the initial value of the cells to the current property values
       if hasattr(object, xkey):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]