class VectorGeoref:

	def __init__(self, iface):
		# Save reference to the QGIS interface
		self.iface = iface
		# initialize plugin directory
		self.plugin_dir = os.path.dirname(__file__)
		# initialize locale
		locale = QSettings().value("locale/userLocale")[0:2]
		localePath = os.path.join(self.plugin_dir, 'i18n', 'vectorgeoref_{}.qm'.format(locale))
		if os.path.exists(localePath):
			self.translator = QTranslator()
			self.translator.load(localePath)
			if qVersion() > '4.3.3':
				QCoreApplication.installTranslator(self.translator)
		# Create the dialog (after translation) and keep reference
		self.dlg = VectorGeorefDialog(self.iface)

	def initGui(self):
		# Create action that will start plugin configuration
		self.plugin_dir = os.path.dirname(__file__)
		icoDir = self.plugin_dir + os.sep + "/icon.png"
		self.action = QAction(QIcon(icoDir),u"Vector Georeferencer", self.iface.mainWindow())
		# connect the action to the run method
		self.action.triggered.connect(self.run)
		# Add toolbar button and menu item
		self.iface.addToolBarIcon(self.action)
		self.iface.addPluginToMenu(u"&vectorgeoref", self.action)

	def unload(self):
		# Remove the plugin menu item and icon
		self.iface.removePluginMenu(u"&vectorgeoref", self.action)
		self.iface.removeToolBarIcon(self.action)

	# run method that performs all the real work
	def run(self):
		self.dlg.show()
		# Run the dialog event loop
		result = self.dlg.exec_()
		# See if OK was pressed
		if result == 1:
			# do something useful (delete the line containing pass and
			# substitute with your code)
			pass
	def __init__(self, iface):
		# Save reference to the QGIS interface
		self.iface = iface
		# initialize plugin directory
		self.plugin_dir = os.path.dirname(__file__)
		# initialize locale
		locale = QSettings().value("locale/userLocale")[0:2]
		localePath = os.path.join(self.plugin_dir, 'i18n', 'vectorgeoref_{}.qm'.format(locale))
		if os.path.exists(localePath):
			self.translator = QTranslator()
			self.translator.load(localePath)
			if qVersion() > '4.3.3':
				QCoreApplication.installTranslator(self.translator)
		# Create the dialog (after translation) and keep reference
		self.dlg = VectorGeorefDialog(self.iface)
	def __init__(self, iface):
		# Save reference to the QGIS interface
		self.iface = iface
		# initialize plugin directory
		self.plugin_dir = os.path.dirname(__file__)
		# initialize locale

		userPluginPath = QFileInfo( QgsApplication.qgisUserDbFilePath() ).path() + "/python/plugins/pyarchinit"
		systemPluginPath = QgsApplication.prefixPath() + "/python/plugins/pyarchinit"

		overrideLocale = QSettings().value( "locale/overrideFlag", QVariant ) #.toBool()
		if not overrideLocale:
			localeFullName = QLocale.system().name()
		else:
			localeFullName = QSettings().value( "locale/userLocale", QVariant ) #.toString()

		if QFileInfo( userPluginPath ).exists():
			translationPath = userPluginPath + "/i18n/pyarchinit_plugin_" + localeFullName + ".qm"
		else:
			translationPath = systemPluginPath + "/i18n/pyarchinit_plugin_" + localeFullName + ".qm"

		self.localePath = translationPath
		if QFileInfo( self.localePath ).exists():
			self.translator = QTranslator()
			self.translator.load( self.localePath )
			QCoreApplication.installTranslator( self.translator )
		"""
		locale = QSettings().value("locale/userLocale")[0:2]
		localePath = os.path.join(self.plugin_dir, 'i18n', 'vectorgeoref_{}.qm'.format(locale))
		if os.path.exists(localePath):
			self.translator = QTranslator()
			self.translator.load(localePath)
			if qVersion() > '4.3.3':
				QCoreApplication.installTranslator(self.translator)
		"""
		# Create the dialog (after translation) and keep reference
		self.dlg = VectorGeorefDialog(self.iface)
class VectorGeoref:

	def __init__(self, iface):
		# Save reference to the QGIS interface
		self.iface = iface
		# initialize plugin directory
		self.plugin_dir = os.path.dirname(__file__)
		# initialize locale

		userPluginPath = QFileInfo( QgsApplication.qgisUserDbFilePath() ).path() + "/python/plugins/pyarchinit"
		systemPluginPath = QgsApplication.prefixPath() + "/python/plugins/pyarchinit"

		overrideLocale = QSettings().value( "locale/overrideFlag", QVariant ) #.toBool()
		if not overrideLocale:
			localeFullName = QLocale.system().name()
		else:
			localeFullName = QSettings().value( "locale/userLocale", QVariant ) #.toString()

		if QFileInfo( userPluginPath ).exists():
			translationPath = userPluginPath + "/i18n/pyarchinit_plugin_" + localeFullName + ".qm"
		else:
			translationPath = systemPluginPath + "/i18n/pyarchinit_plugin_" + localeFullName + ".qm"

		self.localePath = translationPath
		if QFileInfo( self.localePath ).exists():
			self.translator = QTranslator()
			self.translator.load( self.localePath )
			QCoreApplication.installTranslator( self.translator )
		"""
		locale = QSettings().value("locale/userLocale")[0:2]
		localePath = os.path.join(self.plugin_dir, 'i18n', 'vectorgeoref_{}.qm'.format(locale))
		if os.path.exists(localePath):
			self.translator = QTranslator()
			self.translator.load(localePath)
			if qVersion() > '4.3.3':
				QCoreApplication.installTranslator(self.translator)
		"""
		# Create the dialog (after translation) and keep reference
		self.dlg = VectorGeorefDialog(self.iface)

	def initGui(self):
		# Create action that will start plugin configuration
		self.plugin_dir = os.path.dirname(__file__)
		icoDir = self.plugin_dir + os.sep + "/icon.png"
		self.action = QAction(QIcon(icoDir),u"Vector Georeferencer", self.iface.mainWindow())
		# connect the action to the run method
		self.action.triggered.connect(self.run)
		# Add toolbar button and menu item
		self.iface.addToolBarIcon(self.action)
		self.iface.addPluginToMenu(u"&vectorgeoref", self.action)

	def unload(self):
		# Remove the plugin menu item and icon
		self.iface.removePluginMenu(u"&vectorgeoref", self.action)
		self.iface.removeToolBarIcon(self.action)

	# run method that performs all the real work
	def run(self):
		self.dlg.show()
		# Run the dialog event loop
		result = self.dlg.exec_()
		# See if OK was pressed
		if result == 1:
			# do something useful (delete the line containing pass and
			# substitute with your code)
			pass