Fix donate button disappearing after connecting/disconnecting device. ALso remove special option ot hide donate button since the toolbar configuration can now be used to acheive that.

This commit is contained in:
Kovid Goyal 2010-08-24 13:01:42 -06:00
parent 215347679a
commit 1a38a4b35c
4 changed files with 49 additions and 60 deletions

View File

@ -93,8 +93,6 @@ def _config():
c.add_opt('default_send_to_device_action', default=None, c.add_opt('default_send_to_device_action', default=None,
help=_('Default action to perform when send to device button is ' help=_('Default action to perform when send to device button is '
'clicked')) 'clicked'))
c.add_opt('show_donate_button', default=True,
help='Show donation button')
c.add_opt('asked_library_thing_password', default=False, c.add_opt('asked_library_thing_password', default=False,
help='Asked library thing password at least once.') help='Asked library thing password at least once.')
c.add_opt('search_as_you_type', default=True, c.add_opt('search_as_you_type', default=True,

View File

@ -504,7 +504,6 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
idx = w.findText(self.db.prefs.get(x+'_restriction', '')) idx = w.findText(self.db.prefs.get(x+'_restriction', ''))
w.setCurrentIndex(0 if idx < 0 else idx) w.setCurrentIndex(0 if idx < 0 else idx)
self.opt_disable_animations.setChecked(config['disable_animations']) self.opt_disable_animations.setChecked(config['disable_animations'])
self.opt_show_donate_button.setChecked(config['show_donate_button'])
idx = 0 idx = 0
for i, x in enumerate([(_('Small'), 'small'), (_('Medium'), 'medium'), for i, x in enumerate([(_('Small'), 'small'), (_('Medium'), 'medium'),
(_('Large'), 'large')]): (_('Large'), 'large')]):
@ -928,7 +927,6 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
config['overwrite_author_title_metadata'] = self.opt_overwrite_author_title_metadata.isChecked() config['overwrite_author_title_metadata'] = self.opt_overwrite_author_title_metadata.isChecked()
config['enforce_cpu_limit'] = bool(self.opt_enforce_cpu_limit.isChecked()) config['enforce_cpu_limit'] = bool(self.opt_enforce_cpu_limit.isChecked())
config['disable_animations'] = bool(self.opt_disable_animations.isChecked()) config['disable_animations'] = bool(self.opt_disable_animations.isChecked())
config['show_donate_button'] = bool(self.opt_show_donate_button.isChecked())
gprefs['show_splash_screen'] = bool(self.show_splash_screen.isChecked()) gprefs['show_splash_screen'] = bool(self.show_splash_screen.isChecked())
for x in ('toolbar_icon_size', 'toolbar_text'): for x in ('toolbar_icon_size', 'toolbar_text'):
w = getattr(self, 'opt_'+x) w = getattr(self, 'opt_'+x)

View File

@ -109,7 +109,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page_3"> <widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -367,16 +367,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QCheckBox" name="roman_numerals">
<property name="text">
<string>Use &amp;Roman numerals for series number</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="opt_disable_animations"> <widget class="QCheckBox" name="opt_disable_animations">
<property name="toolTip"> <property name="toolTip">
@ -387,27 +377,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="systray_icon">
<property name="text">
<string>Enable system &amp;tray icon (needs restart)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="systray_notifications">
<property name="text">
<string>Show &amp;notifications in system tray</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="opt_show_donate_button">
<property name="text">
<string>Show &amp;donate button (restart)</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2"> <item row="11" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
@ -616,20 +585,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="8" column="1">
<widget class="QCheckBox" name="show_splash_screen">
<property name="text">
<string>Show &amp;splash screen at startup</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="sync_news">
<property name="text">
<string>Automatically send downloaded &amp;news to ebook reader</string>
</property>
</widget>
</item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QCheckBox" name="search_as_you_type"> <widget class="QCheckBox" name="search_as_you_type">
<property name="text"> <property name="text">
@ -640,7 +595,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="1">
<widget class="QCheckBox" name="roman_numerals">
<property name="text">
<string>Use &amp;Roman numerals for series</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="systray_icon">
<property name="text">
<string>Enable system &amp;tray icon (needs restart)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="show_avg_rating"> <widget class="QCheckBox" name="show_avg_rating">
<property name="text"> <property name="text">
<string>Show &amp;average ratings in the tags browser</string> <string>Show &amp;average ratings in the tags browser</string>
@ -651,12 +623,33 @@
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="sync_news">
<property name="text">
<string>Automatically send downloaded &amp;news to ebook reader</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="show_splash_screen">
<property name="text">
<string>Show &amp;splash screen at startup</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="separate_cover_flow"> <widget class="QCheckBox" name="separate_cover_flow">
<property name="text"> <property name="text">
<string>Show cover &amp;browser in a separate window (needs restart)</string> <string>Show cover &amp;browser in a separate window (needs restart)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QCheckBox" name="systray_notifications">
<property name="text">
<string>Show &amp;notifications in system tray</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View File

@ -15,7 +15,7 @@ from PyQt4.Qt import QIcon, Qt, QWidget, QToolBar, QSize, \
from calibre.constants import __appname__ from calibre.constants import __appname__
from calibre.gui2.search_box import SearchBox2, SavedSearchBox from calibre.gui2.search_box import SearchBox2, SavedSearchBox
from calibre.gui2.throbber import ThrobbingButton from calibre.gui2.throbber import ThrobbingButton
from calibre.gui2 import config, gprefs from calibre.gui2 import gprefs
from calibre.gui2.widgets import ComboBoxWithHelp from calibre.gui2.widgets import ComboBoxWithHelp
from calibre import human_readable from calibre import human_readable
@ -207,14 +207,11 @@ class ToolBar(QToolBar): # {{{
self.setOrientation(Qt.Horizontal) self.setOrientation(Qt.Horizontal)
self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea) self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea)
self.setStyleSheet('QToolButton:checked { font-weight: bold }') self.setStyleSheet('QToolButton:checked { font-weight: bold }')
self.donate = donate self.donate_button = donate
self.apply_settings() self.apply_settings()
self.location_manager = location_manager self.location_manager = location_manager
self.location_manager.locations_changed.connect(self.build_bar) self.location_manager.locations_changed.connect(self.build_bar)
self.d_widget = QWidget()
self.d_widget.setLayout(QVBoxLayout())
self.d_widget.layout().addWidget(donate)
donate.setAutoRaise(True) donate.setAutoRaise(True)
donate.setCursor(Qt.PointingHandCursor) donate.setCursor(Qt.PointingHandCursor)
self.build_bar() self.build_bar()
@ -228,7 +225,7 @@ class ToolBar(QToolBar): # {{{
if gprefs.get('toolbar_text', 'auto') == 'never': if gprefs.get('toolbar_text', 'auto') == 'never':
style = Qt.ToolButtonIconOnly style = Qt.ToolButtonIconOnly
self.setToolButtonStyle(style) self.setToolButtonStyle(style)
self.donate.set_normal_icon_size(sz, sz) self.donate_button.set_normal_icon_size(sz, sz)
def contextMenuEvent(self, *args): def contextMenuEvent(self, *args):
pass pass
@ -247,7 +244,10 @@ class ToolBar(QToolBar): # {{{
for ac in self.location_manager.available_actions: for ac in self.location_manager.available_actions:
self.addAction(ac) self.addAction(ac)
self.setup_tool_button(ac, QToolButton.MenuButtonPopup) self.setup_tool_button(ac, QToolButton.MenuButtonPopup)
elif what == 'Donate' and config['show_donate_button']: elif what == 'Donate':
self.d_widget = QWidget()
self.d_widget.setLayout(QVBoxLayout())
self.d_widget.layout().addWidget(self.donate_button)
self.addWidget(self.d_widget) self.addWidget(self.d_widget)
elif what in self.gui.iactions: elif what in self.gui.iactions:
action = self.gui.iactions[what] action = self.gui.iactions[what]
@ -278,7 +278,7 @@ class ToolBar(QToolBar): # {{{
# }}} # }}}
class MainWindowMixin(object): class MainWindowMixin(object): # {{{
def __init__(self, db): def __init__(self, db):
self.setObjectName('MainWindow') self.setObjectName('MainWindow')
@ -304,7 +304,7 @@ class MainWindowMixin(object):
l = self.centralwidget.layout() l = self.centralwidget.layout()
l.addWidget(self.search_bar) l.addWidget(self.search_bar)
# }}}