Skip to content

Commit 206f102

Browse files
authored
Merge pull request #106 from mortael/patch-1
Fixed getting path additional widget by number
2 parents a59599f + 28847a0 commit 206f102

File tree

1 file changed

+18
-2
lines changed
  • resources/lib/skinshorcuts

1 file changed

+18
-2
lines changed

resources/lib/skinshorcuts/gui.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,11 +1677,13 @@ def onClick(self, control_id): # pylint: disable=invalid-name
16771677
log("Choose widget (312)")
16781678
list_control = self.getControl(211)
16791679
listitem = list_control.getSelectedItem()
1680+
widgetpath = listitem.getProperty("widgetPath")
16801681

16811682
# If we're setting for an additional widget, get its number
16821683
widget_id = ""
16831684
if self.current_window.getProperty("widgetID"):
16841685
widget_id = ".%s" % self.current_window.getProperty("widgetID")
1686+
widgetpath = self._get_additionalproperty(listitem, "widgetPath%s" % widget_id)
16851687
self.current_window.clearProperty("widgetID")
16861688

16871689
# Get the default widget for this item
@@ -1692,14 +1694,14 @@ def onClick(self, control_id): # pylint: disable=invalid-name
16921694
self.lib_func.load_library("widgets")
16931695

16941696
# Let user choose widget
1695-
if listitem.getProperty("widgetPath") == "":
1697+
if widgetpath == "":
16961698
selected_shortcut = self.lib_func.select_shortcut(grouping="widget", show_none=True)
16971699
else:
16981700
selected_shortcut = self.lib_func.select_shortcut(
16991701
grouping="widget",
17001702
show_none=True,
17011703
custom=True,
1702-
current_action=listitem.getProperty("widgetPath")
1704+
current_action=widgetpath
17031705
)
17041706

17051707
if selected_shortcut is None:
@@ -2533,6 +2535,20 @@ def _add_additionalproperty(self, listitem, property_name, property_value):
25332535

25342536
self._add_additional_properties(listitem)
25352537

2538+
def _get_additionalproperty(self, listitem, property_name):
2539+
# Retrieve the additional properties of a user item
2540+
properties = []
2541+
if listitem.getProperty("additionalListItemProperties"):
2542+
properties = ast.literal_eval(listitem.getProperty("additionalListItemProperties"))
2543+
2544+
# Search for the property
2545+
for prop in properties:
2546+
if prop[0] == property_name:
2547+
return prop[1]
2548+
2549+
# If the property was not found, return None
2550+
return None
2551+
25362552
def _remove_additionalproperty(self, listitem, property_name):
25372553
# Remove an item from the additional properties of a user item
25382554
properties = []

0 commit comments

Comments
 (0)