Skip to content
Permalink
Browse files

mark experimental plugins in installer (fix #5980)

  • Loading branch information
alexbruy committed Oct 7, 2012
1 parent 358c638 commit fccf9ac5d00e326a9b66f314524fde69e438e7e9
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2010 Borys Jurgiel
@@ -12,17 +13,20 @@
* *
***************************************************************************/
"""

import sys
import time

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsApplication, QgsContextHelp
import sys, time

from ui_qgsplugininstallerfetchingbase import Ui_QgsPluginInstallerFetchingDialogBase
from ui_qgsplugininstallerinstallingbase import Ui_QgsPluginInstallerInstallingDialogBase
from ui_qgsplugininstallerrepositorybase import Ui_QgsPluginInstallerRepositoryDetailsDialogBase
from ui_qgsplugininstallerpluginerrorbase import Ui_QgsPluginInstallerPluginErrorDialogBase
from ui_qgsplugininstallerbase import Ui_QgsPluginInstallerDialogBase

from installer_data import *

try:
@@ -475,16 +479,22 @@ def addItem(p):
repository = self.tr("only locally available")
else:
repository = p["repository"]
a = QTreeWidgetItem(self.treePlugins)
a = QgsPluginTreeItem(self.treePlugins)
if p["experimental"]:
a.setIcon(0, QIcon(":/plugins/installer/pluginExperimental.png"))
a.setToolTip(0, self.tr("Experimental plugin. Use at own risk"))
a.setData(0, Qt.UserRole, QVariant(0))
else:
a.setData(0, Qt.UserRole, QVariant(1))
if p["error"]:
a.setText(0,statuses[p["error"]])
a.setText(1,statuses[p["error"]])
else:
a.setText(0,statuses[p["status"]])
a.setToolTip(0,statusTip)
a.setText(1,p["name"])
a.setText(2,ver)
a.setToolTip(2,verTip)
a.setText(3,desc)
a.setText(1,statuses[p["status"]])
a.setToolTip(1,statusTip)
a.setText(2,p["name"])
a.setText(3,ver)
a.setToolTip(3,verTip)
a.setText(4,desc)
# split the tooltip into multiple lines when they are too long
tmp = ""
splitTip = ""
@@ -494,16 +504,16 @@ def addItem(p):
else:
splitTip += tmp + "\n"
tmp = word
a.setToolTip(3, splitTip+tmp)
a.setText(4,p["author"])
a.setToolTip(4, splitTip+tmp)
a.setText(5,p["author"])
if p["homepage"]:
a.setToolTip(4,p["homepage"])
a.setToolTip(5,p["homepage"])
else:
a.setToolTip(4,"")
a.setText(5,repository)
a.setToolTip(5,p["url"])
a.setToolTip(6,"")
a.setText(6,repository)
a.setToolTip(6,p["url"])
# set fonts and colors
for i in [0,1,2,3,4,5]:
for i in [0,1,2,3,4,5,6]:
if p["error"]:
a.setForeground(i,QBrush(QColor(Qt.red)))
if p["status"] in ["new","upgradeable"] or p["error"]:
@@ -922,3 +932,14 @@ def reject(self):
plugins.updateSeenPluginsList()
QDialog.reject(self)
# --- /class QgsPluginInstallerDialog ------------------------------------------------------------------------ #

class QgsPluginTreeItem(QTreeWidgetItem):
def __init__(self, parent=None):
QTreeWidgetItem.__init__(self, parent)

def __lt__(self, otherItem):
column = self.treeWidget().sortColumn()
if column == 0:
return self.data(column, Qt.UserRole).toInt()[0] < otherItem.data(column, Qt.UserRole).toInt()[0]
else:
return self.text(column) < otherItem.text(column)
Binary file not shown.
@@ -8,7 +8,7 @@
<x>0</x>
<y>0</y>
<width>799</width>
<height>382</height>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
@@ -203,6 +203,11 @@
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>State</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
@@ -5,5 +5,6 @@
<file>repoDisabled.png</file>
<file>repoUnavailable.png</file>
<file>repoConnected.png</file>
<file>pluginExperimental.png</file>
</qresource>
</RCC>

0 comments on commit fccf9ac

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