aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/SystemPlugins/NetworkWizard
diff options
context:
space:
mode:
authoracid-burn <acid-burn@opendreambox.org>2010-01-29 09:14:17 +0100
committeracid-burn <acid-burn@opendreambox.org>2010-01-29 09:14:17 +0100
commit57ff47aa9d84ac5502a6d1bebcb10780997c3134 (patch)
treedad2b6d8724a9cd8cc3fa5a20c7da854182da623 /lib/python/Plugins/SystemPlugins/NetworkWizard
parent1ff71d24c512a57686d8cdbef41bc0112ca9be72 (diff)
parentb6bf9802c72dfa28dc2fc25014792d9771e49366 (diff)
downloadenigma2-57ff47aa9d84ac5502a6d1bebcb10780997c3134.tar.gz
enigma2-57ff47aa9d84ac5502a6d1bebcb10780997c3134.zip
Merge commit 'origin/bug_218_simplify_networkwizard' into experimental
Conflicts: lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
Diffstat (limited to 'lib/python/Plugins/SystemPlugins/NetworkWizard')
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py133
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml21
2 files changed, 108 insertions, 46 deletions
diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
index 13e7fdde..150dba9d 100755
--- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
+++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
@@ -51,7 +51,7 @@ class NetworkWizard(WizardLanguage, Rc):
</widget>
<widget name="HelpWindow" pixmap="skin_default/buttons/key_text.png" position="125,170" zPosition="1" size="1,1" transparent="1" alphatest="on" />
</screen>"""
- def __init__(self, session):
+ def __init__(self, session, interface = None):
self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")
WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
Rc.__init__(self)
@@ -67,7 +67,10 @@ class NetworkWizard(WizardLanguage, Rc):
self.isInterfaceUp = None
self.WlanPluginInstalled = None
self.ap = None
- self.selectedInterface = None
+ if interface is not None:
+ self.selectedInterface = interface
+ else:
+ self.selectedInterface = None
self.NextStep = None
self.resetRef = None
self.checkRef = None
@@ -94,6 +97,7 @@ class NetworkWizard(WizardLanguage, Rc):
def markDone(self):
self.rescanTimer.stop()
del self.rescanTimer
+ self.checkOldInterfaceState()
pass
def getInstalledInterfaceCount(self):
@@ -104,6 +108,35 @@ class NetworkWizard(WizardLanguage, Rc):
self.originalEth0State = iNetwork.getAdapterAttribute('eth0', 'up')
self.originalWlan0State = iNetwork.getAdapterAttribute('wlan0', 'up')
+ def selectInterface(self):
+ self.InterfaceState = None
+ if self.selectedInterface is None and self.InstalledInterfaceCount <= 1:
+ if self.selectedInterface == 'eth0':
+ self.NextStep = 'nwconfig'
+ else:
+ self.NextStep = 'scanwlan'
+ self.checkInterface(self.selectedInterface)
+ elif self.selectedInterface is not None and self.InstalledInterfaceCount <= 1:
+ if self.selectedInterface == 'eth0':
+ self.NextStep = 'nwconfig'
+ else:
+ self.NextStep = 'scanwlan'
+ self.checkInterface(self.selectedInterface)
+ elif self.selectedInterface is None and self.InstalledInterfaceCount > 1:
+ self.NextStep = 'selectinterface'
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+ elif self.selectedInterface is not None and self.InstalledInterfaceCount > 1:
+ if self.selectedInterface == 'eth0':
+ self.NextStep = 'nwconfig'
+ else:
+ self.NextStep = 'scanwlan'
+ self.checkInterface(self.selectedInterface)
+ else:
+ self.NextStep = 'selectinterface'
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+
def checkOldInterfaceState(self):
# disable up interface if it was originally down and config is unchanged.
if self.originalAth0State is False and self.originalInterfaceStateChanged is False:
@@ -219,16 +252,18 @@ class NetworkWizard(WizardLanguage, Rc):
if data is True:
if status is not None:
text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n")
- text2 = _('Accesspoint:') + "\t" + status[self.selectedInterface]["acesspoint"] + "\n"
- text3 = _('SSID:') + "\t" + status[self.selectedInterface]["essid"] + "\n"
- text4 = _('Link Quality:') + "\t" + status[self.selectedInterface]["quality"]+"%" + "\n"
- text5 = _('Signal Strength:') + "\t" + status[self.selectedInterface]["signal"] + "\n"
- text6 = _('Bitrate:') + "\t" + status[self.selectedInterface]["bitrate"] + "\n"
- text7 = _('Encryption:') + " " + status[self.selectedInterface]["encryption"] + "\n"
+ text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["acesspoint"]) + "\n"
+ text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\n"
+ text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+"%" + "\n"
+ text5 = _('Signal Strength:') + "\t" + str(status[self.selectedInterface]["signal"]) + "\n"
+ text6 = _('Bitrate:') + "\t" + str(status[self.selectedInterface]["bitrate"]) + "\n"
+ text7 = _('Encryption:') + " " + str(status[self.selectedInterface]["encryption"]) + "\n"
text8 = _("Please press OK to continue.")
infotext = text1 + text2 + text3 + text4 + text5 + text7 +"\n" + text8
self.currStep = self.getStepWithID("checkWlanstatusend")
self.Text = infotext
+ if str(status[self.selectedInterface]["acesspoint"]) == "Not-Associated":
+ self.InterfaceState = False
self.afterAsyncCode()
def checkNetwork(self):
@@ -299,32 +334,38 @@ class NetworkWizard(WizardLanguage, Rc):
except ImportError:
self.APList.append( ( _("No networks found"),_("unavailable") ) )
return self.APList
- else:
- self.w = Wlan(self.selectedInterface)
- 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['bssid'], a['essid']) )
- complist.append( (a['bssid'], a['essid']) )
-
- for entry in tmplist:
- if entry[1] == "":
- for compentry in complist:
- if compentry[0] == entry[0]:
- complist.remove(compentry)
- for entry in complist:
- self.APList.append( (entry[1], entry[1]) )
-
- if "hidden..." not in self.APList:
- self.APList.append(( _("enter hidden network SSID"), "hidden..." ))
-
- self.rescanTimer.start(3000)
- return self.APList
+ else:
+ try:
+ self.w = Wlan(self.selectedInterface)
+ aps = self.w.getNetworkList()
+ except ValueError:
+ self.APList = []
+ self.APList.append( ( _("No networks found"),_("unavailable") ) )
+ return self.APList
+ else:
+ 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['bssid'], a['essid']) )
+ complist.append( (a['bssid'], a['essid']) )
+
+ for entry in tmplist:
+ if entry[1] == "":
+ for compentry in complist:
+ if compentry[0] == entry[0]:
+ complist.remove(compentry)
+ for entry in complist:
+ self.APList.append( (entry[1], entry[1]) )
+
+ if "hidden..." not in self.APList:
+ self.APList.append(( _("enter hidden network SSID"), "hidden..." ))
+
+ self.rescanTimer.start(3000)
+ return self.APList
def AccessPointsSelectionMade(self, index):
self.ap = index
@@ -354,3 +395,27 @@ class NetworkWizard(WizardLanguage, Rc):
else:
self.WlanPluginInstalled = True
+ def listChoices(self):
+ self.rescanTimer.stop()
+ list = []
+ if self.WlanPluginInstalled == True:
+ list.append((_("Configure your wireless LAN again"), "scanwlan"))
+ list.append((_("Configure your internal LAN"), "nwconfig"))
+ list.append((_("Exit network wizard"), "end"))
+ return list
+
+ def ChoicesSelectionMade(self, index):
+ self.ChoicesSelect(index)
+
+ def ChoicesSelect(self, index):
+ if index == 'end':
+ self.NextStep = 'end'
+ elif index == 'nwconfig':
+ self.selectedInterface = "eth0"
+ self.NextStep = 'nwconfig'
+ else:
+ self.NextStep = 'scanwlan'
+
+ def ChoicesSelectionMoved(self):
+ pass
+
diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml b/lib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml
index dcd9d933..c4300436 100755
--- a/lib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml
+++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml
@@ -1,11 +1,14 @@
<wizard>
- <step id="welcome" nextstep="selectinterface">
+ <step id="welcome">
<text value="Welcome.\n\nIf you want to connect your Dreambox to the Internet, this wizard will guide you through the basic network setup of your Dreambox.\n\nPress OK to start configuring your network" />
<displaytext value="Network Wizard" />
<code>
self.clearSelectedKeys()
self.selectKey("OK")
</code>
+ <code pos="after" async="yes">
+self.selectInterface()
+ </code>
</step>
<step id="selectinterface">
@@ -80,7 +83,7 @@ self.selectKey("UP")
self.selectKey("DOWN")
</code>
<list>
- <listentry caption="Configure your network again" step="selectinterface" />
+ <listentry caption="Configure your network again" step="welcome" />
<listentry caption="Exit network wizard" step="end" />
</list>
</step>
@@ -109,11 +112,7 @@ self.condition = (self.isInterfaceUp == False and self.WlanPluginInstalled == Tr
</condition>
<text value="Your wireless LAN internet connection could not be started!\nHave you attached your USB WLAN Stick?\n\nPlease choose what you want to do next." />
<displaytext value="Please follow the instructions on the TV" />
- <list>
- <listentry caption="Configure your wireless LAN again" step="scanwlan" />
- <listentry caption="Configure your internal LAN" step="selectinterface" />
- <listentry caption="Exit network wizard" step="end" />
- </list>
+ <list type="dynamic" source="listChoices" evaluation="ChoicesSelectionMade" onselect="ChoicesSelectionMoved" />
<code>
self.clearSelectedKeys()
self.selectKey("OK")
@@ -127,10 +126,8 @@ self.condition = (self.isInterfaceUp == True and self.WlanPluginInstalled == Fal
</condition>
<text value="The wireless LAN plugin is not installed!\nPlease install it and choose what you want to do next." />
<displaytext value="Please follow the instructions on the TV" />
- <list>
- <listentry caption="Configure your internal LAN" step="selectinterface" />
- <listentry caption="Exit network wizard" step="end" />
- </list>
+ <list type="dynamic" source="listChoices" evaluation="ChoicesSelectionMade" onselect="ChoicesSelectionMoved" />
+
<code>
self.clearSelectedKeys()
self.selectKey("OK")
@@ -185,7 +182,7 @@ self.selectKey("UP")
self.selectKey("DOWN")
</code>
<list>
- <listentry caption="Configure your network again" step="selectinterface" />
+ <listentry caption="Configure your network again" step="welcome" />
<listentry caption="Exit network wizard" step="end" />
</list>
</step>