Skip to content

Commit

Permalink
PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Mar 22, 2013
1 parent 7299da1 commit 2e56dbf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .idea/inasafe-dev.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 30 additions & 17 deletions safe_qgis/plugin.py
Expand Up @@ -90,8 +90,9 @@ def setupI18n(self, thePreferredLocale=None):
Raises:
TranslationLoadException
"""
myOverrideFlag = QSettings().value('locale/overrideFlag',
QVariant(False)).toBool()
myOverrideFlag = QSettings().value(
'locale/overrideFlag',
QVariant(False)).toBool()

if thePreferredLocale is not None:
myLocaleName = thePreferredLocale
Expand All @@ -109,21 +110,28 @@ def setupI18n(self, thePreferredLocale=None):
# .. see:: :py:func:`common.utilities`
os.environ['LANG'] = str(myLocaleName)

LOGGER.debug('%s %s %s %s' % (thePreferredLocale , myOverrideFlag,
QLocale.system().name(),
os.environ['LANG']))
LOGGER.debug('%s %s %s %s' % (
thePreferredLocale,
myOverrideFlag,
QLocale.system().name(),
os.environ['LANG']))

myRoot = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
myTranslationPath = os.path.join(myRoot, 'safe_qgis', 'i18n',
'inasafe_' + str(myLocaleName) + '.qm')
myTranslationPath = os.path.join(
myRoot, 'safe_qgis', 'i18n',
'inasafe_' + str(myLocaleName) + '.qm')

if os.path.exists(myTranslationPath):
self.translator = QTranslator()
myResult = self.translator.load(myTranslationPath)
if not myResult:
myMessage = 'Failed to load translation for %s' % myLocaleName
raise TranslationLoadError(myMessage)
QCoreApplication.installTranslator(self.translator)
LOGGER.debug('%s %s' % (myTranslationPath,
os.path.exists(myTranslationPath)))

LOGGER.debug('%s %s' % (
myTranslationPath,
os.path.exists(myTranslationPath)))

def tr(self, theString):
"""We implement this ourself since we do not inherit QObject.
Expand Down Expand Up @@ -346,7 +354,8 @@ def unload(self):
self.iface.mainWindow().removeDockWidget(self.dockWidget)
self.dockWidget.setVisible(False)
self.dockWidget.destroy()
QObject.disconnect(self.iface,
QObject.disconnect(
self.iface,
SIGNAL("currentLayerChanged(QgsMapLayer*)"),
self.layerChanged)

Expand Down Expand Up @@ -430,9 +439,10 @@ def showOptions(self):
# import here only so that it is AFTER i18n set up
from safe_qgis.options_dialog import OptionsDialog

myDialog = OptionsDialog(self.iface.mainWindow(),
self.iface,
self.dockWidget)
myDialog = OptionsDialog(
self.iface.mainWindow(),
self.iface,
self.dockWidget)
myDialog.show()

def showKeywordsEditor(self):
Expand All @@ -445,8 +455,10 @@ def showKeywordsEditor(self):
Args:
None.
Returns:
None.
Raises:
no exceptions explicitly raised.
"""
Expand All @@ -455,9 +467,10 @@ def showKeywordsEditor(self):

if self.iface.activeLayer() is None:
return
myDialog = KeywordsDialog(self.iface.mainWindow(),
self.iface,
self.dockWidget)
myDialog = KeywordsDialog(
self.iface.mainWindow(),
self.iface,
self.dockWidget)
myDialog.setModal(True)
myDialog.show()

Expand Down Expand Up @@ -521,5 +534,5 @@ def layerChanged(self, theLayer):
self.dockWidget.layerChanged(theLayer)

def keyActionF7(self):
'''Executed when user press F7'''
"""Executed when user press F7"""
self.showImpactFunctionsDoc()

0 comments on commit 2e56dbf

Please sign in to comment.