mrv.maya.ui.browse.finder

Epydoc: mrv.maya.ui.browse.finder

Functions

mrv.maya.ui.browse.finder.concat_url(root, path)
mrv.maya.ui.browse.finder.logException(func)
Decorator which shows short exception information in a popup and a full stack trace to stdout. Finally the exception will be reraised

Classes

Epydoc: mrv.maya.ui.browse.finder.Finder

class mrv.maya.ui.browse.finder.Finder(provider=None, filter=None)

Bases: mrv.maya.ui.util.EventSenderUI

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.

clearAllEvents()

Remove all event receivers for all events registered in this instance.

Note:This usually doesn’t need to be called directly, but might be useful in conjunction with other system that do not release your strongly bound instance
layout()
Returns:the finder’s main layout which contains all controls
classmethod listEventNames()
Returns:list of event ids that exist on our class
numUrlElements()
Returns:number of url elements that are currently shown. A url of 1/2 would

have two url elements

provider()
Returns:current url provider
selectedUrl(absolute=False)
Returns:string representing the currently selected, / separated URL, or None if there is no url selected
Parameter:absolute – if True, an absolute URL will be provided using the provider’s root
selectedUrlItemByIndex(index)
Returns:The selected url item at the given element index or None if nothing is selected
Parameter:index – 0 to numUrlElements()-1
Raies indexerror:
 
selection_changed

User interface signal which keeps assigned functions as strong reference to assure we can always call it. This implies that we may leave many dangling objects unless we are being properly cleaned up on deletion.

Calls generated from this event will not put the sender as first argument, but you may retrieve it using self.sender().

sender()
Returns:instance which sent the event you are currently processing
Raises ValueError:
 if no event is currently in progress
setFilter(filter=None)

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
setItemByIndex(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
setProvider(provider=None)

Set the provider to use :param provider: iFinderProvider compatible instance, or None

If no provider is set, the instance will be blank
setUrl(url, require_all_items=True, allow_memory=False)

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
Parameter:allow_memory – if true, provider memory may be used to show the longest chosen url, being possibly more than you specify. Currently not implemented
t_element
alias of FinderElement
urlItemsByIndex(index)
Returns:list of item ids which are currently being shown
Parameter:index – 0 based element index to numUrlElements()-1
Raises IndexError:
 
url_changed

User interface signal which keeps assigned functions as strong reference to assure we can always call it. This implies that we may leave many dangling objects unless we are being properly cleaned up on deletion.

Calls generated from this event will not put the sender as first argument, but you may retrieve it using self.sender().

Epydoc: mrv.maya.ui.browse.finder

class mrv.maya.ui.browse.finder.FinderElement(*args, **kwargs)

Bases: mrv.maya.ui.StackControlBase

Element with special abilities to suite the finder better. This involves keeping a list of unformatted items which can be used as unique item identifiers.

Set the items to a list of unique identifiers which represent the possibly different items actually present in the list.

classmethod activeParent()
Returns:NameUI of the currently set parent
Raises RuntimeError:
 if no active parent was set
addItem(item)
addItems(items)
Add multiple items to the end of the list :return: self
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
annotation()
:return : the annotation string
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
capitalize

S.capitalize() -> unicode

Return a capitalized version of S, i.e. make the first character have upper case.

center

S.center(width[, fillchar]) -> unicode

Return S centered in a Unicode string of length width. Padding is done using the specified fill character (default is a space)

children(**kwargs)
Returns:all intermediate child instances
Note:the order of children is lexically ordered at this time
Note:this implementation is slow and should be overridden by more specialized subclasses
childrenDeep(**kwargs)
Returns:all child instances recursively
Note:the order of children is lexically ordered at this time
Note:this implementation is slow and should be overridden by more specialized subclasses
clearAllEvents()

Remove all event receivers for all events registered in this instance.

Note:This usually doesn’t need to be called directly, but might be useful in conjunction with other system that do not release your strongly bound instance
count

S.count(sub[, start[, end]]) -> int

Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

decode

S.decode([encoding[,errors]]) -> string or unicode

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registerd with codecs.register_error that is able to handle UnicodeDecodeErrors.

delete()
Delete this UI - the wrapper instance must not be used after this call
dimension()
Returns:(x,y) tuple of x and y dimensions of the UI element
e_dcc
Event suitable to deal with user interface callback
e_deleteKeyCommand
Event suitable to deal with user interface callback
e_dgc
Event suitable to deal with user interface callback
e_dkc
Event suitable to deal with user interface callback
e_doubleClickCommand
Event suitable to deal with user interface callback
e_dpc
Event suitable to deal with user interface callback
e_dragCallback
Event suitable to deal with user interface callback
e_dropCallback
Event suitable to deal with user interface callback
e_sc
Event suitable to deal with user interface callback
e_selectCommand
Event suitable to deal with user interface callback
e_vcc
Event suitable to deal with user interface callback
e_visibleChangeCommand
Event suitable to deal with user interface callback
encode

S.encode([encoding[,errors]]) -> string or unicode

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith

S.endswith(suffix[, start[, end]]) -> bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

exists()
Returns:True if this instance still exists in maya
expandtabs

S.expandtabs([tabsize]) -> unicode

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

find

S.find(sub [,start [,end]]) -> int

Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format
S.format(*args, **kwargs) -> unicode
formatItem(item)
Returns:formatted version of item
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
index

S.index(sub [,start [,end]]) -> int

Like S.find() but raise ValueError when the substring is not found.

isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isalnum

S.isalnum() -> bool

Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.

isalpha

S.isalpha() -> bool

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

isdecimal

S.isdecimal() -> bool

Return True if there are only decimal characters in S, False otherwise.

isdigit

S.isdigit() -> bool

Return True if all characters in S are digits and there is at least one character in S, False otherwise.

islower

S.islower() -> bool

Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.

isnumeric

S.isnumeric() -> bool

Return True if there are only numeric characters in S, False otherwise.

isspace

S.isspace() -> bool

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

istitle

S.istitle() -> bool

Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

isupper

S.isupper() -> bool

Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.

items()
Returns:list of currently available items
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
join

S.join(iterable) -> unicode

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

classmethod listEventNames()
Returns:list of event ids that exist on our class
ljust

S.ljust(width[, fillchar]) -> int

Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

lower

S.lower() -> unicode

Return a copy of the string S converted to lowercase.

lstrip

S.lstrip([chars]) -> unicode

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

p_a
p_aas
p_ai
p_allItems
p_allowAutomaticSelection
p_allowMultiSelection
p_ams
p_ann
:return : the annotation string
p_annotation
:return : the annotation string
p_ap
p_append
p_appendPosition
p_backgroundColor
p_bgc
p_da
p_defineTemplate
p_deselectAll
p_deselectIndexedItem
p_deselectItem
p_di
p_dii
p_dimension
Returns:(x,y) tuple of x and y dimensions of the UI element
p_doctTag
p_dt
p_dtg
p_ebg
p_en
p_enable
p_enableBackground
p_ex
Returns:True if this instance still exists in maya
p_exists
Returns:True if this instance still exists in maya
p_fn
p_font
p_fpn
p_fullPathName
p_h
p_height
p_io
p_isObscured
p_m
p_manage
p_ni
p_npm
p_nr
p_nsi
p_numberOfItems
p_numberOfPopupMenus
p_numberOfRows
p_numberOfSelectedItems
p_pma
Returns:popup menus attached to this control
p_po
p_popupMenuArray
Returns:popup menus attached to this control
p_preventOverride
p_raremoveItem
p_removeAll
p_removeIndexedItem
p_ri
p_rii
p_selectIndexedItem
p_selectItem
p_shi
p_showIndexedItem
p_si
p_sii
p_useTemplate
p_ut
p_vis
p_visible
p_w
p_width
parent()
Returns:parent instance of this ui element
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
partition

S.partition(sep) -> (head, sep, tail)

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

popupMenuArray()
Returns:popup menus attached to this control
removeItem(item)
Remove the given formatted item from the list, as well as the corresponding unformtted item. Its not an error if the item does not exist
replace

S.replace (old, new[, count]) -> unicode

Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

rfind

S.rfind(sub [,start [,end]]) -> int

Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex

S.rindex(sub [,start [,end]]) -> int

Like S.rfind() but raise ValueError when the substring is not found.

rjust

S.rjust(width[, fillchar]) -> unicode

Return S right-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

root()
Returns:the root of the DAG - it has no further parents
rpartition

S.rpartition(sep) -> (head, sep, tail)

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

rsplit

S.rsplit([sep [,maxsplit]]) -> list of strings

Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.

rstrip

S.rstrip([chars]) -> unicode

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

selectUnformattedItem(index_or_item)

Select the unformatted item as identified by either the index or item :param index_or_item: integer representing the 0-based index of the item to

select, or the item’s id
Raises ValueError:
 if the item does not exist
selectedIndex()
Returns:First selected index - the index is 1-based, or -1 if there

is nothing selected :note: even if multiple selections are possible

selectedIndices()
Returns:tuple of all selected 1-based indices, or an empty tuple if there

is nothing selected

selectedItem()
Returns:the first selected item, or None if nothing is selected
selectedItems()
Returns:list of all selected items as strings, or an empty list if nothing

is selected

selectedUnformattedItem()
Returns:unformatted selected item or None
sender()
Returns:instance which sent the event you are currently processing
Raises ValueError:
 if no event is currently in progress
setAnnotation(ann)
Set the UI element’s annotation :note: not all named UI elements can have their annotation set
setDimension(dimension)
Set the UI elements dimension :param dimension: (x,y) : tuple holding desired x and y dimension
setFocus()
Set the global keyboard focus to this control
setItems(items)

Set the given items to be shown. :param items: iterable of items

if empty, the control will be empty after this call.
Returns:self
setSelectedItem(item)

Set the given item selected, or clear the selection :param item: item to select, or clear the selection if None is given :note: it is not considered an error if the item doesnt exist - following

maya’s behaviour
Returns:self
shortName()
Returns:shortname of the ui ( name without pipes )
split

S.split([sep [,maxsplit]]) -> list of strings

Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

splitlines

S.splitlines([keepends]) -> list of strings

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

startswith

S.startswith(prefix[, start[, end]]) -> bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip

S.strip([chars]) -> unicode

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
swapcase

S.swapcase() -> unicode

Return a copy of S with uppercase characters converted to lowercase and vice versa.

title

S.title() -> unicode

Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.

translate

S.translate(table) -> unicode

Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None. Unmapped characters are left untouched. Characters mapped to None are deleted.

type()
Returns:the python class able to create this class
Note:The return value is NOT the type string, but a class
uiDeleted()

If overridden in subclass, it will be called once the UI gets deleted within maya ( i.e. the user closed the window )eee The base implementation assures that all event-receivers that are bound to your events will be freed, allowing them to possibly be destroyed as well.

Use this callback to register yourself from all your event senders, then call the base class method.

Note:This is not related to the __del__ method of your object. Its worth noting that your instance will be strongly bound to a maya event, hence your instance will exist as long as your user interface element exists within maya.
upper

S.upper() -> unicode

Return a copy of S converted to uppercase.

zfill

S.zfill(width) -> unicode

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

Table Of Contents

Previous topic

mrv.maya.ui.browse.control

Next topic

mrv.maya.nt.base

This Page