1 from Screens.Screen import Screen
2 from Screens.MessageBox import MessageBox
3 from Screens.InputBox import InputBox
4 from Screens.Standby import *
5 from Screens.VirtualKeyBoard import VirtualKeyBoard
6 from Screens.HelpMenu import HelpableScreen
7 from Components.Network import iNetwork
8 from Screens.NetworkSetup import NameserverSetup
9 from Components.Sources.StaticText import StaticText
10 from Components.Sources.Boolean import Boolean
11 from Components.Sources.List import List
12 from Components.Label import Label,MultiColorLabel
13 from Components.Pixmap import Pixmap,MultiPixmap
14 from Components.MenuList import MenuList
15 from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigPassword, ConfigSelection, getConfigListEntry, ConfigNothing
16 from Components.config import ConfigInteger, ConfigSubsection
17 from Components.ConfigList import ConfigListScreen
18 from Components.PluginComponent import plugins
19 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
20 from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap
21 from Components.Console import Console
22 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_SKIN
23 from Tools.LoadPixmap import LoadPixmap
24 from Plugins.Plugin import PluginDescriptor
25 from enigma import eTimer, ePoint, eSize, RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
26 from os import path as os_path, system as os_system, unlink,listdir
27 from re import compile as re_compile, search as re_search
28 from Tools.Directories import fileExists
31 class WlanSelection(Screen,HelpableScreen):
32 def __init__(self, session):
33 if session.desktop.size().width() > 720:
35 <screen name="WlanSelection" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
36 <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
37 <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
38 <eLabel text="Wireless Network Adapter Selection..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
39 <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
40 <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
41 <convert type="ClockToText">Format:%H:%M</convert>
43 <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
44 <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
45 <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
46 <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
47 <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
48 <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
49 <widget source="description" render="Label" position="500,140" size="280,360" font="Regular;19" halign="center" valign="center" backgroundColor="#c5c9cc" transparent="1"/>
53 <screen name="WlanSelection" position="110,120" size="500,400" title="Wireless Network Adapter Selection..." >
54 <ePixmap pixmap="750S/div-h.png" position="0,350" zPosition="1" size="560,2" />
55 <ePixmap pixmap="750S/border_menu_a.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
56 <ePixmap pixmap="750S/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
57 <widget source="key_red" render="Label" position="30,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
58 <ePixmap pixmap="750S/buttons/green.png" position="360,360" size="140,40" alphatest="on" />
59 <widget source="key_green" render="Label" position="380,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
60 <widget name="menulist" position="20,20" size="230,260" selectionPixmap="750S/buttons/Selected_bar_230x23px.png" transparent="1" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
61 <widget source="description" render="Label" position="305,10" size="195,300" font="Regular;19" halign="center" valign="center" />
63 Screen.__init__(self,session)
64 HelpableScreen.__init__(self)
65 self.mainmenu = self.getWlandevice()
66 self["menulist"] = MenuList(self.mainmenu)
67 self["key_red"] = StaticText(_("Close"))
68 self["key_green"] = StaticText(_("Select"))
69 self["description"] = StaticText()
70 self["description"].setText(_("Select Wireless Lan module. \n" ))
71 self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
73 "ok": (self.ok, _("select interface")),
74 "cancel": (self.close, _("exit network interface list")),
77 self["ColorActions"] = HelpableActionMap(self, "ColorActions",
79 "green": (self.ok, _("select interface")),
80 "red": (self.close, _("exit network interface list")),
82 self.updateInterfaces()
83 self.onClose.append(self.cleanup)
85 def updateInterfaces(self):
86 iNetwork.config_ready = False
88 iNetwork.getInterfaces()
91 # print len(self["menulist"].list)
92 if len(self["menulist"].list) == 0:
93 self.session.open(MessageBox, (_("Can not find any WirelessLan Module\n")),MessageBox.TYPE_ERROR,5 )
95 ifaces=self["menulist"].getCurrent()[1]
99 self.session.open(WlanSetup,ifaces)
101 def getWlandevice(self):
103 for x in iNetwork.getInstalledAdapters():
104 if x.startswith('eth'):
106 description=self.getAdapterDescription(x)
107 if description == "Unknown network adapter":
108 list.append((description,x))
110 list.append((description + " (%s)"%x,x))
113 def getAdapterDescription(self, iface):
114 classdir = "/sys/class/net/" + iface + "/device/"
115 driverdir = "/sys/class/net/" + iface + "/device/driver/"
116 if os_path.exists(classdir):
117 files = listdir(classdir)
118 if 'driver' in files:
119 if os_path.realpath(driverdir).endswith('rtw_usb_drv'):
120 return _("Realtek")+ " " + _("WLAN adapter.")
121 elif os_path.realpath(driverdir).endswith('ath_pci'):
122 return _("Atheros")+ " " + _("WLAN adapter.")
123 elif os_path.realpath(driverdir).endswith('zd1211b'):
124 return _("Zydas")+ " " + _("WLAN adapter.")
125 elif os_path.realpath(driverdir).endswith('rt73'):
126 return _("Ralink")+ " " + _("WLAN adapter.")
127 elif os_path.realpath(driverdir).endswith('rt73usb'):
128 return _("Ralink")+ " " + _("WLAN adapter.")
130 return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter")
132 return _("Unknown network adapter")
134 return _("Unknown network adapter")
137 iNetwork.stopGetInterfacesConsole()
139 class WlanSetup(Screen,HelpableScreen):
140 def __init__(self, session, ifaces):
141 if session.desktop.size().width() > 720:
143 <screen name="WlanSetup" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
144 <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
145 <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
146 <eLabel text="Wireless Network Setup Menu..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
147 <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
148 <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
149 <convert type="ClockToText">Format:%H:%M</convert>
151 <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
152 <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
153 <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
154 <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
155 <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
156 <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
157 <widget source="description" render="Label" position="500,140" size="280,360" font="Regular;19" halign="center" valign="center" backgroundColor="#c5c9cc" transparent="1"/>
161 <screen name="WlanSetup" position="110,120" size="500,400" title="Wireless Network Setup Menu..." >
162 <ePixmap pixmap="750S/div-h.png" position="0,350" zPosition="1" size="560,2" />
163 <ePixmap pixmap="750S/border_menu_a.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
164 <ePixmap pixmap="750S/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
165 <widget source="key_red" render="Label" position="30,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
166 <ePixmap pixmap="750S/buttons/green.png" position="360,360" size="140,40" alphatest="on" />
167 <widget source="key_green" render="Label" position="380,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
168 <widget name="menulist" position="20,20" size="230,260" selectionPixmap="750S/buttons/Selected_bar_230x23px.png" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
169 <widget source="description" render="Label" position="305,10" size="195,300" font="Regular;19" halign="center" valign="center" />
171 Screen.__init__(self, session)
172 HelpableScreen.__init__(self)
173 self.session = session
175 self.restartLanRef = None
176 self.LinkState = None
177 self.mainmenu = self.MakeMenu()
178 self["menulist"] = MenuList(self.mainmenu)
179 self["key_red"] = StaticText(_("Close"))
180 self["key_green"] = StaticText(_("Select"))
181 self["description"] = StaticText()
182 self["IFtext"] = StaticText()
183 self["IF"] = StaticText()
184 self["Statustext"] = StaticText()
185 self["statuspic"] = MultiPixmap()
186 self["statuspic"].hide()
187 self.onLayoutFinish.append(self.loadDescription)
189 self.oktext = _("Press OK on your remote control to continue.")
191 self["WizardActions"] = HelpableActionMap(self, "WizardActions",
193 "up": (self.up, _("move up to previous entry")),
194 "down": (self.down, _("move down to next entry")),
195 "left": (self.left, _("move up to first entry")),
196 "right": (self.right, _("move down to last entry")),
199 self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
201 "cancel": (self.close, _("exit networkadapter setup menu")),
202 "ok": (self.ok, _("select menu entry")),
205 self["ColorActions"] = HelpableActionMap(self, "ColorActions",
207 "red": (self.close, _("exit networkadapter setup menu")),
208 "green": (self.ok, _("select menu entry")),
211 self["actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
221 self.onClose.append(self.cleanup)
223 def loadDescription(self):
224 if self["menulist"].getCurrent()[1] == 'setting':
225 self["description"].setText(_("Edit the network configuration of your STB.\n" ) + self.oktext )
226 if self["menulist"].getCurrent()[1] == 'scanap':
227 self["description"].setText(_("Scan your network for wireless access points and connect to them using your selected wireless device.\n" ) + self.oktext )
228 if self["menulist"].getCurrent()[1] == 'dns':
229 self["description"].setText(_("Edit the Nameserver configuration of your STB.\n" ) + self.oktext )
230 if self["menulist"].getCurrent()[1] == 'status':
231 self["description"].setText(_("Shows the state of your wireless LAN connection.\n" ) + self.oktext )
232 if self["menulist"].getCurrent()[1] == 'test':
233 self["description"].setText(_("Test the network configuration of your STB.\n" ) + self.oktext )
234 if self["menulist"].getCurrent()[1] == 'restart':
235 self["description"].setText(_("Restart your network connection and interfaces.\n" ) + self.oktext )
238 self["menulist"].up()
239 self.loadDescription()
242 self["menulist"].down()
243 self.loadDescription()
246 self["menulist"].pageUp()
247 self.loadDescription()
250 self["menulist"].pageDown()
251 self.loadDescription()
255 if self["menulist"].getCurrent()[1] == 'setting':
256 self.session.openWithCallback(self.checklist, WlanConfig, self.iface)
257 elif self["menulist"].getCurrent()[1] == 'scanap':
258 self.session.open(WlanScanAp, self.iface)
259 elif self["menulist"].getCurrent()[1] == 'dns':
260 self.session.open(NameserverSetup)
261 elif self["menulist"].getCurrent()[1] == 'status':
262 self.session.open(Wlanstatus, self.iface)
263 elif self["menulist"].getCurrent()[1] == 'test':
264 self.session.openWithCallback(self.checklist,NetworkAdapterTest,self.iface)
265 elif self["menulist"].getCurrent()[1] == 'restart':
266 self.session.openWithCallback(self.restartLan, MessageBox, (_("Are you sure you want to restart your network interfaces?\n\n") + self.oktext ) )
269 self["menulist"].setList(self.MakeMenu())
273 menu.append((_("Adapter settings"), "setting"))
274 menu.append((_("Scan Wireless AP"), "scanap"))
275 menu.append((_("Nameserver settings"), "dns"))
276 if iNetwork.getAdapterAttribute(self.iface, "up"):
277 menu.append((_("Show WLAN Status"), "status"))
278 menu.append((_("Network test"), "test"))
279 menu.append((_("Restart network"), "restart"))
283 def restartLan(self, ret = False):
285 iNetwork.restartNetwork(self.restartLanDataAvail)
286 self.restartLanRef = self.session.openWithCallback(self.restartfinishedCB, MessageBox, _("Please wait while your network is restarting..."), type = MessageBox.TYPE_INFO, enable_input = False)
288 def restartLanDataAvail(self, data):
290 iNetwork.getInterfaces(self.getInterfacesDataAvail)
292 def getInterfacesDataAvail(self, data):
294 self.restartLanRef.close(True)
296 def restartfinishedCB(self,data):
298 self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 5, default = False)
301 iNetwork.stopRestartConsole()
302 iNetwork.stopGetInterfacesConsole()
304 wlanconfig = ConfigSubsection()
305 wlanconfig.usedevice = ConfigSelection(default = "off", choices = [
306 ("off", _("off")), ("on", _("on"))])
307 wlanconfig.usedhcp = ConfigSelection(default = "off", choices = [
308 ("off", _("no")), ("on", _("yes"))])
309 wlanconfig.essid = ConfigSelection(default = "none", choices = ["none"])
310 wlanconfig.encrypt = ConfigSelection(default = "off", choices = [
311 ("off", _("no")), ("on", _("yes"))])
312 wlanconfig.method = ConfigSelection(default = "wep", choices = [
313 ("wep", _("WEP")), ("wpa", _("WPA")), ("wpa2", _("WPA2")),("wpa/wpa2", _("WPA/WPA2"))])
314 wlanconfig.keytype = ConfigSelection(default = "ascii", choices = [
315 ("ascii", _("ASCII")), ("hex", _("HEX"))])
316 wlanconfig.key = ConfigPassword(default = "XXXXXXXX", visible_width = 50, fixed_size = False)
317 wlanconfig.usegateway = ConfigSelection(default = "off", choices = [
318 ("off", _("no")), ("on", _("yes"))])
319 wlanconfig.ip = ConfigIP([0,0,0,0])
320 wlanconfig.netmask = ConfigIP([0,0,0,0])
321 wlanconfig.gateway = ConfigIP([0,0,0,0])
324 class WlanConfig(Screen, ConfigListScreen, HelpableScreen):
325 def __init__(self, session, iface):
326 if session.desktop.size().width() > 720:
328 <screen name="WlanConfig" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
329 <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
330 <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
331 <eLabel text="Wireless Network Configuration..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
332 <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
333 <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
334 <convert type="ClockToText">Format:%H:%M</convert>
336 <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
337 <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
338 <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
339 <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
340 <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
341 <widget name="config" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
342 <widget name="menulist" position="20,80" size="230,230" selectionPixmap="750S/buttons/Selected_bar_230x23px.png" transparent="1" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
343 <eLabel text="IP Address : " position="500,160" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
344 <widget source="ipaddress" render="Label" position="530,190" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
345 <eLabel text="NetMask : " position="500,220" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
346 <widget source="netmask" render="Label" position="530,250" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
347 <eLabel text="Gateway : " position="500,280" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
348 <widget source="gateway" render="Label" position="530,310" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
352 <screen name="WlanConfig" position="110,120" size="500,400" title="Wireless Network Configuration..." >
353 <ePixmap pixmap="750S/buttons/red.png" position="0,355" size="140,40" alphatest="on" />
354 <ePixmap pixmap="750S/buttons/green.png" position="360,355" size="140,40" alphatest="on" />
355 <widget source="key_red" render="Label" position="20,355" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
356 <widget source="key_green" render="Label" position="380,355" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
357 <widget name="config" position="10,10" backgroundColor="#371e1c1a" size="480,210" scrollbarMode="showOnDemand" />
358 <ePixmap pixmap="750S/div-h.png" position="0,225" zPosition="1" size="550,2" />
359 <eLabel text="IP Address : " position="100,250" size="190,21" font="Regular;19" />
360 <widget source="ipaddress" render="Label" position="300,250" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
361 <eLabel text="NetMask : " position="100,275" size="190,21" font="Regular;19" />
362 <widget source="netmask" render="Label" position="300,275" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
363 <eLabel text="Gateway : " position="100,300" size="190,21" font="Regular;19" />
364 <widget source="gateway" render="Label" position="300,300" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
366 Screen.__init__(self,session)
367 self.session = session
368 self["key_red"] = StaticText(_("Close"))
369 self["key_green"] = StaticText(_("Ok"))
370 self["ipaddress"] = StaticText(_("[ N/A ]"))
371 self["netmask"] = StaticText(_("[ N/A ]"))
372 self["gateway"] = StaticText(_("[ N/A ]"))
373 self["OkCancelActions"] = ActionMap(["ShortcutActions", "SetupActions" ],
375 "ok": self.saveWlanConfig,
376 "green": self.saveWlanConfig,
377 "cancel": self.keyCancel,
378 "red": self.keyCancel,
383 self.scan_ssid = None
387 self.encryption_key = None
388 self.wlanscanap = None
389 self.wpaphraseconsole = None
390 # self.scanAPcount =5
393 ConfigListScreen.__init__(self, self.list,session = self.session)
394 self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
395 self.readWpaSupplicantConf()
396 self.scanAPFailedTimer = eTimer()
397 self.scanAPFailedTimer.callback.append(self.scanAPFailed)
398 self.scanAplistTimer = eTimer()
399 self.scanAplistTimer.callback.append(self.scanApList)
400 self.Console = Console()
401 # self.scanAplistTimer.start(100,True)
402 self.updateInterfaces(self.readWlanSettings)
403 self.onClose.append(self.cleanup)
405 def updateInterfaces(self,callback = None):
406 iNetwork.config_ready = False
407 iNetwork.msgPlugins()
408 iNetwork.getInterfaces(callback)
410 def readWlanSettings(self,ret=None):
412 print "getInterfaces Fail... "
413 if iNetwork.getAdapterAttribute(self.iface, "up") == True:
417 wlanconfig.usedevice = ConfigSelection(default=default_tmp, choices = [("off", _("off")), ("on", _("on"))])
419 if iNetwork.getAdapterAttribute(self.iface, "dhcp"):
423 wlanconfig.usedhcp = ConfigSelection(default=default_tmp, choices = [("off", _("no")), ("on", _("yes"))])
425 wlanconfig.ip = ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "ip")) or [0,0,0,0]
427 wlanconfig.netmask = ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "netmask") or [255,0,0,0])
428 if iNetwork.getAdapterAttribute(self.iface, "gateway"):
432 wlanconfig.usegateway = ConfigSelection(default = default_tmp, choices = [("off", _("no")), ("on", _("yes"))])
434 wlanconfig.gateway = ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "gateway") or [0,0,0,0])
436 self["ipaddress"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "ip"))))
437 self["netmask"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "netmask"))))
438 self["gateway"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "gateway"))))
440 if self.encryption_key is not None:
444 wlanconfig.encrypt = ConfigSelection(default = default_tmp, choices = [("off", _("no")), ("on", _("yes"))])
446 if self.key_mgmt=="NONE":
448 elif self.key_mgmt == "WPA-PSK":
449 if self.proto == "WPA":
451 elif self.proto == "RSN":
453 elif self.proto in ( "WPA RSN", "WPA WPA2"):
454 default_tmp = "wpa/wpa2"
460 wlanconfig.method = ConfigSelection(default = default_tmp, choices = [
461 ("wep", _("WEP")), ("wpa", _("WPA")), ("wpa2", _("WPA2")),("wpa/wpa2", _("WPA/WPA2"))])
463 if self.key_type == 0:
466 default_tmp = "ascii"
467 wlanconfig.keytype = ConfigSelection(default = default_tmp, choices = [
468 ("ascii", _("ASCII")), ("hex", _("HEX"))])
469 default_tmp = self.encryption_key or "XXXXXXXX"
470 # default_tmp = "XXXXXXXX"
471 wlanconfig.key = ConfigPassword(default = default_tmp, visible_width = 50, fixed_size = False)
472 self.scanAplistTimer.start(100,True)
474 def readWpaSupplicantConf(self):
476 if fileExists("/etc/wpa_supplicant.conf"):
477 wpafd = open("/etc/wpa_supplicant.conf","r")
479 data = wpafd.readline()
481 # print "####readWpaSupplicantConf, data : ",data
484 data = wpafd.readline()
486 if data.startswith('ssid=') and len(data) > 6:
487 self.ssid = data[6:-2]
488 elif data.startswith('ap_scan=') :
489 self.ap_scan = data[8:]
490 # print "####readWpaSupplicantConf, ap_scan : ",self.ap_scan
491 elif data.startswith('scan_ssid=') and len(data) > 10:
492 self.scan_ssid = data[10:-1]
493 elif data.startswith('key_mgmt=') and len(data) > 9:
494 self.key_mgmt = data[9:-1]
495 elif data.startswith('proto=') and len(data) > 6:
496 self.proto = data[6:-1]
497 elif data.startswith('wep_key0="') and len(data) > 11:
498 self.key_type = 1 # ascii
499 self.encryption_key = data[10:-2]
500 elif data.startswith('wep_key0=') and len(data) > 9:
501 self.key_type = 0 # hex
502 self.encryption_key = data[9:-1]
503 elif data.startswith('psk="') and len(data) > 6:
504 self.key_type = 1 # ascii
505 self.encryption_key = data[5:-2]
506 elif data.startswith('#psk="') and len(data) > 6:
507 self.key_type = 0 # hex
508 self.encryption_key = data[6:-2]
509 elif not self.encryption_key and data.startswith('psk=') and len(data) > 4:
510 self.key_type = 0 # hex
511 self.encryption_key = data[4:-1]
512 data = wpafd.readline()
513 print self.ssid,self.scan_ssid,self.key_mgmt,self.proto,self.key_type,self.encryption_key
520 print 'failed loading wpasupplicant.conf'
522 def createConfig(self):
524 self.usedeviceEntry = getConfigListEntry(_("Use Device"), wlanconfig.usedevice)
525 self.usedhcpEntry = getConfigListEntry(_("Use DHCP"), wlanconfig.usedhcp)
526 self.essidEntry = getConfigListEntry(_("ESSID"), wlanconfig.essid)
527 self.hiddenessidEntry = getConfigListEntry(_("Input Hidden ESSID"), wlanconfig.hiddenessid)
528 self.encryptEntry = getConfigListEntry(_("Encrypt"), wlanconfig.encrypt)
529 self.methodEntry = getConfigListEntry(_("Method"), wlanconfig.method)
530 self.keytypeEntry = getConfigListEntry(_("Key Type"), wlanconfig.keytype)
531 self.keyEntry = getConfigListEntry(_("KEY"), wlanconfig.key)
533 self.ipEntry = getConfigListEntry(_("IP"), wlanconfig.ip)
534 self.netmaskEntry = getConfigListEntry(_("NetMask"), wlanconfig.netmask)
536 self.usegatewayEntry = getConfigListEntry(_("Use Gateway"), wlanconfig.usegateway)
537 self.gatewayEntry = getConfigListEntry(_("Gateway"), wlanconfig.gateway)
539 self.configList.append( self.usedeviceEntry )
540 if wlanconfig.usedevice.value is "on":
541 self.configList.append( self.usedhcpEntry )
542 if wlanconfig.usedhcp.value is "off":
543 self.configList.append(self.ipEntry)
544 self.configList.append(self.netmaskEntry)
545 self.configList.append(self.usegatewayEntry)
546 if wlanconfig.usegateway.value is "on":
547 self.configList.append(self.gatewayEntry)
548 self.configList.append( self.essidEntry )
549 # print "#### wlanconfig.essid.value : ",wlanconfig.essid.value
550 if wlanconfig.essid.value == 'Input hidden ESSID':
551 self.configList.append( self.hiddenessidEntry )
552 self.configList.append( self.encryptEntry )
553 if wlanconfig.encrypt.value is "on" :
554 self.configList.append( self.methodEntry )
555 if wlanconfig.method.value =="wep":
556 self.configList.append( self.keytypeEntry )
557 self.configList.append( self.keyEntry )
559 self["config"].list = self.configList
560 self["config"].l.setList(self.configList)
561 # if not self.selectionChanged in self["config"].onSelectionChanged:
562 # self["config"].onSelectionChanged.append(self.selectionChanged)
564 def scanApList(self):
566 self.configurationmsg = self.session.open(MessageBox, _("Please wait for scanning AP..."), type = MessageBox.TYPE_INFO, enable_input = False)
567 cmd = "ifconfig "+self.iface+" up"
570 self.wlanscanap = Console()
571 cmd = "iwlist "+self.iface+" scan"
573 self.wlanscanap.ePopen(cmd, self.apListFinnished,self.apListParse)
575 def apListFinnished(self, result, retval,extra_args):
576 (callback) = extra_args
577 if self.wlanscanap is not None:
579 self.wlanscanap = None
580 content = result.splitlines()
581 first = content[0].split()
586 if completed == True:
593 def apListParse(self,data):
596 if self.scanAPcount >0:
598 self.configurationmsg.close(True)
600 self.scanAplistTimer.start(500,True)
603 self.configurationmsg.close(True)
604 self.scanAPFailedTimer.start(500,True)
608 # self.scanAPcount =5
610 list = data.splitlines()
613 if xx.startswith('ESSID:') and len(xx)>8 and xx[7:-1]not in self.apList:
614 self.apList.append(xx[7:-1])
615 self.apList.append('Input hidden ESSID')
616 # print "###### selectap : ",selectap
617 if selectap is not None and selectap in self.apList:
618 wlanconfig.essid = ConfigSelection(default=selectap,choices = self.apList)
619 elif self.ap_scan is not None and self.ap_scan.strip() == '2':
620 wlanconfig.essid = ConfigSelection(default='Input hidden ESSID',choices = self.apList)
621 elif self.ssid is not None and self.ssid in self.apList:
622 wlanconfig.essid = ConfigSelection(default=self.ssid,choices = self.apList)
624 wlanconfig.essid = ConfigSelection(choices = self.apList)
625 if self.ssid is not None:
626 wlanconfig.hiddenessid = ConfigText(default = self.ssid, visible_width = 50, fixed_size = False)
628 wlanconfig.hiddenessid = ConfigText(default = "<Input ESSID>", visible_width = 50, fixed_size = False)
629 self.configurationmsg.close(True)
632 def scanAPFailed(self):
633 self.session.openWithCallback(self.keyCancel ,MessageBox, _("Scan AP Failed"), MessageBox.TYPE_ERROR,10)
636 ConfigListScreen.keyLeft(self)
640 ConfigListScreen.keyRight(self)
644 if self["config"].getCurrent() == self.usedeviceEntry or self["config"].getCurrent() == self.encryptEntry \
645 or self["config"].getCurrent() == self.usedhcpEntry or self["config"].getCurrent() == self.usegatewayEntry \
646 or self["config"].getCurrent() == self.essidEntry or self["config"].getCurrent() == self.methodEntry:
649 def saveWlanConfig(self):
651 if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
652 self["config"].getCurrent()[1].onDeselect(self.session)
653 if self["config"].isChanged():
654 self.session.openWithCallback(self.checkNetworkConfig, MessageBox, (_("Are you sure you want to restart your network interfaces?\n") ) )
656 self.session.openWithCallback(self.checkNetworkConfig, MessageBox, (_("Network configuration is not changed....\n\nAre you sure you want to restart your network interfaces?\n") ) )
660 def checkNetworkConfig(self, ret = False):
662 if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
663 self["config"].getCurrent()[1].onSelect(self.session)
665 if wlanconfig.essid.value == 'Input hidden ESSID':
666 if len(wlanconfig.hiddenessid.value) == 0:
667 self.session.open(MessageBox, ("PLEASE INPUT HIDDEN ESSID"), type = MessageBox.TYPE_ERROR, timeout = 10)
669 if len(wlanconfig.key.value) == 0:
670 self.session.open(MessageBox, ("PLEASE INPUT NETWORK KEY"), type = MessageBox.TYPE_ERROR, timeout = 10)
672 self.checkNetworkShares()
674 # def checkNetworkShares(self,ret = False):
676 # if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
677 # self["config"].getCurrent()[1].onSelect(self.session)
679 def checkNetworkShares(self):
681 self.Console = Console()
682 cmd = "cat /proc/mounts"
683 self.Console.ePopen(cmd, self.checkSharesFinished, self.confirmAnotherIfaces)
685 def checkSharesFinished(self, result, retval, extra_args):
686 callback = extra_args
687 print "checkMountsFinished : result : \n",result
688 networks = ['nfs','smbfs','ncp','coda']
689 for line in result.splitlines():
690 split = line.strip().split(' ',3)
691 if split[2] in networks:
692 self.session.open(MessageBox, ("NOT deconfiguring network interfaces :\n network shares still mounted\n"), type = MessageBox.TYPE_ERROR, timeout = 10)
694 if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
695 self["config"].getCurrent()[1].onSelect(self.session)
699 def confirmAnotherIfaces(self, ret = False):
703 num_configured_if = len(iNetwork.getConfiguredAdapters())
704 if num_configured_if >= 1:
705 if num_configured_if == 1 and self.iface in iNetwork.getConfiguredAdapters():
706 self.getWpaPhrase(False)
708 self.session.openWithCallback(self.getWpaPhrase, MessageBox, _("A second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
710 self.getWpaPhrase(False)
712 def getWpaPhrase(self,ret):
714 configuredInterfaces = iNetwork.getConfiguredAdapters()
715 for interface in configuredInterfaces:
716 if interface == self.iface:
718 iNetwork.setAdapterAttribute(interface, "up", False)
719 iNetwork.deactivateInterface(interface)
720 if wlanconfig.method.value =="wep":
721 self.writeWpasupplicantConf("wep") # passphrasekey is not None
723 if wlanconfig.essid.value == 'Input hidden ESSID':
724 cmd = 'wpa_passphrase %s %s' % (wlanconfig.hiddenessid.value,wlanconfig.key.value)
726 cmd = 'wpa_passphrase %s %s' % (wlanconfig.essid.value,wlanconfig.key.value)
728 self.wpaphraseconsole = Console()
729 self.wpaphraseconsole.ePopen(cmd, self.parseWpaPhrase, self.writeWpasupplicantConf)
731 def parseWpaPhrase(self, result, retval, extra_args):
732 print "parseWpaPhrase"
733 (writewlanconfig) = extra_args
734 if self.wpaphraseconsole is not None:
735 print "retval = ",retval
737 self.wpaphraseconsole.killAll()
738 self.wpaphraseconsole = None
739 print "parseWpaPhrase result : "
742 for line in result.splitlines():
743 if line.find('ssid') == -1 and line.find('#psk=') != -1:
745 elif line.find('psk=') != -1:
748 writewlanconfig(psk,plainpwd)
749 # writewlanconfig(None)
751 writewlanconfig(None)
753 writewlanconfig(None)
755 def writeWpasupplicantConf(self, passphrasekey=None,plainpwd=None):
757 wpafd = open("/etc/wpa_supplicant.conf","w")
759 contents = "#WPA Supplicant Configuration by STB\n"
760 contents += "ctrl_interface=/var/run/wpa_supplicant\n"
761 contents += "eapol_version=1\n"
762 contents += "fast_reauth=1\n"
764 if wlanconfig.essid.value == 'Input hidden ESSID':
765 contents += "ap_scan=2\n"
767 contents += "ap_scan=1\n"
768 contents += "network={\n"
769 if wlanconfig.essid.value == 'Input hidden ESSID':
770 contents += "\tssid=\""+wlanconfig.hiddenessid.value+"\"\n"
772 contents += "\tssid=\""+wlanconfig.essid.value+"\"\n"
773 contents += "\tscan_ssid=0\n"
774 if wlanconfig.encrypt.value == "on":
775 if wlanconfig.method.value =="wep":
776 contents += "\tkey_mgmt=NONE\n"
777 contents += "\twep_key0="
778 if wlanconfig.keytype.value == "ascii":
779 contents += "\""+wlanconfig.key.value+"\"\n"
781 contents += wlanconfig.key.value+"\n"
783 print "plainpwd : ",plainpwd
784 print "passphrasekey : ",passphrasekey
785 if wlanconfig.method.value == "wpa":
786 contents += "\tkey_mgmt=WPA-PSK\n"
787 contents += "\tproto=WPA\n"
788 contents += "\tpairwise=CCMP TKIP\n"
789 contents += "\tgroup=CCMP TKIP\n"
790 elif wlanconfig.method.value == "wpa2":
791 contents += "\tkey_mgmt=WPA-PSK\n"
792 contents += "\tproto=RSN\n"
793 contents += "\tpairwise=CCMP TKIP\n"
794 contents += "\tgroup=CCMP TKIP\n"
796 contents += "\tkey_mgmt=WPA-PSK\n"
797 contents += "\tproto=WPA RSN\n"
798 contents += "\tpairwise=CCMP TKIP\n"
799 contents += "\tgroup=CCMP TKIP\n"
800 contents += plainpwd+"\n"
801 contents += passphrasekey+"\n"
803 contents += "\tkey_mgmt=NONE\n"
805 print "content = \n"+contents
806 wpafd.write(contents)
808 self.writeNetConfig(0)
810 self.session.open(MessageBox, _("wpa_supplicant.conf open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
811 self.writeNetConfig(-1)
813 self.writeNetConfig(-2)
815 def writeNetConfig(self,ret = -1):
817 self.session.open(MessageBox, _("wpa_supplicant.conf open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
820 self.session.open(MessageBox, _("Can NOT generate passphrase"), type = MessageBox.TYPE_ERROR, timeout = 10)
823 if wlanconfig.usedevice.value=="on":
824 iNetwork.setAdapterAttribute(self.iface, "up", True)
825 if wlanconfig.usedhcp.value =="on":
826 iNetwork.setAdapterAttribute(self.iface, "dhcp", True)
828 iNetwork.setAdapterAttribute(self.iface, "dhcp", False)
829 iNetwork.setAdapterAttribute(self.iface, "ip", wlanconfig.ip.value)
830 iNetwork.setAdapterAttribute(self.iface, "netmask", wlanconfig.netmask.value)
831 if wlanconfig.usegateway.value == "on":
832 iNetwork.setAdapterAttribute(self.iface, "gateway", wlanconfig.gateway.value)
834 iNetwork.setAdapterAttribute(self.iface, "up", False)
835 iNetwork.deactivateInterface(self.iface)
836 contents = "\tpre-up wpa_supplicant -i"+self.iface+" -c/etc/wpa_supplicant.conf -B -D"+iNetwork.detectWlanModule(self.iface)+"\n"
837 contents += "\tpost-down wpa_cli terminate\n\n"
838 iNetwork.setAdapterAttribute(self.iface, "configStrings", contents)
839 iNetwork.writeNetworkConfig()
840 iNetwork.restartNetwork(self.updateCurrentInterfaces)
841 self.configurationmsg = None
842 self.configurationmsg = self.session.openWithCallback(self.configFinished, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
845 def updateCurrentInterfaces(self,ret):
847 iNetwork.getInterfaces(self.configurationMsgClose)
849 def configurationMsgClose(self,ret):
850 if ret is True and self.configurationmsg is not None:
851 self.configurationmsg.close(True)
853 def configFinished(self,data):
856 self.session.openWithCallback(self.configFinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
857 selectap = wlanconfig.essid.value
859 def configFinishedCB(self,data):
864 def formatip(self, iplist):
867 # print "iplist : ",iplist
870 result = str(iplist[0])+"."+str(iplist[1])+"."+str(iplist[2])+"."+str(iplist[3])
873 # print "result : ",result
878 def keyCancelConfirm(self, result):
881 if self.oldInterfaceState is False:
882 iNetwork.setAdapterAttribute(self.iface, "up", False)
883 iNetwork.deactivateInterface(self.iface,self.keyCancelCB)
887 def keyCancel(self,yesno = True):
888 if self["config"].isChanged():
889 self.session.openWithCallback(self.keyCancelConfirm, MessageBox, _("Really close without saving settings?"))
891 self.keyCancelConfirm(True)
893 def keyCancelCB(self,data):
899 iNetwork.stopRestartConsole()
900 iNetwork.stopGetInterfacesConsole()
901 iNetwork.stopDeactivateInterfaceConsole()
902 self.stopwlanscanapConsole()
903 self.stopCheckNetworkSharesConsole()
904 self.stopWpaPhraseConsole()
906 def stopwlanscanapConsole(self):
907 if self.wlanscanap is not None:
908 if len(self.wlanscanap.appContainers):
909 for name in self.wlanscanap.appContainers.keys():
910 self.wlanscanap.kill(name)
912 def stopCheckNetworkSharesConsole(self):
913 if self.Console is not None:
914 if len(self.Console.appContainers):
915 for name in self.Console.appContainers.keys():
916 self.Console.kill(name)
918 def stopWpaPhraseConsole(self):
919 if self.wpaphraseconsole is not None:
920 if len(self.wpaphraseconsole.appContainers):
921 for name in self.wpaphraseconsole.appContainers.keys():
922 self.wpaphraseconsole.kill(name)
924 class WlanScanAp(Screen,HelpableScreen):
925 def __init__(self, session, iface):
926 if session.desktop.size().width() > 720:
928 <screen name="WlanScanAp" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
929 <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
930 <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
931 <eLabel text="Wireless Network AP Scan..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
932 <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
933 <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
934 <convert type="ClockToText">Format:%H:%M</convert>
936 <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
937 <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
938 <ePixmap pixmap="Vu_HD/buttons/blue.png" position="630,98" size="25,25" alphatest="blend" />
939 <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
940 <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
941 <widget source="key_blue" render="Label" position="665,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
942 <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
943 <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
944 <widget source="Address" render="Label" position="490,220" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
945 <widget source="ESSID" render="Label" position="490,250" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
946 <widget source="Protocol" render="Label" position="490,280" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
947 <widget source="Frequency" render="Label" position="490,310" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
948 <widget source="Encryption key" render="Label" position="490,340" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
949 <widget source="BitRate" render="Label" position="490,370" zPosition="1" size="300,60" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
953 <screen name="WlanScanAp" position="110,120" size="500,400" title="Wireless Network AP Scan..." >
954 <ePixmap pixmap="750S/div-h.png" position="0,350" zPosition="1" size="560,2" />
955 <ePixmap pixmap="750S/border_menu_a.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
956 <ePixmap pixmap="750S/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
957 <ePixmap pixmap="750S/buttons/green.png" position="185,360" size="140,40" alphatest="on" />
958 <ePixmap pixmap="750S/buttons/blue.png" position="360,360" size="140,40" alphatest="on" />
959 <widget source="key_red" render="Label" position="30,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
960 <widget source="key_green" render="Label" position="205,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
961 <widget source="key_blue" render="Label" position="380,360" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
962 <widget name="menulist" position="20,20" size="230,260" selectionPixmap="750S/buttons/Selected_bar_230x23px.png" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
963 <widget source="Address" render="Label" position="265,70" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
964 <widget source="ESSID" render="Label" position="265,100" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
965 <widget source="Protocol" render="Label" position="265,130" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
966 <widget source="Frequency" render="Label" position="265,160" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
967 <widget source="Encryption key" render="Label" position="265,190" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
968 <widget source="BitRate" render="Label" position="265,220" zPosition="1" size="240,60" font="Regular;18" halign="center" valign="center" />
970 Screen.__init__(self,session)
971 HelpableScreen.__init__(self)
972 self.session = session
974 self.wlanscanap = None
975 # self.scanAPcount = 5
980 self["WizardActions"] = HelpableActionMap(self, "WizardActions",
982 "up": (self.up, _("move up to previous entry")),
983 "down": (self.down, _("move down to next entry")),
984 "left": (self.left, _("move up to first entry")),
985 "right": (self.right, _("move down to last entry")),
988 self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
990 "cancel": (self.close, _("exit")),
991 "ok": (self.ok, "select AP"),
994 self["ColorActions"] = HelpableActionMap(self, "ColorActions",
996 "red": (self.close, _("exit")),
997 "green": (self.ok, "select AP"),
998 "blue": (self.startWlanConfig, "Edit Wireless settings"),
1001 self["actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
1009 "right": self.right,
1012 self["menulist"] = MenuList(self.SetApList)
1013 self["key_red"] = StaticText(_("Close"))
1014 self["key_green"] = StaticText(_("Select"))
1015 self["key_blue"] = StaticText(_("EditSetting"))
1016 self["Address"] = StaticText(_("Scanning AP List.."))
1017 self["ESSID"] = StaticText(_("Wait a moment"))
1018 self["Protocol"] = StaticText(" ")
1019 self["Frequency"] = StaticText(" ")
1020 self["Encryption key"] = StaticText(" ")
1021 self["BitRate"] = StaticText(" ")
1022 self.scanAPFailedTimer = eTimer()
1023 self.scanAPFailedTimer.callback.append(self.scanAPFailed)
1024 self.scanAplistTimer = eTimer()
1025 self.scanAplistTimer.callback.append(self.scanApList)
1026 self.scanAplistTimer.start(100,True)
1027 self.onClose.append(self.cleanup)
1030 self["menulist"].pageUp()
1031 self.displayApInfo()
1034 self["menulist"].pageDown()
1035 self.displayApInfo()
1038 self["menulist"].up()
1039 self.displayApInfo()
1042 self["menulist"].down()
1043 self.displayApInfo()
1047 selectAp=self["menulist"].getCurrent()[0]
1051 def startWlanConfig(self):
1053 selectAp=self["menulist"].getCurrent()[0]
1056 self.session.open(WlanConfig,self.iface)
1059 def scanApList(self):
1060 # print "self.scanAPcount : ",self.scanAPcount
1063 self.configurationmsg = self.session.open(MessageBox, _("Please wait for scanning AP..."), type = MessageBox.TYPE_INFO, enable_input = False)
1064 os_system('ifconfig '+self.iface+" up")
1065 self.wlanscanap = Console()
1066 cmd = "iwlist "+self.iface+" scan"
1068 self.wlanscanap.ePopen(cmd, self.iwlistfinnished,self.APListParse)
1070 def iwlistfinnished(self, result, retval,extra_args):
1071 # print "iwlistfinnished"
1072 (statecallback) = extra_args
1073 if self.wlanscanap is not None:
1074 # print "retval = ",retval
1076 self.wlanscanap = None
1077 content = result.splitlines()
1078 first = content[0].split()
1081 if x == 'completed':
1083 if completed == True:
1084 statecallback(result)
1090 def APListParse(self,data):
1092 if self.scanAPcount >0:
1093 self.scanAPcount -=1
1094 self.configurationmsg.close(True)
1096 self.scanAplistTimer.start(500,True)
1099 self.configurationmsg.close(True)
1100 self.scanAPFailedTimer.start(500,True)
1105 # self.scanAPcount =5
1107 list = data.splitlines()
1109 # print "line : ",line
1110 if line.strip().startswith("Cell"): # Cell 01 - Address: 00:26:66:5C:EF:24
1111 parts = line.strip().split(" ")
1112 current_ap_id = int(parts[1])
1113 self.apList[current_ap_id]={}
1114 self.apList[current_ap_id]["Address"]=parts[4]
1115 elif line.strip().startswith("ESSID"):
1116 self.apList[current_ap_id]["ESSID"]=line.strip()[6:].strip('"')
1117 self.SetApList.append( (self.apList[current_ap_id]["ESSID"],current_ap_id) )
1118 elif line.strip().startswith("Protocol"):
1119 self.apList[current_ap_id]["Protocol"]=line.strip()[9:]
1120 elif line.strip().startswith("Frequency"):
1121 self.apList[current_ap_id]["Frequency"]=line.strip()[10:]
1122 elif line.strip().startswith("Encryption key"):
1123 self.apList[current_ap_id]["Encryption key"]=line.strip()[15:]
1124 elif line.strip().startswith("Bit Rates"):
1125 self.apList[current_ap_id]["BitRate"]=line.strip()[10:]
1127 print len(self.apList)
1128 self.configurationmsg.close(True)
1129 self.displayApInfo()
1131 def scanAPFailed(self):
1132 self.session.openWithCallback(self.ScanAPclose,MessageBox, _("Scan AP Failed"), MessageBox.TYPE_ERROR,10)
1134 def displayApInfo(self):
1135 if len(self.apList) >0:
1136 self["menulist"].setList(self.SetApList)
1137 index = self["menulist"].getCurrent()[1]
1138 for key in ["Address", "ESSID", "Protocol", "Frequency", "Encryption key", "BitRate"]:
1139 if self.apList[index].has_key(key):
1140 self[key].setText((key+": "+self.apList[index][key]))
1142 self[key].setText((key+": None"))
1144 self.session.openWithCallback(self.ScanAPclose, MessageBox, _("No AP detected."), type = MessageBox.TYPE_INFO, timeout = 10)
1146 def ScanAPclose(self,data):
1150 self.stopwlanscanapConsole()
1152 def stopwlanscanapConsole(self):
1153 if self.wlanscanap is not None:
1154 if len(self.wlanscanap.appContainers):
1155 for name in self.wlanscanap.appContainers.keys():
1156 self.wlanscanap.kill(name)
1158 class NetworkAdapterTest(Screen):
1159 def __init__(self, session,iface):
1160 Screen.__init__(self, session)
1162 self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
1164 self.onClose.append(self.cleanup)
1165 self.onHide.append(self.cleanup)
1167 self["updown_actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
1171 "up": lambda: self.updownhandler('up'),
1172 "down": lambda: self.updownhandler('down'),
1176 self["shortcuts"] = ActionMap(["ShortcutActions","WizardActions"],
1179 "back": self.cancel,
1181 self["infoshortcuts"] = ActionMap(["ShortcutActions","WizardActions"],
1183 "red": self.closeInfo,
1184 "back": self.closeInfo,
1186 self["shortcutsgreen"] = ActionMap(["ShortcutActions"],
1188 "green": self.KeyGreen,
1190 self["shortcutsgreen_restart"] = ActionMap(["ShortcutActions"],
1192 "green": self.KeyGreenRestart,
1194 self["shortcutsyellow"] = ActionMap(["ShortcutActions"],
1196 "yellow": self.KeyYellow,
1199 self["shortcutsgreen_restart"].setEnabled(False)
1200 self["updown_actions"].setEnabled(False)
1201 self["infoshortcuts"].setEnabled(False)
1202 self.onClose.append(self.delTimer)
1203 self.onLayoutFinish.append(self.layoutFinished)
1204 self.steptimer = False
1206 self.activebutton = 0
1207 self.nextStepTimer = eTimer()
1208 self.nextStepTimer.callback.append(self.nextStepTimerFire)
1211 if self.oldInterfaceState is False:
1212 iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState)
1213 iNetwork.deactivateInterface(self.iface)
1216 def closeInfo(self):
1217 self["shortcuts"].setEnabled(True)
1218 self["infoshortcuts"].setEnabled(False)
1219 self["InfoText"].hide()
1220 self["InfoTextBorder"].hide()
1221 self["key_red"].setText(_("Close"))
1225 del self.nextStepTimer
1227 def nextStepTimerFire(self):
1228 self.nextStepTimer.stop()
1229 self.steptimer = False
1232 def updownhandler(self,direction):
1233 if direction == 'up':
1234 if self.activebutton >=2:
1235 self.activebutton -= 1
1237 self.activebutton = 6
1238 self.setActiveButton(self.activebutton)
1239 if direction == 'down':
1240 if self.activebutton <=5:
1241 self.activebutton += 1
1243 self.activebutton = 1
1244 self.setActiveButton(self.activebutton)
1246 def setActiveButton(self,button):
1248 self["EditSettingsButton"].setPixmapNum(0)
1249 self["EditSettings_Text"].setForegroundColorNum(0)
1250 self["NetworkInfo"].setPixmapNum(0)
1251 self["NetworkInfo_Text"].setForegroundColorNum(1)
1252 self["AdapterInfo"].setPixmapNum(1) # active
1253 self["AdapterInfo_Text"].setForegroundColorNum(2) # active
1255 self["AdapterInfo_Text"].setForegroundColorNum(1)
1256 self["AdapterInfo"].setPixmapNum(0)
1257 self["DhcpInfo"].setPixmapNum(0)
1258 self["DhcpInfo_Text"].setForegroundColorNum(1)
1259 self["NetworkInfo"].setPixmapNum(1) # active
1260 self["NetworkInfo_Text"].setForegroundColorNum(2) # active
1262 self["NetworkInfo"].setPixmapNum(0)
1263 self["NetworkInfo_Text"].setForegroundColorNum(1)
1264 self["IPInfo"].setPixmapNum(0)
1265 self["IPInfo_Text"].setForegroundColorNum(1)
1266 self["DhcpInfo"].setPixmapNum(1) # active
1267 self["DhcpInfo_Text"].setForegroundColorNum(2) # active
1269 self["DhcpInfo"].setPixmapNum(0)
1270 self["DhcpInfo_Text"].setForegroundColorNum(1)
1271 self["DNSInfo"].setPixmapNum(0)
1272 self["DNSInfo_Text"].setForegroundColorNum(1)
1273 self["IPInfo"].setPixmapNum(1) # active
1274 self["IPInfo_Text"].setForegroundColorNum(2) # active
1276 self["IPInfo"].setPixmapNum(0)
1277 self["IPInfo_Text"].setForegroundColorNum(1)
1278 self["EditSettingsButton"].setPixmapNum(0)
1279 self["EditSettings_Text"].setForegroundColorNum(0)
1280 self["DNSInfo"].setPixmapNum(1) # active
1281 self["DNSInfo_Text"].setForegroundColorNum(2) # active
1283 self["DNSInfo"].setPixmapNum(0)
1284 self["DNSInfo_Text"].setForegroundColorNum(1)
1285 self["EditSettingsButton"].setPixmapNum(1) # active
1286 self["EditSettings_Text"].setForegroundColorNum(2) # active
1287 self["AdapterInfo"].setPixmapNum(0)
1288 self["AdapterInfo_Text"].setForegroundColorNum(1)
1291 next = self.nextstep
1307 self.steptimer = True
1308 self.nextStepTimer.start(3000)
1309 self["key_yellow"].setText(_("Stop test"))
1312 self["Adapter"].setText(iNetwork.getFriendlyAdapterName(self.iface))
1313 self["Adapter"].setForegroundColorNum(2)
1314 self["Adaptertext"].setForegroundColorNum(1)
1315 self["AdapterInfo_Text"].setForegroundColorNum(1)
1316 self["AdapterInfo_OK"].show()
1317 self.steptimer = True
1318 self.nextStepTimer.start(3000)
1321 self["Networktext"].setForegroundColorNum(1)
1322 self["Network"].setText(_("Please wait..."))
1323 self.AccessPointInfo(self.iface)
1324 self["NetworkInfo_Text"].setForegroundColorNum(1)
1325 self.steptimer = True
1326 self.nextStepTimer.start(3000)
1329 self["Dhcptext"].setForegroundColorNum(1)
1330 if iNetwork.getAdapterAttribute(self.iface, 'dhcp') is True:
1331 self["Dhcp"].setForegroundColorNum(2)
1332 self["Dhcp"].setText(_("enabled"))
1333 self["DhcpInfo_Check"].setPixmapNum(0)
1335 self["Dhcp"].setForegroundColorNum(1)
1336 self["Dhcp"].setText(_("disabled"))
1337 self["DhcpInfo_Check"].setPixmapNum(1)
1338 self["DhcpInfo_Check"].show()
1339 self["DhcpInfo_Text"].setForegroundColorNum(1)
1340 self.steptimer = True
1341 self.nextStepTimer.start(3000)
1344 self["IPtext"].setForegroundColorNum(1)
1345 self["IP"].setText(_("Please wait..."))
1346 iNetwork.checkNetworkState(self.NetworkStatedataAvail)
1349 self.steptimer = False
1350 self.nextStepTimer.stop()
1351 self["DNStext"].setForegroundColorNum(1)
1352 self["DNS"].setText(_("Please wait..."))
1353 iNetwork.checkDNSLookup(self.DNSLookupdataAvail)
1356 self["shortcutsgreen"].setEnabled(False)
1357 self["shortcutsyellow"].setEnabled(True)
1358 self["updown_actions"].setEnabled(False)
1359 self["key_yellow"].setText("")
1360 self["key_green"].setText("")
1361 self.steptimer = True
1362 self.nextStepTimer.start(1000)
1364 def KeyGreenRestart(self):
1366 self.layoutFinished()
1367 self["Adapter"].setText((""))
1368 self["Network"].setText((""))
1369 self["Dhcp"].setText((""))
1370 self["IP"].setText((""))
1371 self["DNS"].setText((""))
1372 self["AdapterInfo_Text"].setForegroundColorNum(0)
1373 self["NetworkInfo_Text"].setForegroundColorNum(0)
1374 self["DhcpInfo_Text"].setForegroundColorNum(0)
1375 self["IPInfo_Text"].setForegroundColorNum(0)
1376 self["DNSInfo_Text"].setForegroundColorNum(0)
1377 self["shortcutsgreen_restart"].setEnabled(False)
1378 self["shortcutsgreen"].setEnabled(False)
1379 self["shortcutsyellow"].setEnabled(True)
1380 self["updown_actions"].setEnabled(False)
1381 self["key_yellow"].setText("")
1382 self["key_green"].setText("")
1383 self.steptimer = True
1384 self.nextStepTimer.start(1000)
1387 self["infoshortcuts"].setEnabled(True)
1388 self["shortcuts"].setEnabled(False)
1389 if self.activebutton == 1: # Adapter Check
1390 self["InfoText"].setText(_("This test detects your configured Wireless LAN-Adapter."))
1391 self["InfoTextBorder"].show()
1392 self["InfoText"].show()
1393 self["key_red"].setText(_("Back"))
1394 if self.activebutton == 2: #LAN Check
1395 self["InfoText"].setText(_("This test checks whether a network cable is connected to your Wireless LAN-Adapter."))
1396 self["InfoTextBorder"].show()
1397 self["InfoText"].show()
1398 self["key_red"].setText(_("Back"))
1399 if self.activebutton == 3: #DHCP Check
1400 self["InfoText"].setText(_("This test checks whether your Wireless LAN Adapter is set up for automatic IP Address configuration with DHCP.\nIf you get a \"disabled\" message:\n - then your Wireless LAN Adapter is configured for manual IP Setup\n- verify thay you have entered correct IP informations in the AdapterSetup dialog.\nIf you get an \"enabeld\" message:\n-verify that you have a configured and working DHCP Server in your network."))
1401 self["InfoTextBorder"].show()
1402 self["InfoText"].show()
1403 self["key_red"].setText(_("Back"))
1404 if self.activebutton == 4: # IP Check
1405 self["InfoText"].setText(_("This test checks whether a valid IP Address is found for your LAN Adapter.\nIf you get a \"unconfirmed\" message:\n- no valid IP Address was found\n- please check your DHCP, cabling and adapter setup"))
1406 self["InfoTextBorder"].show()
1407 self["InfoText"].show()
1408 self["key_red"].setText(_("Back"))
1409 if self.activebutton == 5: # DNS Check
1410 self["InfoText"].setText(_("This test checks for configured Nameservers.\nIf you get a \"unconfirmed\" message:\n- please check your DHCP, cabling and Adapter setup\n- if you configured your Nameservers manually please verify your entries in the \"Nameserver\" Configuration"))
1411 self["InfoTextBorder"].show()
1412 self["InfoText"].show()
1413 self["key_red"].setText(_("Back"))
1414 if self.activebutton == 6: # Edit Settings
1416 self.session.open(WlanConfig,self.iface)
1417 self["shortcuts"].setEnabled(True)
1418 self["infoshortcuts"].setEnabled(False)
1420 def KeyYellow(self):
1422 self["shortcutsgreen_restart"].setEnabled(True)
1423 self["shortcutsgreen"].setEnabled(False)
1424 self["shortcutsyellow"].setEnabled(False)
1425 self["key_green"].setText(_("Restart test"))
1426 self["key_yellow"].setText("")
1427 self.steptimer = False
1428 self.nextStepTimer.stop()
1430 def layoutFinished(self):
1431 self.setTitle(_("Network test: ") + iNetwork.getFriendlyAdapterName(self.iface) )
1432 self["shortcutsyellow"].setEnabled(False)
1433 self["AdapterInfo_OK"].hide()
1434 self["NetworkInfo_Check"].hide()
1435 self["DhcpInfo_Check"].hide()
1436 self["IPInfo_Check"].hide()
1437 self["DNSInfo_Check"].hide()
1438 self["EditSettings_Text"].hide()
1439 self["EditSettingsButton"].hide()
1440 self["InfoText"].hide()
1441 self["InfoTextBorder"].hide()
1442 self["key_yellow"].setText("")
1444 def setLabels(self):
1445 self["Adaptertext"] = MultiColorLabel(_("LAN Adapter"))
1446 self["Adapter"] = MultiColorLabel()
1447 self["AdapterInfo"] = MultiPixmap()
1448 self["AdapterInfo_Text"] = MultiColorLabel(_("Show Info"))
1449 self["AdapterInfo_OK"] = Pixmap()
1451 if self.iface in iNetwork.wlan_interfaces:
1452 self["Networktext"] = MultiColorLabel(_("Wireless Network"))
1454 self["Networktext"] = MultiColorLabel(_("Local Network"))
1456 self["Network"] = MultiColorLabel()
1457 self["NetworkInfo"] = MultiPixmap()
1458 self["NetworkInfo_Text"] = MultiColorLabel(_("Show Info"))
1459 self["NetworkInfo_Check"] = MultiPixmap()
1461 self["Dhcptext"] = MultiColorLabel(_("DHCP"))
1462 self["Dhcp"] = MultiColorLabel()
1463 self["DhcpInfo"] = MultiPixmap()
1464 self["DhcpInfo_Text"] = MultiColorLabel(_("Show Info"))
1465 self["DhcpInfo_Check"] = MultiPixmap()
1467 self["IPtext"] = MultiColorLabel(_("IP Address"))
1468 self["IP"] = MultiColorLabel()
1469 self["IPInfo"] = MultiPixmap()
1470 self["IPInfo_Text"] = MultiColorLabel(_("Show Info"))
1471 self["IPInfo_Check"] = MultiPixmap()
1473 self["DNStext"] = MultiColorLabel(_("Nameserver"))
1474 self["DNS"] = MultiColorLabel()
1475 self["DNSInfo"] = MultiPixmap()
1476 self["DNSInfo_Text"] = MultiColorLabel(_("Show Info"))
1477 self["DNSInfo_Check"] = MultiPixmap()
1479 self["EditSettings_Text"] = MultiColorLabel(_("Edit settings"))
1480 self["EditSettingsButton"] = MultiPixmap()
1482 self["key_red"] = StaticText(_("Close"))
1483 self["key_green"] = StaticText(_("Start test"))
1484 self["key_yellow"] = StaticText(_("Stop test"))
1486 self["InfoTextBorder"] = Pixmap()
1487 self["InfoText"] = Label()
1489 def NetworkStatedataAvail(self,data):
1491 self["IP"].setForegroundColorNum(2)
1492 self["IP"].setText(_("confirmed"))
1493 self["IPInfo_Check"].setPixmapNum(0)
1495 self["IP"].setForegroundColorNum(1)
1496 self["IP"].setText(_("unconfirmed"))
1497 self["IPInfo_Check"].setPixmapNum(1)
1498 self["IPInfo_Check"].show()
1499 self["IPInfo_Text"].setForegroundColorNum(1)
1500 self.steptimer = True
1501 self.nextStepTimer.start(3000)
1503 def DNSLookupdataAvail(self,data):
1505 self["DNS"].setForegroundColorNum(2)
1506 self["DNS"].setText(_("confirmed"))
1507 self["DNSInfo_Check"].setPixmapNum(0)
1509 self["DNS"].setForegroundColorNum(1)
1510 self["DNS"].setText(_("unconfirmed"))
1511 self["DNSInfo_Check"].setPixmapNum(1)
1512 self["DNSInfo_Check"].show()
1513 self["DNSInfo_Text"].setForegroundColorNum(1)
1514 self["EditSettings_Text"].show()
1515 self["EditSettingsButton"].setPixmapNum(1)
1516 self["EditSettings_Text"].setForegroundColorNum(2) # active
1517 self["EditSettingsButton"].show()
1518 self["key_yellow"].setText("")
1519 self["key_green"].setText(_("Restart test"))
1520 self["shortcutsgreen"].setEnabled(False)
1521 self["shortcutsgreen_restart"].setEnabled(True)
1522 self["shortcutsyellow"].setEnabled(False)
1523 self["updown_actions"].setEnabled(True)
1524 self.activebutton = 6
1526 def getInfoCB(self,status):
1527 if status is not None:
1528 if status.startswith("No Connection") or status.startswith("Not-Associated") or status == False:
1529 self["Network"].setForegroundColorNum(1)
1530 self["Network"].setText(_("disconnected"))
1531 self["NetworkInfo_Check"].setPixmapNum(1)
1532 self["NetworkInfo_Check"].show()
1534 self["Network"].setForegroundColorNum(2)
1535 self["Network"].setText(_("connected"))
1536 self["NetworkInfo_Check"].setPixmapNum(0)
1537 self["NetworkInfo_Check"].show()
1540 iNetwork.stopLinkStateConsole()
1541 iNetwork.stopPingConsole()
1542 iNetwork.stopDNSConsole()
1544 def AccessPointInfo(self,iface):
1545 cmd = "iwconfig %s"%iface
1546 self.iwconfigConsole = Console()
1547 self.iwconfigConsole.ePopen(cmd,self.readAP,self.getInfoCB)
1549 def readAP(self,result,retval,extra_args):
1550 (callback) = extra_args
1552 if self.iwconfigConsole is not None:
1554 self.iwconfigConsole = None
1555 for content in result.splitlines():
1556 if 'Access Point' in content:
1557 self.apState = content.strip().split('Access Point: ')[1]
1558 callback(self.apState)
1560 callback(self.apState)
1562 class Wlanstatus(Screen):
1563 def __init__(self, session,iface):
1564 if session.desktop.size().width() > 720:
1566 <screen name="Wlanstatus" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
1567 <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
1568 <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
1569 <eLabel text="Wireless Network Status..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
1570 <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
1571 <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
1572 <convert type="ClockToText">Format:%H:%M</convert>
1574 <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
1575 <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
1576 <widget source="status" render="Label" position="110,200" size="650,400" transparent="1" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" zPosition="1" />
1580 <screen name="Wlanstatus" position="center,center" size="400,350" title="Wireless Network Status..." >
1581 <ePixmap pixmap="750S/buttons/red.png" position="0,300" size="140,40" alphatest="on" />
1582 <widget source="key_red" render="Label" position="20,300" zPosition="1" size="115,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
1583 <widget source="status" render="Label" position="10,10" size="380,290" font="Regular;20" zPosition="1" />
1585 Screen.__init__(self,session)
1586 self.session = session
1588 self["status"] = StaticText(_("Wait a moment..."))
1589 self["key_red"] = StaticText(_("Close"))
1590 self["OkCancelActions"] = ActionMap(["ShortcutActions", "SetupActions" ],
1593 "cancel": self.close,
1597 self.onClose.append(self.cleanup)
1599 def readstatus(self):
1600 self.wlanstatus = Console()
1601 cmd1 = "iwconfig "+self.iface
1602 self.wlanstatus.ePopen(cmd1, self.iwconfigfinnished,self.statusdisplay)
1604 def iwconfigfinnished(self, result, retval,extra_args):
1606 (statecallback) = extra_args
1607 if self.wlanstatus is not None:
1609 statecallback(result)
1616 def statusdisplay(self,data):
1618 self["status"].setText(_("No information..."))
1620 self["status"].setText(data)
1626 self.stopWlanStatusConsole()
1628 def stopWlanStatusConsole(self):
1629 if self.wlanstatus is not None:
1630 if len(self.wlanstatus.appContainers):
1631 for name in self.wlanstatus.appContainers.keys():
1632 self.wlanstatus.kill(name)
1634 def openconfig(session, **kwargs):
1635 session.open(WlanSelection)
1637 def selSetup(menuid, **kwargs):
1639 if menuid != "system":
1642 for x in iNetwork.getInstalledAdapters():
1643 if x.startswith('eth'):
1647 return [(_("Wireless LAN Setup"), openconfig, "wlansetup_config", 80)]
1652 def Plugins(**kwargs):
1653 return PluginDescriptor(name=_("Wireless LAN Setup"), description="Wireless LAN Setup", where = PluginDescriptor.WHERE_MENU, fnc=selSetup)