Skip to content
Permalink
Browse files

[processing] code formatting, make sources more pep8 compliant

  • Loading branch information
alexbruy committed Oct 1, 2013
1 parent 52746c8 commit 498a5d9ab8aac027a3f55f348288c97de9936919
Showing 358 changed files with 16,621 additions and 12,307 deletions.
@@ -16,35 +16,38 @@
* *
***************************************************************************
"""

from processing import interface

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

import shutil
import inspect
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from processing.commander.CommanderWindow import CommanderWindow
from processing.core.Processing import Processing
from processing.tools import dataobjects
from processing.tools.system import *
from processing.gui.ProcessingToolbox import ProcessingToolbox
from processing.gui.HistoryDialog import HistoryDialog
from processing.gui.ConfigDialog import ConfigDialog
from processing.gui.ResultsDialog import ResultsDialog
from processing.modeler.ModelerDialog import ModelerDialog
from processing.commander.CommanderWindow import CommanderWindow
from processing.tools import dataobjects
from processing.tools.system import *
import processing.resources_rc


cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)


class ProcessingPlugin:

def __init__(self, iface):
@@ -59,51 +62,61 @@ def initGui(self):
Processing.addAlgListListener(self.toolbox)

self.menu = QMenu(interface.iface.mainWindow())
self.menu.setTitle(QCoreApplication.translate("Processing", "Processing"))
self.menu.setTitle(QCoreApplication.translate('Processing',
'Processing'))

self.toolboxAction = self.toolbox.toggleViewAction()
self.toolboxAction.setIcon(QIcon(":/processing/images/alg.png"))
self.toolboxAction.setText(QCoreApplication.translate("Processing", "Toolbox"))
self.toolboxAction.setIcon(QIcon(':/processing/images/alg.png'))
self.toolboxAction.setText(QCoreApplication.translate('Processing',
'Toolbox'))
self.menu.addAction(self.toolboxAction)

self.modelerAction = QAction(QIcon(":/processing/images/model.png"),
QCoreApplication.translate("Processing", "Graphical modeler"),
interface.iface.mainWindow())
self.modelerAction = QAction(QIcon(':/processing/images/model.png'),
QCoreApplication.translate('Processing',
'Graphical modeler'),
interface.iface.mainWindow())
self.modelerAction.triggered.connect(self.openModeler)
self.menu.addAction(self.modelerAction)

self.historyAction = QAction(QIcon(":/processing/images/history.gif"),
QCoreApplication.translate("Processing", "History and log"),
interface.iface.mainWindow())
self.historyAction = QAction(QIcon(':/processing/images/history.gif'),
QCoreApplication.translate('Processing',
'History and log'),
interface.iface.mainWindow())
self.historyAction.triggered.connect(self.openHistory)
self.menu.addAction(self.historyAction)

self.configAction = QAction(QIcon(":/processing/images/config.png"),
QCoreApplication.translate("Processing", "Options and configuration"),
interface.iface.mainWindow())
self.configAction = QAction(QIcon(':/processing/images/config.png'),
QCoreApplication.translate('Processing',
'Options and configuration'),
interface.iface.mainWindow())
self.configAction.triggered.connect(self.openConfig)
self.menu.addAction(self.configAction)

self.resultsAction = QAction(QIcon(":/processing/images/results.png"),
QCoreApplication.translate("Processing", "&Results viewer"),
interface.iface.mainWindow())
self.resultsAction = QAction(QIcon(':/processing/images/results.png'),
QCoreApplication.translate('Processing',
'&Results viewer'),
interface.iface.mainWindow())
self.resultsAction.triggered.connect(self.openResults)
self.menu.addAction(self.resultsAction)

menuBar = interface.iface.mainWindow().menuBar()
menuBar.insertMenu(interface.iface.firstRightStandardMenu().menuAction(), self.menu)
menuBar.insertMenu(
interface.iface.firstRightStandardMenu().menuAction(), self.menu)

self.commanderAction = QAction(QIcon(":/processing/images/commander.png"),
QCoreApplication.translate("Processing", "&Commander"),
interface.iface.mainWindow())
self.commanderAction = QAction(
QIcon(':/processing/images/commander.png'),
QCoreApplication.translate('Processing', '&Commander'),
interface.iface.mainWindow())
self.commanderAction.triggered.connect(self.openCommander)
self.menu.addAction(self.commanderAction)
interface.iface.registerMainWindowAction(self.commanderAction, "Ctrl+Alt+M")
interface.iface.registerMainWindowAction(self.commanderAction,
'Ctrl+Alt+M')

def unload(self):
self.toolbox.setVisible(False)
self.menu.deleteLater()
#delete temporary output files

# delete temporary output files
folder = tempFolder()
if QDir(folder).exists():
shutil.rmtree(folder, True)
@@ -112,12 +125,11 @@ def unload(self):

def openCommander(self):
if self.commander is None:
self.commander = CommanderWindow(interface.iface.mainWindow(), interface.iface.mapCanvas())
self.commander = CommanderWindow(interface.iface.mainWindow(),
interface.iface.mapCanvas())
Processing.addAlgListListener(self.commander)
self.commander.prepareGui()
self.commander.show()
#dlg.exec_()


def openToolbox(self):
if self.toolbox.isVisible():
@@ -142,4 +154,3 @@ def openHistory(self):
def openConfig(self):
dlg = ConfigDialog(self.toolbox)
dlg.exec_()

@@ -20,7 +20,9 @@
__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

from processing.tools.dataobjects import *
@@ -30,6 +32,7 @@
from processing.tools.system import *
from processing.tests.TestData import loadTestData


def classFactory(iface):
from processing.ProcessingPlugin import ProcessingPlugin
return ProcessingPlugin(iface)
@@ -16,32 +16,43 @@
* *
***************************************************************************
"""
from processing.admintools.PostGISExecuteSQL import PostGISExecuteSQL
import os
from PyQt4 import QtGui

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui

from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.admintools.PostGISExecuteSQL import PostGISExecuteSQL
from processing.admintools.ImportIntoPostGIS import ImportIntoPostGIS
from processing.admintools.ImportVectorIntoGeoServer import ImportVectorIntoGeoServer
from processing.admintools.ImportVectorIntoGeoServer import \
ImportVectorIntoGeoServer
from processing.admintools.CreateWorkspace import CreateWorkspace
from processing.admintools.ImportRasterIntoGeoServer import ImportRasterIntoGeoServer
from processing.admintools.ImportRasterIntoGeoServer import \
ImportRasterIntoGeoServer
from processing.admintools.DeleteWorkspace import DeleteWorkspace
from processing.admintools.DeleteDatastore import DeleteDatastore
from processing.admintools.CreateStyleGeoServer import CreateStyleGeoServer
from processing.core.AlgorithmProvider import AlgorithmProvider


class AdminToolsAlgorithmProvider(AlgorithmProvider):

def __init__(self):
AlgorithmProvider.__init__(self)
self.alglist = [ImportVectorIntoGeoServer(), ImportRasterIntoGeoServer(),
CreateWorkspace(), DeleteWorkspace(), DeleteDatastore(),
CreateStyleGeoServer()]
self.alglist = [
ImportVectorIntoGeoServer(),
ImportRasterIntoGeoServer(),
CreateWorkspace(),
DeleteWorkspace(),
DeleteDatastore(),
CreateStyleGeoServer(),
]

try:
self.alglist.append(ImportIntoPostGIS())
@@ -52,22 +63,21 @@ def __init__(self):
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)


def unload(self):
AlgorithmProvider.unload(self)


def getName(self):
return "gspg"
return 'gspg'

def getDescription(self):
return "GeoServer/PostGIS tools"
return 'GeoServer/PostGIS tools'

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/database.png")
return QtGui.QIcon(os.path.dirname(__file__)
+ '/../images/database.png')

def _loadAlgorithms(self):
self.algs = self.alglist

def supportsNonFileBasedOutput(self):
return False
return False
@@ -1,61 +1,58 @@
#===============================================================================
# # -*- coding: utf-8 -*-
#
# """
# ***************************************************************************
# CreateMosaicDatastore.py
# ---------------------
# Date : October 2012
# Copyright : (C) 2012 by Victor Olaya
# Email : volayaf at gmail dot com
# ***************************************************************************
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# ***************************************************************************
# """
# from processing.tools import dataobjects
# from processing.parameters.ParameterString import ParameterString
# from processing.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm
#
# __author__ = 'Victor Olaya'
# __date__ = 'October 2012'
# __copyright__ = '(C) 2012, Victor Olaya'
# # This will get replaced with a git SHA1 when you do a git archive
# __revision__ = '$Format:%H$'
#
# from qgis.core import *
# from processing.parameters.ParameterVector import ParameterVector
# from processing.tools import dataobjects
# import os
#
# class CreateMosaicDatastore(GeoServerToolsAlgorithm):
#
# INPUT = "INPUT"
# WORKSPACE = "WORKSPACE"
#
# def processAlgorithm(self, progress):
# self.createCatalog()
# input = self.getParameterValue(self.INPUT)
# workspaceName = self.getParameterValue(self.WORKSPACE)
# connection = {
# 'shp': basepathname + '.shp',
# 'shx': basepathname + '.shx',
# 'dbf': basepathname + '.dbf',
# 'prj': basepathname + '.prj'
# }
#
# workspace = self.catalog.get_workspace(workspaceName)
# self.catalog.create_featurestore(basefilename, connection, workspace)
#
#
# def defineCharacteristics(self):
# self.addcaddBaseParameters()
# self.name = "Import into GeoServer"
# self.group = "GeoServer management tools"
# self.addParameter(ParameterVector(self.INPUT, "Layer to import", [ParameterVector.VECTOR_TYPE_ANY]))
# self.addParameter(ParameterString(self.WORKSPACE, "Workspace"))
#===============================================================================
# -*- coding: utf-8 -*-

"""
***************************************************************************
CreateMosaicDatastore.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from qgis.core import *
from processing.admintools.GeoServerToolsAlgorithm import \
GeoServerToolsAlgorithm
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
from processing.tools import dataobjects


class CreateMosaicDatastore(GeoServerToolsAlgorithm):

INPUT = "INPUT"
WORKSPACE = "WORKSPACE"

def processAlgorithm(self, progress):
self.createCatalog()
input = self.getParameterValue(self.INPUT)
workspaceName = self.getParameterValue(self.WORKSPACE)
connection = {
'shp': basepathname + '.shp',
'shx': basepathname + '.shx',
'dbf': basepathname + '.dbf',
'prj': basepathname + '.prj'}
workspace = self.catalog.get_workspace(workspaceName)
self.catalog.create_featurestore(basefilename, connection, workspace)

def defineCharacteristics(self):
self.addcaddBaseParameters()
self.name = "Import into GeoServer"
self.group = "GeoServer management tools"
self.addParameter(ParameterVector(self.INPUT, "Layer to import",
[ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterString(self.WORKSPACE, "Workspace"))

0 comments on commit 498a5d9

Please sign in to comment.
You can’t perform that action at this time.