Exemple #1
0
def search_categories(categories, combobox):
    """
    * Parameter: categories  (etree element -Tag- 'Categories)
    * Parameter: combobox (Qt Combobox object)
    * Create Categories object -Note- Pass opt parameter Scan as True
    * Iterate over category (etree element tag 'Category) in categories
    * Get name of category (attrib 'Name')
    * Execute add_category method for each category (Category Object)
    """

    categories_object = Categories.add(categories.getparent(), combobox, True)
    for category in categories:
        name = category.attrib["Name"]
        categories_object.add_category(name, True)
Exemple #2
0
    def check_categories(self):
        """
        * Check if the categories checkbox is selected
        * Add Categories object if it is checked
        * Delete Categories object if it is not checked
        * Update category fields
        * Display error message if AttributeError occurs
        """

        try:
            status = self.categoryCheckbox.isChecked()
            if status:
                root = self.tree.getroot()
                self.categories = Categories.add(root, self.category_box, False)
            else:
                self.categories.delete()
                self.categories = None
            set_software_tags(self)
            update_category_fields(self, status)
        except AttributeError:
            self.statusBar().showMessage('No file selected.', 1500)