From 3dc7f119fd4f8f65434cf2fc69470cb7b3211fd3 Mon Sep 17 00:00:00 2001 From: kiwidude Date: Tue, 14 Jun 2011 17:35:42 +0100 Subject: [PATCH] Rename/add button to Preferences->Plugins to allow check for new plugins as well as for updates --- src/calibre/gui2/preferences/plugins.py | 12 ++++++++---- src/calibre/gui2/preferences/plugins.ui | 13 ++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index c98906e79a..a8d787dedb 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -7,6 +7,7 @@ __docformat__ = 'restructuredtext en' import textwrap, os from collections import OrderedDict +from functools import partial from PyQt4.Qt import Qt, QModelIndex, QAbstractItemModel, QVariant, QIcon, \ QBrush @@ -217,7 +218,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.customize_plugin_button.clicked.connect(self.customize_plugin) self.remove_plugin_button.clicked.connect(self.remove_plugin) self.button_plugin_add.clicked.connect(self.add_plugin) - self.button_plugin_updates.clicked.connect(self.update_plugins) + self.button_plugin_updates.clicked.connect(partial(self.update_plugins, not_installed=False)) + self.button_plugin_new.clicked.connect(partial(self.update_plugins, not_installed=True)) self.search.initialize('plugin_search_history', help_text=_('Search for plugin')) self.search.search.connect(self.find) @@ -354,9 +356,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): plugin.name + _(' cannot be removed. It is a ' 'builtin plugin. Try disabling it instead.')).exec_() - def update_plugins(self): - from calibre.gui2.dialogs.plugin_updater import PluginUpdaterDialog - d = PluginUpdaterDialog(self.gui) + def update_plugins(self, not_installed=False): + from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog, + FILTER_UPDATE_AVAILABLE, FILTER_NOT_INSTALLED) + mode = FILTER_NOT_INSTALLED if not_installed else FILTER_UPDATE_AVAILABLE + d = PluginUpdaterDialog(self.gui, initial_filter=mode) d.exec_() self._plugin_model.populate() self._plugin_model.reset() diff --git a/src/calibre/gui2/preferences/plugins.ui b/src/calibre/gui2/preferences/plugins.ui index f67d1aa0e0..e372c7616b 100644 --- a/src/calibre/gui2/preferences/plugins.ui +++ b/src/calibre/gui2/preferences/plugins.ui @@ -128,7 +128,7 @@ - &Plugin updates + &Check for plugin updates @@ -136,6 +136,17 @@ + + + + &Get new plugins + + + + :/images/plugins/plugin_new.png:/images/plugins/plugin_new.png + + +