diff options
author | Rechi <Rechi@users.noreply.github.com> | 2018-06-18 09:12:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 09:12:16 +0200 |
commit | 42f21e2dc49355430cb4c9673a12fe113190c309 (patch) | |
tree | dfd0f9787475669b1f49e5513673212d98a26f39 | |
parent | dc6028082f33c8596263414615657f6623a99162 (diff) | |
parent | 2cc81e4e77b0cbcece794a7646fe58d48b50dc15 (diff) |
Merge pull request #13952 from notspiff/add_setproperties
added: ListItem.setProperties wrapper for python list items
-rw-r--r-- | xbmc/interfaces/legacy/ListItem.cpp | 6 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/ListItem.h | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/xbmc/interfaces/legacy/ListItem.cpp b/xbmc/interfaces/legacy/ListItem.cpp index f0093d5693..bd7793ecbb 100644 --- a/xbmc/interfaces/legacy/ListItem.cpp +++ b/xbmc/interfaces/legacy/ListItem.cpp @@ -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); diff --git a/xbmc/interfaces/legacy/ListItem.h b/xbmc/interfaces/legacy/ListItem.h index 5c325bbcaa..09b9641043 100644 --- a/xbmc/interfaces/legacy/ListItem.h +++ b/xbmc/interfaces/legacy/ListItem.h @@ -947,6 +947,31 @@ namespace XBMCAddon #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 /// @brief \python_func{ getProperty(key) } ///----------------------------------------------------------------------- /// Returns a listitem property as a string, similar to an infolabel. |