aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoracid-burn <acid-burn@opendreambox.org>2010-01-29 08:50:34 +0100
committeracid-burn <acid-burn@opendreambox.org>2010-01-29 08:50:34 +0100
commitbf2f4196dede42bb8b5b8168a85a60498a3d630f (patch)
treed2829a4240c92628fff5d6729c5104c7723b711b
parent025acea46debca45f8ae004cdb17cc6e5fc84309 (diff)
downloadenigma2-bf2f4196dede42bb8b5b8168a85a60498a3d630f.tar.gz
enigma2-bf2f4196dede42bb8b5b8168a85a60498a3d630f.zip
* simplify NetworkWizard usability. Its now possible to open the wizard directly with the current selected network interface,
so its no more needed to select the interface twice. * add a blue button link to the network wizard also inside the AdapterSelectionScreen. * d't show interface question if only one interface is available. This fixes bug #218
-rwxr-xr-xdata/skin_default.xml2
-rwxr-xr-xlib/python/Components/Network.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py131
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/networkwizard.xml21
-rwxr-xr-xlib/python/Screens/NetworkSetup.py18
5 files changed, 125 insertions, 50 deletions
diff --git a/data/skin_default.xml b/data/skin_default.xml
index 85c4016a..56d53dc3 100755
--- a/data/skin_default.xml
+++ b/data/skin_default.xml
@@ -572,9 +572,11 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
<widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
<widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
<widget name="list" position="5,50" size="550,280" scrollbarMode="showOnDemand" zPosition="10"/>
<ePixmap pixmap="skin_default/div-h.png" position="0,340" zPosition="1" size="560,2" />
<widget source="introduction" render="Label" position="0,350" size="560,50" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index bd10d9c3..4b0213d4 100755
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -234,7 +234,7 @@ class Network:
self.configuredNetworkAdapters = self.configuredInterfaces
# load ns only once
self.loadNameserverConfig()
- print "read configured interfac:", ifaces
+ print "read configured interface:", ifaces
print "self.ifaces after loading:", self.ifaces
self.config_ready = True
self.msgPlugins()
@@ -425,6 +425,7 @@ class Network:
def checkNetworkState(self,statecallback):
# www.dream-multimedia-tv.de, www.heise.de, www.google.de
+ self.NetworkState = 0
cmd1 = "ping -c 1 82.149.226.170"
cmd2 = "ping -c 1 193.99.144.85"
cmd3 = "ping -c 1 209.85.135.103"
diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
index 75ca390b..018ae876 100755
--- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
+++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
@@ -9,7 +9,6 @@ from Components.Network import iNetwork
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from enigma import eTimer
-
config.misc.firstrun = ConfigBoolean(default = True)
list = []
list.append("WEP")
@@ -52,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)
@@ -68,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
@@ -95,6 +97,7 @@ class NetworkWizard(WizardLanguage, Rc):
def markDone(self):
self.rescanTimer.stop()
del self.rescanTimer
+ self.checkOldInterfaceState()
pass
def getInstalledInterfaceCount(self):
@@ -105,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:
@@ -220,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):
@@ -300,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
@@ -355,5 +395,26 @@ 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>
diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
index 3e9354ea..c0037f81 100755
--- a/lib/python/Screens/NetworkSetup.py
+++ b/lib/python/Screens/NetworkSetup.py
@@ -64,6 +64,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
self["key_red"] = StaticText(_("Close"))
self["key_green"] = StaticText(_("Select"))
self["key_yellow"] = StaticText("")
+ self["key_blue"] = StaticText("")
self["introduction"] = StaticText(self.edittext)
self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()]
@@ -81,6 +82,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
{
"red": (self.close, _("exit network interface list")),
"green": (self.okbuttonClick, _("select interface")),
+ "blue": (self.openNetworkWizard, _("Use the Networkwizard to configure selected network adapter")),
})
self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions",
@@ -132,7 +134,9 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
else:
active_int = False
self.list.append(InterfaceEntryComponent(index = x[1],name = _(x[0]),default=default_int,active=active_int ))
-
+
+ if os_path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")):
+ self["key_blue"].setText(_("NetworkWizard"))
self["list"].l.setList(self.list)
def setDefaultInterface(self):
@@ -202,6 +206,16 @@ class NetworkAdapterSelection(Screen,HelpableScreen):
self.updateList()
self.session.open(MessageBox, _("Finished configuring your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False)
+ def openNetworkWizard(self):
+ if os_path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")):
+ try:
+ from Plugins.SystemPlugins.NetworkWizard.NetworkWizard import NetworkWizard
+ except ImportError:
+ self.session.open(MessageBox, _("The NetworkWizard extension is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
+ else:
+ selection = self["list"].getCurrent()
+ if selection is not None:
+ self.session.openWithCallback(self.AdapterSetupClosed, NetworkWizard, selection[0])
class NameserverSetup(Screen, ConfigListScreen, HelpableScreen):
@@ -769,7 +783,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
self.session.openWithCallback(self.restartLan, MessageBox, (_("Are you sure you want to restart your network interfaces?\n\n") + self.oktext ) )
if self["menulist"].getCurrent()[1] == 'openwizard':
from Plugins.SystemPlugins.NetworkWizard.NetworkWizard import NetworkWizard
- self.session.openWithCallback(self.AdapterSetupClosed, NetworkWizard)
+ self.session.openWithCallback(self.AdapterSetupClosed, NetworkWizard, self.iface)
if self["menulist"].getCurrent()[1][0] == 'extendedSetup':
self.extended = self["menulist"].getCurrent()[1][2]
self.extended(self.session, self.iface)