Пример #1
0
    def fill_items(self):
        self.sobjects = self.sobjects_query_thread.result

        current_widget = self.get_current_widget()
        current_tree_widget = current_widget.resultsTreeWidget

        current_tree_widget.clear()

        current_widget.progress_bar.setVisible(True)
        total_sobjects = len(self.sobjects.keys()) - 1

        for p, sobject in enumerate(self.sobjects.itervalues()):
            item_info = {
                'relates_to': self.parent_ui.relates_to,
                'is_expanded': False,
            }

            gf.add_sobject_item(
                current_tree_widget,
                self.parent_ui,
                sobject,
                self.parent_ui.stype,
                item_info,
                ignore_dict=self.parent_ui.get_process_ignore_list()
            )

            if total_sobjects:
                current_widget.progress_bar.setValue(int(p * 100 / total_sobjects))

        if current_widget.info['state']:
            gf.tree_state_revert(current_tree_widget, current_widget.info['state'])

        current_widget.progress_bar.setVisible(False)
Пример #2
0
    def add_child_sobjects(self):
        if not self.info['is_expanded']:

            self.info['is_expanded'] = True

            server = tc.server_start()
            built_process = server.build_search_type(self.child.get('from'), self.project.info.get('code'))

            child_code = None

            relationship = self.child.get('relationship')
            if relationship:
                if relationship == 'search_type':
                    child_code = 'search_code'
                elif relationship == 'code':
                    child_code = '{0}_code'.format(self.child.get('to').split('/')[-1])

            if not child_code:
                child_code = self.child.get('from_col')

            filters = [(child_code, self.sobject.info.get('code'))]

            assets = server.query(built_process, filters)

            if self.stype.pipeline:
                process = []
                for pipe in self.stype.pipeline.values():
                    process.extend(pipe.process.keys())
            else:
                process = []

            sobjects = tc.get_sobjects(process, assets, project_code=self.project.info.get('code'))
            stype = self.stype
            sobject_item_widget = self.get_parent_item_widget()

            for sobject in sobjects.itervalues():
                item_info = {
                    'relates_to': self.info['relates_to'],
                    'is_expanded': False,
                }
                gf.add_sobject_item(
                    self.tree_item,
                    self.parent_ui,
                    sobject,
                    stype,
                    item_info,
                    ignore_dict=sobject_item_widget.ignore_dict
                )