def selectimage(self):
     '''helper which lets the user select an image or imagepath from resourceaddons or custom path'''
     skinsettings = SkinSettings()
     skinstring = self.params.get("skinstring", "")
     skinshortcutsprop = self.params.get("skinshortcutsproperty", "")
     current_value = self.params.get("currentvalue", "")
     resource_addon = self.params.get("resourceaddon", "")
     allow_multi = self.params.get("allowmulti", "false") == "true"
     windowheader = self.params.get("header", "")
     skinhelper_backgrounds = self.params.get("skinhelperbackgrounds", "false") == "true"
     label, value = skinsettings.select_image(
         skinstring, allow_multi=allow_multi, windowheader=windowheader, resource_addon=resource_addon,
         skinhelper_backgrounds=skinhelper_backgrounds, current_value=current_value)
     if label:
         if skinshortcutsprop:
             # write value to skinshortcuts prop
             from skinshortcuts import set_skinshortcuts_property
             set_skinshortcuts_property(skinshortcutsprop, value, label)
         else:
             # write the values to skin strings
             if value.startswith("$INFO"):
                 # we got an dynamic image from window property
                 skinsettings.set_skin_variable(skinstring, value)
                 value = "$VAR[%s]" % skinstring
             skinstring = skinstring.encode("utf-8")
             label = label.encode("utf-8")
             xbmc.executebuiltin("Skin.SetString(%s.label,%s)" % (skinstring, label))
             xbmc.executebuiltin("Skin.SetString(%s.name,%s)" % (skinstring, label))
             xbmc.executebuiltin("Skin.SetString(%s,%s)" % (skinstring, value))
             xbmc.executebuiltin("Skin.SetString(%s.path,%s)" % (skinstring, value))
     del skinsettings
Ejemplo n.º 2
0
 def set_skinshortcuts_property(self, setting="", window_header="", property_name=""):
     '''allows the user to make a setting for skinshortcuts using the special skinsettings dialogs'''
     cur_value = xbmc.getInfoLabel(
         "$INFO[Container(211).ListItem.Property(%s)]" %
         property_name).decode("utf-8")
     cur_value_label = xbmc.getInfoLabel(
         "$INFO[Container(211).ListItem.Property(%s.name)]" %
         property_name).decode("utf-8")
     if setting == "||IMAGE||":
         # select image
         label, value = self.select_image(setting, allow_multi=True, windowheader=windowheader)
     if setting:
         # use skin settings select dialog
         value, label = self.set_skin_setting(
             setting, window_header=window_header, sublevel="", cur_value_label=cur_value_label,
             skip_skin_string=True, cur_value=cur_value)
     else:
         # manually input string
         if not cur_value:
             cur_value = "None"
         value = xbmcgui.Dialog().input(window_header, cur_value, type=xbmcgui.INPUT_ALPHANUM).decode("utf-8")
         label = value
     if label:
         from skinshortcuts import set_skinshortcuts_property
         set_skinshortcuts_property(property_name, value, label)
Ejemplo n.º 3
0
 def selectimage(self):
     '''helper which lets the user select an image or imagepath from resourceaddons or custom path'''
     skinsettings = SkinSettings()
     skinstring = self.params.get("skinstring", "")
     skinshortcutsprop = self.params.get("skinshortcutsproperty", "")
     current_value = self.params.get("currentvalue", "")
     resource_addon = self.params.get("resourceaddon", "")
     allow_multi = self.params.get("allowmulti", "false") == "true"
     windowheader = self.params.get("header", "")
     skinhelper_backgrounds = self.params.get("skinhelperbackgrounds", "false") == "true"
     label, value = skinsettings.select_image(
         skinstring, allow_multi=allow_multi, windowheader=windowheader, resource_addon=resource_addon,
         skinhelper_backgrounds=skinhelper_backgrounds, current_value=current_value)
     if label:
         if skinshortcutsprop:
             # write value to skinshortcuts prop
             from skinshortcuts import set_skinshortcuts_property
             set_skinshortcuts_property(skinshortcutsprop, value, label)
         else:
             # write the values to skin strings
             if value.startswith("$INFO"):
                 # we got an dynamic image from window property
                 skinsettings.set_skin_variable(skinstring, value)
                 value = "$VAR[%s]" % skinstring
             skinstring = skinstring.encode("utf-8")
             label = label.encode("utf-8")
             xbmc.executebuiltin("Skin.SetString(%s.label,%s)" % (skinstring, label))
             xbmc.executebuiltin("Skin.SetString(%s.name,%s)" % (skinstring, label))
             xbmc.executebuiltin("Skin.SetString(%s,%s)" % (skinstring, value))
             xbmc.executebuiltin("Skin.SetString(%s.path,%s)" % (skinstring, value))
     del skinsettings
Ejemplo n.º 4
0
 def set_skinshortcuts_property(self, setting="", window_header="", property_name=""):
     '''allows the user to make a setting for skinshortcuts using the special skinsettings dialogs'''
     cur_value = xbmc.getInfoLabel(
         "$INFO[Container(211).ListItem.Property(%s)]" %
         property_name).decode("utf-8")
     cur_value_label = xbmc.getInfoLabel(
         "$INFO[Container(211).ListItem.Property(%s.name)]" %
         property_name).decode("utf-8")
     if setting == "||IMAGE||":
         # select image
         label, value = self.select_image(setting, allow_multi=True, windowheader=windowheader)
     if setting:
         # use skin settings select dialog
         value, label = self.set_skin_setting(
             setting, window_header=window_header, sublevel="", cur_value_label=cur_value_label,
             skip_skin_string=True, cur_value=cur_value)
     else:
         # manually input string
         if not cur_value:
             cur_value = "None"
         value = xbmcgui.Dialog().input(window_header, cur_value, type=xbmcgui.INPUT_ALPHANUM).decode("utf-8")
         label = value
     if label:
         from skinshortcuts import set_skinshortcuts_property
         set_skinshortcuts_property(property_name, value, label)