aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2018-06-18 09:12:16 +0200
committerGitHub <noreply@github.com>2018-06-18 09:12:16 +0200
commit42f21e2dc49355430cb4c9673a12fe113190c309 (patch)
treedfd0f9787475669b1f49e5513673212d98a26f39
parentdc6028082f33c8596263414615657f6623a99162 (diff)
parent2cc81e4e77b0cbcece794a7646fe58d48b50dc15 (diff)
Merge pull request #13952 from notspiff/add_setproperties
added: ListItem.setProperties wrapper for python list items
-rw-r--r--xbmc/interfaces/legacy/ListItem.cpp6
-rw-r--r--xbmc/interfaces/legacy/ListItem.h25
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.