1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
"""
FetchPDBDialog.py
Qt Dialog for fetching pdb files from the interweb
@author: Urmi
@version: $Id$
@copyright:2008 Nanorex, Inc. See LICENSE file for details.
"""
from PyQt4.Qt import SIGNAL, SLOT
from PyQt4.QtGui import QDialog, QLineEdit, QPushButton, QLabel
from PyQt4.QtGui import QHBoxLayout, QVBoxLayout, QApplication
class FetchPDBDialog(QDialog):
def __init__(self, parent = None):
self.parentWidget = parent
super(FetchPDBDialog, self).__init__(parent)
self.text = ''
self.setWindowTitle("Fetch PDB")
layout = QVBoxLayout()
idLayout = QHBoxLayout()
self.label = QLabel("Enter PDB ID:")
self.lineEdit = QLineEdit()
#self.lineEdit.setMaxLength(8) # Check with Piotr about this.
idLayout.addWidget(self.label)
idLayout.addWidget(self.lineEdit)
self.okButton = QPushButton("&OK")
self.cancelButton = QPushButton("Cancel")
buttonLayout = QHBoxLayout()
buttonLayout.addStretch()
buttonLayout.addWidget(self.okButton)
buttonLayout.addWidget(self.cancelButton)
layout.addLayout(idLayout)
layout.addLayout(buttonLayout)
self.setLayout(layout)
self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.getProteinCode)
self.connect(self.okButton, SIGNAL("clicked()"), self.getProteinCode)
self.connect(self.cancelButton, SIGNAL("clicked()"), self, SLOT("reject()"))
self.show()
return
def getProteinCode(self):
self.parentWidget.setPDBCode(str(self.lineEdit.text()))
self.close()
self.emit(SIGNAL("editingFinished()"))
return
|