1
1
# -*- coding: utf-8 -*-
2
- """ "
2
+ """
3
3
Copyright (C) 2007-2008 Matthew Perry
4
4
Copyright (C) 2008 Borys Jurgiel
5
5
11
11
* (at your option) any later version. *
12
12
* *
13
13
***************************************************************************/
14
-
15
- This file contains some additional quote marks (for example in the lines 2 and 20), they are
16
- for compatibility with lupdate, which doesn't properly recognize the comments in Python.
17
- The use of lupdate instead of pylupdate is forced by integration with rest of QGIS files,
18
- which are written mainly in C++. After editing this file make sure that lupdate and pylupdate
19
- find the same number of strings and balance the quotemarks if doesn't.
20
- " """
14
+ """
21
15
22
16
23
17
from PyQt4 .QtCore import *
37
31
def removeDir (path ):
38
32
result = QString ()
39
33
if not QFile (path ).exists ():
40
- result = QCoreApplication .translate ("QgsPluginInstaller" ,"Plugin directory doesn't exist: " ) + path
34
+ result = QCoreApplication .translate ("QgsPluginInstaller" ,"Plugin directory doesn't exist:" ) + " \n " + path
41
35
elif QFile (path ).remove (): # if it is only link, just remove it without resolving.
42
36
#print " Link removing successfull: %s" % path
43
37
pass
@@ -57,7 +51,7 @@ def removeDir(path):
57
51
#print " Directory removing successfull: %s" % item
58
52
pass
59
53
if QFile (path ).exists ():
60
- result = QCoreApplication .translate ("QgsPluginInstaller" ,"Failed to remove directory" )+ " " + path + " \n " + QCoreApplication .translate ("QgsPluginInstaller" ,"Check permissions or remove it manually" )
54
+ result = QCoreApplication .translate ("QgsPluginInstaller" ,"Failed to remove the directory: " )+ " " + path + "\n " + QCoreApplication .translate ("QgsPluginInstaller" ,"Check permissions or remove it manually" )
61
55
# restore plugin directory if removed by QDir().rmpath()
62
56
pluginDir = unicode (QFileInfo (QgsApplication .qgisUserDbFilePath ()).path ()+ "/python/plugins" )
63
57
if not QDir (pluginDir ).exists ():
@@ -70,9 +64,6 @@ def removeDir(path):
70
64
71
65
72
66
# --- class QgsPluginInstallerFetchingDialog --------------------------------------------------------------- #
73
- """ " C++ style header for compability with lupdate
74
- QgsPluginInstallerFetchingDialog::foo(){
75
- " """
76
67
class QgsPluginInstallerFetchingDialog (QDialog , Ui_QgsPluginInstallerFetchingDialog ):
77
68
# ----------------------------------------- #
78
69
def __init__ (self , parent ):
@@ -118,17 +109,13 @@ def repositoryFetched(self, repoName):
118
109
self .displayState (repoName ,7 )
119
110
if not repositories .fetchingInProgress ():
120
111
self .close ()
121
- # } - C++ style footer for compability with lupdate
122
112
# --- /class QgsPluginInstallerFetchingDialog -------------------------------------------------------------- #
123
113
124
114
125
115
126
116
127
117
128
118
# --- class QgsPluginInstallerRepositoryDialog ------------------------------------------------------------- #
129
- """ " C++ style header for compability with lupdate
130
- QgsPluginInstallerRepositoryDialog::foo(){
131
- " """
132
119
class QgsPluginInstallerRepositoryDialog (QDialog , Ui_QgsPluginInstallerRepositoryDetailsDialog ):
133
120
# ----------------------------------------- #
134
121
def __init__ (self , parent = None ):
@@ -143,17 +130,13 @@ def __init__(self, parent=None):
143
130
def textChanged (self , string ):
144
131
enable = (self .editName .text ().count () > 0 and self .editURL .text ().count () > 0 )
145
132
self .buttonBox .button (QDialogButtonBox .Ok ).setEnabled (enable )
146
- # } - C++ style footer for compability with lupdate
147
133
# --- /class QgsPluginInstallerRepositoryDialog ------------------------------------------------------------ #
148
134
149
135
150
136
151
137
152
138
153
139
# --- class QgsPluginInstallerInstallingDialog --------------------------------------------------------------- #
154
- """ " C++ style header for compability with lupdate
155
- QgsPluginInstallerInstallingDialog::foo(){
156
- " """
157
140
class QgsPluginInstallerInstallingDialog (QDialog , Ui_QgsPluginInstallerInstallingDialog ):
158
141
# ----------------------------------------- #
159
142
def __init__ (self , parent , plugin ):
@@ -226,7 +209,7 @@ def requestFinished(self, requestId, state):
226
209
removeDir (QDir .cleanPath (pluginDir + "/" + self .plugin ["localdir" ])) # remove old plugin if exists
227
210
un .extract (tmpPath , pluginDir ) # final extract.
228
211
except :
229
- self .mResult = self .tr ("Failed to unzip file to " ) + pluginDir + "\n " + self .tr ("check permissions" )
212
+ self .mResult = self .tr ("Failed to unzip file to the following directory: " ) + " \n " + pluginDir + "\n " + self .tr ("Check permissions" )
230
213
self .reject ()
231
214
return
232
215
@@ -244,26 +227,21 @@ def abort(self):
244
227
self .http .abort ()
245
228
self .mResult = self .tr ("Aborted by user" )
246
229
self .reject ()
247
- # } - C++ style footer for compability with lupdate
248
230
# --- /class QgsPluginInstallerPluginErrorDialog ------------------------------------------------------------- #
249
231
250
232
251
233
252
234
253
235
254
236
# --- class QgsPluginInstallerPluginErrorDialog -------------------------------------------------------------- #
255
- """ " C++ style header for compability with lupdate
256
- QgsPluginInstallerPluginErrorDialog::foo(){
257
- " """
258
237
class QgsPluginInstallerPluginErrorDialog (QDialog , Ui_QgsPluginInstallerPluginErrorDialog ):
259
238
# ----------------------------------------- #
260
239
def __init__ (self , parent , errorMessage ):
261
240
QDialog .__init__ (self , parent )
262
241
self .setupUi (self )
263
242
if not errorMessage :
264
- errorMessage = self .tr ("No error message received. Try to restart QGIS and ensure the plugin isn't installed under a different name. If it is, contact the plugin author and submit this issue, please." )
243
+ errorMessage = self .tr ("No error message received. Try to restart Quantum GIS and ensure the plugin isn't installed under a different name. If it is, contact the plugin author and submit this issue, please." )
265
244
self .textBrowser .setText (errorMessage )
266
- # } - C++ style footer for compability with lupdate
267
245
# --- /class QgsPluginInstallerPluginErrorDialog ------------------------------------------------------------- #
268
246
269
247
@@ -272,9 +250,6 @@ def __init__(self, parent, errorMessage):
272
250
273
251
274
252
# --- class QgsPluginInstallerDialog ------------------------------------------------------------------------- #
275
- """ " C++ style header for compability with lupdate
276
- QgsPluginInstallerDialog::foo(){
277
- " """
278
253
class QgsPluginInstallerDialog (QDialog , Ui_QgsPluginInstallerDialog ):
279
254
# ----------------------------------------- #
280
255
def __init__ (self , parent , fl ):
@@ -326,7 +301,7 @@ def getAllAvailablePlugins(self):
326
301
# display error messages for every unavailable reposioty, except the case if all repositories are unavailable!
327
302
if repositories .allUnavailable () and repositories .allUnavailable () != repositories .allEnabled ():
328
303
for key in repositories .allUnavailable ():
329
- QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), self .tr ("Error reading repository: " ) + key + "\n " + repositories .all ()[key ]["error" ])
304
+ QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), self .tr ("Error reading repository:" ) + " " + key + "\n " + repositories .all ()[key ]["error" ])
330
305
331
306
plugins .getAllInstalled ()
332
307
@@ -357,7 +332,7 @@ def populateMostWidgets(self):
357
332
if repositories .all ()[key ]["valid" ]:
358
333
a .setToolTip (0 ,self .tr ("This repository is disabled" ))
359
334
else :
360
- a .setToolTip (0 ,self .tr ("This repository is blocked due to incompatibility with your QGIS version" ))
335
+ a .setToolTip (0 ,self .tr ("This repository is blocked due to incompatibility with your Quantum GIS version" ))
361
336
a .setDisabled (True )
362
337
for i in [0 ,1 ,2 ]:
363
338
self .treeRepositories .resizeColumnToContents (i )
@@ -425,7 +400,7 @@ def addItem(p):
425
400
if self .filterCheck (p ):
426
401
statusTip = descrip [p ["status" ]]
427
402
if p ["read-only" ]:
428
- statusTip += "\n " + self .tr ("Note that it's a core plugin and I can't uninstall it " )
403
+ statusTip += "\n " + self .tr ("Note that it's an uninsatallable core plugin" )
429
404
if p ["status" ] == "upgradeable" :
430
405
ver = p ["version_inst" ] + " -> " + p ["version_avail" ]
431
406
elif p ["status" ] == "newer" :
@@ -435,32 +410,35 @@ def addItem(p):
435
410
else :
436
411
ver = p ["version_inst" ]
437
412
if p ["status" ] in ["upgradeable" ,"newer" ]:
438
- vd = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("available version" ) + ": " + p ["version_avail" ]
413
+ verTip = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("available version" ) + ": " + p ["version_avail" ]
439
414
elif p ["status" ] in ["not installed" , "new" ]:
440
- vd = self .tr ("available version" ) + ": " + p ["version_avail" ]
415
+ verTip = self .tr ("available version" ) + ": " + p ["version_avail" ]
441
416
elif p ["status" ] == "installed" :
442
- vd = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("That's the newest available version" )
417
+ verTip = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("That's the newest available version" )
443
418
elif p ["status" ] == "orphan" :
444
- vd = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("There is no version available for download" )
419
+ verTip = self .tr ("installed version" ) + ": " + p ["version_inst" ] + "\n " + self .tr ("There is no version available for download" )
445
420
else :
446
- vd = ""
421
+ verTip = ""
447
422
if p ["status" ] == "invalid" :
448
- p ["desc_local" ] = self .tr ("This plugin seems to be invalid or have unfulfilled dependencies" )
449
- p ["desc_repo" ] = self .tr ("This plugin seems to be invalid or have unfulfilled dependencies\n It has been installed, but can't be loaded" )
423
+ desc = self .tr ("This plugin seems to be invalid or have unfulfilled dependencies" )
424
+ descTip = self .tr ("This plugin seems to be invalid or have unfulfilled dependencies\n It has been installed, but can't be loaded" )
425
+ else :
426
+ desc = p ["desc_local" ]
427
+ descTip = p ["desc_repo" ]
428
+ if not desc :
429
+ desc = descTip
450
430
if not p ["repository" ]:
451
431
repository = self .tr ("only locally available" )
452
432
else :
453
433
repository = p ["repository" ]
454
- if not p ["desc_local" ]:
455
- p ["desc_local" ] = p ["desc_repo" ]
456
434
a = QTreeWidgetItem (self .treePlugins )
457
435
a .setText (0 ,status [p ["status" ]])
458
436
a .setToolTip (0 ,statusTip )
459
437
a .setText (1 ,p ["name" ])
460
438
a .setText (2 ,ver )
461
- a .setToolTip (2 ,vd )
462
- a .setText (3 ,p [ "desc_local" ] )
463
- a .setToolTip (3 , p [ "desc_repo" ] )
439
+ a .setToolTip (2 ,verTip )
440
+ a .setText (3 ,desc )
441
+ a .setToolTip (3 ,descTip )
464
442
a .setText (4 ,p ["author" ])
465
443
if p ["homepage" ]:
466
444
a .setToolTip (4 ,p ["homepage" ])
@@ -578,7 +556,7 @@ def uninstallPlugin(self):
578
556
plugin = plugins .all ()[key ]
579
557
if not plugin :
580
558
return
581
- warning = self .tr ("Are you sure you want to uninstall the plugin " ) + plugin [ "name" ] + "?"
559
+ warning = self .tr ("Are you sure you want to uninstall the following plugin? " ) + " \n " + plugin [ "name" ]
582
560
if plugin ["status" ] == "orphan" :
583
561
warning += "\n \n " + self .tr ("Warning: this plugin isn't available in any accessible repository!" )
584
562
if QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), warning , QMessageBox .Yes , QMessageBox .No ) == QMessageBox .No :
@@ -617,7 +595,7 @@ def ChangeCheckingPolicy(self,policy):
617
595
def addKnownRepositories (self ):
618
596
""" update list of known repositories - in the future it will be replaced with an online fetching """
619
597
#print "add known repositories"
620
- message = self .tr ("You are going to add some plugin repositories neither authorized nor supported by the QGIS 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!" )
598
+ 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!" )
621
599
if QMessageBox .question (self , self .tr ("QGIS Python Plugin Installer" ), message , QMessageBox .Ok , QMessageBox .Abort ) == QMessageBox .Ok :
622
600
repositories .addKnownRepos ()
623
601
# refresh lists and populate widgets
@@ -677,7 +655,7 @@ def editRepository(self):
677
655
dlg .labelInfo .setText ("" )
678
656
else :
679
657
dlg .checkBoxEnabled .setEnabled (False )
680
- dlg .labelInfo .setText (self .tr ("This repository is blocked due to incompatibility with your QGIS version" ))
658
+ dlg .labelInfo .setText (self .tr ("This repository is blocked due to incompatibility with your Quantum GIS version" ))
681
659
dlg .labelInfo .setFrameShape (QFrame .Box )
682
660
if not dlg .exec_ ():
683
661
return # nothing to do if cancelled
@@ -713,7 +691,7 @@ def deleteRepository(self):
713
691
current = self .treeRepositories .currentItem ()
714
692
if current == None :
715
693
return
716
- warning = self .tr ("Are you sure you want to remove the repository" ) + "\n " + current .text (1 ) + "?"
694
+ warning = self .tr ("Are you sure you want to remove the following repository? " ) + "\n " + current .text (1 )
717
695
if QMessageBox .warning (self , self .tr ("QGIS Python Plugin Installer" ), warning , QMessageBox .Yes , QMessageBox .No ) == QMessageBox .No :
718
696
return
719
697
reposName = current .text (1 )
@@ -734,5 +712,4 @@ def reject(self):
734
712
""" update the list of seen plugins before exit (both 'done' and 'x' buttons emit 'reject' signal) """
735
713
plugins .updateSeenPluginsList ()
736
714
QDialog .reject (self )
737
- # } - C++ style footer for compability with lupdate
738
715
# --- /class QgsPluginInstallerDialog ------------------------------------------------------------------------ #
0 commit comments