@@ -1272,7 +1272,7 @@ def packet_received(self, pck, port=None):
12721272 if int (macd ,2 ) in dic and ttl > 0 :
12731273 pck .animate (self , dic [int (macd ,2 )])
12741274
1275- elif int (macd ,2 ) in [x [0 ] for x in self .table ]:
1275+ elif int (macd ,2 ) in [x [0 ] for x in self .table ] and ttl >= 0 :
12761276 for x in self .table :
12771277 if x [0 ] == int (macd ,2 ):
12781278 pck .animate (self , self .pdic [x [1 ]])
@@ -1346,6 +1346,11 @@ def __init__(self, x, y, *args, name="Default", maxconnections=1, ip=None):
13461346
13471347 self .update ()
13481348
1349+ def load (self ):
1350+ ObjetoBase .load (self )
1351+ self .pingwin = PingWin (self )
1352+ self .builder .get_object ("grid_rclick-sendpkg" ).connect ("activate" , self .pingwin .show )
1353+
13491354 class ip ():
13501355 def __init__ (self , * args , ipstr = "None" ):
13511356 self .str = ipstr
@@ -1406,26 +1411,6 @@ def update(self):
14061411 submenu1 = self .builder .get_object ("grid_rclick-sendpkg" ).get_submenu ()
14071412 print ("Compcon: " , [x .name for x in self .compcon ()])
14081413
1409- '''
1410- for child in submenu1.get_children():
1411- if child.link.__class__.__name__ == "Switch" or child.link.__class__.__name__ == "Hub":
1412- child.hide()
1413- for con in self.compcon():
1414- if con.uuid not in [x.link.uuid for x in submenu1.get_children()]:
1415- print("Not yet")
1416- MeIt = Gtk.MenuItem.new_with_label(con.name)
1417- MeIt.link = con
1418- MeIt.connect("activate", self.send_pck)
1419- submenu1.append(MeIt)
1420- MeIt.show()
1421- con.update()
1422- else:
1423- print("\033 [91m",con, "ya está en submenu1\033 [0m")
1424- pass
1425-
1426- print("self.connections", self.connections)
1427- '''
1428-
14291414 if self .IP != None :
14301415 objlst .update (self ,"IP" , str (self .IP ))
14311416
@@ -1639,9 +1624,8 @@ def send(self, de):
16391624 to = de .connections [1 ]
16401625 self .animate (de , to )
16411626
1642- #Composición de movimientos lineales en eje x e y
16431627 #Siendo t=fps/s, v=px/s, v default = 84
1644- def animate (self , start , end , fps = 120 , v = 200 , color = None , port = None ):
1628+ def animate (self , start , end , fps = 30 , v = 200 , color = None , port = None ):
16451629 if color == None :
16461630 if self .color != None :
16471631 color = self .color
@@ -2092,6 +2076,7 @@ def __init__(self, obj):
20922076 self .ping .connect ("clicked" , self .do_ping )
20932077
20942078 self .entry .connect ("changed" , self .filter_ip )
2079+ self .win .connect ("delete-event" , self .destroy )
20952080
20962081 def filter_ip (self , entry ):
20972082 if entry .get_text ().strip ("" ) == "" :
@@ -2144,8 +2129,8 @@ def do_ping(self, widget):
21442129
21452130 def show (self , widget ):
21462131 self .win .show ()
2147- def destroy (self ):
2148- self . win .hide ()
2132+ def destroy (self , window , event ):
2133+ window .hide ()
21492134 return True
21502135
21512136class about (Gtk .AboutDialog ):
0 commit comments