def categorize(my, widget, search_type, search): '''categorize parents based on search_type''' # FIXME: this should not be here. This is a general class for all # search types, not just prod/asset if my.get_option('read_only') != 'true': if search_type == "prod/asset": lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/asset_library") lib_select.set_search_for_options(search2, "code", "title") lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('asset_library', parent_lib) elif search_type == "prod/shot": lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/sequence") lib_select.set_search_for_options(search2, "code", "code") lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('sequence_code', parent_lib) elif search_type == 'prod/texture': lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/texture") search2.add_column('category') search2.add_group_by("category") lib_select.set_search_for_options(search2, "category", "category") lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('category', parent_lib)
def categorize(my, widget, search_type, search): '''categorize parents based on search_type''' # FIXME: this should not be here. This is a general class for all # search types, not just prod/asset if my.get_option('read_only') != 'true': if search_type == "prod/asset": lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/asset_library") lib_select.set_search_for_options( search2, "code", "title" ) lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('asset_library', parent_lib) elif search_type == "prod/shot": lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/sequence") lib_select.set_search_for_options( search2, "code", "code" ) lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('sequence_code', parent_lib) elif search_type == 'prod/texture': lib_select = FilterSelectWdg('parent_lib') lib_select.persistence = False search2 = Search("prod/texture") search2.add_column('category') search2.add_group_by("category") lib_select.set_search_for_options( search2, "category", "category" ) lib_select.add_empty_option("-- Any --") widget.add(lib_select) # get all of the options for this search type parent_lib = lib_select.get_value() if parent_lib: search.add_filter('category', parent_lib)