seFileSelector.py

Go to the documentation of this file.
00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2005
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
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

Generated on Thu Apr 27 20:52:43 2006 for LICOS L02-01-00 by doxygen 1.4.6-NO