This commit is contained in:
Kovid Goyal 2013-06-19 10:02:20 +05:30
parent 45704e36c5
commit ccaa960edf

View File

@ -254,7 +254,7 @@ Platforms: Windows, OSX, Linux; History: Yes;</span></i></li>
return self.installed_version is not None return self.installed_version is not None
def is_upgrade_available(self): def is_upgrade_available(self):
return self.is_installed() and (self.installed_version < self.available_version \ return self.is_installed() and (self.installed_version < self.available_version
or self.is_deprecated) or self.is_deprecated)
def is_valid_platform(self): def is_valid_platform(self):
@ -317,7 +317,7 @@ class DisplayPluginModel(QAbstractTableModel):
def data(self, index, role): def data(self, index, role):
if not index.isValid(): if not index.isValid():
return NONE; return NONE
row, col = index.row(), index.column() row, col = index.row(), index.column()
if row < 0 or row >= self.rowCount(): if row < 0 or row >= self.rowCount():
return NONE return NONE
@ -429,11 +429,11 @@ class DisplayPluginModel(QAbstractTableModel):
return QVariant(_('This plugin has been deprecated and should be uninstalled')+'\n\n'+ return QVariant(_('This plugin has been deprecated and should be uninstalled')+'\n\n'+
_('Right-click to see more options')) _('Right-click to see more options'))
if not display_plugin.is_valid_platform(): if not display_plugin.is_valid_platform():
return QVariant(_('This plugin can only be installed on: %s') % \ return QVariant(_('This plugin can only be installed on: %s') %
', '.join(display_plugin.platforms)+'\n\n'+ ', '.join(display_plugin.platforms)+'\n\n'+
_('Right-click to see more options')) _('Right-click to see more options'))
if numeric_version < display_plugin.calibre_required_version: if numeric_version < display_plugin.calibre_required_version:
return QVariant(_('You must upgrade to at least Calibre %s before installing this plugin') % \ return QVariant(_('You must upgrade to at least Calibre %s before installing this plugin') %
self._get_display_version(display_plugin.calibre_required_version)+'\n\n'+ self._get_display_version(display_plugin.calibre_required_version)+'\n\n'+
_('Right-click to see more options')) _('Right-click to see more options'))
if display_plugin.installed_version < display_plugin.available_version: if display_plugin.installed_version < display_plugin.available_version:
@ -687,7 +687,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
def _install_clicked(self): def _install_clicked(self):
display_plugin = self._selected_display_plugin() display_plugin = self._selected_display_plugin()
if not question_dialog(self, _('Install %s')%display_plugin.name, '<p>' + \ if not question_dialog(self, _('Install %s')%display_plugin.name, '<p>' +
_('Installing plugins is a <b>security risk</b>. ' _('Installing plugins is a <b>security risk</b>. '
'Plugins can contain a virus/malware. ' 'Plugins can contain a virus/malware. '
'Only install it if you got it from a trusted source.' 'Only install it if you got it from a trusted source.'
@ -886,3 +886,4 @@ class PluginUpdaterDialog(SizePersistedDialog):
pt.write(raw) pt.write(raw)
pt.close() pt.close()
return pt.name return pt.name