def _create_action_items(group_def, _id): refresh = "$INFO[Window(10000).Property(autowidget-{}-refresh)]".format( _id) props = {"specialsort": "bottom"} group_id = group_def["id"] group_name = group_def["label"] group_type = group_def["type"] if group_type == "widget": directory.add_separator(title=32010, char="/", sort="bottom") directory.add_menu_item( title=utils.get_string(32076).format(six.text_type(group_name)), params={ "mode": "path", "action": "static", "group": group_id, "id": six.text_type(_id), "refresh": refresh, }, art=utils.get_art("folder"), isFolder=True, props=props, ) directory.add_menu_item( title=utils.get_string(32028).format(six.text_type(group_name)), params={ "mode": "path", "action": "cycling", "group": group_id, "id": six.text_type(_id), "refresh": refresh, }, art=utils.get_art("shuffle"), isFolder=True, props=props, ) directory.add_menu_item( title=utils.get_string(32089).format(six.text_type(group_name)), params={ "mode": "path", "action": "merged", "group": group_id, "id": six.text_type(_id), }, art=utils.get_art("merge"), isFolder=True, props=props, )
def _create_action_items(group_def, _id): refresh = '$INFO[Window(10000).Property(autowidget-{}-refresh)]'.format( _id) props = {'specialsort': 'bottom'} group_id = group_def['id'] group_name = group_def['label'] group_type = group_def['type'] if group_type == 'widget': directory.add_separator(title=32010, char='/', sort='bottom') directory.add_menu_item(title=utils.get_string(32076).format( six.text_type(group_name)), params={ 'mode': 'path', 'action': 'static', 'group': group_id, 'id': six.text_type(_id), 'refresh': refresh }, art=utils.get_art('folder'), isFolder=True, props=props) directory.add_menu_item(title=utils.get_string(32028).format( six.text_type(group_name)), params={ 'mode': 'path', 'action': 'cycling', 'group': group_id, 'id': six.text_type(_id), 'refresh': refresh }, art=utils.get_art('shuffle'), isFolder=True, props=props) directory.add_menu_item(title=utils.get_string(32089).format( six.text_type(group_name)), params={ 'mode': 'path', 'action': 'merged', 'group': group_id, 'id': six.text_type(_id) }, art=utils.get_art('merge'), isFolder=True, props=props)
def group_menu(group_id, target, _id): _window = utils.get_active_window() group = manage.get_group_by_id(group_id) if not group: utils.log( '\"{}\" is missing, please repoint the widget to fix it.'.format( group_id), level=xbmc.LOGERROR) return False, 'AutoWidget' group_name = group['label'] paths = manage.find_defined_paths(group_id) if len(paths) > 0: cm = [] art = folder_shortcut if target == 'shortcut' else folder_sync for idx, path in enumerate(paths): if _window == 'media': cm = _create_context_items(group_id, path['id'], idx, len(paths)) directory.add_menu_item(title=path['label'], params={ 'mode': 'path', 'action': 'call', 'group': group_id, 'path': path['id'] }, info=path.get('info'), art=path.get('art') or art, cm=cm, isFolder=False) if target == 'widget' and _window != 'home': directory.add_separator(title=32010, char='/') directory.add_menu_item(title=utils.get_string(32028).format( group_name, _id), params={ 'mode': 'path', 'action': 'random', 'group': group_id, 'id': six.text_type(_id) }, art=folder_sync, isFolder=True) directory.add_menu_item(title=utils.get_string(32076).format( group_name, _id), params={ 'mode': 'path', 'action': 'next', 'group': group_id, 'id': six.text_type(_id) }, art=folder_next, isFolder=True) else: directory.add_menu_item(title=32032, art=alert, isFolder=False) return True, group_name