Skip to content

Commit c695198

Browse files
committed
Apply patch from Borys to remove 'add 3rd party repos' button in plugin manager
1 parent db71d44 commit c695198

File tree

3 files changed

+75
-133
lines changed

3 files changed

+75
-133
lines changed

python/plugins/plugin_installer/installer_data.py

+42-59
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,27 @@ def setIface(qgisIface):
6969

7070

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

9094

9195

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

191195

192-
# ----------------------------------------- #
193-
def addKnownRepos(self):
194-
""" add known 3rd party repositories to QSettings """
195-
presentURLs = []
196-
for i in self.all().values():
197-
presentURLs += [QString(i["url"])]
198-
settings = QSettings()
199-
settings.beginGroup(reposGroup)
200-
# add the central repositories
201-
if presentURLs.count(officialRepo[1]) == 0:
202-
settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
203-
settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
204-
if presentURLs.count(officialRepo2[1]) == 0:
205-
settings.setValue(officialRepo2[0]+"/url", QVariant(officialRepo2[1]))
206-
settings.setValue(officialRepo2[0]+"/enabled", QVariant(True))
207-
if presentURLs.count(contribRepo[1]) == 0:
208-
settings.setValue(contribRepo[0]+"/url", QVariant(contribRepo[1]))
209-
settings.setValue(contribRepo[0]+"/enabled", QVariant(True))
210-
# add author repositories
211-
for i in authorRepos:
212-
if i[1] and presentURLs.count(i[1]) == 0:
213-
repoName = QString(i[0])
214-
if self.all().has_key(repoName):
215-
repoName = repoName + " (original)"
216-
settings.setValue(repoName+"/url", QVariant(i[1]))
217-
settings.setValue(repoName+"/enabled", QVariant(True))
196+
## depreciated in qgis 1.8 until we use 3rd party repos again
197+
## ----------------------------------------- #
198+
#def addKnownRepos(self):
199+
#""" add known 3rd party repositories to QSettings """
200+
#presentURLs = []
201+
#for i in self.all().values():
202+
#presentURLs += [QString(i["url"])]
203+
#settings = QSettings()
204+
#settings.beginGroup(reposGroup)
205+
## add the official repository
206+
#if presentURLs.count(officialRepo[1]) == 0:
207+
#settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
208+
#settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
209+
## add author repositories
210+
#for i in authorRepos:
211+
#if i[1] and presentURLs.count(i[1]) == 0:
212+
#repoName = QString(i[0])
213+
#if self.all().has_key(repoName):
214+
#repoName = repoName + " (original)"
215+
#settings.setValue(repoName+"/url", QVariant(i[1]))
216+
#settings.setValue(repoName+"/enabled", QVariant(True))
218217

219218

220219
# ----------------------------------------- #
@@ -328,31 +327,15 @@ def load(self):
328327
settings.beginGroup(reposGroup)
329328
# first, update repositories in QSettings if needed
330329
officialRepoPresent = False
331-
officialRepo2Present = False
332330
for key in settings.childGroups():
333331
url = settings.value(key+"/url", QVariant()).toString()
334-
if url == contribRepo[1]:
335-
settings.setValue(key+"/valid", QVariant(True)) # unlock the contrib repo in qgis 1.x
336-
else:
337-
settings.setValue(key+"/valid", QVariant(True)) # unlock any other repo
338332
if url == officialRepo[1]:
339333
officialRepoPresent = True
340-
if url == officialRepo2[1]:
341-
officialRepoPresent2 = True
342334
if url == officialRepo[2]:
343335
settings.setValue(key+"/url", QVariant(officialRepo[1])) # correct a depreciated url
344336
officialRepoPresent = True
345-
if url == officialRepo2[2]:
346-
settings.setValue(key+"/url", QVariant(officialRepo2[1])) # correct a depreciated url
347-
officialRepoPresent2 = True
348-
for authorRepo in authorRepos:
349-
if url == authorRepo[2]:
350-
settings.setValue(key+"/url", QVariant(authorRepo[1])) # correct a depreciated url
351337
if not officialRepoPresent:
352338
settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
353-
if not officialRepo2Present:
354-
settings.setValue(officialRepo2[0]+"/url", QVariant(officialRepo2[1]))
355-
356339

357340
for key in settings.childGroups():
358341
self.mRepositories[key] = {}

python/plugins/plugin_installer/installer_gui.py

+23-31
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __init__(self, parent, plugin):
161161
if port < 0:
162162
port = 80
163163
self.http = QPHttp(url.host(), port)
164-
self.connect(self.http, SIGNAL("stateChanged ( int )"), self.stateChanged)
164+
self.connect(self.http, SIGNAL("stateChanged ( int )"), self.stateChanged)
165165
self.connect(self.http, SIGNAL("dataReadProgress ( int , int )"), self.readProgress)
166166
self.connect(self.http, SIGNAL("requestFinished (int, bool)"), self.requestFinished)
167167
self.httpGetId = self.http.get(path, self.file)
@@ -269,7 +269,7 @@ def __init__(self, parent):
269269
self.connect(self.buttonHelp, SIGNAL("clicked()"), self.runHelp)
270270
# repositories handling
271271
self.connect(self.treeRepositories, SIGNAL("doubleClicked(QModelIndex)"), self.editRepository)
272-
self.connect(self.buttonFetchRepositories, SIGNAL("clicked()"), self.addKnownRepositories)
272+
#self.connect(self.buttonFetchRepositories, SIGNAL("clicked()"), self.addKnownRepositories)
273273
self.connect(self.buttonAddRep, SIGNAL("clicked()"), self.addRepository)
274274
self.connect(self.buttonEditRep, SIGNAL("clicked()"), self.editRepository)
275275
self.connect(self.buttonDeleteRep, SIGNAL("clicked()"), self.deleteRepository)
@@ -360,23 +360,14 @@ def populateMostWidgets(self):
360360
self.comboFilter2.addItem(self.tr("installed", "plural"))
361361
if plugins.isThereAnythingNew():
362362
self.comboFilter2.addItem(self.tr("upgradeable and news"))
363-
#set configuration widgets (dependent on the repository list)
364-
if len(repositories.all()) == 1:
365-
self.radioPluginType0.setEnabled(False)
366-
self.radioPluginType1.setEnabled(False)
367-
self.radioPluginType2.setEnabled(False)
368-
else:
369-
self.radioPluginType0.setEnabled(True)
370-
self.radioPluginType1.setEnabled(True)
371-
self.radioPluginType2.setEnabled(True)
372363
settings = QSettings()
373-
(i, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(2)).toInt()
374-
if i == 1 or len(repositories.all()) == 1:
364+
(i, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(1)).toInt()
365+
if i == 1:
375366
self.radioPluginType0.setChecked(Qt.Checked)
376-
elif i == 3:
377-
self.radioPluginType2.setChecked(Qt.Checked)
378-
else:
367+
elif i == 2:
379368
self.radioPluginType1.setChecked(Qt.Checked)
369+
else:
370+
self.radioPluginType2.setChecked(Qt.Checked)
380371

381372

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

532523
# initially, keep insert order
533524
self.treePlugins.sortItems(100,Qt.AscendingOrder)
534-
525+
535526
# resize the columns
536527
for i in [0,1,2,3,4,5]:
537528
self.treePlugins.resizeColumnToContents(i)
@@ -605,7 +596,7 @@ def installPlugin(self, key, quiet=False):
605596
if plugin["status"] == "newer" and not plugin["error"]: # ask for confirmation if user downgrades an usable plugin
606597
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:
607598
return
608-
599+
609600
dlg = QgsPluginInstallerInstallingDialog(self,plugin)
610601
dlg.exec_()
611602

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

797788

789+
## depreciated in qgis 1.8 until we use 3rd party repos again
798790
# ----------------------------------------- #
799-
def addKnownRepositories(self):
800-
""" update list of known repositories - in the future it will be replaced with an online fetching """
801-
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.")
802-
if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), message, QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
803-
repositories.addKnownRepos()
804-
# refresh lists and populate widgets
805-
QApplication.setOverrideCursor(Qt.WaitCursor)
806-
self.getAllAvailablePlugins()
807-
plugins.rebuild()
808-
self.populateMostWidgets()
809-
self.populatePluginTree()
810-
QApplication.restoreOverrideCursor()
791+
#def addKnownRepositories(self):
792+
#""" update list of known repositories - in the future it will be replaced with an online fetching """
793+
#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.")
794+
#if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), message, QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
795+
#repositories.addKnownRepos()
796+
## refresh lists and populate widgets
797+
#QApplication.setOverrideCursor(Qt.WaitCursor)
798+
#self.getAllAvailablePlugins()
799+
#plugins.rebuild()
800+
#self.populateMostWidgets()
801+
#self.populatePluginTree()
802+
#QApplication.restoreOverrideCursor()
811803

812804

813805
# ----------------------------------------- #
@@ -854,7 +846,7 @@ def editRepository(self):
854846
dlg.checkBoxEnabled.setCheckState(checkState[repositories.all()[reposName]["enabled"]])
855847
if repositories.all()[reposName]["valid"]:
856848
dlg.checkBoxEnabled.setEnabled(True)
857-
dlg.labelInfo.setText("")
849+
dlg.labelInfo.setText("")
858850
else:
859851
dlg.checkBoxEnabled.setEnabled(False)
860852
dlg.labelInfo.setText(self.tr("This repository is blocked due to incompatibility with your Quantum GIS version"))

python/plugins/plugin_installer/qgsplugininstallerbase.ui

+10-43
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
<string>List of plugin repositories</string>
311311
</attribute>
312312
<layout class="QGridLayout">
313-
<item row="0" column="0" colspan="9">
313+
<item row="0" column="0" colspan="7">
314314
<widget class="QTreeWidget" name="treeRepositories">
315315
<property name="rootIsDecorated">
316316
<bool>false</bool>
@@ -335,39 +335,7 @@
335335
</column>
336336
</widget>
337337
</item>
338-
<item row="1" column="1">
339-
<spacer>
340-
<property name="orientation">
341-
<enum>Qt::Horizontal</enum>
342-
</property>
343-
<property name="sizeType">
344-
<enum>QSizePolicy::Preferred</enum>
345-
</property>
346-
<property name="sizeHint" stdset="0">
347-
<size>
348-
<width>20</width>
349-
<height>20</height>
350-
</size>
351-
</property>
352-
</spacer>
353-
</item>
354-
<item row="1" column="2">
355-
<widget class="QPushButton" name="buttonFetchRepositories">
356-
<property name="enabled">
357-
<bool>true</bool>
358-
</property>
359-
<property name="toolTip">
360-
<string>Add third party plugin repositories to the list</string>
361-
</property>
362-
<property name="whatsThis">
363-
<string>Add third party plugin repositories to the list</string>
364-
</property>
365-
<property name="text">
366-
<string>Add 3rd party repositories</string>
367-
</property>
368-
</widget>
369-
</item>
370-
<item row="1" column="5">
338+
<item row="1" column="3">
371339
<spacer>
372340
<property name="orientation">
373341
<enum>Qt::Horizontal</enum>
@@ -380,7 +348,7 @@
380348
</property>
381349
</spacer>
382350
</item>
383-
<item row="1" column="6">
351+
<item row="1" column="4">
384352
<widget class="QPushButton" name="buttonAddRep">
385353
<property name="toolTip">
386354
<string>Add a new plugin repository</string>
@@ -393,7 +361,7 @@
393361
</property>
394362
</widget>
395363
</item>
396-
<item row="1" column="7">
364+
<item row="1" column="5">
397365
<widget class="QPushButton" name="buttonEditRep">
398366
<property name="toolTip">
399367
<string>Edit the selected repository</string>
@@ -406,7 +374,7 @@
406374
</property>
407375
</widget>
408376
</item>
409-
<item row="1" column="8">
377+
<item row="1" column="6">
410378
<widget class="QPushButton" name="buttonDeleteRep">
411379
<property name="toolTip">
412380
<string>Remove the selected repository</string>
@@ -419,7 +387,7 @@
419387
</property>
420388
</widget>
421389
</item>
422-
<item row="1" column="3">
390+
<item row="1" column="1">
423391
<widget class="QPushButton" name="buttonAddContributedRepository">
424392
<property name="sizePolicy">
425393
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -450,7 +418,7 @@
450418
</property>
451419
</widget>
452420
</item>
453-
<item row="1" column="4">
421+
<item row="1" column="2">
454422
<widget class="QPushButton" name="buttonDeleteDepreciatedRepos">
455423
<property name="sizePolicy">
456424
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -594,7 +562,7 @@ p, li { white-space: pre-wrap; }
594562
<item row="0" column="0">
595563
<widget class="QRadioButton" name="radioPluginType0">
596564
<property name="enabled">
597-
<bool>false</bool>
565+
<bool>true</bool>
598566
</property>
599567
<property name="text">
600568
<string>Only show plugins from the official repository</string>
@@ -607,7 +575,7 @@ p, li { white-space: pre-wrap; }
607575
<item row="1" column="0">
608576
<widget class="QRadioButton" name="radioPluginType1">
609577
<property name="enabled">
610-
<bool>false</bool>
578+
<bool>true</bool>
611579
</property>
612580
<property name="text">
613581
<string>Show all plugins except those marked as experimental</string>
@@ -620,7 +588,7 @@ p, li { white-space: pre-wrap; }
620588
<item row="2" column="0">
621589
<widget class="QRadioButton" name="radioPluginType2">
622590
<property name="enabled">
623-
<bool>false</bool>
591+
<bool>true</bool>
624592
</property>
625593
<property name="text">
626594
<string>Show all plugins, even those marked as experimental</string>
@@ -679,7 +647,6 @@ p, li { white-space: pre-wrap; }
679647
<tabstop>buttonClose</tabstop>
680648
<tabstop>buttonHelp</tabstop>
681649
<tabstop>treeRepositories</tabstop>
682-
<tabstop>buttonFetchRepositories</tabstop>
683650
<tabstop>buttonAddContributedRepository</tabstop>
684651
<tabstop>buttonDeleteDepreciatedRepos</tabstop>
685652
<tabstop>buttonAddRep</tabstop>

0 commit comments

Comments
 (0)