Пример #1
0
    def checkGlade(self, glade_tree):
        """Check that all icons referenced from glade files are valid in the gnome icon theme."""
        # Stock image names are deprecated
        stock_elements = glade_tree.xpath("//property[@name='stock' or @name='stock_id']")
        if stock_elements:
            raise AssertionError("Deprecated stock icon found at %s:%d" %
                    (stock_elements[0].base, stock_elements[0].sourceline))

        # Check whether named icons exist
        for element in glade_tree.xpath("//property[@name='icon_name']"):
            self.assertTrue(icon_exists(element.text),
                    msg="Invalid icon name %s found at %s:%d" %
                    (element.text, element.base, element.sourceline))
Пример #2
0
    def checkGlade(self, glade_tree):
        """Check that all icons referenced from glade files are valid in the gnome icon theme."""
        # Stock image names are deprecated
        stock_elements = glade_tree.xpath(
            "//property[@name='stock' or @name='stock_id']")
        if stock_elements:
            raise AssertionError(
                "Deprecated stock icon found at %s:%d" %
                (stock_elements[0].base, stock_elements[0].sourceline))

        # Check whether named icons exist
        for element in glade_tree.xpath("//property[@name='icon_name']"):
            self.assertTrue(icon_exists(element.text),
                            msg="Invalid icon name %s found at %s:%d" %
                            (element.text, element.base, element.sourceline))
Пример #3
0
def check_glade_file(glade_file_path):
    glade_success = True
    with open(glade_file_path) as glade_file:
        # Parse the XML
        glade_tree = etree.parse(glade_file)

        # Stock image names are deprecated
        for element in glade_tree.xpath("//property[@name='stock' or @name='stock_id']"):
            glade_success = False
            print("Deprecated stock icon found at %s:%d" % (glade_file_path, element.sourceline))

        # Check whether named icons exist
        for element in glade_tree.xpath("//property[@name='icon_name']"):
            if not icon_exists(element.text):
                glade_success = False
                print("Invalid icon name %s found at %s:%d" % (element.text, glade_file_path, element.sourceline))

    return glade_success
Пример #4
0
def check_glade_file(glade_file_path):
    glade_success = True
    with open(glade_file_path) as glade_file:
        # Parse the XML
        glade_tree = etree.parse(glade_file)

        # Stock image names are deprecated
        for element in glade_tree.xpath("//property[@name='stock' or @name='stock_id']"):
            glade_success = False
            print("Deprecated stock icon found at %s:%d" % (glade_file_path, element.sourceline))

        # Check whether named icons exist
        for element in glade_tree.xpath("//property[@name='icon_name']"):
            if not icon_exists(element.text):
                glade_success = False
                print("Invalid icon name %s found at %s:%d" % (element.text, glade_file_path, element.sourceline))

    return glade_success