Package dtk :: Package ui :: Module droplist :: Class Droplist

Class Droplist

source code


Droplist.

Instance Methods
 
__init__(self, items, x_align=ALIGN_START, y_align=ALIGN_START, font_size=DEFAULT_FONT_SIZE, opacity=1.0, padding_x=0, padding_y=0, item_padding_left=6, item_padding_right=32, item_padding_y=3, max_width=None)
Initialize Droplist class.
source code
 
get_droplist_width(self)
Get droplist width.
source code
 
get_first_index(self)
Get index of first item.
source code
 
get_last_index(self)
Get index of last item.
source code
 
get_prev_index(self)
Get index of previous item.
source code
 
get_next_index(self)
Get index of next item.
source code
 
get_select_item_rect(self, item_index=None)
Get item rectangle with given index.
source code
 
active_item(self, item_index=None)
Select item with given index.
source code
 
select_first_item(self)
Select first item.
source code
 
select_last_item(self)
Select last item.
source code
 
select_prev_item(self)
Select previous item.
source code
 
select_next_item(self)
Select next item.
source code
 
scroll_page_to_select_item(self)
Scroll page to select item.
source code
 
scroll_page_up(self)
Scroll page up.
source code
 
scroll_page_down(self)
Scroll page down.
source code
 
press_select_item(self)
Press select item.
source code
 
get_droplist_item_at_coordinate(self, (x, y))
Get droplist item at coordinate, return None if haven't any droplist item at given coordinate.
source code
 
show(self, (x, y), (offset_x, offset_y)=(0,0))
Show droplist.
source code
 
hide(self)
Hide droplist.
source code
Class Variables
  __gsignals__ = {"item-selected":(gobject.SIGNAL_RUN_LAST, gobj...
Method Details

__init__(self, items, x_align=ALIGN_START, y_align=ALIGN_START, font_size=DEFAULT_FONT_SIZE, opacity=1.0, padding_x=0, padding_y=0, item_padding_left=6, item_padding_right=32, item_padding_y=3, max_width=None)
(Constructor)

source code 

Initialize Droplist class.

Parameters:
  • items - A list of item, item format: (item_content, item_value).
  • x_align - Horticultural alignment.
  • y_align - Vertical alignment.
  • font_size - Font size of droplist, default is DEFAULT_FONT_SIZE
  • opacity - Opacity of droplist window, default is 1.0.
  • padding_x - Padding x, default is 0.
  • padding_y - Padding y, default is 0.
  • item_padding_left - Padding at left of item, default is 6.
  • item_padding_right - Padding at right of item, default is 32.
  • item_padding_y - Padding of item vertically, default is 3.
  • max_width - Maximum width of droplist, default is None.

get_first_index(self)

source code 

Get index of first item.

Returns:
Return index of first item, or return None if haven't item in droplist.

get_last_index(self)

source code 

Get index of last item.

Returns:
Return index of last item, or return None if haven't item in droplist.

get_prev_index(self)

source code 

Get index of previous item.

Returns:
Return index of previous item, or return None if haven't item in droplist.

get_next_index(self)

source code 

Get index of next item.

Returns:
Return index of next item, or return None if haven't item in droplist.

get_select_item_rect(self, item_index=None)

source code 

Get item rectangle with given index.

Parameters:
  • item_index - If item_index is None, use select index.
Returns:
Return (x, y, w, h) rectangle for match item.

active_item(self, item_index=None)

source code 

Select item with given index.

Parameters:
  • item_index - If item_index is None, use select index.

get_droplist_item_at_coordinate(self, (x, y))

source code 

Get droplist item at coordinate, return None if haven't any droplist item at given coordinate.

Parameters:
  • x - X coordiante.
  • y - Y coordiante.
Returns:
Return match item with given coordinate, return None if haven't any item match coordinate.

show(self, (x, y), (offset_x, offset_y)=(0,0))

source code 

Show droplist.

Parameters:
  • x - Show x coordinate.
  • y - Show y coordinate.
  • offset_x - Offset x value when droplist haven't space to show in origin coordinate, default is 0.
  • offset_y - Offset y value when droplist haven't space to show in origin coordinate, default is 0.

Class Variable Details

__gsignals__

Value:
{"item-selected":(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (str, go\
bject.TYPE_PYOBJECT, int,)), "key-release":(gobject.SIGNAL_RUN_LAST, g\
object.TYPE_NONE, (str, gobject.TYPE_PYOBJECT, int,)),}