mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a button to clear the viewer search history in the viewer Preferences, under Miscellaneous
This commit is contained in:
parent
29f9e455a7
commit
8ff4ff2aa0
@ -187,7 +187,7 @@ def _config(): # {{{
|
||||
c.add_opt('shortcuts_search_history', default=[],
|
||||
help='Search history for the keyboard preferences')
|
||||
c.add_opt('jobs_search_history', default=[],
|
||||
help='Search history for the keyboard preferences')
|
||||
help='Search history for the tweaks preferences')
|
||||
c.add_opt('tweaks_search_history', default=[],
|
||||
help='Search history for tweaks')
|
||||
c.add_opt('worker_limit', default=6,
|
||||
|
@ -139,12 +139,20 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
self.load_options(opts)
|
||||
self.init_load_themes()
|
||||
|
||||
self.clear_search_history_button.clicked.connect(self.clear_search_history)
|
||||
|
||||
def clear_search_history(self):
|
||||
from calibre.gui2 import config
|
||||
config['viewer_search_history'] = []
|
||||
|
||||
def save_theme(self):
|
||||
themename, ok = QInputDialog.getText(self, _('Theme name'),
|
||||
_('Choose a name for this theme'))
|
||||
if not ok: return
|
||||
if not ok:
|
||||
return
|
||||
themename = unicode(themename).strip()
|
||||
if not themename: return
|
||||
if not themename:
|
||||
return
|
||||
c = config('')
|
||||
c.add_opt('theme_name_xxx', default=themename)
|
||||
self.save_options(c)
|
||||
@ -247,7 +255,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
def update_sample_colors(self):
|
||||
for x in ('text', 'background'):
|
||||
val = getattr(self, 'current_%s_color'%x)
|
||||
if not val: val = 'inherit' if x == 'text' else 'transparent'
|
||||
if not val:
|
||||
val = 'inherit' if x == 'text' else 'transparent'
|
||||
ss = 'QLabel { %s: %s }'%('background-color' if x == 'background'
|
||||
else 'color', val)
|
||||
getattr(self, '%s_color_sample'%x).setStyleSheet(ss)
|
||||
|
@ -68,7 +68,7 @@ QToolBox::tab:hover {
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>811</width>
|
||||
<height>352</height>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -240,8 +240,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>397</width>
|
||||
<height>232</height>
|
||||
<width>811</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -370,8 +370,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>176</height>
|
||||
<width>811</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -446,8 +446,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>76</height>
|
||||
<width>811</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -525,8 +525,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>120</height>
|
||||
<width>811</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -596,8 +596,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>151</height>
|
||||
<width>811</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -628,27 +628,34 @@ QToolBox::tab:hover {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="5" column="0">
|
||||
<widget class="QPushButton" name="clear_search_history_button">
|
||||
<property name="text">
|
||||
<string>Clear search history</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="opt_show_controls">
|
||||
<property name="text">
|
||||
<string>Show &controls in the viewer window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="opt_remember_window_size">
|
||||
<property name="text">
|
||||
<string>Remember last used &window size and layout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="opt_remember_current_page">
|
||||
<property name="text">
|
||||
<string>Remember the &current page when quitting</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_show_controls">
|
||||
<property name="text">
|
||||
<string>Show &controls in the viewer window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -940,6 +940,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
def do_config(self):
|
||||
self.view.config(self)
|
||||
self.load_theme_menu()
|
||||
from calibre.gui2 import config
|
||||
if not config['viewer_search_history']:
|
||||
self.search.clear_history()
|
||||
|
||||
def bookmark(self, *args):
|
||||
num = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user