- Who use Fade?
- ui/src/plugins/idlebar.py
- ui/src/gui/animation/transition.py
- ui/src/gui/areas/handler.py
- ui/src/gui/compat.py
- ui/src/plugins/idlebar.py
- Who has Area?
- ui/src/gui/areas/tvlisting_area.py
- ui/src/gui/areas/progress_area.py
- ui/src/gui/areas/listing_area.py
- ui/src/gui/areas/view_area.py
- ui/src/gui/areas/info_area.py
- ui/src/gui/theme.py
- ui/src/input/linux_input.py
- ui/src/menu/menu.py
- ui/src/gui/areas/tvlisting_area.py
- What is Menu?
- A Menu page with Items for the MenuStack. It is not allowed to change the selected item or the internal choices directly, use 'select', 'set_items' or 'change_item' to do this.
- Inherited from:
- from kaa.weakref import weakref
- from item import Item
Menu(heading, choices=[], reload_func = None, type = None)
Global Variable: next_id, start from 1 - from kaa.weakref import weakref
- Attributes:
- . heading
- stack
- id = next_id (automate increase)
- state
- pos(in menu stack)
- choices(items)
- selected
- infoitem
- viewitem
- type
- submenu
- tem
- autoselect
- cols
- rows
- . heading
- Methods:
- set_items(items, refresh=True)
- select(item)
- get_items()
- get_selection()
- change_item(old, new)
- eventhandler(event): event :
MENU_LEFT, MENU_BACK_ONE_MENU, MENU_RIGHT, MENU_SELECT, MENU_PAGEUP,
MENU_PAGEDOWN, MENU_UP, MENU_DOWN, MENU_PLAY_ITEM, MENU_CHANGE_SELECTION,
MENU_SUBMENU, MENU_CALL_ITEM_ACTION
- set_items(items, refresh=True)
- A Menu page with Items for the MenuStack. It is not allowed to change the selected item or the internal choices directly, use 'select', 'set_items' or 'change_item' to do this.
- What is ActionItem?
- A simple item with one action. The first parameter of the function passed to this action is always the parent item if not None.
- Attributes:
- item: parent
- Inherited from:
- from files import Files
- from item import Item
- from mediaitem import MediaItem
- from action import Action
- from menu import Menu
- from stack import MenuStack
- from plugin import ItemPlugin, MediaPlugin
- from files import Files
- A simple item with one action. The first parameter of the function passed to this action is always the parent item if not None.
- What is Action?
- Action for item.actions()
An action has a name and a function to call. Optional parameter is a shortcut name to be placed into the config for mapping an action to a button. It also has an optional description.
To set parameters for the function call, use the parameter function of the action object. The function itself has always one or two parameters. If the function is defined inside the item, no extra parameters are used. If it is outside the item, the first parameter is the item.
Action(name, function, shortcut=None, description=None)
Action.parameter(*args, **kwargs) - Attributes:
- name,
- function,
- shortcut
- description
- args
- kwargs
- item
- name,
- Action for item.actions()
- What is the Files in UI?
- File operations for an item.
- Attributes:
- files
- fxd_file
- image
- read_only
- files
- Methods:
- append(filename)
- get()
- copy_possible()
- copy(dest)
- move_possible()
- move(dest)
- delete_possible() == move_possible()
- delete()
- append(filename)
- File operations for an item.
- What is Item?
- Item class. This is the base class for all items in the menu. It's a template for other info items like VideoItem, AudioItem and ImageItem
- Inherited from:
- from kaa.weakref import weakref
- import kaa.beacon
- from plugin import ItemPlugin
- from kaa.weakref import weakref
Item(parent=None, action=None, type=None) - Item class. This is the base class for all items in the menu. It's a template for other info items like VideoItem, AudioItem and ImageItem
- Attributes:
- icon
- info: a hash of key:value
- menu
- type
- _image
- action
- name == action.name
- description = action.description
- parent
- iscopy
- fxd_file
- icon
- Methods:
- _get_image()
- _set_image()
- __setitem__(key, value)
- copy()
- __id__()
- sort(mode): mode = name, smart
- actions()
- get_actions()
- get_menustack()
- pushmenu(menu)
- show_menu(refresh=True)
- replace(item)
- get_playlist()
- eventhandler(event)
- __getitem__(attr): attr could be:
parent(),len(),name, or the key of info
- _get_image()
- This item is for a media. It's only a template for image, video or audio items
- Inherited from
- import kaa.beacon
- from kaa.strutils import str_to_unicode
- from freevo.ui.event import PLAY_START, STOP
- from item import Item
- from files import Files
- import kaa.beacon
- Attributes:
- url: for player, such as dvd://
- filename
- fxdinfo
- url: for player, such as dvd://
- Methods:
- set_url(url): url must be an instance of beacon
- __getitem__(attr): attr could be length, length:min, elapsed:percent,
or in fxdinfo, or come from Item - __id__(): == url
- __repr__()
- sort(mode): mode: name, filename, date
- cache()
- play()
- stop()
- eventhandler(event): event: PLAY_START, STOP
- set_url(url): url must be an instance of beacon
- Plugin class to add something to the item action list
The plugin can also have an eventhandler. All events passed to the item
will also be passed to this plugin. This works only for VideoItems right
now (each item type must support it directly). If the function returns
True, the event won't be passed to other eventhandlers and also not to
the item itself. - Inherited from
- from freevo.ui import plugin
ItemPlugin(name)
- _plugin_type = "item"
- actions()
- eventhandler(item, event)
MediaPlugin(name)
- _plugin_type = "item"
- suffix()
- get(parent, files)
- count(parent, listing)
- dirinfo(diritem)
- database()
- The MenuStack handles a stack of Menus.
Stack 是為了讓選單能順利返回上一層,現在要慢慢搞懂其運作,每個 menu 會有個 menu.stack, 估計只是指向它在 MenuStack 的位置 - Inherited from
- from kaa.weakref import weakref
- from freevo.ui.event import *
- from menu import Menu
- from item import Item
- from kaa.weakref import weakref
- When __init__(), clear menustack
- Attributes:
- menustack
- Methods:
- back_to_menu(menu, refresh=True)
- back_one_menu(refresh=True)
- delete_submenu(refresh=True, reload=False, osd_message='')
- pushmenu(menu): push and show
- refresh(): 搞不懂為何 len(menu.choices) == 1 且 menu.autoselect 要刪除它
- __getitem__(attr)
- __setitem__(attr, value)
- get_selected()
- get_menu()
- eventhendler(event): MENU_GOTO_MAINMENU, MENU_BACK_ONE_MENU,
MENU_GOTO_MEDIA, MENU_SELECT, MENU_SUBMENU, MENU_PLAY_ITEM
- back_to_menu(menu, refresh=True)
- MainMenu system contains three parts: MainMenuItem, MainMenuPlugin, MainMenu
- Inherited from
- from menu import Item, Action, Menu
- from application.menuw import MenuWidget
- from menu import Item, Action, Menu
- This class is a main menu item. Items of this type can be returned by a MainMenuPlugin.
MainMenuItem(parent=None, name=u'', type=None, image=None, icon=None, skin_type=None)
skin_info = theme.mainmenu.items 從 theme.mainmenu 中取出 skin_info
用來設定 name, image, icon 等等 - Attributes:
- name
- icon
- image
- type: == "main"
- skin_type
- name
- Methods:
- actions()
- select()
- actions()
- Plugin class for plugins to add something to the main menu
MainMenuPlugin(name) - Attributes:
- _plugin_type = "mainmenu"
- _plugin_special = True
- plugins
- _plugin_type = "mainmenu"
- Methods:
- items(parent)
- plugins(subtype)
- items(parent)
- MainMenu is an Item.
This class handles the main menu. It will start the main menu widget and the first menu page based on the main menu plugins.
它從每個 plugin 取得 items 再透過 Menu 變成主選單,最後利用 MenuWidget(menu)
來產生畫面的 widget - Attributes:
- menuw : menu widget
- Methods:
- get_menustack(): 竟然是傳回 menuw?
- The MenuWidget is an Application for GUI and event handling and also an instance of MenuStack defined in menu.stack.
重點在於它是 Application, 另外它的 refresh(reload=False) 只有兩行:
MenuStack.refresh(self, reload)
self.engine.update(self.menustack[-1])
- Inherited from
- from kaa.notifier import Signal
- from freevo.ui import gui
- from handler import handler
- from kaa.notifier import Signal
Application(name, eventmap, capabilities)
- __name
- _eventmap
- _visible
- engine = gui.Application(name)
- signals = show, hide, start, stop
- _status
- _capabilities
- has_capabilities(capabilities)
- get_status()
- set_status(status)
- _show_app(): emit a signal.show then call engine.show()
- _hide_app()
- eventhandler(event)
- stop()
- is_visible()
- set_eventmap(eventmap)
- get_eventmap()
- get_name()
- get_resources(*resources): 目前不知道 resources 的機制
- free_resources(*resources)
- __repr__()
0 意見:
張貼留言