Skip to content
Permalink
Browse files

Apply patch from Borys to remove 'add 3rd party repos' button in plug…

…in manager
  • Loading branch information
timlinux committed Jun 6, 2012
1 parent db71d44 commit c695198e17e8bcf29ed2d2d8d5d98603eab09caf
@@ -69,23 +69,27 @@ def setIface(qgisIface):


# Repositories: (name, url, possible depreciated url)
officialRepo = ("QGIS Official Repository", "http://pyqgis.org/repo/official","")
officialRepo2 = ("QGIS Official Repository 2", "http://plugins.qgis.org/plugins/plugins.xml","http://plugins.qgis.org/plugins")
contribRepo = ("QGIS Contributed Repository", "http://pyqgis.org/repo/contributed","")
authorRepos = [("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com", ""),
("Barry Rowlingson's Repository", "http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/plugins.xml", ""),
# depreciated: ("Bob Bruce's Repository", "http://www.mappinggeek.ca/QGISPythonPlugins/Bobs-QGIS-plugins.xml", ""),
# depreciated: ("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
("Carson Farmer's Repository", "http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"),
("CatAIS Repository", "http://www.catais.org/qgis/plugins.xml", ""),
("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/plugins.xml"),
("GIS-Lab Repository", "http://gis-lab.info/programs/qgis/qgis-repo.xml", ""),
("Kappasys Repository", "http://www.kappasys.org/qgis/plugins.xml", ""),
("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
("Marco Hugentobler's Repository","http://karlinapp.ethz.ch/python_plugins/python_plugins.xml", ""),
("Sourcepole Repository", "http://build.sourcepole.ch/qgis/plugins.xml", ""),
#("Volkan Kepoglu's Repository","http://ggit.metu.edu.tr/~volkan/plugins.xml", "")
]
officialRepo = ("QGIS Official Repository", "http://plugins.qgis.org/plugins/plugins.xml","http://plugins.qgis.org/plugins")
depreciatedRepos = [
("Old QGIS Official Repository", "http://pyqgis.org/repo/official"),
("Old QGIS Contributed Repository","http://pyqgis.org/repo/contributed"),
("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com"),
("Barry Rowlingson's Repository", "http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/plugins.xml"),
("Bob Bruce's Repository", "http://www.mappinggeek.ca/QGISPythonPlugins/Bobs-QGIS-plugins.xml"),
("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml"),
("Borys Jurgiel's Repository 2", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
("Carson Farmer's Repository", "http://www.ftools.ca/cfarmerQgisRepo.xml"),
("Carson Farmer's Repository 2", "http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"),
("CatAIS Repository", "http://www.catais.org/qgis/plugins.xml"),
("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml"),
("Faunalia Repository 2", "http://faunalia.it/qgis/plugins.xml"),
("GIS-Lab Repository", "http://gis-lab.info/programs/qgis/qgis-repo.xml"),
("Kappasys Repository", "http://www.kappasys.org/qgis/plugins.xml"),
("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml"),
("Marco Hugentobler's Repository", "http://karlinapp.ethz.ch/python_plugins/python_plugins.xml"),
("Sourcepole Repository", "http://build.sourcepole.ch/qgis/plugins.xml"),
("Volkan Kepoglu's Repository", "http://ggit.metu.edu.tr/~volkan/plugins.xml")
]



@@ -189,32 +193,27 @@ def __init__(self):
self.httpId = {} # {httpId : repoName}


# ----------------------------------------- #
def addKnownRepos(self):
""" add known 3rd party repositories to QSettings """
presentURLs = []
for i in self.all().values():
presentURLs += [QString(i["url"])]
settings = QSettings()
settings.beginGroup(reposGroup)
# add the central repositories
if presentURLs.count(officialRepo[1]) == 0:
settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
if presentURLs.count(officialRepo2[1]) == 0:
settings.setValue(officialRepo2[0]+"/url", QVariant(officialRepo2[1]))
settings.setValue(officialRepo2[0]+"/enabled", QVariant(True))
if presentURLs.count(contribRepo[1]) == 0:
settings.setValue(contribRepo[0]+"/url", QVariant(contribRepo[1]))
settings.setValue(contribRepo[0]+"/enabled", QVariant(True))
# add author repositories
for i in authorRepos:
if i[1] and presentURLs.count(i[1]) == 0:
repoName = QString(i[0])
if self.all().has_key(repoName):
repoName = repoName + " (original)"
settings.setValue(repoName+"/url", QVariant(i[1]))
settings.setValue(repoName+"/enabled", QVariant(True))
## depreciated in qgis 1.8 until we use 3rd party repos again
## ----------------------------------------- #
#def addKnownRepos(self):
#""" add known 3rd party repositories to QSettings """
#presentURLs = []
#for i in self.all().values():
#presentURLs += [QString(i["url"])]
#settings = QSettings()
#settings.beginGroup(reposGroup)
## add the official repository
#if presentURLs.count(officialRepo[1]) == 0:
#settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
#settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
## add author repositories
#for i in authorRepos:
#if i[1] and presentURLs.count(i[1]) == 0:
#repoName = QString(i[0])
#if self.all().has_key(repoName):
#repoName = repoName + " (original)"
#settings.setValue(repoName+"/url", QVariant(i[1]))
#settings.setValue(repoName+"/enabled", QVariant(True))


# ----------------------------------------- #
@@ -328,31 +327,15 @@ def load(self):
settings.beginGroup(reposGroup)
# first, update repositories in QSettings if needed
officialRepoPresent = False
officialRepo2Present = False
for key in settings.childGroups():
url = settings.value(key+"/url", QVariant()).toString()
if url == contribRepo[1]:
settings.setValue(key+"/valid", QVariant(True)) # unlock the contrib repo in qgis 1.x
else:
settings.setValue(key+"/valid", QVariant(True)) # unlock any other repo
if url == officialRepo[1]:
officialRepoPresent = True
if url == officialRepo2[1]:
officialRepoPresent2 = True
if url == officialRepo[2]:
settings.setValue(key+"/url", QVariant(officialRepo[1])) # correct a depreciated url
officialRepoPresent = True
if url == officialRepo2[2]:
settings.setValue(key+"/url", QVariant(officialRepo2[1])) # correct a depreciated url
officialRepoPresent2 = True
for authorRepo in authorRepos:
if url == authorRepo[2]:
settings.setValue(key+"/url", QVariant(authorRepo[1])) # correct a depreciated url
if not officialRepoPresent:
settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
if not officialRepo2Present:
settings.setValue(officialRepo2[0]+"/url", QVariant(officialRepo2[1]))


for key in settings.childGroups():
self.mRepositories[key] = {}
@@ -161,7 +161,7 @@ def __init__(self, parent, plugin):
if port < 0:
port = 80
self.http = QPHttp(url.host(), port)
self.connect(self.http, SIGNAL("stateChanged ( int )"), self.stateChanged)
self.connect(self.http, SIGNAL("stateChanged ( int )"), self.stateChanged)
self.connect(self.http, SIGNAL("dataReadProgress ( int , int )"), self.readProgress)
self.connect(self.http, SIGNAL("requestFinished (int, bool)"), self.requestFinished)
self.httpGetId = self.http.get(path, self.file)
@@ -269,7 +269,7 @@ def __init__(self, parent):
self.connect(self.buttonHelp, SIGNAL("clicked()"), self.runHelp)
# repositories handling
self.connect(self.treeRepositories, SIGNAL("doubleClicked(QModelIndex)"), self.editRepository)
self.connect(self.buttonFetchRepositories, SIGNAL("clicked()"), self.addKnownRepositories)
#self.connect(self.buttonFetchRepositories, SIGNAL("clicked()"), self.addKnownRepositories)
self.connect(self.buttonAddRep, SIGNAL("clicked()"), self.addRepository)
self.connect(self.buttonEditRep, SIGNAL("clicked()"), self.editRepository)
self.connect(self.buttonDeleteRep, SIGNAL("clicked()"), self.deleteRepository)
@@ -360,23 +360,14 @@ def populateMostWidgets(self):
self.comboFilter2.addItem(self.tr("installed", "plural"))
if plugins.isThereAnythingNew():
self.comboFilter2.addItem(self.tr("upgradeable and news"))
#set configuration widgets (dependent on the repository list)
if len(repositories.all()) == 1:
self.radioPluginType0.setEnabled(False)
self.radioPluginType1.setEnabled(False)
self.radioPluginType2.setEnabled(False)
else:
self.radioPluginType0.setEnabled(True)
self.radioPluginType1.setEnabled(True)
self.radioPluginType2.setEnabled(True)
settings = QSettings()
(i, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(2)).toInt()
if i == 1 or len(repositories.all()) == 1:
(i, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(1)).toInt()
if i == 1:
self.radioPluginType0.setChecked(Qt.Checked)
elif i == 3:
self.radioPluginType2.setChecked(Qt.Checked)
else:
elif i == 2:
self.radioPluginType1.setChecked(Qt.Checked)
else:
self.radioPluginType2.setChecked(Qt.Checked)


# ----------------------------------------- #
@@ -531,7 +522,7 @@ def addItem(p):

# initially, keep insert order
self.treePlugins.sortItems(100,Qt.AscendingOrder)

# resize the columns
for i in [0,1,2,3,4,5]:
self.treePlugins.resizeColumnToContents(i)
@@ -605,7 +596,7 @@ def installPlugin(self, key, quiet=False):
if plugin["status"] == "newer" and not plugin["error"]: # ask for confirmation if user downgrades an usable plugin
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
return

dlg = QgsPluginInstallerInstallingDialog(self,plugin)
dlg.exec_()

@@ -795,19 +786,20 @@ def changePluginPolicy(self, state):
self.populatePluginTree()


## depreciated in qgis 1.8 until we use 3rd party repos again
# ----------------------------------------- #
def addKnownRepositories(self):
""" update list of known repositories - in the future it will be replaced with an online fetching """
message = self.tr("You are about to add several plugin repositories that are neither authorized nor supported by the Quantum GIS team. Plugin authors generally make efforts to ensure that their work is useful and safe, however, we can assume no responsibility for them.")
if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), message, QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
repositories.addKnownRepos()
# refresh lists and populate widgets
QApplication.setOverrideCursor(Qt.WaitCursor)
self.getAllAvailablePlugins()
plugins.rebuild()
self.populateMostWidgets()
self.populatePluginTree()
QApplication.restoreOverrideCursor()
#def addKnownRepositories(self):
#""" update list of known repositories - in the future it will be replaced with an online fetching """
#message = self.tr("You are about to add several plugin repositories that are neither authorized nor supported by the Quantum GIS team. Plugin authors generally make efforts to ensure that their work is useful and safe, however, we can assume no responsibility for them.")
#if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), message, QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
#repositories.addKnownRepos()
## refresh lists and populate widgets
#QApplication.setOverrideCursor(Qt.WaitCursor)
#self.getAllAvailablePlugins()
#plugins.rebuild()
#self.populateMostWidgets()
#self.populatePluginTree()
#QApplication.restoreOverrideCursor()


# ----------------------------------------- #
@@ -854,7 +846,7 @@ def editRepository(self):
dlg.checkBoxEnabled.setCheckState(checkState[repositories.all()[reposName]["enabled"]])
if repositories.all()[reposName]["valid"]:
dlg.checkBoxEnabled.setEnabled(True)
dlg.labelInfo.setText("")
dlg.labelInfo.setText("")
else:
dlg.checkBoxEnabled.setEnabled(False)
dlg.labelInfo.setText(self.tr("This repository is blocked due to incompatibility with your Quantum GIS version"))
@@ -310,7 +310,7 @@
<string>List of plugin repositories</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0" colspan="9">
<item row="0" column="0" colspan="7">
<widget class="QTreeWidget" name="treeRepositories">
<property name="rootIsDecorated">
<bool>false</bool>
@@ -335,39 +335,7 @@
</column>
</widget>
</item>
<item row="1" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="buttonFetchRepositories">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Add third party plugin repositories to the list</string>
</property>
<property name="whatsThis">
<string>Add third party plugin repositories to the list</string>
</property>
<property name="text">
<string>Add 3rd party repositories</string>
</property>
</widget>
</item>
<item row="1" column="5">
<item row="1" column="3">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -380,7 +348,7 @@
</property>
</spacer>
</item>
<item row="1" column="6">
<item row="1" column="4">
<widget class="QPushButton" name="buttonAddRep">
<property name="toolTip">
<string>Add a new plugin repository</string>
@@ -393,7 +361,7 @@
</property>
</widget>
</item>
<item row="1" column="7">
<item row="1" column="5">
<widget class="QPushButton" name="buttonEditRep">
<property name="toolTip">
<string>Edit the selected repository</string>
@@ -406,7 +374,7 @@
</property>
</widget>
</item>
<item row="1" column="8">
<item row="1" column="6">
<widget class="QPushButton" name="buttonDeleteRep">
<property name="toolTip">
<string>Remove the selected repository</string>
@@ -419,7 +387,7 @@
</property>
</widget>
</item>
<item row="1" column="3">
<item row="1" column="1">
<widget class="QPushButton" name="buttonAddContributedRepository">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -450,7 +418,7 @@
</property>
</widget>
</item>
<item row="1" column="4">
<item row="1" column="2">
<widget class="QPushButton" name="buttonDeleteDepreciatedRepos">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -594,7 +562,7 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0">
<widget class="QRadioButton" name="radioPluginType0">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Only show plugins from the official repository</string>
@@ -607,7 +575,7 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0">
<widget class="QRadioButton" name="radioPluginType1">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Show all plugins except those marked as experimental</string>
@@ -620,7 +588,7 @@ p, li { white-space: pre-wrap; }
<item row="2" column="0">
<widget class="QRadioButton" name="radioPluginType2">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Show all plugins, even those marked as experimental</string>
@@ -679,7 +647,6 @@ p, li { white-space: pre-wrap; }
<tabstop>buttonClose</tabstop>
<tabstop>buttonHelp</tabstop>
<tabstop>treeRepositories</tabstop>
<tabstop>buttonFetchRepositories</tabstop>
<tabstop>buttonAddContributedRepository</tabstop>
<tabstop>buttonDeleteDepreciatedRepos</tabstop>
<tabstop>buttonAddRep</tabstop>

0 comments on commit c695198

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