Package mrv :: Package maya :: Package ui :: Package browse :: Module finder :: Class Finder
[hide private]
[frames] | no frames]

Class Finder

source code

EventSenderUI --+
                |
               Finder

The Finder control implements a finder-like browser, which displays URLs. URLs consist of items separated by the "/" character. Whenever a item is selected, an iProvider compatible instance will be asked for the subitems of the corresponding URL. Using these, a new field will be set up for presentation. A filter can be installed to prevent items from being shown.

An added benefit is the ability to automatically match previously selected path items on a certain level of the URL with the available ones, allowing to quickly parse through URLs with a similar structure.

A limitation of the current implementation is, that you can only keep one item selected at once in each url item area.

Instance Methods [hide private]
 
__init__(self, provider=None, filter=None) source code
 
layout(self)
Returns: the finder's main layout which contains all controls
source code
 
provider(self)
Returns: current url provider
source code
 
selectedUrl(self, absolute=False)
Returns: string representing the currently selected, / separated URL, or None if there is no url selected
source code
 
numUrlElements(self)
have two url elements
source code
 
selectedUrlItemByIndex(self, index)
Returns: The selected url item at the given element index or None if nothing is selected
source code
 
urlItemsByIndex(self, index)
Returns: list of item ids which are currently being shown
source code
    Edit
 
setFilter(self, filter=None)
Set or unset a filter.
source code
 
setProvider(self, provider=None)
Set the provider to use...
source code
 
_set_item_by_index(self, elm, index, item) source code
 
setItemByIndex(self, item, index)
Set the given string item, which sits at the given index of a url :raise ValueError: if item does not exist at given index :raise IndexError: if index is not currently shown
source code
 
setUrl(self, url, require_all_items=True, allow_memory=False)
Set the given url to be selected :param url: / separated relative url.
source code
    Callbacks
 
_element_selection_changed(self, element, *args)
Called whenever any element changes its value, which forces the following elements to refresh
source code
    Utilities
 
_index_by_item_element(self, element)
Returns: index matching the given item element, which must be one of our children
source code
 
_set_element_items(self, start_elm_id, elements)
Fill the items from the start_elm_id throughout to all elements, until one url does not yield any items, or the item cannot be selected :param elements: a full list of all available child elements.
source code
 
_set_element_visible(self, index)
Possibly create and fill the given element index, all following elements are set invivisble
source code
Class Variables [hide private]
    Configuration
  t_element = FinderElement
    Signals
  selection_changed = ui.Signal()
  url_changed = ui.Signal()
Method Details [hide private]

layout(self)

source code 
Returns:
the finder's main layout which contains all controls

provider(self)

source code 
Returns:
current url provider

selectedUrl(self, absolute=False)

source code 
Parameters:
  • absolute - if True, an absolute URL will be provided using the provider's root
Returns:
string representing the currently selected, / separated URL, or None if there is no url selected

numUrlElements(self)

source code 
have two url elements
Returns:
number of url elements that are currently shown. A url of 1/2 would

selectedUrlItemByIndex(self, index)

source code 
Parameters:
  • index - 0 to numUrlElements()-1
Returns:
The selected url item at the given element index or None if nothing is selected

urlItemsByIndex(self, index)

source code 
Parameters:
  • index - 0 based element index to numUrlElements()-1
Returns:
list of item ids which are currently being shown
Raises:
  • IndexError

setFilter(self, filter=None)

source code 
Set or unset a filter. All items will be sent through the filter, and will
be shown only if they pass.
:param filter: Functor called f(url,t) and returns True for each item which may
        be shown in the Finder. The url is the full relative url leading to, but 
        excluding the item t, whose visibility is being decided upon

setProvider(self, provider=None)

source code 
Set the provider to use
:param provider: ``iFinderProvider`` compatible instance, or None
        If no provider is set, the instance will be blank

setUrl(self, url, require_all_items=True, allow_memory=False)

source code 
Set the given url to be selected
:param url: / separated relative url. The individual items must be available
        in the provider.
:parm require_all_items: if False, the control will display as many items as possible.
        Otherwise it must display all given items, or raise ValueError
:param allow_memory: if true, provider memory may be used to show the longest chosen url, 
        being possibly more than you specify. Currently not implemented

_element_selection_changed(self, element, *args)

source code 
Called whenever any element changes its value, which forces the following elements to refresh
Decorators:
  • @logException

_index_by_item_element(self, element)

source code 
Returns:
index matching the given item element, which must be one of our children