00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2003 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__ = "Argument GUI implementation module" 00012 __author__ = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online" 00013 __date__ = "11/20/2003" 00014 __version__ = "$Revision: 2.2 $" 00015 __credits__ = "SLAC" 00016 00017 import LATTE.copyright_SLAC 00018 00019 import sys 00020 from qt import * 00021 from Argument import Argument 00022 00023 00024 class ArgumentImpl(Argument): 00025 00026 def __init__(self,parent = None,name = None,modal = 0,fl = 0): 00027 Argument.__init__(self,parent,name,modal,fl) 00028 00029 self.__label = 0 00030 00031 self.connect(self.OKButton,SIGNAL("clicked()"),self.OKButtonClicked) 00032 self.connect(self.CancelButton,SIGNAL("clicked()"),self.CancelButtonClicked) 00033 00034 def OKButtonClicked(self): 00035 self.__value = int(self.ArgumentList.text().latin1()) 00036 self.close() 00037 00038 def getValue(self, caption, value = None): 00039 if value is not None: 00040 self.ArgumentList.setText(str(value)) 00041 self.ArgLabel.setText(caption) 00042 self.show() 00043 self.exec_loop() 00044 return self.__value 00045 00046 def CancelButtonClicked(self): 00047 self.close() 00048 00049 if __name__ == "__main__": 00050 a = QApplication(sys.argv) 00051 QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) 00052 w = ArgumentImpl() 00053 a.setMainWidget(w) 00054 w.show() 00055 a.exec_loop()