00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 __facility__ = "Online"
00011 __author__ = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00012 __abstract__ = "Argument GUI implementation module"
00013 __date__ = "2003/11/20 00:00:00"
00014 __updated__ = "$Date: 2005/09/21 23:54:51 $"
00015 __version__ = "$Revision: 1.4 $"
00016 __release__ = "$Name: HEAD $"
00017 __credits__ = "SLAC"
00018
00019 import LICOS.copyright_SLAC
00020
00021 import sys
00022 from qt import *
00023 from Argument import Argument
00024
00025
00026 class ArgumentImpl(Argument):
00027 """!\brief Generic class to provide an input dialog for operator input.
00028
00029 """
00030 def __init__(self, parent = None,name = None, modal = 0, fl = 0):
00031 """!\brief ArgumentImpl constructor
00032
00033 \param parent Parent GUI
00034 \param name GUI name
00035 \param modal Whether the dialog is modal or not
00036 \param fl GUI flags
00037 """
00038 Argument.__init__(self,parent,name,modal,fl)
00039
00040 self.__label = 0
00041
00042 self.connect(self.OKButton,SIGNAL("clicked()"),self.OKButtonClicked)
00043 self.connect(self.CancelButton,SIGNAL("clicked()"),self.CancelButtonClicked)
00044
00045 def OKButtonClicked(self):
00046 """!\brief Handle OK button click.
00047
00048 """
00049 self.__value = int(self.ArgumentList.text().latin1())
00050 self.close()
00051
00052 def getValue(self, caption, value = None):
00053 """!\brief Show the dialog box and wait for user input.
00054
00055 \param caption Input dialog title
00056 \param value Default value
00057
00058 \return Input value
00059 """
00060 if value is not None:
00061 self.ArgumentList.setText(str(value))
00062 self.ArgLabel.setText(caption)
00063 self.show()
00064 self.exec_loop()
00065 return self.__value
00066
00067 def CancelButtonClicked(self):
00068 """!\brief Handle Cancel button click.
00069
00070 """
00071 self.close()
00072
00073 if __name__ == "__main__":
00074 a = QApplication(sys.argv)
00075 QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00076 w = ArgumentImpl()
00077 a.setMainWidget(w)
00078 w.show()
00079 a.exec_loop()