+ def rescanTimerFired(self):
+ self.rescanTimer.stop()
+ self.updateAPList()
+
+ def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal):
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ encryption = encrypted and _("Yes") or _("No")
+ if bssid == 'hidden...':
+ return((essid, bssid, None, None, None, None, divpng))
+ else:
+ return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng))
+
+ def updateAPList(self):
+ self.oldlist = []
+ self.oldlist = self.cleanList
+ self.newAPList = []
+ newList = []
+ tmpList = []
+ newListIndex = None
+ currentListEntry = None
+ currentListIndex = None
+ newList = self.getAccessPoints(refresh = True)
+
+ for oldentry in self.oldlist:
+ if oldentry not in newList:
+ newList.append(oldentry)
+
+ for newentry in newList:
+ if newentry[1] == "hidden...":
+ continue
+ tmpList.append(newentry)
+
+ if len(tmpList):
+ if "hidden..." not in tmpList:
+ tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+
+ for entry in tmpList:
+ self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
+
+ currentListEntry = self["list"].getCurrent()
+ idx = 0
+ for entry in self.newAPList:
+ if entry == currentListEntry:
+ newListIndex = idx
+ idx +=1
+ self['list'].setList(self.newAPList)
+ self["list"].setIndex(newListIndex)
+ self["list"].updateList(self.newAPList)
+ self.listLenght = len(self.newAPList)
+ self.buildWlanList()
+ self.setInfo()
+
+ def getAccessPoints(self, refresh = False):
+ self.APList = []
+ self.cleanList = []
+ self.w = Wlan(self.iface)
+ aps = self.w.getNetworkList()
+ if aps is not None:
+ print "[NetworkWizard.py] got Accespoints!"
+ tmpList = []
+ compList = []
+ for ap in aps:
+ a = aps[ap]
+ if a['active']:
+ tmpList.append( (a['essid'], a['bssid']) )
+ compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
+
+ for entry in tmpList:
+ if entry[0] == "":
+ for compentry in compList:
+ if compentry[1] == entry[1]:
+ compList.remove(compentry)
+ for entry in compList:
+ self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) )
+
+ if "hidden..." not in self.cleanList:
+ self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+
+ for entry in self.cleanList:
+ self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))