Skip to content

Commit

Permalink
Merge pull request #908 from Giswater/dev-3.6
Browse files Browse the repository at this point in the history
Dev 3.6
  • Loading branch information
smaspons authored Mar 21, 2024
2 parents c887f4d + 1c804b5 commit ae59647
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 76 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ build/
.idea/workspace.xml
.idea/
test/log/
__pycache__
__pycache__
config/dev.config
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ As Giswater is as server-client software you need to install it into two separat

### Backend environment:
Works as well on Windows, MaC or Linux O/S.<br>
Install PostgreSQL (from 9.5 to 14).<br>
Install Postgis, pgrouting, tablefunc and unaccent extensions for PostgreSQL.<br>
Install PostgreSQL (from 9.5 to 16).<br>
Install Postgis, pgrouting and other extensions for PostgreSQL.<br>
`create extension postgis;`<br>
`create extension pgrouting;`<br>
`create extension tablefunc;`<br>
`create extension unaccent;`<br>
`create extension postgis_raster;`<br>
`create extension fuzzystrmatch;`<br>

### Frontend environment:
Works as well on Windows, MaC or Linux O/S, but only on Windows to enjoy EPA models.<br>
Expand Down Expand Up @@ -117,10 +119,10 @@ There is no time-period defined for major releases.<br>
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 3 of the License, or (at your option) any later version. See LICENSE file for more information.


## THANKS TO
## THANKS TO THE FOUNDING CONTRIBUTORS
GITS-BarcelonaTech University<br>
Aigües de Mataró<br>
Aigües de Girona<br>
Cicle de l'Aigua del Ter S.A<br>
Aigües de Blanes<br>
Aigües del Prat<br>
Aigües de Vic<br>
Expand All @@ -130,4 +132,4 @@ Figueres de Serveis, S.A<br>
Prodaisa<br>
Sabemsa<br>
Consorci Aigües de Tarragona<br>

BGEO OPEN GIS S.L.<br>
49 changes: 0 additions & 49 deletions config/dev.config

This file was deleted.

13 changes: 11 additions & 2 deletions core/admin/admin_btn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2904,6 +2904,12 @@ def _insert_inp_into_db(self, folder_path=None):
aux = list_aux[x].split(" ")
str_aux = ""
for i in range(len(aux)):
# If the text starts with `;` it means it's the annotation for that line, so we put all
# the annotation text in a single string to then insert it to csv39
if str(aux[i]).startswith(';'):
final_col = ' '.join(aux[i:])
dirty_list.append(final_col)
break
# If text is between double-quotes, insert it without the quotes
# This includes "xxxx" and ""
if str(aux[i]).startswith('"') and str(aux[i]).endswith('"'):
Expand Down Expand Up @@ -2939,12 +2945,15 @@ def _insert_inp_into_db(self, folder_path=None):
sql += "INSERT INTO temp_csv (fid, source, "
values = "VALUES(239, $$" + target + "$$, "
for x in range(0, len(sp_n)):
csv_col = str(x + 1)
if sp_n[x] != "''":
sql += "csv" + str(x + 1) + ", "
if sp_n[x].strip().replace("\n", "").startswith(';') and x == len(sp_n)-1:
csv_col = "39"
sql += "csv" + csv_col + ", "
value = "$$" + sp_n[x].strip().replace("\n", "") + "$$, "
values += value.replace("$$$$", "null")
else:
sql += "csv" + str(x + 1) + ", "
sql += "csv" + csv_col + ", "
values = "VALUES(null, "
sql = sql[:-2] + ") "
values = values[:-2] + ");\n"
Expand Down
3 changes: 2 additions & 1 deletion core/load_project_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def _fill_tbl_config_files(self):
self.tree_config_files.itemChanged.connect(partial(self._set_config_value))

path = f"{lib_vars.user_folder_dir}{os.sep}core{os.sep}config"
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f != 'user_params.config']
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f != 'user_params.config'
and '.bak' not in f]
for file in files:
item = QTreeWidgetItem([f"{file}"])

Expand Down
1 change: 1 addition & 0 deletions core/shared/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from ..ui.ui_manager import GwInfoGenericUi, GwInfoFeatureUi, GwVisitEventFullUi, GwMainWindow, GwVisitDocumentUi, \
GwInfoCrossectUi, GwInterpolate
# WARNING: DO NOT REMOVE THESE IMPORTS, THEY ARE USED BY EPA ACTIONS
# noinspection PyUnresolvedReferences
from ..ui.ui_manager import GwInfoEpaDemandUi, GwInfoEpaOrificeUi, GwInfoEpaOutletUi, GwInfoEpaPumpUi, \
GwInfoEpaWeirUi, GwInfoEpaDwfUi
from ... import global_vars
Expand Down
2 changes: 1 addition & 1 deletion core/toolbars/om/flow_exit_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def activate(self):

# Show help message when action is activated
if self.show_help:
message = "Click on node to computed its downstream network"
message = "Click on node to compute its downstream network"
tools_qgis.show_info(message)

# Control current layer (due to QGIS bug in snapping system)
Expand Down
4 changes: 2 additions & 2 deletions core/toolbars/om/flow_trace_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def activate(self):

# Show help message when action is activated
if self.show_help:
message = "Click on node to computed its upstream network"
message = "Click on node to compute its upstream network"
tools_qgis.show_info(message)

# Control current layer (due to QGIS bug in snapping system)
Expand Down Expand Up @@ -103,4 +103,4 @@ def _set_flow_trace(self, event):
# Set action pan
self.set_action_pan()

# endregion
# endregion
10 changes: 5 additions & 5 deletions core/toolbars/toc/epa_world_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def _get_sectors():


def _get_layers():
arc_layers = [tools_qgis.get_layer_by_tablename('v_edit_arc')]
node_layers = [tools_qgis.get_layer_by_tablename('v_edit_node')]
connec_layers = [tools_qgis.get_layer_by_tablename('v_edit_connec')]
gully_layers = [tools_qgis.get_layer_by_tablename('v_edit_gully')]
link_layers = [tools_qgis.get_layer_by_tablename('v_edit_link')]
arc_layers = [lyr for lyr in [tools_qgis.get_layer_by_tablename('v_edit_arc')] if lyr is not None]
node_layers = [lyr for lyr in [tools_qgis.get_layer_by_tablename('v_edit_node')] if lyr is not None]
connec_layers = [lyr for lyr in [tools_qgis.get_layer_by_tablename('v_edit_connec')] if lyr is not None]
gully_layers = [lyr for lyr in [tools_qgis.get_layer_by_tablename('v_edit_gully')] if lyr is not None]
link_layers = [lyr for lyr in [tools_qgis.get_layer_by_tablename('v_edit_link')] if lyr is not None]

return arc_layers, node_layers, connec_layers, gully_layers, link_layers

Expand Down
8 changes: 5 additions & 3 deletions core/utils/tools_gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def initialize_parsers():
filepath, parser = _get_parser_from_filename(config)
global_vars.configs[config][0] = filepath
global_vars.configs[config][1] = parser
if parser is None:
if parser is None and config != 'dev': # dev.config file might or might not exist
success = False
return success

Expand Down Expand Up @@ -2514,7 +2514,9 @@ def manage_json_return(json_result, sql, rubber_band=None, i=None):

# Get values for set layer style
opacity = 100
style_type = json_result['body']['returnManager']['style']


style_type = return_manager['style']

if 'style' in return_manager and 'values' in return_manager['style'][key]:
if 'transparency' in return_manager['style'][key]['values']:
Expand All @@ -2523,7 +2525,7 @@ def manage_json_return(json_result, sql, rubber_band=None, i=None):
if 'transparency' in return_manager['style'][key]:
opacity = return_manager['style'][key]['transparency']
color_values = {}
for item in json_result['body']['returnManager']['style'][key].get('values', []):
for item in return_manager['style'][key].get('values', []):
color = QColor(item['color'][0], item['color'][1], item['color'][2], int(opacity * 255))
color_values[item['id']] = color
cat_field = str(style_type[key]['field'])
Expand Down
15 changes: 8 additions & 7 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ qgisMinimumVersion=3.22
qgisMaximumVersion=3.36
description=Plugin to manage water networks (water supply, sewerage and urban drainage) using QGIS and PostGIS-PostgreSQL
about=Disclaimer: This plugin is released using the open source GNU-GPL3 license. Although a reasonable effort has been made to assure that the results obtained are correct, some of the capabilities provided by Giswater are experimental, therefore the development team and the Giswater Association are not responsible and assume no liability whatsoever for any results or any use made of the results obtained from the program, nor for any damages or litigation that result from the use of these programs for any purpose.
version=3.6.008
version=3.6.009
author=David Erill, Barbara Rzepka, Sergi Muñoz, Josep Lluís Sala, Edgar Fusté, Albert Bofill, Sergi Maspons, Elies Bertran, Abel García Juanes, Maria Guzmán, Jordi Blanch, Xavier Torret

Changelog=Version 3.6.008
- Allow setting geometry to psector other prices
- Add info form to edit dscenario items
- Add action "mincut_export_hydro_csv" on mincut form
- Add action "rotation" on node custom form for UD
- Refactor schema creation to be much more efficient and faster
Changelog=Version 3.6.009
- Bug fix: manage info accept so widget values are not lost
- Bug fix: changing epa network mode with epa point of view active
- Epa world: only apply to parent layers
- Improve automatic extension creation & version management
- Enhancement: insert INP annotations on column csv39
- Don't show backup files on advanced options menu

tags= giswater, water networks, sewerage, urban drainage, EPANET, SWMM
homepage=https://www.giswater.org
Expand Down

0 comments on commit ae59647

Please sign in to comment.