nodes: 0, module; 1, function_definition; 2, function_name:set_filter; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, comment:"""Set regular expression for filter."""; 12, assignment; 13, attribute; 14, block; 15, else_clause; 16, call; 17, attribute; 18, call; 19, identifier:self; 20, identifier:pattern; 21, expression_statement; 22, block; 23, attribute; 24, argument_list; 25, identifier:self; 26, identifier:pattern; 27, identifier:get_search_regex; 28, argument_list; 29, call; 30, expression_statement; 31, identifier:self; 32, identifier:invalidateFilter; 33, identifier:text; 34, attribute; 35, argument_list; 36, call; 37, attribute; 38, identifier:setSortingEnabled; 39, False; 40, attribute; 41, argument_list; 42, identifier:self; 43, identifier:_parent; 44, attribute; 45, identifier:setSortingEnabled; 46, True; 47, identifier:self; 48, identifier:_parent
code: def set_filter(self, text):
          """Set regular expression for filter."""
          self.pattern = get_search_regex(text)
          if self.pattern:
              self._parent.setSortingEnabled(False)
          else:
              self._parent.setSortingEnabled(True)
          self.invalidateFilter()