00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2004 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__ = "GLAST LAT finite state transistions classes" 00012 __author__ = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online" 00013 __date__ = ("$Date: 2004/08/24 23:16:43 $").split(' ')[1] 00014 __version__ = "$Revision: 2.1 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 import qt 00021 00022 # This class puts up a GUI for getting the SchemaConfig file to use. 00023 class rcScmCfgSelector(qt.QFileDialog): 00024 "GUI for getting the SchemaConfig file to use." 00025 def __init__(self, startwithDir, startwithFile, parent = None, name = None, fl = 0): 00026 qt.QFileDialog.__init__(self, parent, name, fl) 00027 00028 self.setMode(qt.QFileDialog.ExistingFile) 00029 self.setFilter("(*.xml)") 00030 if startwithDir is not None: 00031 self.setDir(startwithDir) 00032 self.setCaption("Choose a schema/configuration file") 00033 if startwithFile is not None: 00034 self.setSelection(startwithFile) 00035 00036 if self.exec_loop() == qt.QDialog.Accepted: 00037 self.__value = str(self.selectedFile()) 00038 else: 00039 self.__value = None 00040 00041 def getValue(self): 00042 return self.__value 00043 00044 class rcScmCfgSelText(object): 00045 "Text user interface for getting the user to a SchemaConfig file" 00046 def __init__(self, startwith): 00047 self.__startwith = startwith 00048 00049 def getValue(self): 00050 startwith = self.__startwith 00051 if startwith is None: 00052 startwith = '' 00053 answer = raw_input("Choose a schema/configuration file [%s]: " % startwith) 00054 if answer == '': 00055 answer = self.__startwith 00056 return answer