INNER CODE UNIT · Python
_on_iface_changed
HaxL0p4/L0p4Map · ui/app.py:695
def _on_iface_changed(self,index):
iface = self.iface_selector.itemData(index)
if not iface:
return
try:
self.subnet_label.setText(get_local_subnet(iface["name"]))
except Exception:
self.subnet_label.clear()
def _resolve_subnet(self):
manual = self.subnet_label.text().strip()
if manual:
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}-\d{1,3}$", manual):
return manual
try:
return str(ipaddress.ip_network(manual, strict=False))
except ValueError:
pass