Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favorites #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Favorites #9

wants to merge 8 commits into from

Conversation

DragonWin
Copy link
Contributor

This is the first attempt at making the menu-contexts available to the addon coder. It is fully documented with the changes, and the test addon has been updated to reflect the new functionality.

Feedback is appreciated.

lets you create a context menu by creating an object that you can
use with add_video_item, add_item, add_music_item, to have extra
menu's show when a user right clicks on a directory or a movie / song.

args:
    menuname (str): The name that will be shown in your menu

    scriptargs (str): a list of arguments will be passed back to the
    addon in sys.argv[2] the form of:
    mode=mymode&type=53&displaylist=1

    kwargs:
    newlist (Bol): Default False, If you want to replace the current
    movie / dir list shown on the screen set this to True.
    If you only want the user to stay on the same screen, set this
    to False or omit.

    contextmenuobj (tuple): is an existing object that has already been
    returned by this function. Passing the existing tuple, will stack
    the menu's you create, allowing you to create multiple menu items.

    Returns: a tuple conforming to the listitem.addContextMenuItems()

Modified add_item, add_video_item, add_music_item, add_dir to handle the context item.
New functions are: create_favorite, save_favorite, del_favorite, show_favorites, dict_to_string, string_to_dict, create_contextmenu
… to MenuContext class, and adjusted code and documentation.

There is still a few issues:
cm = ContextMenu(addon.url) should be cm = ContextMenu(addon)

Find a way around parsing the ContextMenu obj to addon.show_favorite(cm)

Find a way not to pass a query string around base64 encrypted to avoid clashes with existing args.

Need to remvoe a few # comments in the code.
…code it.

Changed init to receive the addon object instead of the addon.url
Removed debug printing
…cm module to be passed to it.

Moved the cotext and add_dir / add_item to the addon instead of t0mm0.common.addon
Fixed an urlencode failure in common.addon where it would fail if the content were unicode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant