def search_by_author(self, asset_index):
     sr = bpy.context.scene['search results']
     asset_data = sr[asset_index]
     a = asset_data['author']['id']
     if a is not None:
         sprops = utils.get_search_props()
         sprops.search_keywords = ''
         sprops.search_verification_status = 'ALL'
         utils.p('author:', a)
         search.search(author_id=a)
     return True
    def on_invoke(self, context, event):

        if self.do_search:
            #TODO: move the search behaviour to separate operator, since asset bar can be already woken up from a timer.

            # we erase search keywords for cateogry search now, since these combinations usually return nothing now.
            # when the db gets bigger, this can be deleted.
            if self.category != '':
                sprops = utils.get_search_props()
                sprops.search_keywords = ''
            search.search(category=self.category)

        ui_props = context.scene.blenderkitUI
        if ui_props.assetbar_on:
            #TODO solve this otehrwise to enable more asset bars?

            # we don't want to run the assetbar many times, that's why it has a switch on/off behaviour,
            # unless being called with 'keep_running' prop.
            if not self.keep_running:
                # this sends message to the originally running operator, so it quits, and then it ends this one too.
                # If it initiated a search, the search will finish in a thread. The switch off procedure is run
                # by the 'original' operator, since if we get here, it means
                # same operator is already running.
                ui_props.turn_off = True
                # if there was an error, we need to turn off these props so we can restart after 2 clicks
                ui_props.assetbar_on = False

            else:
                pass
            return False

        ui_props.assetbar_on = True

        self.active_index = -1

        widgets_panel = self.widgets_panel
        widgets_panel.extend(self.buttons)
        widgets_panel.extend(self.asset_buttons)
        widgets_panel.extend(self.validation_icons)

        widgets = [self.panel]

        widgets += widgets_panel
        widgets.append(self.tooltip_panel)
        widgets += self.tooltip_widgets

        self.init_widgets(context, widgets)

        self.panel.add_widgets(widgets_panel)
        self.tooltip_panel.add_widgets(self.tooltip_widgets)

        # Open the panel at the mouse location
        # self.panel.set_location(bpy.context.area.width - event.mouse_x,
        #                         bpy.context.area.height - event.mouse_y + 20)
        self.panel.set_location(self.bar_x, self.bar_y)

        self.context = context
        args = (self, context)

        # self._handle_2d_tooltip = bpy.types.SpaceView3D.draw_handler_add(draw_callback_tooltip, args, 'WINDOW', 'POST_PIXEL')
        return True