Ça exporte en smwi mais, peu de chances que ça marche.
[minwii.git] / src / gui / MINWiiDialog.py
1 '''
2 Created on 17 dec. 2009
3
4 @author: samsam
5 '''
6
7 import pgu.gui as pguGui
8 import os
9 import constants
10
11 class MINWiiDialog(pguGui.FileDialog):
12 '''
13 classdocs
14 '''
15
16 def __init__(self, font = None, width = 800, height = 600,path=None):
17 pguGui.FileDialog.__init__(self,title_txt = "Choisir une chanson", customFont = font,customWidth = width, customHeight = height,folderText = "", fileText = "",path =path,showCurDir = False)
18
19 def _list_dir_(self):
20 self.input_dir.value = self.curdir
21 self.input_dir.pos = len(self.curdir)
22 self.input_dir.vpos = 0
23 dirs = []
24 files = []
25 try:
26 for i in os.listdir(self.curdir):
27 if os.path.isdir(os.path.join(self.curdir, i)): dirs.append(i)
28 else: files.append(i)
29 except:
30 self.input_file.value = "Opps! no access"
31 #if '..' not in dirs: dirs.append('..')
32 dirs.sort()
33 dirs = ['..'] + dirs
34
35 files.sort()
36 for i in dirs:
37 #item = ListItem(image=self.dir_img, text=i, value=i)
38 if self.customFont == None :
39 self.list.add(i,image=self.dir_img,value=i)
40 else :
41 if i == ".." or i[0] != ".":
42 label = pguGui.basic.Label(i,font = self.customFont)
43 self.list.add(label,image=self.dir_img,value=i)
44 for i in files:
45 #item = ListItem(image=None, text=i, value=i)
46 if self.customFont == None :
47 self.list.add(i,value=i)
48 else:
49 if i.endswith(".smwi"):
50 key = i[:-5]
51 if key in constants.reversedReadabilityDict :
52 label = pguGui.basic.Label(constants.reversedReadabilityDict[key],font = self.customFont)
53 else :
54 label = pguGui.basic.Label(key,font = self.customFont)
55 self.list.add(label,value=i)
56 #self.list.resize()
57 self.list.set_vertical_scroll(0)
58 #self.list.repaintall()
59