00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2002 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__ = "Standard Plotter Gui Implementation" 00012 __author__ = "Lester Miller <lmiller@slac.stanford.edu> SLAC - GLAST I&T" 00013 __date__ = "07/13/04" 00014 __version__ = "$Revision: 1.2 $" 00015 __credits__ = "SLAC" 00016 00017 import LATTE.copyright_SLAC 00018 from LATTE.consumer.standardPlotterGui import standardPlotterGui 00019 from qt import * 00020 import os 00021 00022 class standardPlotterGuiImpl(standardPlotterGui): 00023 00024 def __init__(self,parent = None,name = None,modal = 0,fl = 0): 00025 standardPlotterGui.__init__(self,parent,name,modal,fl) 00026 00027 self.lat = None 00028 self.params = None 00029 self.connect(self.buttonOk,SIGNAL("clicked()"),self.OKButtonClicked) 00030 self.connect(self.buttonCancel,SIGNAL("clicked()"),self.CancelButtonClicked) 00031 self.connect(self.buttonBrowse,SIGNAL("clicked()"),self.configFileBrowser) 00032 00033 def OKButtonClicked(self): 00034 self.fileName = self.cfgFile.text().latin1() 00035 self.close() 00036 00037 def getConfigFile(self,fileName): 00038 if fileName is not None: 00039 self.cfgFile.setText(QString(fileName)) 00040 self.fileName = fileName 00041 self.show() 00042 self.exec_loop() 00043 return self.fileName 00044 00045 def CancelButtonClicked(self): 00046 self.fileName = None 00047 self.close() 00048 00049 def configFileBrowser(self): 00050 try: 00051 (filepath,filename) = os.path.split(self.fileName) 00052 except: 00053 filepath = os.getcwd() 00054 filename = '' 00055 fnPath = QString(filepath) 00056 fn = QFileDialog.getOpenFileName(fnPath, '*.cfg', self,"Configuration File Browser", "Choose configuration file") 00057 if fn.isEmpty(): 00058 return 00059 filename = str(fn) 00060 self.cfgFile.setText(QString(filename)) 00061