def organization_projects_spatial_call_finished(self, result):
        """Function when Organization Project Spatial Api finished.

        :param result: result of request
        :type result: (bool, list/dict/str)
        """
        self.save_organizations()
        if result[0]:
            # save result to local file
            organization_slug = result[2]
            project_slug = result[3]
            vlayers = Utilities.save_layer(result[1], organization_slug,
                                           project_slug)
            self.progress_bar.setValue(50)

            download_relationship_and_party = False

            if self.project['access'] == 'public':
                # Get organization
                status, results = self.organisation_api.summary_organization(
                    organization_slug)

                if status and 'users' in results:
                    for user in results['users']:
                        if user['username'] == get_setting('username'):
                            download_relationship_and_party = True
                            break
            else:
                download_relationship_and_party = True

            relationship_layer_id = None
            party_layer_id = None

            if download_relationship_and_party:
                relationship_layer = self.relationships_layer(vlayers)
                if relationship_layer:
                    relationship_layer_id = relationship_layer.id()

                party_layer = self.parties_layer()
                if party_layer:
                    party_layer_id = party_layer.id()

            self.progress_bar.setValue(80)

            QCoreApplication.processEvents()
            Utilities.save_project_basic_information(self.project, vlayers,
                                                     relationship_layer_id,
                                                     party_layer_id)
        else:
            pass
        self.progress_bar.setValue(self.progress_bar.maximum())
        self.warning_label.setText(self.loaded_label_string)
        self.parent.close()
Example #2
0
    def organization_projects_spatial_call_finished(self, result):
        """Function when Organization Project Spatial Api finished.

        :param result: result of request
        :type result: (bool, list/dict/str)
        """
        if result[0]:
            # save result to local file
            organization_slug = result[2]
            project_slug = result[3]
            vlayers = Utilities.save_layer(result[1], organization_slug,
                                           project_slug)
            relationship_layer = self.relationships_layer(
                vlayers, organization_slug, project_slug)
            party_layer = self.parties_layer(organization_slug, project_slug)
            QCoreApplication.processEvents()
            Utilities.save_project_basic_information(
                information=self.project_upload_result,
                vlayers=vlayers,
                relationship_layer_id=relationship_layer.id(),
                party_layer_id=party_layer.id())
        else:
            pass