Skip to content
Permalink
Browse files

[Plugin Manager] Minor gui tweaks

  • Loading branch information
borysiasty committed Jun 10, 2013
1 parent 039ae69 commit a3ea7ce1642e28f98674d6a2add647368424242d
@@ -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
@@ -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 )


@@ -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"]) \
@@ -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" ) );
}

@@ -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" )
{
@@ -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() ) );
@@ -943,6 +946,10 @@ void QgsPluginManager::setCurrentTab( int idx )
}
tbDetails->setHtml( welcomeHTML );
}

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


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



bool QgsPluginManager::hasAvailablePlugins( )
{
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
@@ -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();
@@ -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( );

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>857</width>
<width>812</width>
<height>507</height>
</rect>
</property>
@@ -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">
@@ -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">
@@ -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">
@@ -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">
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>

0 comments on commit a3ea7ce

Please sign in to comment.
You can’t perform that action at this time.