74 @param self this object
78 hscrollbar_policy=Gtk.PolicyType.AUTOMATIC,
79 vscrollbar_policy=Gtk.PolicyType.AUTOMATIC,
86 def add_column(descr, colid):
87 column = Gtk.TreeViewColumn(descr, Gtk.CellRendererText(), text=colid)
88 treeview.append_column(column)
98 @param self this object
100 @param packet_list packet list
104 for sample
in packet_list:
106 if sample.device
is None:
107 interface_name =
"(unknown)"
109 interface_name = ns.Names.FindName(sample.device)
110 if not interface_name:
111 interface_name =
"(interface %i)" % sample.device.GetIfIndex()
115 str(sample.time.GetSeconds()),
119 str(sample.packet.GetSize()),
127 @param self this object
128 @param visualizer the visualizer object
129 @param node_index the node index
131 InformationWindow.__init__(self)
133 parent=visualizer.window,
134 flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
135 buttons=(
"_Close", Gtk.ResponseType.CLOSE),
138 self.
win.set_title(
"Last packets for node %i" % node_index)
141 self.
node = ns.NodeList.GetNode(node_index)
143 def smart_expand(expander, vbox):
144 if expander.get_expanded():
145 vbox.set_child_packing(
146 expander, expand=
True, fill=
True, padding=0, pack_type=Gtk.PACK_START
149 vbox.set_child_packing(
150 expander, expand=
False, fill=
False, padding=0, pack_type=Gtk.PACK_START
153 main_hbox = Gtk.HBox(
False, 4)
155 main_vbox = Gtk.VBox(
False, 4)
157 self.
win.vbox.add(main_hbox)
158 main_hbox.add(main_vbox)
162 group = Gtk.Expander(
"Last transmitted packets")
165 main_vbox.pack_start(group, expand=
False, fill=
False)
166 group.connect_after(
"activate", smart_expand, main_vbox)
170 group = Gtk.Expander(
"Last received packets")
173 main_vbox.pack_start(group, expand=
False, fill=
False)
174 group.connect_after(
"activate", smart_expand, main_vbox)
178 group = Gtk.Expander(
"Last dropped packets")
181 main_vbox.pack_start(group, expand=
False, fill=
False)
182 group.connect_after(
"activate", smart_expand, main_vbox)
190 packet_filter_vbox = Gtk.VBox(
False, 4)
191 packet_filter_vbox.show()
192 main_hbox.add(packet_filter_vbox)
194 sel_buttons_box = Gtk.HButtonBox()
195 sel_buttons_box.show()
196 packet_filter_vbox.pack_start(sel_buttons_box,
False,
False, 4)
197 select_all_button = GObject.new(Gtk.Button, label=
"Sel. All", visible=
True)
198 select_none_button = GObject.new(Gtk.Button, label=
"Sel. None", visible=
True)
199 sel_buttons_box.add(select_all_button)
200 sel_buttons_box.add(select_none_button)
204 Column(
"selected", title=
"Sel.", data_type=bool, editable=
True),
205 Column(
"name", title=
"Header"),
212 class TypeIdConfig(
object):
213 __slots__ = [
"name",
"selected",
"typeid"]
217 Header = ns.TypeId.LookupByName(
"ns3::Header")
218 Trailer = ns.TypeId.LookupByName(
"ns3::Trailer")
219 for typeid_i
in range(ns.TypeId.GetRegisteredN()):
220 typeid = ns.TypeId.GetRegistered(typeid_i)
225 if typeid_tmp == Header
or typeid_tmp == Trailer:
228 if typeid_tmp.HasParent():
229 typeid_tmp = typeid_tmp.GetParent()
234 if typeid
in [Header, Trailer]:
238 c.name = typeid.GetName()
243 def update_capture_options():
254 self.
visualizer.simulation.sim_helper.SetPacketCaptureOptions(
264 update_capture_options()
270 update_capture_options()
272 select_all_button.connect(
"clicked", sel_all_cb)
273 select_none_button.connect(
"clicked", sel_none_cb)
275 op_buttons_box = Gtk.HButtonBox()
276 op_buttons_box.show()
277 packet_filter_vbox.pack_start(op_buttons_box,
False,
False, 4)
278 self.
op_AND_button = GObject.new(Gtk.RadioButton, label=
"AND", visible=
True)
280 Gtk.RadioButton, label=
"OR", visible=
True, group=self.
op_AND_button
286 self.
op_AND_button.connect(
"toggled",
lambda b: update_capture_options())
288 def cell_edited(l, obj, attribute):
289 update_capture_options()
293 update_capture_options()
296 self.
win.set_default_size(600, 300)
301 Response callback function
302 @param self this object
303 @param win the window
304 @param response the response
308 self.
visualizer.remove_information_window(self)
313 @param self this object
316 last_packets = self.
visualizer.simulation.sim_helper.GetLastPackets(self.
node.GetId())
324 menu_item = Gtk.MenuItem(
"Show Last Packets")
327 def _show_it(dummy_menu_item):
330 menu_item.connect(
"activate", _show_it)
335 viz.connect(
"populate-node-menu", populate_node_menu)