mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
GwR 2nd patch mapping ESC to SearchBox2.clear()
This commit is contained in:
parent
93fc7cab28
commit
2be9281390
@ -76,10 +76,7 @@ class SearchBox2(QComboBox): # {{{
|
||||
c.setCompletionMode(c.PopupCompletion)
|
||||
c.highlighted[QString].connect(self.completer_used)
|
||||
c.activated[QString].connect(self.history_selected)
|
||||
self.esc_action = QAction(self)
|
||||
self.addAction(self.esc_action)
|
||||
self.esc_action.setShortcut(QKeySequence(Qt.Key_Escape))
|
||||
self.esc_action.triggered.connect(self.esc)
|
||||
|
||||
self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection)
|
||||
self.activated.connect(self.history_selected)
|
||||
self.setEditable(True)
|
||||
@ -94,9 +91,6 @@ class SearchBox2(QComboBox): # {{{
|
||||
self._in_a_search = False
|
||||
self.tool_tip_text = self.toolTip()
|
||||
|
||||
def esc(self, *args):
|
||||
self.clear()
|
||||
|
||||
def initialize(self, opt_name, colorize=False, help_text=_('Search')):
|
||||
self.as_you_type = config['search_as_you_type']
|
||||
self.opt_name = opt_name
|
||||
|
@ -16,7 +16,7 @@ from PyQt4.Qt import Qt, SIGNAL, QTimer, \
|
||||
QPixmap, QMenu, QIcon, pyqtSignal, \
|
||||
QDialog, \
|
||||
QSystemTrayIcon, QApplication, QKeySequence, \
|
||||
QMessageBox, QHelpEvent
|
||||
QMessageBox, QHelpEvent, QAction
|
||||
|
||||
from calibre import prints
|
||||
from calibre.constants import __appname__, isosx
|
||||
@ -198,6 +198,10 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
||||
self.system_tray_icon.activated.connect(
|
||||
self.system_tray_icon_activated)
|
||||
|
||||
self.esc_action = QAction(self)
|
||||
self.addAction(self.esc_action)
|
||||
self.esc_action.setShortcut(QKeySequence(Qt.Key_Escape))
|
||||
self.esc_action.triggered.connect(self.esc)
|
||||
|
||||
####################### Start spare job server ########################
|
||||
QTimer.singleShot(1000, self.add_spare_server)
|
||||
@ -294,6 +298,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
||||
'the file: %s<p>The '
|
||||
'log will be displayed automatically.')%self.gui_debug, show=True)
|
||||
|
||||
def esc(self, *args):
|
||||
self.search.clear()
|
||||
|
||||
def start_content_server(self):
|
||||
from calibre.library.server.main import start_threaded_server
|
||||
@ -305,7 +311,6 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
||||
self.content_server.state_callback(True)
|
||||
self.test_server_timer = QTimer.singleShot(10000, self.test_server)
|
||||
|
||||
|
||||
def resizeEvent(self, ev):
|
||||
MainWindow.resizeEvent(self, ev)
|
||||
self.search.setMaximumWidth(self.width()-150)
|
||||
|
Loading…
x
Reference in New Issue
Block a user