Skip to content

Commit

Permalink
add warning when a value reÃlation has no layer set (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored Apr 20, 2021
1 parent 3750ae5 commit 2ec5f06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qfieldsync/core/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
QgsProviderMetadata,
QgsEditorWidgetSetup
)

import qgis


class OfflineConverter(QObject):
progressStopped = pyqtSignal()
task_progress_updated = pyqtSignal(int, int)
total_progress_updated = pyqtSignal(int, int, str)
message_emitted = pyqtSignal(str, Qgis.MessageLevel)

def __init__(self, project, export_folder, extent, offline_editing):
super(OfflineConverter, self).__init__(parent=None)
Expand Down Expand Up @@ -259,6 +261,12 @@ def convert(self):
if ews.type() == 'ValueRelation':
widget_config = ews.config()
online_layer_id = widget_config['Layer']
if not online_layer_id:
self.message_emitted.emit(
f'For field "{field.name()}" in layer "{layer.name()}", the value relation widget has no layer set',
Qgis.MessageLevel.Warning
)
continue
if project.mapLayer(online_layer_id):
continue

Expand Down
1 change: 1 addition & 0 deletions qfieldsync/gui/package_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def package_project(self):
# progress connections
offline_convertor.total_progress_updated.connect(self.update_total)
offline_convertor.task_progress_updated.connect(self.update_task)
offline_convertor.message_emitted.connect(lambda message, level: self.iface.messageBar().pushMessage('QFieldSync', message, level))

offline_convertor.convert()
self.do_post_offline_convert_action()
Expand Down

0 comments on commit 2ec5f06

Please sign in to comment.