From 406e517f7023e80dee259b8ebfb034cf6dc2b2bb Mon Sep 17 00:00:00 2001 From: vmora Date: Fri, 18 Apr 2014 18:20:44 +0200 Subject: [PATCH] added Makefile for package creation and cleanup --- Makefile | 7 +++++++ gui.py | 15 ++------------- metadata.txt | 28 +--------------------------- 3 files changed, 10 insertions(+), 40 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7015daa --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +package: epanet.png metadata.txt timeplot.svg EpanetAlgorithm.py EpanetAlgorithmProvider.py EpanetOutputTable.py EpanetTableWriter.py gui.py __init__.py + rm -rf qgis_epanet + mkdir qgis_epanet + cp $^ qgis_epanet/ + rm -f qgis_epanet.zip + zip -r qgis_epanet.zip qgis_epanet + rm -r qgis_epanet diff --git a/gui.py b/gui.py index 7506819..ce6588b 100644 --- a/gui.py +++ b/gui.py @@ -1,6 +1,5 @@ # -*- coding: UTF-8 -*- -from SpatialiteAlgorithmProvider import SpatialiteAlgorithmProvider from EpanetAlgorithmProvider import EpanetAlgorithmProvider from processing.core.Processing import Processing @@ -30,17 +29,12 @@ def initGui(self): for a in self.actions: self.iface.addToolBarIcon(a) - print "here" self.epanetAlgoProvider = EpanetAlgorithmProvider() - print self.epanetAlgoProvider Processing.addProvider(self.epanetAlgoProvider, True) - self.spatialiteAlgorithmProvider = SpatialiteAlgorithmProvider() - Processing.addProvider(self.spatialiteAlgorithmProvider, True) QgsMapLayerRegistry.instance().layersAdded.connect( self.layerAdded ) def unload(self): - Processing.removeProvider(self.spatialiteAlgorithmProvider) Processing.removeProvider(self.epanetAlgoProvider) # Remove the plugin menu item and icon for a in self.actions: @@ -48,17 +42,16 @@ def unload(self): def timeplot(self): layer = self.iface.activeLayer() - print layer.name() + if not layer: + return if layer.name().lower() == 'reservoirs' or layer.name().lower() == 'tanks': res = QgsMapLayerRegistry.instance().mapLayersByName('Node output table') if res: - print res assert(len(res) == 1) nbfeat = len(layer.selectedFeatures()) fig, p = None,[] if nbfeat >= 1 : fig,p = subplots(1,nbfeat) if nbfeat == 1 : p = [p] - print nbfeat, p for i,s in enumerate(layer.selectedFeatures()): x,y = [],[] for f in res[0].getFeatures(QgsFeatureRequest(QgsExpression("Node = '"+s[0]+"'"))): @@ -140,7 +133,6 @@ def timeplot(self): if fig : show() def layerAdded(self, layers): - print 'layers added ', layers # get a map from layer names epanet_layers = {} @@ -157,10 +149,8 @@ def layerAdded(self, layers): result_type = 'Link time agregates' if 'Node' in fields and 'MaxPressure' in fields: result_type = 'Node time agregates' - print result_type if result_type == 'Node time agregates': # create join on first field - print 'create join on junctions' join_info = QgsVectorJoinInfo() join_info.targetFieldName = 'ID Node' join_info.targetFieldIndex = 0 @@ -173,7 +163,6 @@ def layerAdded(self, layers): if name in epanet_layers: epanet_layers[name].addJoin( join_info ) if result_type == 'Link time agregates': # create join on first field - print 'create join on junctions' join_info = QgsVectorJoinInfo() join_info.targetFieldName = 'ID Link' join_info.targetFieldIndex = 0 diff --git a/metadata.txt b/metadata.txt index d5fd58f..5574689 100644 --- a/metadata.txt +++ b/metadata.txt @@ -1,38 +1,12 @@ -# This file contains metadata for your plugin. Beginning -# with version 1.8 this is the preferred way to supply information about a -# plugin. The current method of embedding metadata in __init__.py will -# be supported until version 2.0 - -# This file should be included when you package your plugin. - -# Mandatory items: - - [general] -name=qgis-epanet +name=qgis_epanet qgisMinimumVersion=2.0 description=Extends processing framework to models the hydraulic and water quality behavior of water distribution piping systems version=1.0 author=Oslandia email=infos@oslandia.com - -# end of mandatory metadata - -# Optional items: - -# Uncomment the following line and add your changelog entries: -# changelog= - -# tags are comma separated with spaces allowed -# tags= - homepage=https://github.com/Oslandia/qgis-epanet -# tracker= repository=https://github.com/Oslandia/qgis-epanet icon=epanet.png -# experimental flag experimental=True - -# deprecated flag (applies to the whole plugin, not just a single version deprecated=False -