From 907cfcc5c9c39eda2ba6c79bb28a175f15f2f0e8 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Sun, 12 Nov 2023 07:57:00 +0100 Subject: [PATCH] Generator option to expose t_ili_tid in project Fix https://github.com/opengisch/QgisModelBaker/issues/713 --- modelbaker/generator/generator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modelbaker/generator/generator.py b/modelbaker/generator/generator.py index d013bc3..2ff13a1 100644 --- a/modelbaker/generator/generator.py +++ b/modelbaker/generator/generator.py @@ -49,6 +49,7 @@ def __init__( mgmt_uri=None, consider_basket_handling=False, optimize_strategy=OptimizeStrategy.NONE, + expose_t_ili_tid=False, ): """ Creates a new Generator objects. @@ -71,6 +72,7 @@ def __init__( self._db_connector.new_message.connect(self.append_print_message) self.basket_handling = consider_basket_handling and self.get_basket_handling() self.optimize_strategy = optimize_strategy + self.expose_t_ili_tid = expose_t_ili_tid self._additional_ignored_layers = ( [] @@ -308,7 +310,8 @@ def layers(self, filter_layer_list=[]): break if column_name in IGNORED_FIELDNAMES: - hide_attribute = True + if not self.expose_t_ili_tid and column_name.lower() == "t_ili_tid": + hide_attribute = True if not self.basket_handling and column_name in BASKET_FIELDNAMES: hide_attribute = True @@ -316,7 +319,8 @@ def layers(self, filter_layer_list=[]): field.hidden = hide_attribute if column_name in READONLY_FIELDNAMES: - field.read_only = True + if not self.expose_t_ili_tid and column_name.lower() == "t_ili_tid": + field.read_only = True if column_name in min_max_info: field.widget = "Range" @@ -394,6 +398,7 @@ def layers(self, filter_layer_list=[]): field.default_value_expression = "substr(uuid(), 2, 36)" else: field.oid_domain = fielddef["oid_domain"] + if "enum_domain" in fielddef and fielddef["enum_domain"]: field.enum_domain = fielddef["enum_domain"]