Skip to content

Commit a3ea7ce

Browse files
committedJun 10, 2013
[Plugin Manager] Minor gui tweaks
1 parent 039ae69 commit a3ea7ce

File tree

5 files changed

+52
-18
lines changed

5 files changed

+52
-18
lines changed
 

‎python/pyplugin_installer/installer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def checkingDone(self):
161161
tabIndex = 2 # tab 2 contains upgradeable plugins
162162
# finally set the notify label
163163
if status:
164-
self.statusLabel.setText(u' <a href="#%d">%s</a> ' % (tabIndex,status) )
164+
self.statusLabel.setText(u' <a href="%d">%s</a> ' % (tabIndex,status) )
165165
else:
166166
iface.mainWindow().statusBar().removeWidget(self.statusLabel)
167167
self.statusLabel = None
@@ -256,7 +256,7 @@ def showPluginManagerWhenReady(self, * params):
256256
if len( params ) == 1:
257257
indx = unicode(params[0])
258258
if indx.isdigit() and int(indx) > -1 and int(indx) < 7:
259-
tabIndex = indx
259+
tabIndex = int(indx)
260260
iface.pluginManagerInterface().showPluginManager( tabIndex )
261261

262262

‎python/pyplugin_installer/installer_data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ def rebuild(self):
729729
settings = QSettings()
730730
allowExperimental = settings.value(settingsGroup+"/allowExperimental", False, type=bool)
731731
for i in self.repoCache.values():
732-
for plugin in i:
732+
for j in i:
733+
plugin=j.copy() # do not update repoCache elements!
733734
key = plugin["id"]
734735
# check if the plugin is allowed and if there isn't any better one added already.
735736
if (allowExperimental or not plugin["experimental"]) \

‎src/app/pluginmanager/qgspluginmanager.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ void QgsPluginManager::reloadModelData()
509509
if ( mPythonUtils && mPythonUtils->isEnabled() )
510510
{
511511
// TODO: implement better sort method instead of these dummy -Z statuses
512-
mModelPlugins->appendRow( createSpacerItem( tr( "Reinstallable", "category: plugins that are installed and available" ) , "installedZ" ) );
513-
if ( hasUpgradeablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Upgradeable", "category: plugins that are installed and there is a newer version available" ), "upgradeableZ") );
514512
mModelPlugins->appendRow( createSpacerItem( tr( "Only locally available", "category: plugins that are only locally available" ), "orphanZ" ) );
513+
if ( hasReinstallablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Reinstallable", "category: plugins that are installed and available" ) , "installedZ" ) );
514+
if ( hasUpgradeablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Upgradeable", "category: plugins that are installed and there is a newer version available" ), "upgradeableZ") );
515515
if ( hasNewerPlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Downgradeable", "category: plugins that are installed and there is an OLDER version available" ), "newerZ" ) );
516516
}
517517

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

709709
tbDetails->setHtml( html );
710710

711-
// Set buttonInstall text
711+
// Set buttonInstall text (and sometimes focus)
712+
buttonInstall->setDefault( false );
712713
if ( metadata->value( "status" ) == "upgradeable" )
713714
{
714715
buttonInstall->setText( tr( "Upgrade plugin" ) );
716+
buttonInstall->setDefault( true );
715717
}
716718
else if ( metadata->value( "status" ) == "newer" )
717719
{
@@ -797,9 +799,10 @@ void QgsPluginManager::clearRepositoryList()
797799
//! Add repository to the repository listWidget
798800
void QgsPluginManager::addToRepositoryList( QMap<QString, QString> repository )
799801
{
800-
// If the item is second on the tree, add a context menu
802+
// If it's the second item on the tree, change the button text to plural form and add the filter context menu
801803
if ( buttonRefreshRepos->isEnabled() && treeRepositories->actions().count() < 1 )
802804
{
805+
buttonRefreshRepos->setText( tr("Reload all repositories") );
803806
QAction* actionEnableThisRepositoryOnly = new QAction( tr( "Only show plugins from selected repository" ), treeRepositories );
804807
treeRepositories->addAction( actionEnableThisRepositoryOnly );
805808
connect( actionEnableThisRepositoryOnly, SIGNAL( triggered() ), this, SLOT( setRepositoryFilter() ) );
@@ -943,6 +946,10 @@ void QgsPluginManager::setCurrentTab( int idx )
943946
}
944947
tbDetails->setHtml( welcomeHTML );
945948
}
949+
950+
// disable buttons
951+
buttonInstall->setEnabled( false );
952+
buttonUninstall->setEnabled( false );
946953
}
947954

948955

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

12011208

1209+
12021210
bool QgsPluginManager::hasAvailablePlugins( )
12031211
{
12041212
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
@@ -1215,6 +1223,25 @@ bool QgsPluginManager::hasAvailablePlugins( )
12151223
}
12161224

12171225

1226+
1227+
bool QgsPluginManager::hasReinstallablePlugins( )
1228+
{
1229+
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();
1230+
it != mPlugins.end();
1231+
it++ )
1232+
{
1233+
// plugins marked as "installed" are available for download (otherwise they are marked "orphans")
1234+
if ( it->value( "status" ) == "installed" )
1235+
{
1236+
return true;
1237+
}
1238+
}
1239+
1240+
return false;
1241+
}
1242+
1243+
1244+
12181245
bool QgsPluginManager::hasUpgradeablePlugins( )
12191246
{
12201247
for ( QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.begin();

‎src/app/pluginmanager/qgspluginmanager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
169169
//! Return true if there are plugins available for download in the metadata registry
170170
bool hasAvailablePlugins( );
171171

172+
//! Return true if there are installed plugins also available for download in the metadata registry
173+
bool hasReinstallablePlugins( );
174+
172175
//! Return true if there are upgradeable plugins in metadata the registry
173176
bool hasUpgradeablePlugins( );
174177

‎src/ui/qgspluginmanagerbase.ui

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>857</width>
9+
<width>812</width>
1010
<height>507</height>
1111
</rect>
1212
</property>
@@ -124,7 +124,7 @@
124124
<string>Get more</string>
125125
</property>
126126
<property name="toolTip">
127-
<string>Uninstalled plugins available for download</string>
127+
<string>Not installed plugins available for download</string>
128128
</property>
129129
<property name="icon">
130130
<iconset resource="../../images/images.qrc">
@@ -139,7 +139,7 @@
139139
<string>Upgradeable</string>
140140
</property>
141141
<property name="toolTip">
142-
<string>Installed plugins with newer version available</string>
142+
<string>Installed plugins with more recent version available for download</string>
143143
</property>
144144
<property name="icon">
145145
<iconset resource="../../images/images.qrc">
@@ -154,7 +154,7 @@
154154
<string>New</string>
155155
</property>
156156
<property name="toolTip">
157-
<string>New plugins seens for thw first time</string>
157+
<string>Not installed plugins seen for the first time</string>
158158
</property>
159159
<property name="icon">
160160
<iconset resource="../../images/images.qrc">
@@ -169,7 +169,7 @@
169169
<string>Invalid</string>
170170
</property>
171171
<property name="toolTip">
172-
<string>Broken or uncompatible installed plugins</string>
172+
<string>Broken and incompatible installed plugins</string>
173173
</property>
174174
<property name="icon">
175175
<iconset resource="../../images/images.qrc">
@@ -398,7 +398,7 @@
398398
<bool>false</bool>
399399
</property>
400400
<property name="alternatingRowColors">
401-
<bool>false</bool>
401+
<bool>true</bool>
402402
</property>
403403
<property name="selectionMode">
404404
<enum>QAbstractItemView::SingleSelection</enum>
@@ -442,8 +442,7 @@
442442
<bool>false</bool>
443443
</property>
444444
<property name="styleSheet">
445-
<string notr="true">background-color: rgb(244, 244, 244);
446-
padding: 0px</string>
445+
<string notr="true">padding: 0px</string>
447446
</property>
448447
<property name="textInteractionFlags">
449448
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@@ -634,7 +633,7 @@ padding: 0px</string>
634633
&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;
635634
p, li { white-space: pre-wrap; }
636635
&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;
637-
&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>
636+
&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>
638637
</property>
639638
<property name="wordWrap">
640639
<bool>true</bool>
@@ -790,8 +789,12 @@ p, li { white-space: pre-wrap; }
790789
</property>
791790
<item>
792791
<widget class="QPushButton" name="buttonRefreshRepos">
792+
<property name="toolTip">
793+
<string>Reload repository contents
794+
(useful when you uploaded a plugin there)</string>
795+
</property>
793796
<property name="text">
794-
<string>Reload all repositories</string>
797+
<string>Reload repository</string>
795798
</property>
796799
</widget>
797800
</item>
@@ -811,7 +814,7 @@ p, li { white-space: pre-wrap; }
811814
<item>
812815
<widget class="QPushButton" name="buttonAddRep">
813816
<property name="toolTip">
814-
<string>Add a new plugin repository</string>
817+
<string>Configure an additional plugin repository</string>
815818
</property>
816819
<property name="whatsThis">
817820
<string>Add a new plugin repository</string>

0 commit comments

Comments
 (0)
Please sign in to comment.