- def cancel(self):
- iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState)
- self.activateInterfaceEntry.value = self.oldInterfaceState
- if self.activateInterfaceEntry.value is False:
- iNetwork.deactivateInterface(self.iface)
- iNetwork.getInterfaces()
- self.close()
+ def secondIfaceFoundCB(self,data):
+ if data is False:
+ self.applyConfig(True)
+ else:
+ configuredInterfaces = iNetwork.getConfiguredAdapters()
+ for interface in configuredInterfaces:
+ if interface == self.iface:
+ continue
+ iNetwork.setAdapterAttribute(interface, "up", False)
+ iNetwork.deactivateInterface(interface)
+ self.applyConfig(True)
+
+ def applyConfig(self, ret = False):
+ if (ret == True):
+ iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value)
+ if self.hasGatewayConfigEntry.value:
+ iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value)
+ else:
+ iNetwork.removeAdapterAttribute(self.iface, "gateway")
+ if self.extended is not None and self.configStrings is not None:
+ iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface))
+ self.ws.writeConfig()
+ if self.activateInterfaceEntry.value is False:
+ iNetwork.deactivateInterface(self.iface)
+ iNetwork.writeNetworkConfig()
+ iNetwork.restartNetwork(self.applyConfigDataAvail)
+ self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
+ else:
+ self.keyCancel()