+# -*- coding: utf-8 -*-
+"""
+Boîte de dialogue pour sélection des chansons.
+
+$Id$
+$URL$
+"""
+
+from pgu.gui import FileDialog
+import os
+
+class FileOpenDialog(FileDialog):
+
+
+
+ def __init__(self, path):
+ FileDialog.__init__(self,
+ title_txt="Ouvrir une chanson",
+ button_txt="Ouvrir",
+ #cls="dialog",
+ #folderText = "Folder",
+ #fileText = "File",
+ path=path,
+ #customFont = None,
+ showCurDir = False
+ #customWidth = 350,
+ #customHeight = 150
+ )
+
+ def _list_dir_(self):
+ self.input_dir.value = self.curdir
+ self.input_dir.pos = len(self.curdir)
+ self.input_dir.vpos = 0
+ dirs = []
+ files = []
+ try:
+ for i in os.listdir(self.curdir):
+ if os.path.isdir(os.path.join(self.curdir, i)): dirs.append(i)
+ else: files.append(i)
+ except:
+ self.input_file.value = "Opps! no access"
+ #if '..' not in dirs: dirs.append('..')
+ dirs.sort()
+ dirs = ['..'] + dirs
+
+ files.sort()
+ for i in dirs:
+ if i.startswith('.') and i != '..' :
+ continue
+ #item = ListItem(image=self.dir_img, text=i, value=i)
+ if self.customFont == None :
+ self.list.add(i,image=self.dir_img,value=i)
+ else :
+ label = basic.Label(i,font = self.customFont)
+ self.list.add(label,image=self.dir_img,value=i)
+ for i in files:
+ #item = ListItem(image=None, text=i, value=i)
+ if i.startswith('.') or (not i.endswith('.xml')) :
+ continue
+ if self.customFont == None :
+ self.list.add(i,value=i)
+ else:
+ label = basic.Label(i,font = self.customFont)
+ self.list.add(label,value=i)
+ #self.list.resize()
+ self.list.set_vertical_scroll(0)
+ #self.list.repaintall()
+