Skip to content

Commit

Permalink
[Plugin Manager] Minor gui tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty committed Jun 10, 2013
1 parent 039ae69 commit a3ea7ce
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 18 deletions.
4 changes: 2 additions & 2 deletions python/pyplugin_installer/installer.py
Expand Up @@ -161,7 +161,7 @@ def checkingDone(self):
tabIndex = 2 # tab 2 contains upgradeable plugins
# finally set the notify label
if status:
self.statusLabel.setText(u' <a href="#%d">%s</a> ' % (tabIndex,status) )
self.statusLabel.setText(u' <a href="%d">%s</a> ' % (tabIndex,status) )
else:
iface.mainWindow().statusBar().removeWidget(self.statusLabel)
self.statusLabel = None
Expand Down Expand Up @@ -256,7 +256,7 @@ def showPluginManagerWhenReady(self, * params):
if len( params ) == 1:
indx = unicode(params[0])
if indx.isdigit() and int(indx) > -1 and int(indx) < 7:
tabIndex = indx
tabIndex = int(indx)
iface.pluginManagerInterface().showPluginManager( tabIndex )


Expand Down
3 changes: 2 additions & 1 deletion python/pyplugin_installer/installer_data.py
Expand Up @@ -729,7 +729,8 @@ def rebuild(self):
settings = QSettings()
allowExperimental = settings.value(settingsGroup+"/allowExperimental", False, type=bool)
for i in self.repoCache.values():
for plugin in i:
for j in i:
plugin=j.copy() # do not update repoCache elements!
key = plugin["id"]
# check if the plugin is allowed and if there isn't any better one added already.
if (allowExperimental or not plugin["experimental"]) \
Expand Down
35 changes: 31 additions & 4 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -509,9 +509,9 @@ void QgsPluginManager::reloadModelData()
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
// TODO: implement better sort method instead of these dummy -Z statuses
mModelPlugins->appendRow( createSpacerItem( tr( "Reinstallable", "category: plugins that are installed and available" ) , "installedZ" ) );
if ( hasUpgradeablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Upgradeable", "category: plugins that are installed and there is a newer version available" ), "upgradeableZ") );
mModelPlugins->appendRow( createSpacerItem( tr( "Only locally available", "category: plugins that are only locally available" ), "orphanZ" ) );
if ( hasReinstallablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Reinstallable", "category: plugins that are installed and available" ) , "installedZ" ) );
if ( hasUpgradeablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Upgradeable", "category: plugins that are installed and there is a newer version available" ), "upgradeableZ") );
if ( hasNewerPlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Downgradeable", "category: plugins that are installed and there is an OLDER version available" ), "newerZ" ) );
}

Expand Down Expand Up @@ -708,10 +708,12 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )

tbDetails->setHtml( html );

// Set buttonInstall text
// Set buttonInstall text (and sometimes focus)
buttonInstall->setDefault( false );
if ( metadata->value( "status" ) == "upgradeable" )
{
buttonInstall->setText( tr( "Upgrade plugin" ) );
buttonInstall->setDefault( true );
}
else if ( metadata->value( "status" ) == "newer" )
{
Expand Down Expand Up @@ -797,9 +799,10 @@ void QgsPluginManager::clearRepositoryList()
//! Add repository to the repository listWidget
void QgsPluginManager::addToRepositoryList( QMap<QString, QString> repository )
{
// If the item is second on the tree, add a context menu
// If it's the second item on the tree, change the button text to plural form and add the filter context menu
if ( buttonRefreshRepos->isEnabled() && treeRepositories->actions().count() < 1 )
{
buttonRefreshRepos->setText( tr("Reload all repositories") );
QAction* actionEnableThisRepositoryOnly = new QAction( tr( "Only show plugins from selected repository" ), treeRepositories );
treeRepositories->addAction( actionEnableThisRepositoryOnly );
connect( actionEnableThisRepositoryOnly, SIGNAL( triggered() ), this, SLOT( setRepositoryFilter() ) );
Expand Down Expand Up @@ -943,6 +946,10 @@ void QgsPluginManager::setCurrentTab( int idx )
}
tbDetails->setHtml( welcomeHTML );
}

// disable buttons
buttonInstall->setEnabled( false );
buttonUninstall->setEnabled( false );
}


Expand Down Expand Up @@ -1199,6 +1206,7 @@ bool QgsPluginManager::isPluginLoaded( QString key )
}



bool QgsPluginManager::hasAvailablePlugins( )
{
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
Expand All @@ -1215,6 +1223,25 @@ bool QgsPluginManager::hasAvailablePlugins( )
}



bool QgsPluginManager::hasReinstallablePlugins( )
{
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
it != mPlugins.end();
it++ )
{
// plugins marked as "installed" are available for download (otherwise they are marked "orphans")
if ( it->value( "status" ) == "installed" )
{
return true;
}
}

return false;
}



bool QgsPluginManager::hasUpgradeablePlugins( )
{
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
Expand Down
3 changes: 3 additions & 0 deletions src/app/pluginmanager/qgspluginmanager.h
Expand Up @@ -169,6 +169,9 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Return true if there are plugins available for download in the metadata registry
bool hasAvailablePlugins( );

//! Return true if there are installed plugins also available for download in the metadata registry
bool hasReinstallablePlugins( );

//! Return true if there are upgradeable plugins in metadata the registry
bool hasUpgradeablePlugins( );

Expand Down
25 changes: 14 additions & 11 deletions src/ui/qgspluginmanagerbase.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>857</width>
<width>812</width>
<height>507</height>
</rect>
</property>
Expand Down Expand Up @@ -124,7 +124,7 @@
<string>Get more</string>
</property>
<property name="toolTip">
<string>Uninstalled plugins available for download</string>
<string>Not installed plugins available for download</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand All @@ -139,7 +139,7 @@
<string>Upgradeable</string>
</property>
<property name="toolTip">
<string>Installed plugins with newer version available</string>
<string>Installed plugins with more recent version available for download</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand All @@ -154,7 +154,7 @@
<string>New</string>
</property>
<property name="toolTip">
<string>New plugins seens for thw first time</string>
<string>Not installed plugins seen for the first time</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand All @@ -169,7 +169,7 @@
<string>Invalid</string>
</property>
<property name="toolTip">
<string>Broken or uncompatible installed plugins</string>
<string>Broken and incompatible installed plugins</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand Down Expand Up @@ -398,7 +398,7 @@
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
Expand Down Expand Up @@ -442,8 +442,7 @@
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(244, 244, 244);
padding: 0px</string>
<string notr="true">padding: 0px</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -634,7 +633,7 @@ padding: 0px</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; If this function is enabled, QGIS will inform you whenever a new plugin or plugin update is available. Otherwise, fetching repositories will be performed during opening the Plugin Manager window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; If this function is enabled, QGIS will inform you whenever a new plugin or plugin update is available. Otherwise, fetching repositories will be performed during opening of the Plugin Manager window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down Expand Up @@ -790,8 +789,12 @@ p, li { white-space: pre-wrap; }
</property>
<item>
<widget class="QPushButton" name="buttonRefreshRepos">
<property name="toolTip">
<string>Reload repository contents
(useful when you uploaded a plugin there)</string>
</property>
<property name="text">
<string>Reload all repositories</string>
<string>Reload repository</string>
</property>
</widget>
</item>
Expand All @@ -811,7 +814,7 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="QPushButton" name="buttonAddRep">
<property name="toolTip">
<string>Add a new plugin repository</string>
<string>Configure an additional plugin repository</string>
</property>
<property name="whatsThis">
<string>Add a new plugin repository</string>
Expand Down

0 comments on commit a3ea7ce

Please sign in to comment.