Favorites#9
Open
DragonWin wants to merge 8 commits intot0mm0:masterfrom
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.