Skip to content

Commit

Permalink
add logo, i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Jul 9, 2014
1 parent 82096a1 commit 6cfd4c7
Show file tree
Hide file tree
Showing 13 changed files with 4,094 additions and 103 deletions.
6 changes: 3 additions & 3 deletions Controller/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def ProcessQuickQuery(dialog = None, key = None,value = None,bbox = None,nominat
layerName = layerName[:-1]

#Prepare outputs
dialog.setProgressText("Prepare outputs")
dialog.setProgressText(QApplication.translate("QuickOSM",u"Prepare outputs"))
#If a file already exist, we avoid downloading data for nothing
outputs = {}
for layer in ['points','lines','multilinestrings','multipolygons']:
Expand All @@ -84,7 +84,7 @@ def ProcessQuickQuery(dialog = None, key = None,value = None,bbox = None,nominat

#Getting the default OAPI and running the query
server = Tools.getSetting('defaultOAPI')
dialog.setProgressText("Downloading data from Overpass")
dialog.setProgressText(QApplication.translate("QuickOSM",u"Downloading data from Overpass"))
QApplication.processEvents()
connexionOAPI = ConnexionOAPI(url=server,output = "xml")
osmFile = connexionOAPI.getFileFromQuery(query)
Expand All @@ -97,7 +97,7 @@ def ProcessQuickQuery(dialog = None, key = None,value = None,bbox = None,nominat

#Geojson to shapefile
numLayers = 0
dialog.setProgressText("From GeoJSON to Shapefile")
dialog.setProgressText(QApplication.translate("QuickOSM",u"From GeoJSON to Shapefile"))
for i, (layer,item) in enumerate(layers.iteritems()):
dialog.setProgressPercentage(i/len(layers)*100)
QApplication.processEvents()
Expand Down
32 changes: 25 additions & 7 deletions CoreQuickOSM/ExceptionQuickOSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,66 @@
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from PyQt4.QtGui import QApplication

"""
QApplication.translate doesn't work in contructor's parameters
"""

'''
Error 10-19 - Overpass
'''
class OverpassBadRequestException(GeoAlgorithmExecutionException):
def __init__(self, msg = QApplication.translate("Exception", u"Bad request OverpassAPI")):
def __init__(self, msg=None):
if not msg:
msg = QApplication.translate("Exception", u"Bad request OverpassAPI")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 10

class OverpassTimeoutException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"OverpassAPI timeout")):
def __init__(self, msg=None):
if not msg:
msg = QApplication.translate("Exception", u"OverpassAPI timeout")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 11

'''
Error 20-29 - Nominatim
'''
class NominatimAreaException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"No nominatim area")):
def __init__(self, msg=None):
if not msg:
msg = QApplication.translate("Exception", u"No nominatim area")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 20

'''
Error 30-39 - Other
'''
class DirectoryOutPutException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"The output directory does not exist.")):
def __init__(self, msg=None):
if not msg:
msg = QApplication.translate("Exception", u"The output directory does not exist.")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 30

class FileOutPutException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"The output file already exist, set a prefix"), suffix=None):
def __init__(self, msg=None, suffix=None):
if not msg:
msg= QApplication.translate("Exception", u"The output file already exist, set a prefix")
if suffix:
msg = msg + " " + suffix
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 31

class OutPutFormatException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"Output not available")):
def __init__(self,msg=None):
if not msg:
msg = QApplication.translate("Exception", u"Output not available")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 32

class Ogr2OgrException(GeoAlgorithmExecutionException):
def __init__(self,msg= QApplication.translate("Exception", u"Error with ogr2ogr")):
def __init__(self,msg=None):
if not msg:
msg = QApplication.translate("Exception", u"Error with ogr2ogr")
GeoAlgorithmExecutionException.__init__(self,msg)
self.errorNumber = 33
5 changes: 3 additions & 2 deletions CoreQuickOSM/Parser/OsmParser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from qgis.core import QgsVectorLayer, QgsFeature, QgsField, QgsFields, QgsVectorFileWriter
from PyQt4.QtCore import *
from PyQt4.QtGui import QApplication

from osgeo import gdal
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
Expand Down Expand Up @@ -65,7 +66,7 @@ def parse(self):

#Foreach layers
for layer in self.__layers:
self.signalText.emit("Parsing layer : " + layer)
self.signalText.emit(QApplication.translate("QuickOSM",u"Parsing layer : " + layer))
layers[layer] = {}

#Reading it with a QgsVectorLayer
Expand Down Expand Up @@ -117,7 +118,7 @@ def parse(self):

#Creating GeoJSON files for each layers
for layer in self.__layers:
self.signalText.emit("Creating GeoJSON file : " + layer)
self.signalText.emit(QApplication.translate("QuickOSM",u"Creating GeoJSON file : " + layer))
self.signalPercentage.emit(0)

#Creating the temp file
Expand Down
25 changes: 3 additions & 22 deletions ProcessingQuickOSM/API/OverpassQueryGeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,9 @@ def defineCharacteristics(self):
self.group = "API"

self.addParameter(ParameterString(self.SERVER, 'Overpass API','http://overpass-api.de/api/', False, False))
self.addParameter(ParameterString(self.QUERY_STRING,'Query (XML or OQL)', '<osm-script output="json">\n \
<id-query into="area" ref="3600028722" type="area"/>\n \
<union into="_">\n \
<query into="_" type="node">\n \
<has-kv k="amenity" modv="" v="school"/>\n \
<area-query from="area" into="_" ref=""/>\n \
</query>\n \
<query into="_" type="way">\n \
<has-kv k="amenity" modv="" v="school"/>\n \
<area-query from="area" into="_" ref=""/>\n \
</query>\n \
<query into="_" type="relation">\n \
<has-kv k="amenity" modv="" v="school"/>\n \
<area-query from="area" into="_" ref=""/>\n \
</query>\n \
</union>\n \
<print from="_" limit="" mode="body" order="id"/>\n \
<recurse from="_" into="_" type="down"/>\n \
<print from="_" limit="" mode="skeleton" order="quadtile"/>\n \
</osm-script>', True,False))
self.addParameter(ParameterExtent(self.EXTENT, 'Extent for {{bbox}} '))
self.addParameter(ParameterString(self.NOMINATIM, 'Place for {{nominatim}}','Montpellier', False, True))
self.addParameter(ParameterString(self.QUERY_STRING,'Query (XML or OQL)', '', True,False))
self.addParameter(ParameterExtent(self.EXTENT, 'If {{bbox}} in the query, extent :'))
self.addParameter(ParameterString(self.NOMINATIM, 'If {{nominatim}} in the query, place :','', False, True))

self.addOutput(OutputFile(self.OUTPUT_FILE, 'OSM file'))

Expand Down
2 changes: 1 addition & 1 deletion ProcessingQuickOSM/API/XapiQueryGeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def defineCharacteristics(self):
self.group = "API"

self.addParameter(ParameterString(self.SERVER, 'XAPI','http://www.overpass-api.de/api/xapi?', False, False))
self.addParameter(ParameterString(self.QUERY_STRING,'Query', 'relation[ref:INSEE=25047]', False,False))
self.addParameter(ParameterString(self.QUERY_STRING,'Query', '', False,False))

self.addOutput(OutputFile(self.OUTPUT_FILE,'OSM file'))

Expand Down
49 changes: 0 additions & 49 deletions ProcessingQuickOSM/Parser/FirstRelationIdParserGeoAlgorithm.py

This file was deleted.

7 changes: 2 additions & 5 deletions ProcessingQuickOSM/QuickOSMAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from Tools.ReadIniFilePathGeoAlgorithm import ReadIniFilePathGeoAlgorithm
from Tools.QueryFactoryGeoAlgorithm import QueryFactoryGeoAlgorithm
from Parser.OsmParserGeoAlgorithm import OsmParserGeoAlgorithm
from Parser.FirstRelationIdParserGeoAlgorithm import FirstRelationIdParserGeoAlgorithm
from Tools.GetFirstFieldGeoAlgorithm import GetFirstFieldGeoAlgorithm
from PyQt4.QtGui import QIcon
from os.path import dirname,abspath,join
Expand All @@ -36,10 +35,9 @@ def __init__(self):

# Load algorithms
self.alglist = [OverpassQueryGeoAlgorithm(),
NominatimQueryGeoAlgorithm(),
#NominatimQueryGeoAlgorithm(),
OsmParserGeoAlgorithm(),
XapiQueryGeoAlgorithm(),
FirstRelationIdParserGeoAlgorithm(),
#XapiQueryGeoAlgorithm(),
ReadIniFileGeoAlgorithm(),
ReadIniFilePathGeoAlgorithm(),
ListIniFilesGeoAlgorithm(),
Expand All @@ -54,7 +52,6 @@ def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
directory = join(dirname(dirname(abspath(__file__))),'queries')
ProcessingConfig.addSetting(Setting(self.getDescription(),self.QUERIES_FOLDER,'Queries folder',directory))


def unload(self):
AlgorithmProvider.unload(self)
Expand Down
Binary file modified i18n/QuickOSM_fr.qm
Binary file not shown.
42 changes: 33 additions & 9 deletions i18n/QuickOSM_fr.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr_FR" sourcelanguage="en">
<!DOCTYPE TS><TS version="2.0" language="fr_FR" sourcelanguage="en">
<context>
<name>Exception</name>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="14"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="20"/>
<source>Bad request OverpassAPI</source>
<translation>Erreur de requête OverpassAPI</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="19"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="27"/>
<source>OverpassAPI timeout</source>
<translation>Temps d&apos;exécution OverpassAPI atteint</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="27"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="37"/>
<source>No nominatim area</source>
<translation>Absence de résultat Nominatim</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="35"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="47"/>
<source>The output directory does not exist.</source>
<translation>Le dossier de sortie n&apos;existe pas.</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="40"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="54"/>
<source>The output file already exist, set a prefix</source>
<translation>Le fichier de sortie existe déjà, préfixez</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="47"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="63"/>
<source>Output not available</source>
<translation>Format non disponible</translation>
</message>
<message>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="52"/>
<location filename="CoreQuickOSM/ExceptionQuickOSM.py" line="70"/>
<source>Error with ogr2ogr</source>
<translation>Erreur avec ogr2ogr</translation>
</message>
Expand All @@ -51,6 +50,31 @@
<source>Running query ...</source>
<translation>Requête en cours ...</translation>
</message>
<message>
<location filename="ui/quick_query_dialog.py" line="144"/>
<source>Successful query !</source>
<translation>Requête réussie !</translation>
</message>
<message>
<location filename="ui/quick_query_dialog.py" line="146"/>
<source>Successful query, but no result.</source>
<translation>Requête réussie, mais pas de résultat.</translation>
</message>
<message>
<location filename="Controller/Process.py" line="61"/>
<source>Prepare outputs</source>
<translation>Préparation des fichiers</translation>
</message>
<message>
<location filename="Controller/Process.py" line="88"/>
<source>Downloading data from Overpass</source>
<translation>Téléchargement des données OSM</translation>
</message>
<message>
<location filename="Controller/Process.py" line="101"/>
<source>From GeoJSON to Shapefile</source>
<translation>Du GeoJSON au Shapefile</translation>
</message>
</context>
<context>
<name>ui_main_window</name>
Expand Down
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6cfd4c7

Please sign in to comment.