[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Tue Jun 21 08:56:31 PDT 2011


 wizards/com/sun/star/wizards/common/FileAccess.py |   26 ++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

New commits:
commit ede834f501b9e6320644b5e272c95763f13703f8
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Jun 21 17:56:03 2011 +0200

    Sort listboxes properly

diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index dfa5d80..8a6b145 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -3,7 +3,6 @@ from NoValidPathException import *
 from com.sun.star.ucb import CommandAbortedException
 from com.sun.star.awt.VclWindowPeerAttribute import OK, YES_NO
 import types
-from os import path as osPath
 
 '''
 This class delivers static convenience methods
@@ -406,15 +405,34 @@ class FileAccess(object):
                     NameVectorAppend(i)
                     TitleVectorAppend(xDocInterface.Title)
 
-            LocLayoutFiles[1] = sorted(NameVector)
-            LocLayoutFiles[0] = sorted(TitleVector)
+            LocLayoutFiles[1] = NameVector
+            LocLayoutFiles[0] = TitleVector
 
         except Exception, exception:
             traceback.print_exc()
 
-        return LocLayoutFiles
+        return self.__bubblesortList(LocLayoutFiles)
 
     '''
+    This function bubble sorts an array of with 2 dimensions.
+    The default sorting order is the first dimension
+    Only if sort2ndValue is True the second dimension is
+    the relevant for the sorting order
+    '''
+
+    @classmethod
+    def __bubblesortList(self, SortList):
+        SortCount = len(SortList[0])
+        DimCount = len(SortList)
+        for i in xrange(SortCount):
+            for t in xrange(SortCount - i - 1):
+                if SortList[0][t] > SortList[0][t + 1]:
+                    for k in xrange(DimCount):
+                        DisplayDummy = SortList[k][t];
+                        SortList[k][t] = SortList[k][t + 1];
+                        SortList[k][t + 1] = DisplayDummy
+        return SortList
+    '''
     We search in all given path for a given file
     @param _sPath
     @param _sPath2


More information about the Libreoffice-commits mailing list