00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 __facility__ = "Online"
00011 __abstract__ = "A customizable file open dialog class"
00012 __author__ = """S. Tuvi <stuvi@slac.Stanford.edu>
00013 SLAC - GLAST LAT I&T/Online"""
00014 __date__ = "2005/11/09 00:08:27"
00015 __updated__ = "$Date: 2005/11/10 03:45:39 $"
00016 __version__ = "$Revision: 1.1 $"
00017 __release__ = "$Name: HEAD $"
00018 __credits__ = "SLAC"
00019
00020 import LICOS.copyright_SLAC
00021
00022 import os
00023
00024 from qt import QFileDialog
00025
00026 class seFileSelector(QFileDialog):
00027 """!\brief A customizable file open dialog class.
00028
00029 """
00030 def __init__(self, startwith, filter, parent, name):
00031 """!\brief seFileSelector constructor.
00032
00033 \param startwith File path to start with
00034 \param filter File extension filter
00035 \param parent Parent GUI
00036 \param name GUI name
00037 """
00038 QFileDialog.__init__(self, parent, name, 0)
00039 self.setMode(QFileDialog.ExistingFile)
00040 self.setFilter(filter)
00041 self.setDir(os.path.dirname(startwith))
00042 self.setCaption(name)
00043 self.setViewMode( QFileDialog.Detail)
00044 self.setSelection(startwith)
00045
00046 def getValue(self):
00047 """!\brief Retrieve the file name selected.
00048
00049 \return Full path of the file selected or
00050 None if the user cancelled file selection.
00051 """
00052 if self.exec_loop() == QFileDialog.Accepted:
00053 return str(self.selectedFile())
00054 else:
00055 return None