ui/EntryTree.py
def load_imaged_moment_entry(self, entry: EntryTreeItem):
        """
        Load imaged moment entry data into tree.
        :param entry: Imaged moment entry item
        :return: None
        """
        while entry.childCount():  # Remove children
            entry.removeChild(entry.child(0))

        entry.metadata = get_imaged_moment(entry.metadata['uuid'])  # Fetch original imaged moment data
        meta = entry.metadata
        meta['type'] = 'imaged_moment'

        video_reference_uuid = meta['video_reference_uuid']
        imaged_moment_uuid = meta['uuid']

        try:
            all_moments = get_windowed_moments(  # Fetch all moments in window
                [meta['video_reference_uuid']], meta['uuid'],
                self.time_window
            )

            for moment in all_moments:  # Add other observations to the imaged moment observations list
                known_observation_uuids = [obs['uuid'] for obs in meta['observations']]
                for obs in moment['observations']:
                    if obs['uuid'] not in known_observation_uuids:
                        meta['observations'].append(obs)
        except:
            log('Failed to fetch windowed moments for video reference {} around imaged moment {}'.format(
                video_reference_uuid, imaged_moment_uuid
            ), level=2)

        for image_reference in meta['image_references']:  # Pick the image reference & URL to use
            if image_reference['format'] == 'image/png':
                meta['image_reference_uuid'] = image_reference['uuid']
                meta['url'] = image_reference['url']
                break
        else:  # No image reference found
            meta['image_reference_uuid'] = None
            meta['url'] = None

        for observation in meta['observations']:
            obs_item = self.add_item(observation, parent=entry)
            obs_item.metadata['type'] = 'observation'
            obs_item.metadata['boxes'] = list(extract_bounding_boxes(
                observation['associations'],
                observation['concept'],
                observation['uuid'],
                im_ref_filter=meta['image_reference_uuid']
            ))
            if observation['uuid'] in self.editable_uuids:
                obs_item.set_background('uuid', QColor('#b9ff96'))

        update_imaged_moment_entry(entry)

        Load imaged moment entry data into tree.
        :param entry: Imaged moment entry item
        :return: None
        
Load imaged moment entry data into tree.
Load imaged moment entry data into tree .
def load_imaged_moment_entry(self, entry: EntryTreeItem):
        while entry.childCount():  
            entry.removeChild(entry.child(0))
        entry.metadata = get_imaged_moment(entry.metadata['uuid'])  
        meta = entry.metadata
        meta['type'] = 'imaged_moment'
        video_reference_uuid = meta['video_reference_uuid']
        imaged_moment_uuid = meta['uuid']
        try:
            all_moments = get_windowed_moments(  
                [meta['video_reference_uuid']], meta['uuid'],
                self.time_window
            )
            for moment in all_moments:  
                known_observation_uuids = [obs['uuid'] for obs in meta['observations']]
                for obs in moment['observations']:
                    if obs['uuid'] not in known_observation_uuids:
                        meta['observations'].append(obs)
        except:
            log('Failed to fetch windowed moments for video reference {} around imaged moment {}'.format(
                video_reference_uuid, imaged_moment_uuid
            ), level=2)
        for image_reference in meta['image_references']:  
            if image_reference['format'] == 'image/png':
                meta['image_reference_uuid'] = image_reference['uuid']
                meta['url'] = image_reference['url']
                break
        else:  
            meta['image_reference_uuid'] = None
            meta['url'] = None
        for observation in meta['observations']:
            obs_item = self.add_item(observation, parent=entry)
            obs_item.metadata['type'] = 'observation'
            obs_item.metadata['boxes'] = list(extract_bounding_boxes(
                observation['associations'],
                observation['concept'],
                observation['uuid'],
                im_ref_filter=meta['image_reference_uuid']
            ))
            if observation['uuid'] in self.editable_uuids:
                obs_item.set_background('uuid', QColor('#b9ff96'))
        update_imaged_moment_entry(entry)
def load_imaged_moment_entry ( self , entry : EntryTreeItem ) : while entry . childCount ( ) : entry . removeChild ( entry . child ( 0 ) ) entry . metadata = get_imaged_moment ( entry . metadata [ 'uuid' ] ) meta = entry . metadata meta [ 'type' ] = 'imaged_moment' video_reference_uuid = meta [ 'video_reference_uuid' ] imaged_moment_uuid = meta [ 'uuid' ] try : all_moments = get_windowed_moments ( [ meta [ 'video_reference_uuid' ] ] , meta [ 'uuid' ] , self . time_window ) for moment in all_moments : known_observation_uuids = [ obs [ 'uuid' ] for obs in meta [ 'observations' ] ] for obs in moment [ 'observations' ] : if obs [ 'uuid' ] not in known_observation_uuids : meta [ 'observations' ] . append ( obs ) except : log ( 'Failed to fetch windowed moments for video reference {} around imaged moment {}' . format ( video_reference_uuid , imaged_moment_uuid ) , level = 2 ) for image_reference in meta [ 'image_references' ] : if image_reference [ 'format' ] == 'image/png' : meta [ 'image_reference_uuid' ] = image_reference [ 'uuid' ] meta [ 'url' ] = image_reference [ 'url' ] break else : meta [ 'image_reference_uuid' ] = None meta [ 'url' ] = None for observation in meta [ 'observations' ] : obs_item = self . add_item ( observation , parent = entry ) obs_item . metadata [ 'type' ] = 'observation' obs_item . metadata [ 'boxes' ] = list ( extract_bounding_boxes ( observation [ 'associations' ] , observation [ 'concept' ] , observation [ 'uuid' ] , im_ref_filter = meta [ 'image_reference_uuid' ] ) ) if observation [ 'uuid' ] in self . editable_uuids : obs_item . set_background ( 'uuid' , QColor ( '#b9ff96' ) ) update_imaged_moment_entry ( entry )
Load imaged moment entry data into tree.
Load imaged moment entry data into tree .
"""
        Load imaged moment entry data into tree.
        :param entry: Imaged moment entry item
        :return: None
        """ # Remove children # Fetch original imaged moment data # Fetch all moments in window # Add other observations to the imaged moment observations list # Pick the image reference & URL to use # No image reference found
None
self
entry
EntryTreeItem
Imaged moment entry item
Imaged moment entry item