def loadTables(self, type): #Load textual or spatial tables self.lstDestTables.clear() tables = None if type == "textual": tables = profile_user_tables(self.curr_profile, False, True) elif type == "spatial": tables = profile_spatial_tables(self.curr_profile) if tables is not None: for t in tables: tabItem = QListWidgetItem(t,self.lstDestTables) tabItem.setCheckState(Qt.Unchecked) tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png")) self.lstDestTables.addItem(tabItem)
def __init__(self, config, treeview, parent=None): super(EntityNodeFormatter, self).__init__(config, treeview, parent) prefix = self.curr_profile.prefix self._str_ref = str(prefix)+"_social_tenure_relationship" self._str_title = QApplication.translate("STRFormatterBase", "Social Tenure Relationship") self._str_model, self._str_doc_model = entity_model( self.curr_profile.social_tenure, False, True ) # Cache for entity supporting document tables. # [table_name]:[list of supporting document tables] self._entity_supporting_doc_tables = {} self._str_model_disp_mapping = {} if not self._str_model is None: self._str_model_disp_mapping = entity_display_columns( self.curr_profile.social_tenure, True ) self._fk_references = [ ( e.entity_relation.child_column, e.entity_relation.parent.name, e.entity_relation.parent_column ) for e in self.curr_profile.social_tenure.columns.values() if e.TYPE_INFO == 'FOREIGN_KEY' ] self._str_num_char_cols = entity_display_columns( self.curr_profile.social_tenure ) self._current_data_source_fk_ref = self._current_data_source_foreign_key_reference() #numeric_char_cols for entities - party and sp_unit self._numeric_char_cols = entity_display_columns( self.curr_profile.entity_by_name(config.data_source_name) ) self._spatial_data_sources = profile_spatial_tables(self.curr_profile).keys()
def __init__(self, config, treeview, parent=None): super(EntityNodeFormatter, self).__init__(config, treeview, parent) prefix = self.curr_profile.prefix self._str_ref = str(prefix) + "_social_tenure_relationship" self._str_title = QApplication.translate("STRFormatterBase", "Social Tenure Relationship") self._str_model, self._str_doc_model = entity_model( self.curr_profile.social_tenure, False, True) # Cache for entity supporting document tables. # [table_name]:[list of supporting document tables] self._entity_supporting_doc_tables = {} self._str_model_disp_mapping = {} if not self._str_model is None: self._str_model_disp_mapping = model_display_mapping( self._str_model, self.curr_profile.social_tenure) self._fk_references = [ (e.entity_relation.child_column, e.entity_relation.parent.name, e.entity_relation.parent_column) for e in self.curr_profile.social_tenure.columns.values() if e.TYPE_INFO == 'FOREIGN_KEY' ] self._str_num_char_cols = entity_display_columns( self.curr_profile.social_tenure) self._current_data_source_fk_ref = self._current_data_source_foreign_key_reference( ) #numeric_char_cols for entities - party and sp_unit self._numeric_char_cols = entity_display_columns( self.curr_profile.entity_by_name(config.data_source_name)) self._spatial_data_sources = profile_spatial_tables( self.curr_profile).keys()
def load_tables_of_type(self, type: str, initial_selection: Optional[str] = None): """ Load textual or spatial tables If initial_selection is specified then that table will be initially checked """ self.lstDestTables.clear() tables = None if type == "textual": tables = profile_user_tables(self.curr_profile, False, True, include_read_only=False) elif type == "spatial": tables = profile_spatial_tables(self.curr_profile, include_read_only=False) if tables is not None: for table_name, table_label in tables.items(): table_item = QListWidgetItem(table_label, self.lstDestTables) table_item.setData(ImportData.ROLE_TABLE_NAME, table_name) if initial_selection: table_item.setCheckState( Qt.Checked if ImportData.names_are_matching(table_name, initial_selection) else Qt.Unchecked) else: table_item.setCheckState(Qt.Unchecked) table_item.setIcon(GuiUtils.get_icon("table.png")) self.lstDestTables.addItem(table_item)