Add option in preferences / Look & Feel to display the layout buttons directly on the status bar. Default is False.

This commit is contained in:
Charles Haley 2017-06-18 10:06:43 +02:00
parent af6d043375
commit a763d7336c
4 changed files with 25 additions and 9 deletions

View File

@ -123,6 +123,7 @@ def create_defs():
defs['tag_browser_old_look'] = False
defs['tag_browser_hide_empty_categories'] = False
defs['book_list_tooltips'] = True
defs['show_layout_buttons'] = False
defs['bd_show_cover'] = True
defs['bd_overlay_cover_size'] = False
defs['tags_browser_category_icons'] = {}

View File

@ -587,15 +587,22 @@ class LayoutMixin(object): # {{{
QToolButton:checked { background: rgba(0, 0, 0, 25%); }
''')
self.status_bar.addPermanentWidget(button)
self.layout_button = b = QToolButton(self)
b.setAutoRaise(True), b.setCursor(Qt.PointingHandCursor)
b.setPopupMode(b.InstantPopup)
b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
b.setText(_('Layout')), b.setIcon(QIcon(I('config.png')))
b.setMenu(LayoutMenu(self))
b.setToolTip(_(
'Show and hide various parts of the calibre main window'))
self.status_bar.addPermanentWidget(b)
if gprefs['show_layout_buttons']:
from calibre.utils.icu import primary_sort_key
for b in sorted(self.layout_buttons, key=lambda b: primary_sort_key(b.label)):
print(b.label)
b.setVisible(True)
self.status_bar.addPermanentWidget(b)
else:
self.layout_button = b = QToolButton(self)
b.setAutoRaise(True), b.setCursor(Qt.PointingHandCursor)
b.setPopupMode(b.InstantPopup)
b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
b.setText(_('Layout')), b.setIcon(QIcon(I('config.png')))
b.setMenu(LayoutMenu(self))
b.setToolTip(_(
'Show and hide various parts of the calibre main window'))
self.status_bar.addPermanentWidget(b)
self.status_bar.addPermanentWidget(self.jobs_button)
self.setStatusBar(self.status_bar)
self.status_bar.update_label.linkActivated.connect(self.update_link_clicked)

View File

@ -348,6 +348,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
self.opt_hidpi.setVisible(False), self.label_hidpi.setVisible(False)
r('ui_style', gprefs, restart_required=True, choices=[(_('System default'), 'system'), (_('calibre style'), 'calibre')])
r('book_list_tooltips', gprefs)
r('show_layout_buttons', gprefs, restart_required=True)
r('row_numbers_in_book_list', gprefs)
r('tag_browser_old_look', gprefs, restart_required=True)
r('tag_browser_hide_empty_categories', gprefs)

View File

@ -126,6 +126,13 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="opt_show_layout_buttons">
<property name="text">
<string>Show &amp;layout buttons in the status bar (needs restart)</string>
</property>
</widget>
</item>
<item row="12" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">