ajout des fonts.
[minwii.git] / src / minwii / 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 path=path,
21 )
22
23 def _list_dir_(self):
24 self.input_dir.value = self.curdir
25 self.input_dir.pos = len(self.curdir)
26 self.input_dir.vpos = 0
27 dirs = []
28 files = []
29 try:
30 for i in os.listdir(self.curdir):
31 if os.path.isdir(os.path.join(self.curdir, i)): dirs.append(i)
32 else: files.append(i)
33 except:
34 self.input_file.value = "Opps! no access"
35 #if '..' not in dirs: dirs.append('..')
36 dirs.sort()
37 dirs = ['..'] + dirs
38
39 files.sort()
40 for i in dirs:
41 if i.startswith('.') and i != '..' :
42 continue
43 self.list.add(i, image=self.dir_img, value=i)
44
45 for i in files:
46 if i.startswith('.') or (not i.endswith('.xml')) :
47 continue
48 self.list.add(i,value=i)
49
50 self.list.set_vertical_scroll(0)
51