2 from PyQt5
import QtCore, QtWidgets, QtGui
6 QtWidgets.QWidget.__init__(self, parent)
8 self.
default_font_default_font_.setForeground(QtGui.QBrush(QtGui.QColor(0,0,0)))
10 self.
error_font_error_font_.setForeground(QtGui.QBrush(QtGui.QColor(255,0,0)))
14 self.
status_status_=QtWidgets.QLabel(
" ",self);
15 self.
status_status_.setWordWrap(
True)
16 self.
status_status_.setMargin(0)
17 self.
status_status_.setAlignment(QtCore.Qt.AlignRight)
18 self.
status_status_.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
19 QtWidgets.QSizePolicy.Expanding))
20 vl=QtWidgets.QVBoxLayout()
22 self.
no_bonds_no_bonds_=QtWidgets.QRadioButton(
'none')
23 self.
ex_bonds_ex_bonds_=QtWidgets.QRadioButton(
'exclusive')
24 self.
in_bonds_in_bonds_=QtWidgets.QRadioButton(
'inclusive')
26 self.
match_res_match_res_=QtWidgets.QCheckBox(
'match residues')
28 vl.setContentsMargins(0,0,0,0)
31 vl.addWidget(self.
status_status_)
32 hl=QtWidgets.QHBoxLayout()
33 l=QtWidgets.QLabel(
"bonds:")
54 flags|=mol.EXCLUSIVE_BONDS
56 flags|=mol.MATCH_RESIDUES
66 self.
no_bonds_no_bonds_.setChecked(flags & mol.NO_BONDS)
67 self.
ex_bonds_ex_bonds_.setChecked(flags & mol.EXCLUSIVE_BONDS)
68 self.
in_bonds_in_bonds_.setChecked(
not (flags & mol.NO_BONDS|mol.EXCLUSIVE_BONDS))
69 self.
match_res_match_res_.setChecked(flags & mol.MATCH_RESIDUES)
74 def _StartTimer(self):
76 self.
timer_timer_.start(500)
78 def _UpdateMessage(self):
85 cursor.select(QtGui.QTextCursor.Document)
91 d=query.GetErrorDescription()
92 self.
status_status_.setText(
"<font color='red'>%s</font>"%d.msg.strip())
94 cursor.movePosition(QtGui.QTextCursor.Start)
95 if d.range.Loc<len(query.string):
97 cursor.movePosition(QtGui.QTextCursor.NextCharacter,
98 QtGui.QTextCursor.MoveAnchor, d.range.Loc)
99 cursor.movePosition(QtGui.QTextCursor.NextCharacter,
100 QtGui.QTextCursor.KeepAnchor, d.range.Length)
106 QtWidgets.QDialog.__init__(self, parent)
107 l=QtWidgets.QVBoxLayout(self)
108 self.setWindowTitle(title)
110 l.addWidget(self.
editoreditor)
112 l3=QtWidgets.QHBoxLayout()
113 ab=QtWidgets.QPushButton(
'OK')
115 cb=QtWidgets.QPushButton(
'Cancel')
120 cb.clicked.connect(self.reject)
121 ab.clicked.connect(self.accept)
126 return self.
editoreditor.GetQueryFlags()
129 return self.
editoreditor.GetQueryText()
132 if e.type() == QtCore.QEvent.KeyPress
and (e.key () == QtCore.Qt.Key_Return
or e.key () == QtCore.Qt.Key_Enter):
136 return QtWidgets.QDialog.event(self, e)
138 def _CheckNewline(self):
139 if self.
editoreditor.GetQueryText().endswith(
"\n"):
def __init__(self, title, parent=None)