Skip to content

Commit

Permalink
Merge pull request #888 from Giswater/dev-3.5
Browse files Browse the repository at this point in the history
Dev 3.5
  • Loading branch information
smaspons authored May 23, 2023
2 parents 80135c2 + 3c8d24b commit 70b1826
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion core/load_project_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def _fill_tbl_config_files(self):
item = QTreeWidgetItem([f"{file}"])

project_types = tools_gw.get_config_parser('system', 'project_types', "project", "giswater")
parser = configparser.ConfigParser(comment_prefixes=';', allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=';', allow_no_value=True, strict=False)
parser.read(f"{global_vars.user_folder_dir}{os.sep}core{os.sep}config{os.sep}{file}")

# For each section we create a sub-item and add all the parameters to that sub-item
Expand Down
6 changes: 3 additions & 3 deletions core/toolbars/epa/dscenario_manager_btn.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _manage_feature_type(self):

for x in self.feature_types:
col_idx = tools_qt.get_col_index_by_col_name(tableview, x)
if col_idx is not False:
if col_idx not in (False, -1, None):
feature_type = x
break

Expand All @@ -460,7 +460,7 @@ def _manage_highlight(self, qtableview, view, index):

for x in self.feature_types:
col_idx = tools_qt.get_col_index_by_col_name(qtableview, x)
if col_idx is not False:
if col_idx not in (False, -1, None):
feature_type = x
break
if feature_type != 'feature_id':
Expand Down Expand Up @@ -619,7 +619,7 @@ def _manage_delete(self):

for x in self.feature_types:
col_idx = tools_qt.get_col_index_by_col_name(tableview, x)
if col_idx is not False:
if col_idx not in (False, -1, None):
feature_type = x
break

Expand Down
9 changes: 6 additions & 3 deletions core/ui/toolbars/epa/go2epa_options.ui
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@
</item>
<item>
<widget class="QGroupBox" name="grb_time_steps">
<property name="title">
<property name="toolTip">
<string>DATE &amp; TIME STEPS</string>
</property>
<property name="title">
<string>DATE &amp;&amp; TIME STEPS</string>
</property>
<layout class="QGridLayout" name="gridLayout_19">
<item row="0" column="1">
<layout class="QGridLayout" name="lyt_date_2" rowstretch="0" columnstretch="0"/>
Expand Down Expand Up @@ -124,8 +127,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>335</height>
<width>98</width>
<height>137</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
Expand Down
16 changes: 8 additions & 8 deletions core/utils/tools_gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ def get_config_parser(section: str, parameter: str, config_type, file_name, pref
if parser is None:
if plugin == 'core':
tools_log.log_info(f"Creating parser for file: {path}")
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True, strict=False)
parser.read(path)

# If project has already been loaded and filename is 'init' or 'session', always read and parse file
if force_reload or (global_vars.project_loaded and file_name in ('init', 'session')):
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True, strict=False)
parser.read(path)

if config_type == 'user' and prefix and global_vars.project_type is not None:
Expand Down Expand Up @@ -183,7 +183,7 @@ def set_config_parser(section: str, parameter: str, value: str = None, config_ty

try:

parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True, strict=False)
parser.read(path)

raw_parameter = parameter
Expand Down Expand Up @@ -3215,7 +3215,7 @@ def refresh_selectors(tab_name=None):
def open_dlg_help():
""" Opens the help page for the last focused dialog """

parser = configparser.ConfigParser()
parser = configparser.ConfigParser(strict=False)
path = f"{global_vars.plugin_dir}{os.sep}config{os.sep}giswater.config"
if not os.path.exists(path):
webbrowser.open_new_tab('https://giswater.gitbook.io/giswater-manual')
Expand Down Expand Up @@ -3393,8 +3393,8 @@ def remove_deprecated_config_vars():
if global_vars.user_folder_dir is None:
return

init_parser = configparser.ConfigParser()
session_parser = configparser.ConfigParser()
init_parser = configparser.ConfigParser(strict=False)
session_parser = configparser.ConfigParser(strict=False)
path_folder = os.path.join(tools_os.get_datadir(), global_vars.user_folder_dir)
project_types = get_config_parser('system', 'project_types', "project", "giswater").split(',')

Expand Down Expand Up @@ -3614,7 +3614,7 @@ def reset_position_dialog(show_message=False, plugin='core', file_name='session'
""" Reset position dialog x/y """

try:
parser = configparser.ConfigParser(comment_prefixes=';', allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=';', allow_no_value=True, strict=False)
config_folder = f"{global_vars.user_folder_dir}{os.sep}{plugin}{os.sep}config"

if not os.path.exists(config_folder):
Expand Down Expand Up @@ -3702,7 +3702,7 @@ def _get_parser_from_filename(filename):
else:
return None, None

parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True)
parser = configparser.ConfigParser(comment_prefixes=";", allow_no_value=True, strict=False)
filepath = f"{folder}{os.sep}config{os.sep}{filename}.config"
if not os.path.exists(filepath):
tools_log.log_warning(f"File not found: {filepath}")
Expand Down
2 changes: 1 addition & 1 deletion lib/tools_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def manage_pg_service(section):
tools_log.log_warning(f"File defined in environment variable 'PGSERVICEFILE' not found: {service_file}")
return None

config_parser = configparser.ConfigParser()
config_parser = configparser.ConfigParser(strict=False)
credentials = {'host': None, 'port': None, 'dbname': None, 'user': None, 'password': None, 'sslmode': None}
try:
config_parser.read(service_file)
Expand Down
4 changes: 2 additions & 2 deletions lib/tools_qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def get_plugin_metadata(parameter, default_value, plugin_dir=None):

value = None
try:
metadata = configparser.ConfigParser()
metadata = configparser.ConfigParser(strict=False)
metadata.read(metadata_file)
value = metadata.get('general', parameter)
except configparser.NoOptionError:
Expand All @@ -224,7 +224,7 @@ def get_plugin_version():
message = f"Metadata file not found: {metadata_file}"
return plugin_version, message

metadata = configparser.ConfigParser()
metadata = configparser.ConfigParser(strict=False)
metadata.read(metadata_file)
plugin_version = metadata.get('general', 'version')
if plugin_version is None:
Expand Down
10 changes: 5 additions & 5 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ qgisMinimumVersion=3.10
qgisMaximumVersion=3.99
description=Plugin to manage water networks (water supply, sewerage and urban drainage) using QGIS and PostGIS-PostgreSQL(from 9.5 to 14.x)
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.5.036
version=3.5.037
author=David Erill, Luigi Pirelli, Natasa Cica, Nestor Ibañez, Adrian Valenciano, Barbara Rzepka, Sergi Muñoz, Josep Lluís Sala, Edgar Fusté, Albert Bofill, Sergi Maspons, Elies Bertran, Abel García Juanes, Xavier Torret

Changelog=Version 3.5.036
- Keep the scrolled amount on selector
- Add "Show only active" checkbox to non-visual objects manager
- Epa result manager: "Set corporate" button is now "Toggle corporate"
Changelog=Version 3.5.037
- Bug fix in Dscenario Manager.
- Bug fix with config files. If they break the plugin will still load.
- Fix section title in go2epa options dialog.


tags= giswater, water networks, sewerage, urban drainage, EPANET, SWMM
Expand Down

0 comments on commit 70b1826

Please sign in to comment.