forked from Oslandia/qgis-epanet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
EpanetOutputTable.py
51 lines (38 loc) · 1.85 KB
/
EpanetOutputTable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
***************************************************************************
EpanetOutputTable.py
---------------------
Date : Febuary 2014
Copyright : (C) 2014 by Vincent Mora
Email : vincent dot mora at oslandia 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__ = 'Vincent Mora'
__date__ = 'Febuary 2014'
__copyright__ = '(C) 2014, Oslandia'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtCore import *
from EpanetTableWriter import EpanetTableWriter
from processing.outputs.OutputTable import OutputTable
from processing.tools.system import *
class EpanetOutputTable(OutputTable):
def getTableWriter(self, fields):
"""Returns a suitable writer to which records can be added as a
result of the algorithm. Use this to transparently handle
output values instead of creating your own method.
@param fields a list of QgsField
@return writer instance of the table writer class
"""
if self.encoding is None:
settings = QSettings()
self.encoding = settings.value('/Processing/encoding', 'System')
return EpanetTableWriter(self.value, self.encoding, fields)