+ 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):
+ newList = []
+ newList = self.getAccessPoints(refresh = True)
+ self.newAPList = []
+ tmpList = []
+ newListIndex = None
+ currentListEntry = None
+ currentListIndex = None
+
+ for ap in self.oldlist.keys():
+ data = self.oldlist[ap]['data']
+ if data is not None:
+ tmpList.append(data)
+
+ 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[0] == currentListEntry[0]:
+ newListIndex = idx
+ idx +=1
+ self['list'].setList(self.newAPList)
+ self["list"].setIndex(newListIndex)
+ self["list"].updateList(self.newAPList)
+ self.listLength = 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 "[WirelessLan.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 not self.oldlist.has_key(entry[0]):
+ self.oldlist[entry[0]] = { 'data': entry }
+ else:
+ self.oldlist[entry[0]]['data'] = entry
+
+ 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] ))