예제 #1
0
    def __init__(self, xml_file, location, item_information=None):
        super(BaseWindow, self).__init__(xml_file, location)
        self.item_information = {}
        self.action_exitkeys_id = [ACTION_PREVIOUS_MENU,
                                   ACTION_PLAYER_STOP,
                                   ACTION_NAV_BACK]
        self.canceled = False

        self.setProperty('texture.white', os.path.join(g.IMAGES_PATH, 'white.png'))
        self.setProperty('seren.logo', os.path.join(g.IMAGES_PATH, 'logo-seren-2.png'))
        self.setProperty('seren.fanart', g.DEFAULT_FANART)
        self.setProperty('settings.color', g.get_user_text_color())
        self.setProperty('test.pattern', os.path.join(g.IMAGES_PATH, 'test_pattern.png'))
        self.setProperty('skin.dir', SkinManager().confirm_skin_path(xml_file)[1])

        if item_information is None:
            return

        self.add_item_information_to_window(item_information)
예제 #2
0
def set_info_properties(info, item):
    """
    Set standard properties for an item.
    The item can be anything that supports a setProperty() method such as window or list item
    :param info: The info set from the source
    :type info: set
    :param item: xbmcgui element with setProperty() method
    """
    struct_info = source_utils.info_set_to_dict(info)
    codec_type_display_list = ["hdrcodec", "videocodec", "misc", "audiocodec", "audiochannels"]
    color_tag = "[COLOR {}]".format(g.get_user_text_color())

    item.setProperty(
        "info_text",
        " | ".join(
            [
                " ".join(struct_info[c])
                for c in codec_type_display_list
                if struct_info[c]
            ]
        ),
    )

    item.setProperty(
        "info_text_formatted",
        " | ".join(
            [
                "{}{}[/COLOR]".format(color_tag, " ".join(struct_info[c]))
                for c in codec_type_display_list
                if struct_info[c]
            ]
        ),
    )

    for prop in struct_info:
        item.setProperty("info.{}_text".format(prop), " ".join(struct_info[prop]))
        for n in range(0, len(struct_info[prop])):
            item.setProperty("info.{}_{}".format(prop, n + 1), struct_info[prop][n])