Package PyFoam :: Package Applications :: Module PyFoamApplicationQt4
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Applications.PyFoamApplicationQt4

 1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/Applications/PyFoamApplicationQt4.py 6286 2010-04-01T09:40:31.994745Z bgschaid  $  
 2  """ 
 3  Base class for pyFoam-applications that have a QT4-GUI 
 4  """ 
 5   
 6  from PyFoamApplication import PyFoamApplication 
 7  from PyQt4 import QtGui,QtCore 
 8  import PyFoam 
 9   
10  import sys 
11  from os import path 
12   
13 -class PyFoamApplicationQt4(PyFoamApplication):
14 - def __init__(self, 15 args=None, 16 description=None, 17 usage=None, 18 interspersed=False, 19 nr=None, 20 changeVersion=True, 21 exactNr=True):
22 """ 23 @param description: description of the command 24 @param usage: Usage 25 @param interspersed: Is the command line allowed to be interspersed (options after the arguments) 26 @param args: Command line arguments when using the Application as a 'class' from a script 27 @param nr: Number of required arguments 28 @param changeVersion: May this application change the version of OF used? 29 @param exactNr: Must not have more than the required number of arguments 30 """ 31 super(PyFoamApplicationQt4,self).__init__(args=args, 32 description=description, 33 usage=usage, 34 interspersed=interspersed, 35 nr=nr, 36 changeVersion=changeVersion, 37 exactNr=exactNr) 38 self.app=None
39
40 - def setupGUI(self):
41 """ 42 Set up the graphical user interface 43 """ 44 error("Not a valid QT application")
45 46
47 - def run(self):
48 """ 49 Setup user interface and start QT 50 """ 51 app=QtGui.QApplication(self.parser.getArgs()) 52 app.setApplicationName(path.basename(sys.argv[0])) 53 try: 54 app.setApplicationVersion(PyFoam.versionString()) 55 except AttributeError: 56 # Old PyQt 57 pass 58 app.setOrganizationName("PyFoam") 59 self.setupGUI() 60 61 sys.exit(app.exec_())
62