[Gfoss] plugin python per QGis e QtCreator e Linguist

Giuseppe Sucameli brush.tyler a gmail.com
Sab 27 Ago 2011 14:13:20 CEST


On Aug 27, 2011, at 10:48 AM, Luca Mandolesi <mandoluca at gmail.com> wrote:

> Quando però do inglese come lingua a Qgis non cambia nulla.....
> 
> Mi manca ancora qualche passaggio....ma quale?
> 
> class PyArchInitPlugin:
> 	def __init__(self, iface):
> 		self.iface = iface
fin qui ok.

Le righe seguenti
> 		try:
> 		  self.QgisVersion = unicode( QGis.QGIS_VERSION_INT )
> 		except:
> 		  self.QgisVersion = unicode( QGis.qgisVersion )[ 0 ]
> 
> 		if QGis.QGIS_VERSION[0:3] < "1.5":
fino a qui invece sono un problema perché come puoi notare il controllo if è verificato solo se la versione di qgis è minore di 1.5.

Questo controllo è stato aggiunto quando GdalTools è stato inserito in trunk per mantenere una sola versione del codice funzionante con tutte le versioni di QGis.

Il resto va bene.
Ciao!

> 		  # For i18n support
> 		  userPluginPath = QFileInfo( QgsApplication.qgisUserDbFilePath() ).path() + "/python/plugins/pyarchinit"
> 		  systemPluginPath = QgsApplication.prefixPath() + "/python/plugins/pyarchinit"
> 
> 		  overrideLocale = QSettings().value( "locale/overrideFlag", QVariant( False ) ).toBool()
> 		  if not overrideLocale:
> 			localeFullName = QLocale.system().name()
> 		  else:
> 			localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString()
> 
> 		  if QFileInfo( userPluginPath ).exists():
> 			translationPath = userPluginPath + "/i18n/pyarchinit_" + localeFullName + ".qm"
> 		  else:
> 			translationPath = systemPluginPath + "/i18n/pyarchinit_" + localeFullName + ".qm"
> 
> 		  self.localePath = translationPath
> 		  if QFileInfo( self.localePath ).exists():
> 			self.translator = QTranslator()
> 			self.translator.load( self.localePath )
> 			QCoreApplication.installTranslator( self.translator )
> 
> 	def initGui(self):
>                ........


Maggiori informazioni sulla lista Gfoss