Ajout description midi des instruments et sélection au niveau de fluidsynth.
[minwii.git] / src / app / widgets / songfilebrowser.py
1 # -*- coding: utf-8 -*-
2 """
3 Boîte de dialogue pour sélection des chansons.
4
5 $Id$
6 $URL$
7 """
8
9 from pgu.gui import FileDialog
10 import os
11
12 class FileOpenDialog(FileDialog):
13
14
15
16 def __init__(self, path):
17 FileDialog.__init__(self,
18 title_txt="Ouvrir une chanson",
19 button_txt="Ouvrir",
20 #cls="dialog",
21 #folderText = "Folder",
22 #fileText = "File",
23 path=path,
24 #customFont = None,
25 showCurDir = False
26 #customWidth = 350,
27 #customHeight = 150
28 )
29
30 def _list_dir_(self):
31 self.input_dir.value = self.curdir
32 self.input_dir.pos = len(self.curdir)
33 self.input_dir.vpos = 0
34 dirs = []
35 files = []
36 try:
37 for i in os.listdir(self.curdir):
38 if os.path.isdir(os.path.join(self.curdir, i)): dirs.append(i)
39 else: files.append(i)
40 except:
41 self.input_file.value = "Opps! no access"
42 #if '..' not in dirs: dirs.append('..')
43 dirs.sort()
44 dirs = ['..'] + dirs
45
46 files.sort()
47 for i in dirs:
48 if i.startswith('.') and i != '..' :
49 continue
50 #item = ListItem(image=self.dir_img, text=i, value=i)
51 if self.customFont == None :
52 self.list.add(i,image=self.dir_img,value=i)
53 else :
54 label = basic.Label(i,font = self.customFont)
55 self.list.add(label,image=self.dir_img,value=i)
56 for i in files:
57 #item = ListItem(image=None, text=i, value=i)
58 if i.startswith('.') or (not i.endswith('.xml')) :
59 continue
60 if self.customFont == None :
61 self.list.add(i,value=i)
62 else:
63 label = basic.Label(i,font = self.customFont)
64 self.list.add(label,value=i)
65 #self.list.resize()
66 self.list.set_vertical_scroll(0)
67 #self.list.repaintall()
68