From ed2ffc00be79ecc54b987545decd46c0ce309de4 Mon Sep 17 00:00:00 2001
From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Tue, 31 Aug 2010 09:30:33 +0000
Subject: [PATCH] QueryEditor, newline before match residues QueryEditorDialog,
accept with enter
git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2680 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
modules/gui/pymod/scene/query_editor.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules/gui/pymod/scene/query_editor.py b/modules/gui/pymod/scene/query_editor.py
index 5b5ed1787..7335c8a0c 100644
--- a/modules/gui/pymod/scene/query_editor.py
+++ b/modules/gui/pymod/scene/query_editor.py
@@ -38,8 +38,8 @@ class QueryEditorWidget(QtGui.QWidget):
hl.addWidget(self.ex_bonds_)
hl.addWidget(self.in_bonds_)
hl.addStretch(1)
- hl.addWidget(self.match_res_)
vl.addLayout(hl)
+ vl.addWidget(self.match_res_)
self.changing_text_=False;
self.connect(self.selection_edit_,QtCore.SIGNAL("textChanged()"),
@@ -47,6 +47,7 @@ class QueryEditorWidget(QtGui.QWidget):
self.timer_=QtCore.QTimer()
QtCore.QObject.connect(self.timer_, QtCore.SIGNAL('timeout()'),
self._UpdateMessage)
+
def GetQueryFlags(self):
flags=0
if self.no_bonds_.isChecked():
@@ -120,9 +121,22 @@ class QueryDialog(QtGui.QDialog):
l.addLayout(l3)
QtCore.QObject.connect(cb, QtCore.SIGNAL('clicked()'), self.reject)
QtCore.QObject.connect(ab, QtCore.SIGNAL('clicked()'), self.accept)
+ self.connect(self.editor.selection_edit_,QtCore.SIGNAL("textChanged()"),self._CheckNewline)
+
@property
def query_flags(self):
return self.editor.GetQueryFlags()
@property
def query(self):
- return self.editor.GetQueryText()
\ No newline at end of file
+ return self.editor.GetQueryText()
+
+ def event(self, e):
+ if e.type() == QtCore.QEvent.KeyPress and (e.key () == QtCore.Qt.Key_Return or e.key () == QtCore.Qt.Key_Enter):
+ self.accept()
+ return True
+ else:
+ return QtGui.QDialog.event(self, e)
+
+ def _CheckNewline(self):
+ if self.editor.GetQueryText().endswith("\n"):
+ self.accept()
\ No newline at end of file
--
GitLab