Skip to content

Commit

Permalink
Fix Python exceptions and buttons visible
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Dec 14, 2023
1 parent c4198c7 commit 8232ef6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
11 changes: 9 additions & 2 deletions lizmap/dialogs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,19 +1001,26 @@ def only_lizmap_cloud(self):
if not is_lizmap_cloud(metadata):
only_cloud = False

# Widgets disabled on Lizmap Cloud
widgets = (
# These rules are hard coded
# Other rules depends on the user.
self.safe_ecw,
self.safe_other_drive,
self.safe_pg_auth_db,
self.safe_pg_user_password,
# SSL is not checked
)
for widget in widgets:
widget.setVisible(not only_cloud)

# Widgets enable only Lizmap Cloud
widgets = (
self.label_pg_ssl,
self.button_convert_ssl,
)
for widget in widgets:
widget.setVisible(not only_cloud)
widget.setVisible(only_cloud)

if only_cloud:
if self.safe_number_parent.value() > CLOUD_MAX_PARENT_FOLDER:
self.safe_number_parent.setValue(CLOUD_MAX_PARENT_FOLDER)
Expand Down
18 changes: 16 additions & 2 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3348,9 +3348,9 @@ def project_config_file(
if key == 'mapScales':
liz2json["options"]['mapScales'] = self.map_scales()
if key == 'minScale':
liz2json["options"]['minScale'] = int(self.dlg.minimum_scale.text())
liz2json["options"]['minScale'] = self.minimum_scale_value()
if key == 'maxScale':
liz2json["options"]['maxScale'] = int(self.dlg.maximum_scale.text())
liz2json["options"]['maxScale'] = self.maximum_scale_value()
if key == 'use_native_zoom_levels':
liz2json["options"]['use_native_zoom_levels'] = self.dlg.use_native_scales.isChecked()

Expand Down Expand Up @@ -3613,6 +3613,20 @@ def map_scales(self) -> list:
else:
return [int(a) for a in self.dlg.list_map_scales.text().split(', ') if a.isdigit()]

def minimum_scale_value(self) -> int:
""" Return the minimum scale value. """
value = self.dlg.minimum_scale.text()
if not value:
value = self.global_options['minScale']['default']
return int(value)

def maximum_scale_value(self) -> int:
""" Return the maximum scale value. """
value = self.dlg.maximum_scale.text()
if not value:
value = self.global_options['maxScale']['default']
return int(value)

def set_map_scales_in_ui(
self, map_scales: list, min_scale: int, max_scale: int, use_native: bool, project_crs: str):
""" From CFG or default values into the user interface. """
Expand Down

0 comments on commit 8232ef6

Please sign in to comment.