Skip to content

Commit

Permalink
mark experimental plugins in installer (fix #5980)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 7, 2012
1 parent 358c638 commit fccf9ac
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 18 deletions.
55 changes: 38 additions & 17 deletions python/plugins/plugin_installer/installer_gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2010 Borys Jurgiel
Expand All @@ -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:
Expand Down Expand Up @@ -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 = ""
Expand All @@ -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"]:
Expand Down Expand Up @@ -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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion python/plugins/plugin_installer/qgsplugininstallerbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<x>0</x>
<y>0</y>
<width>799</width>
<height>382</height>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions python/plugins/plugin_installer/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -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.