Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
added Makefile for package creation and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vmora committed Apr 18, 2014
1 parent daaf33b commit 406e517
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 40 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 2 additions & 13 deletions gui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: UTF-8 -*-

from SpatialiteAlgorithmProvider import SpatialiteAlgorithmProvider
from EpanetAlgorithmProvider import EpanetAlgorithmProvider
from processing.core.Processing import Processing

Expand Down Expand Up @@ -30,35 +29,29 @@ 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:
self.iface.removeToolBarIcon(a)

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]+"'"))):
Expand Down Expand Up @@ -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 = {}
Expand All @@ -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
Expand All @@ -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
Expand Down
28 changes: 1 addition & 27 deletions metadata.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 406e517

Please sign in to comment.