Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

grep: replace the GrepLineEdit class with a QAction

Simpler, again ;-)

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
commit 1e52aa041e2d9f94c7211222bcc264086784122d 1 parent 223b8d3
@davvid davvid authored
Showing with 4 additions and 14 deletions.
  1. +4 −14 cola/widgets/grep.py
View
18 cola/widgets/grep.py
@@ -49,7 +49,7 @@ def __init__(self, parent):
self.input_label.setFont(diff_font())
hint = N_('command-line arguments')
- self.input_txt = GrepLineEdit(hint, self)
+ self.input_txt = HintedLineEdit(hint, self)
self.input_txt.enable_hint(True)
hint = N_('grep result...')
@@ -107,9 +107,10 @@ def __init__(self, parent):
self.connect(self.input_txt, SIGNAL('textChanged(QString)'),
self.input_txt_changed)
- self.connect(self.input_txt, SIGNAL('returnPressed()'),
- lambda: self.result_txt.setFocus())
+ qtutils.add_action(self.input_txt, 'FocusResults',
+ lambda: self.result_txt.setFocus(),
+ Qt.Key_Down, Qt.Key_Enter, Qt.Key_Return)
qtutils.connect_button(self.edit_button, self.edit)
qtutils.connect_button(self.refresh_button, self.search)
qtutils.connect_button(self.close_button, self.close)
@@ -148,17 +149,6 @@ def edit(self):
goto_grep(self.result_txt.selected_line()),
-class GrepLineEdit(HintedLineEdit):
- def __init__(self, hint, parent):
- HintedLineEdit.__init__(self, hint, parent)
-
- def keyPressEvent(self, event):
- if event.key() in (Qt.Key_Return, Qt.Key_Enter):
- self.emit(SIGNAL('returnPressed()'))
- else:
- HintedLineEdit.keyPressEvent(self, event)
-
-
class GrepTextView(HintedTextView):
def __init__(self, hint, parent):
HintedTextView.__init__(self, hint, parent)
Please sign in to comment.
Something went wrong with that request. Please try again.