mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-24 02:17:51 -04:00
Only show the Sort button on the search bar if the Sort By action has not been added to the search bar by the user. Fixes #2138770 [[Enhancement] Sort By - List view](https://bugs.launchpad.net/calibre/+bug/2138770)
This commit is contained in:
parent
3e69c33552
commit
6c63a1fa3e
@ -650,6 +650,7 @@ class SearchToolBar(QHBoxLayout):
|
||||
QHBoxLayout.__init__(self)
|
||||
self.search_tool_bar_widgets = []
|
||||
self.gui = gui
|
||||
self.has_sort_by_button = False
|
||||
self.donate_button = None
|
||||
|
||||
def init_bar(self, actions):
|
||||
@ -661,6 +662,7 @@ class SearchToolBar(QHBoxLayout):
|
||||
|
||||
self.search_tool_bar_widgets = []
|
||||
self.search_tool_bar_actions = []
|
||||
self.has_sort_by_button = False
|
||||
for what in gprefs['action-layout-searchbar']:
|
||||
if what is None:
|
||||
frame = QFrame()
|
||||
@ -672,6 +674,8 @@ class SearchToolBar(QHBoxLayout):
|
||||
self.search_tool_bar_widgets.append(frame)
|
||||
self.search_tool_bar_actions.append(None)
|
||||
elif what in self.gui.iactions:
|
||||
if what == 'Sort By':
|
||||
self.has_sort_by_button = True
|
||||
act = self.gui.iactions[what]
|
||||
qact = act.qaction
|
||||
tb = RightClickButton()
|
||||
|
||||
@ -298,7 +298,7 @@ class AlternateViewsButtons(LayoutButton): # {{{
|
||||
if btn.isChecked():
|
||||
btn.update_state(False)
|
||||
self.gui.library_view.alternate_views.show_view(self.view_name if show else None)
|
||||
self.gui.sort_button.setVisible(show)
|
||||
self.gui.show_sort_button_for_alternate_view(show)
|
||||
self.gui.group_by_button.setVisible(self.needs_group_by and show)
|
||||
AlternateViewsButtons.ignore_toggles = False
|
||||
# }}}
|
||||
|
||||
@ -399,4 +399,9 @@ class MainWindowMixin: # {{{
|
||||
smw.setText(_('<h2>Shutting down</h2><div>') + message)
|
||||
# Force processing the events needed to show the message
|
||||
QCoreApplication.processEvents()
|
||||
|
||||
def show_sort_button_for_alternate_view(self, show: bool = True) -> None:
|
||||
if self.bars_manager.search_tool_bar.has_sort_by_button:
|
||||
show = False
|
||||
self.sort_button.setVisible(show)
|
||||
# }}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user