mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
8e74361336
commit
4b88420482
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import re, time
|
||||
from functools import partial
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ from calibre.gui2.dialogs.search import SearchDialog
|
||||
|
||||
class SearchLineEdit(QLineEdit): # {{{
|
||||
key_pressed = pyqtSignal(object)
|
||||
select_on_mouse_press = False
|
||||
select_on_mouse_press = None
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
self.key_pressed.emit(event)
|
||||
@ -41,14 +41,14 @@ class SearchLineEdit(QLineEdit): # {{{
|
||||
return QLineEdit.paste(self)
|
||||
|
||||
def focusInEvent(self, ev):
|
||||
self.select_on_mouse_press = True
|
||||
self.select_on_mouse_press = time.time()
|
||||
return QLineEdit.focusInEvent(self, ev)
|
||||
|
||||
def mousePressEvent(self, ev):
|
||||
QLineEdit.mousePressEvent(self, ev)
|
||||
if self.select_on_mouse_press:
|
||||
self.select_on_mouse_press = False
|
||||
if self.select_on_mouse_press is not None and abs(time.time() - self.select_on_mouse_press) < 0.2:
|
||||
self.selectAll()
|
||||
self.select_on_mouse_press = None
|
||||
# }}}
|
||||
|
||||
class SearchBox2(QComboBox): # {{{
|
||||
|
Loading…
x
Reference in New Issue
Block a user