@@ -262,27 +262,15 @@ def __init__(self, parent, fl):
262262 self .connect (self .buttonAddRep , SIGNAL ("clicked()" ), self .addRepository )
263263 self .connect (self .buttonEditRep , SIGNAL ("clicked()" ), self .editRepository )
264264 self .connect (self .buttonDeleteRep , SIGNAL ("clicked()" ), self .deleteRepository )
265- self .buttonEditRep .setEnabled (False )
266- self .buttonDeleteRep .setEnabled (False )
267- # configuration widgets
268- self .connect (self .checkUpdates , SIGNAL ("toggled (bool)" ), self .changeCheckingPolicy )
269- self .connect (self .comboInterval , SIGNAL ("currentIndexChanged (int)" ), self .changeCheckingInterval )
270- self .connect (self .radioPluginType0 , SIGNAL ("toggled (bool)" ), self .changePluginPolicy )
271- self .connect (self .radioPluginType1 , SIGNAL ("toggled (bool)" ), self .changePluginPolicy )
272- self .connect (self .radioPluginType2 , SIGNAL ("toggled (bool)" ), self .changePluginPolicy )
265+ # checkingOnStart checkbox
266+ self .connect (self .checkUpdates , SIGNAL ("stateChanged (int)" ), self .ChangeCheckingPolicy )
273267 if repositories .checkingOnStart ():
274- self .checkUpdates .setChecked (Qt .Checked )
275- else :
276- self .checkUpdates .setChecked (Qt .Unchecked )
277- interval = repositories .checkingOnStartInterval ()
278- intervals = [0 ,1 ,3 ,7 ,14 ,30 ] # days
279- if intervals .count (interval ):
280- index = intervals .index (interval )
268+ self .checkUpdates .setCheckState (Qt .Checked )
281269 else :
282- index = 1
283- if QGIS_VER [ 0 ] == "0" :
284- self .label_2 . setText ( "<b>Note: This functionality requires QGIS 1.0</b>" )
285- self . comboInterval . setCurrentIndex ( index )
270+ self . checkUpdates . setCheckState ( Qt . Unchecked )
271+ self . buttonEditRep . setEnabled ( False )
272+ self .buttonDeleteRep . setEnabled ( False )
273+
286274 self .populateMostWidgets ()
287275
288276
@@ -340,32 +328,13 @@ def populateMostWidgets(self):
340328 for i in [0 ,1 ,2 ]:
341329 self .treeRepositories .resizeColumnToContents (i )
342330 self .comboFilter1 .addItem (self .tr ("orphans" ))
343- # fill the status filter comboBox
331+ # filling the status filter comboBox
344332 self .comboFilter2 .clear ()
345333 self .comboFilter2 .addItem (self .tr ("any status" ))
346334 self .comboFilter2 .addItem (self .tr ("not installed" , "plural" ))
347335 self .comboFilter2 .addItem (self .tr ("installed" , "plural" ))
348336 if plugins .isThereAnythingNew ():
349337 self .comboFilter2 .addItem (self .tr ("upgradeable and news" ))
350- #set configuration widgets (dependent on the repository list)
351- if len (repositories .all ()) == 1 or QGIS_VER [0 ] == "0" :
352- self .radioPluginType0 .setEnabled (False )
353- self .radioPluginType1 .setEnabled (False )
354- self .radioPluginType2 .setEnabled (False )
355- else :
356- self .radioPluginType0 .setEnabled (True )
357- self .radioPluginType1 .setEnabled (True )
358- self .radioPluginType2 .setEnabled (True )
359- settings = QSettings ()
360- (i , ok ) = settings .value (settingsGroup + "/allowedPluginType" , QVariant (2 )).toInt ()
361- if QGIS_VER [0 ] == "0" :
362- self .radioPluginType1 .setChecked (Qt .Checked )
363- elif i == 1 or len (repositories .all ()) == 1 :
364- self .radioPluginType0 .setChecked (Qt .Checked )
365- elif i == 3 :
366- self .radioPluginType2 .setChecked (Qt .Checked )
367- else :
368- self .radioPluginType1 .setChecked (Qt .Checked )
369338
370339
371340 # ----------------------------------------- #
@@ -389,17 +358,14 @@ def filterCheck(self,plugin):
389358 return False
390359 if self .comboFilter2 .currentIndex () == 3 and not plugin ["status" ] in ["upgradeable" ,"new" ]:
391360 return False
392- if self .radioPluginType0 .isChecked () and plugin ["repository" ] != officialRepo [0 ] and plugin ["status" ] in ["not installed" ,"new" ]:
393- return False
394- if self .radioPluginType1 .isChecked () and plugin ["experimental" ] and plugin ["status" ] in ["not installed" ,"new" ]:
395- return False
396361 if self .lineFilter .text () == "" :
397362 return True
398363 else :
399364 for i in ["name" ,"version_inst" ,"version_avail" ,"desc_repo" ,"desc_local" ,"author" ,"status" ,"repository" ]:
400365 item = QString (plugin [i ]) #.toUpper()
401366 if item != None :
402367 if item .contains (self .lineFilter .text (), Qt .CaseInsensitive ):
368+ #if item.find(self.lineFilter.text().toUpper()) > -1:
403369 return True
404370 return False
405371
@@ -692,41 +658,17 @@ def repositoryTreeClicked(self):
692658
693659
694660 # ----------------------------------------- #
695- def changeCheckingPolicy (self ,policy ):
696- """ the Checking On Start checkbox has been clicked """
697- if policy :
661+ def ChangeCheckingPolicy (self ,policy ):
662+ if policy == Qt .Checked :
698663 repositories .setCheckingOnStart (True )
699664 else :
700665 repositories .setCheckingOnStart (False )
701666
702667
703- # ----------------------------------------- #
704- def changeCheckingInterval (self ,interval ):
705- """ the Checking on start interval combobox has been clicked """
706- intervals = [0 ,1 ,3 ,7 ,14 ,30 ]
707- repositories .setCheckingOnStartInterval (intervals [interval ])
708-
709-
710- # ----------------------------------------- #
711- def changePluginPolicy (self , state ):
712- """ one of the plugin type radiobuttons has been clicked """
713- if not state : # radio button released
714- return
715- if self .radioPluginType0 .isChecked ():
716- i = 1
717- elif self .radioPluginType1 .isChecked ():
718- i = 2
719- else :
720- i = 3
721- settings = QSettings ()
722- settings .setValue (settingsGroup + "/allowedPluginType" , QVariant (i ))
723- self .populatePluginTree ()
724-
725-
726668 # ----------------------------------------- #
727669 def addKnownRepositories (self ):
728670 """ update list of known repositories - in the future it will be replaced with an online fetching """
729- 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." )
671+ message = self .tr ("You are going to add some plugin repositories neither authorized nor supported by the Quantum GIS team, however provided by folks associated with us . Plugin authors generally make efforts to make their works useful and safe, but we can't assume any responsibility for them. FEEL WARNED! " )
730672 if QMessageBox .question (self , self .tr ("QGIS Python Plugin Installer" ), message , QMessageBox .Ok , QMessageBox .Abort ) == QMessageBox .Ok :
731673 repositories .addKnownRepos ()
732674 # refresh lists and populate widgets
@@ -745,13 +687,13 @@ def addRepository(self):
745687 if not dlg .exec_ ():
746688 return
747689 for i in repositories .all ().values ():
748- if dlg .editURL .text (). trimmed () == i ["url" ]:
690+ if dlg .editURL .text () == i ["url" ]:
749691 QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), self .tr ("Unable to add another repository with the same URL!" ))
750692 return
751693 settings = QSettings ()
752694 settings .beginGroup (self .reposGroup )
753695 reposName = dlg .editName .text ()
754- reposURL = dlg .editURL .text (). trimmed ()
696+ reposURL = dlg .editURL .text ()
755697 if repositories .all ().has_key (reposName ):
756698 reposName = reposName + "(2)"
757699 # add to settings
@@ -787,7 +729,7 @@ def editRepository(self):
787729 if not dlg .exec_ ():
788730 return # nothing to do if cancelled
789731 for i in repositories .all ().values ():
790- if dlg .editURL .text (). trimmed () == i ["url" ] and dlg .editURL .text (). trimmed () != repositories .all ()[reposName ]["url" ]:
732+ if dlg .editURL .text () == i ["url" ] and dlg .editURL .text () != repositories .all ()[reposName ]["url" ]:
791733 QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), self .tr ("Unable to add another repository with the same URL!" ))
792734 return
793735 # delete old repo from QSettings and create new one
@@ -797,9 +739,9 @@ def editRepository(self):
797739 newName = dlg .editName .text ()
798740 if repositories .all ().has_key (newName ) and newName != reposName :
799741 newName = newName + "(2)"
800- settings .setValue (newName + "/url" , QVariant (dlg .editURL .text (). trimmed () ))
742+ settings .setValue (newName + "/url" , QVariant (dlg .editURL .text ()))
801743 settings .setValue (newName + "/enabled" , QVariant (bool (dlg .checkBoxEnabled .checkState ())))
802- if dlg .editURL .text (). trimmed () == repositories .all ()[reposName ]["url" ] and dlg .checkBoxEnabled .checkState () == checkState [repositories .all ()[reposName ]["enabled" ]]:
744+ if dlg .editURL .text () == repositories .all ()[reposName ]["url" ] and dlg .checkBoxEnabled .checkState () == checkState [repositories .all ()[reposName ]["enabled" ]]:
803745 repositories .rename (reposName , newName )
804746 self .populateMostWidgets ()
805747 return # nothing else to do if only repository name was changed
0 commit comments