Home | Trees | Indices | Help |
|
---|
|
1 """ 2 """ 3 4 import PyQt4.QtGui 5 import PyQt4.QtCore 6 7 import Constants 8 936 3712 # sets up the QDialog with the correct icon, title, and then gives it a vertical main layout 13 PyQt4.QtGui.QDialog.__init__ (self, win) 14 self.setWindowTitle ("Delete") 15 self.setWindowIcon (PyQt4.QtGui.QIcon (Constants.ICON_DIR + "/misc/delete.png")) 16 layout = PyQt4.QtGui.QVBoxLayout () 17 self.setLayout (layout) 18 19 # The main layout is a vertical layout which comprises of these two horizontal layouts 20 topLayout = PyQt4.QtGui.QHBoxLayout () 21 bottomLayout = PyQt4.QtGui.QHBoxLayout () 22 layout.addLayout (topLayout) 23 layout.addLayout (bottomLayout) 24 25 # The QLabel directing the user to choose a button 26 topLayout.addWidget (PyQt4.QtGui.QLabel ("Are you sure you want to delete " + name + "?")) 27 28 # Adds the buttons, and connects them to QDialog's accept and reject, and to the bottom layout 29 acceptButton = Constants.BQPushButton ("&Yes", bottomLayout) 30 PyQt4.QtCore.QObject.connect (acceptButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.accept) 31 rejectButton = Constants.BQPushButton ("&No", bottomLayout) 32 PyQt4.QtCore.QObject.connect (rejectButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.reject) 33 34 # Execute the dialog, it will remain until resolved 35 self.exec_ ()7540 # Sets up normal PyQt4.QtGui.QDialog stuff, with the correct title and icon, 41 # as well as give it a main vertical layout 42 PyQt4.QtGui.QDialog.__init__ (self, win) 43 self.setWindowTitle (type) 44 self.setWindowIcon (icon) 45 layout = PyQt4.QtGui.QVBoxLayout () 46 self.setLayout (layout) 47 48 # Set up horizontal layouts in the main vertical layout 49 topLayout = PyQt4.QtGui.QHBoxLayout () 50 bottomLayout = PyQt4.QtGui.QHBoxLayout () 51 layout.addLayout (topLayout) 52 layout.addLayout (bottomLayout) 53 54 # Create a line edit, but with a regular expression validator 55 # Which is essentially a line that thwe user edits, but if their keystrokes 56 # don't agree with the regular expression given, their input won't even show up 57 # This is nice, because only valid variable names should go here. 58 self.name = PyQt4.QtGui.QLineEdit () 59 # REGEXP_VAR defined in BASIN_constants.py 60 regexp = PyQt4.QtCore.QRegExp (Constants.REGEXP_VAR) 61 valid = PyQt4.QtGui.QRegExpValidator (regexp, self.name) 62 self.name.setValidator (valid) 63 topLayout.addWidget (PyQt4.QtGui.QLabel (PyQt4.QtCore.QString ("Name:"))) 64 topLayout.addWidget (self.name) 65 66 # Adds the buttons, and connects them to PyQt4.QtGui.QDialog's accept 67 # and reject, and to the bottom layout 68 acceptButton = Constants.BQPushButton ("Ok", bottomLayout) 69 PyQt4.QtCore.QObject.connect (acceptButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.accept) 70 rejectButton = Constants.BQPushButton ("Cancel", bottomLayout) 71 PyQt4.QtCore.QObject.connect (rejectButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.reject) 72 73 # Execute the dialog, it will remain until resolved 74 self.exec_ ()
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Mar 21 09:10:54 2008 | http://epydoc.sourceforge.net |