Skip to content

Commit fccf9ac

Browse files
committed
mark experimental plugins in installer (fix #5980)
1 parent 358c638 commit fccf9ac

File tree

4 files changed

+45
-18
lines changed

4 files changed

+45
-18
lines changed

python/plugins/plugin_installer/installer_gui.py

+38-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
23
"""
34
Copyright (C) 2007-2008 Matthew Perry
45
Copyright (C) 2008-2010 Borys Jurgiel
@@ -12,17 +13,20 @@
1213
* *
1314
***************************************************************************/
1415
"""
15-
16+
import sys
17+
import time
1618

1719
from PyQt4.QtCore import *
1820
from PyQt4.QtGui import *
21+
1922
from qgis.core import QgsApplication, QgsContextHelp
20-
import sys, time
23+
2124
from ui_qgsplugininstallerfetchingbase import Ui_QgsPluginInstallerFetchingDialogBase
2225
from ui_qgsplugininstallerinstallingbase import Ui_QgsPluginInstallerInstallingDialogBase
2326
from ui_qgsplugininstallerrepositorybase import Ui_QgsPluginInstallerRepositoryDetailsDialogBase
2427
from ui_qgsplugininstallerpluginerrorbase import Ui_QgsPluginInstallerPluginErrorDialogBase
2528
from ui_qgsplugininstallerbase import Ui_QgsPluginInstallerDialogBase
29+
2630
from installer_data import *
2731

2832
try:
@@ -475,16 +479,22 @@ def addItem(p):
475479
repository = self.tr("only locally available")
476480
else:
477481
repository = p["repository"]
478-
a = QTreeWidgetItem(self.treePlugins)
482+
a = QgsPluginTreeItem(self.treePlugins)
483+
if p["experimental"]:
484+
a.setIcon(0, QIcon(":/plugins/installer/pluginExperimental.png"))
485+
a.setToolTip(0, self.tr("Experimental plugin. Use at own risk"))
486+
a.setData(0, Qt.UserRole, QVariant(0))
487+
else:
488+
a.setData(0, Qt.UserRole, QVariant(1))
479489
if p["error"]:
480-
a.setText(0,statuses[p["error"]])
490+
a.setText(1,statuses[p["error"]])
481491
else:
482-
a.setText(0,statuses[p["status"]])
483-
a.setToolTip(0,statusTip)
484-
a.setText(1,p["name"])
485-
a.setText(2,ver)
486-
a.setToolTip(2,verTip)
487-
a.setText(3,desc)
492+
a.setText(1,statuses[p["status"]])
493+
a.setToolTip(1,statusTip)
494+
a.setText(2,p["name"])
495+
a.setText(3,ver)
496+
a.setToolTip(3,verTip)
497+
a.setText(4,desc)
488498
# split the tooltip into multiple lines when they are too long
489499
tmp = ""
490500
splitTip = ""
@@ -494,16 +504,16 @@ def addItem(p):
494504
else:
495505
splitTip += tmp + "\n"
496506
tmp = word
497-
a.setToolTip(3, splitTip+tmp)
498-
a.setText(4,p["author"])
507+
a.setToolTip(4, splitTip+tmp)
508+
a.setText(5,p["author"])
499509
if p["homepage"]:
500-
a.setToolTip(4,p["homepage"])
510+
a.setToolTip(5,p["homepage"])
501511
else:
502-
a.setToolTip(4,"")
503-
a.setText(5,repository)
504-
a.setToolTip(5,p["url"])
512+
a.setToolTip(6,"")
513+
a.setText(6,repository)
514+
a.setToolTip(6,p["url"])
505515
# set fonts and colors
506-
for i in [0,1,2,3,4,5]:
516+
for i in [0,1,2,3,4,5,6]:
507517
if p["error"]:
508518
a.setForeground(i,QBrush(QColor(Qt.red)))
509519
if p["status"] in ["new","upgradeable"] or p["error"]:
@@ -922,3 +932,14 @@ def reject(self):
922932
plugins.updateSeenPluginsList()
923933
QDialog.reject(self)
924934
# --- /class QgsPluginInstallerDialog ------------------------------------------------------------------------ #
935+
936+
class QgsPluginTreeItem(QTreeWidgetItem):
937+
def __init__(self, parent=None):
938+
QTreeWidgetItem.__init__(self, parent)
939+
940+
def __lt__(self, otherItem):
941+
column = self.treeWidget().sortColumn()
942+
if column == 0:
943+
return self.data(column, Qt.UserRole).toInt()[0] < otherItem.data(column, Qt.UserRole).toInt()[0]
944+
else:
945+
return self.text(column) < otherItem.text(column)
Loading

python/plugins/plugin_installer/qgsplugininstallerbase.ui

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<x>0</x>
99
<y>0</y>
1010
<width>799</width>
11-
<height>382</height>
11+
<height>409</height>
1212
</rect>
1313
</property>
1414
<property name="windowTitle">
@@ -203,6 +203,11 @@
203203
<property name="allColumnsShowFocus">
204204
<bool>true</bool>
205205
</property>
206+
<column>
207+
<property name="text">
208+
<string>State</string>
209+
</property>
210+
</column>
206211
<column>
207212
<property name="text">
208213
<string>Status</string>

python/plugins/plugin_installer/resources.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
<file>repoDisabled.png</file>
66
<file>repoUnavailable.png</file>
77
<file>repoConnected.png</file>
8+
<file>pluginExperimental.png</file>
89
</qresource>
910
</RCC>

0 commit comments

Comments
 (0)