27 import wx |
27 import wx |
28 |
28 |
29 from util.BitmapLibrary import GetBitmap |
29 from util.BitmapLibrary import GetBitmap |
30 |
30 |
31 DRIVE, FOLDER, FILE = range(3) |
31 DRIVE, FOLDER, FILE = range(3) |
|
32 |
32 |
33 |
33 def sort_folder(x, y): |
34 def sort_folder(x, y): |
34 if x[1] == y[1]: |
35 if x[1] == y[1]: |
35 return cmp(x[0], y[0]) |
36 return cmp(x[0], y[0]) |
36 elif x[1] != FILE: |
37 elif x[1] != FILE: |
37 return -1 |
38 return -1 |
38 else: |
39 else: |
39 return 1 |
40 return 1 |
40 |
41 |
|
42 |
41 def splitpath(path): |
43 def splitpath(path): |
42 head, tail = os.path.split(path) |
44 head, tail = os.path.split(path) |
43 if head == "": |
45 if head == "": |
44 return [tail] |
46 return [tail] |
45 elif tail == "": |
47 elif tail == "": |
46 return splitpath(head) |
48 return splitpath(head) |
47 return splitpath(head) + [tail] |
49 return splitpath(head) + [tail] |
|
50 |
48 |
51 |
49 class FolderTree(wx.Panel): |
52 class FolderTree(wx.Panel): |
50 |
53 |
51 def __init__(self, parent, folder, filter=None, editable=True): |
54 def __init__(self, parent, folder, filter=None, editable=True): |
52 wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL) |
55 wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL) |