From c5253c206a6b8a1fcb2a184b1df92aaeb156ac12 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 21 Jun 2011 17:56:03 +0200 Subject: Sort listboxes properly --- wizards/com/sun/star/wizards/common/FileAccess.py | 26 +++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py index dfa5d803299c..8a6b14559891 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 -- cgit