def boto_inicia(self): self.real_devices=[] self.real_devices=self.detectConcentrator() #get ethernet connected to pppoe concentrator #print self.real_devices if len(self.real_devices)==0: # si no hi ha cap eth, vol dir que no es pot configurar QMessageBox.critical(self, self.tr("ADSL/PPPoE Provider Not Found"), self.tr("It don't seems to have an ADSL/PPPoE concentrator connectated to any ethernet."), QMessageBox.Ok) else: #if there's a configured interface, allow to desconfigure it if grepNetInterfaceLines("dsl-provider"): self.ui.b_disconfigure.setVisible(True) else: self.ui.b_disconfigure.setVisible(False) self.ui.list_net_dev.clear() icon=self.img_ethernet for dev in self.real_devices: vendor=grepNetInterfaceInformation(dev, "vendor") product=grepNetInterfaceInformation(dev, "product") a=QListWidgetItem(self.ui.list_net_dev) a.setText(dev+": "+vendor+"\n"+product) a.setIcon(QIcon(icon)) self.ui.list_net_dev.addItem(a) self.ui.pages.setCurrentIndex(1)
def enterPageEvent(self, page): #this function makes things when enter to a concrete page if page==1: #entered to page Devices self.ui.list_net_dev.blockSignals(True) self.real_devices=[] devices=getNetworkDevices() #get network devices self.ui.list_net_dev.clear() for dev in devices: wireless=path.exists("/sys/class/net/"+dev+"/wireless") #this interface is wireless? if wireless: icon=self.img_wireless else: icon=self.img_ethernet vendor=grepNetInterfaceInformation(dev, "vendor") product=grepNetInterfaceInformation(dev, "product") a=QListWidgetItem(self.ui.list_net_dev) a.setText(dev+": "+vendor+"\n"+product) a.setIcon(QIcon(icon)) self.ui.list_net_dev.addItem(a) # eth, true/false, vendor, product d=[dev, wireless, vendor, product] self.real_devices.append(d) self.ui.b_next.setEnabled(False) #disable next button self.ui.list_net_dev.blockSignals(False) #get hal information about it #restart IP parameters self.restartIpParameters() elif page==2: #entered to page Wireless networks self.reload_wifi_list() #restart IP parameters self.restartIpParameters() elif page==3: self.grepOldDeviceSettings() self.ui.le_ip.setText(self.returnOldSetting("address")) self.ui.le_netmask.setText(self.returnOldSetting("netmask")) self.ui.le_gateway.setText(self.returnOldSetting("gateway")) self.ui.le_custom_dns.setText(self.returnOldSetting("dns-nameservers"))