def get_selected_field(self): """ Get the selected field @return a tuple (packet, proto, field) containing the parent protocol for field and the field or None, None, None """ model, iter = self.tree.get_selection().get_selected() if not iter: return (None, None, None) obj = model.get_value(iter, 0) proto = obj.proto if isinstance(obj, TField): field = obj.ref elif isinstance(obj, TFlag): field = obj.field else: field = None if not proto or not field or \ not backend.is_field(field) or \ not backend.is_proto(proto): return (None, None, None) return (self.packet, proto, field)
def __search_func(self, model, col, key, iter): field = model.get_value(iter, 0) if not field or backend.is_proto(field): return True if isinstance(field, TFlag): return not key in field.ref name = backend.get_field_name(field.ref) return not key in name
def get_active_protocol(self): """ Return the selected protocol or the most important protocol if no selection. @return a tuple Packet, Protocol or None, None """ model, iter = self.tree.get_selection().get_selected() if not iter: return None, None obj = model.get_value(iter, 2) assert backend.is_proto(obj), "Should be a Protocol instance." return self.session.packet, obj