RB.History¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w  | 
Maximum length of the history. Infinite if 0  | 
||
r/w/c  | 
Whether   | 
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
parent  | 
r  | 
Class Details¶
- class RB.History(**kwargs)¶
 - Bases:
 - Abstract:
 No
- Structure:
 
RB.Historyis aGLib.Sequencethat maintains a “current” pointer and can delete an arbitrary element in amortized O(log(N)) time. It can call a deletion callback when it removes one of its entries.All operations take amortized O(log(N)) (worst-case O(N)) time unless noted otherwise.
- classmethod new(truncate_on_play, destroyer, *destroy_userdata)¶
 - Parameters:
 truncate_on_play (
bool) – WhetherRB.History.set_playing() should truncate the historydestroyer (
GLib.Func) – function to call when removing an entry from the historydestroy_userdata (
objectorNone) – data to pass to destroyer
- Returns:
 a new
RB.History- Return type:
 
Creates a new history instance.
- append(entry)¶
 - Parameters:
 entry (
RB.RhythmDBEntry) – aRB.RhythmDBEntryto append
Adds a new entry to the end of the history list. If a size limit is set, an entry may be removed from the start to keep the history list within the limit.
- clear()¶
 Empties the history list.
- contains_entry(entry)¶
 - Parameters:
 entry (
RB.RhythmDBEntry) – aRB.RhythmDBEntryto check for- Returns:
 Trueif found- Return type:
 
Returns
Trueif the entry is present in the history list.
- current()¶
 - Returns:
 current entry or
None- Return type:
 
Returns the current
RB.RhythmDBEntry, orNoneif there is no current position
- dump()¶
 - Returns:
 a copy of the history list
- Return type:
 
Constructs a copy of the whole history in order. Caller must free the result. The caller does not own any references on the entries in the returned array. Takes O(Nlog(N)) time.
- first()¶
 - Returns:
 first entry
- Return type:
 
Returns the first entry in the history.
- get_current_index()¶
 - Returns:
 index of the current entry
- Return type:
 
Gets the index of the current entry. This is guaranteed to be < the history’s size, so if the history is empty, it returns -1.
- go_first()¶
 Moves the current position to the first entry in the history
- go_last()¶
 Moves the current position to the last entry in the history
- go_next()¶
 Moves the current position to the next entry. If the current position is already at the end of the history, nothing happens.
- go_previous()¶
 Moves the current position to the previous entry. If the current position is already at the start of the history, nothing happens.
- insert_at_index(entry, index)¶
 - Parameters:
 entry (
RB.RhythmDBEntry) – aRB.RhythmDBEntryto insertindex (
int) – position at which to insert entry
Inserts entry at index within the history list. 0<=`index`<=size
- last()¶
 - Returns:
 last entry
- Return type:
 
Returns the last
RB.RhythmDBEntryin the history
- next()¶
 - Returns:
 next entry
- Return type:
 
Returns the
RB.RhythmDBEntryafter the current position
- previous()¶
 - Returns:
 previous entry
- Return type:
 
Returns the
RB.RhythmDBEntrybefore the current position.
- remove_entry(entry)¶
 - Parameters:
 entry (
RB.RhythmDBEntry) – theRB.RhythmDBEntryto remove
Removes the specified entry from the history list.
- set_destroy_notify(destroyer, *destroy_userdata)¶
 - Parameters:
 
Sets a new function to call when removing entries from the history.
- set_maximum_size(maximum_size)¶
 - Parameters:
 maximum_size (
int) – new maximum size of the history (or 0 for no limit)
Sets the maximum-size property
- set_playing(entry)¶
 - Parameters:
 entry (
RB.RhythmDBEntry) – the new playingRB.RhythmDBEntry
Updates the current position to point to the specified entry. If the truncate-on-play property is set, this will remove all entries after that.
- set_truncate_on_play(truncate_on_play)¶
 - Parameters:
 truncate_on_play (
bool) – WhetherRB.History.set_playing() should truncate the history
Sets the ‘truncate-on-play’ property.
Property Details¶
- RB.History.props.maximum_size¶
 - 
Maximum number of entries to store in the history. If 0, no limit is applied.