Skip to content

Commit

Permalink
Merge pull request #13952 from notspiff/add_setproperties
Browse files Browse the repository at this point in the history
added: ListItem.setProperties wrapper for python list items
  • Loading branch information
Rechi committed Jun 18, 2018
2 parents dc60280 + 2cc81e4 commit 42f21e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xbmc/interfaces/legacy/ListItem.cpp
Expand Up @@ -250,6 +250,12 @@ namespace XBMCAddon
item->SetProperty(lowerKey, value);
}

void ListItem::setProperties(const Properties& dictionary)
{
for (const auto& it: dictionary)
setProperty(it.first.c_str(), it.second);
}

String ListItem::getProperty(const char* key)
{
XBMCAddonUtils::GuiLock lock(languageHook, m_offscreen);
Expand Down
25 changes: 25 additions & 0 deletions xbmc/interfaces/legacy/ListItem.h
Expand Up @@ -944,6 +944,31 @@ namespace XBMCAddon
void setProperty(const char * key, const String& value);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmcgui_listitem
/// @brief \python_func{ setProperties(values) }
///-----------------------------------------------------------------------
/// Sets multiple properties for listitem's
///
/// @param values dictionary - pairs of `{ label: value }`.
///
/// @python_v18 New function added.
///
///-----------------------------------------------------------------------
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # setProperties(values)
/// listitem.setProperties({ 'AspectRatio': '1.85', 'StartOffset' : '256.4' })
/// ...
/// ~~~~~~~~~~~~~
///
setProperties(...);
#else
void setProperties(const Properties& dictionary);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmcgui_listitem
Expand Down

0 comments on commit 42f21e2

Please sign in to comment.