From 3a4d44ac0f28fa87f1d8cde20b5e38dd644d5b37 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 12:23:42 +0100 Subject: fixes bug #380 stop service when entering tuner setup (and ask to restore afterwards) --- lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/Satconfig.py | 16 +++++++++++++--- lib/python/Screens/ServiceStopScreen.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 lib/python/Screens/ServiceStopScreen.py (limited to 'lib/python') diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 5457bf64..d96b491e 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -14,5 +14,5 @@ install_PYTHON = \ SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \ SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \ SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py \ - TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py + TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index d5249b99..62480b5f 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -10,11 +10,12 @@ from Components.config import getConfigListEntry, config, ConfigNothing, ConfigS from Components.Sources.List import List from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox +from Screens.ServiceStopScreen import ServiceStopScreen from time import mktime, localtime from datetime import datetime -class NimSetup(Screen, ConfigListScreen): +class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createSimpleSetup(self, list, mode): nim = self.nimConfig if mode == "single": @@ -376,11 +377,14 @@ class NimSetup(Screen, ConfigListScreen): self.deleteConfirmed(confirmed) break if not self.satpos_to_remove: - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] + + ServiceStopScreen.__init__(self) + self.stopService() ConfigListScreen.__init__(self, self.list) @@ -405,6 +409,12 @@ class NimSetup(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) self.newConfig() + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?")) + else: + self.restoreService(_("Zap back to service before tuner setup?")) + def saveAll(self): if self.nim.isCompatible("DVB-S"): # reset connectedTo to all choices to properly store the default value @@ -424,7 +434,7 @@ class NimSetup(Screen, ConfigListScreen): x[1].cancel() # we need to call saveAll to reset the connectedTo choices self.saveAll() - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def nothingConnectedShortcut(self): if type(self["config"].getCurrent()[1]) is ConfigSatlist: diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py new file mode 100644 index 00000000..3b3dda88 --- /dev/null +++ b/lib/python/Screens/ServiceStopScreen.py @@ -0,0 +1,29 @@ +from Screens.MessageBox import MessageBox + +class ServiceStopScreen: + def __init__(self): + try: + self.session + except: + print "[ServiceStopScreen] ERROR: no self.session set" + + self.oldref = None + self.onClose.append(self.__onClose) + + def stopService(self): + self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() + self.session.nav.stopService() + + def __onClose(self): + self.session.nav.playService(self.oldref) + + def restoreService(self, msg = _("Zap back to previously tuned service?")): + if self.oldref: + self.session.openWithCallback(self.restartPrevService, MessageBox, msg, MessageBox.TYPE_YESNO) + else: + self.restartPrevService(False) + + def restartPrevService(self, yesno): + if not yesno: + self.oldref=None + self.close() \ No newline at end of file -- cgit v1.2.3 From cecd9068fcba09234232399748d4a55ed7574e4b Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 13:24:37 +0100 Subject: fixes bug #288 last playing position for recorded services was stored only if between 1% and 99% of the recording's length. this lead to voodoo for the user, since long recordings naturally have a longer 1% than short ones. so the 1% rule is gone now and we display the position of the marker in the message box, asking the user if playing should continue at this position. --- lib/python/Screens/InfoBarGenerics.py | 4 +++- lib/service/servicedvb.cpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 7ae0b123..ca9ba550 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -2014,8 +2014,10 @@ class InfoBarCueSheetSupport: if last is not None: self.resume_point = last + + l = last / 90000 if config.usage.on_movie_start.value == "ask": - Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?"), timeout=10) + Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10) elif config.usage.on_movie_start.value == "resume": # TRANSLATORS: The string "Resuming playback" flashes for a moment # TRANSLATORS: at the start of a movie, when the user has selected diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 615329c9..1a3cb0e0 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1128,11 +1128,7 @@ RESULT eDVBServicePlay::stop() if (length) { - int perc = play_position * 100LL / length; - - /* only store last play position when between 1% and 99% */ - if ((1 < perc) && (perc < 99)) - m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ + m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ } m_cuesheet_changed = 1; } -- cgit v1.2.3 From c75e82f378fef9e9a1c500ffb1696ba02d8fbd9a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 14 Jan 2010 14:11:20 +0100 Subject: fixes bug #393 change DVI picture to HDMI picture for dm500hd --- lib/python/Plugins/SystemPlugins/Videomode/HDMI.png | Bin 0 -> 4098 bytes lib/python/Plugins/SystemPlugins/Videomode/Makefile.am | 4 +++- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 5 ++++- lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png | Bin 0 -> 261 bytes 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/HDMI.png create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png new file mode 100644 index 00000000..5aa83047 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png differ diff --git a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am index 2ec0b335..1ac1d5dd 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am @@ -16,4 +16,6 @@ dist_install_DATA = \ LICENSE \ Scart.png \ videowizard.xml \ - YPbPr.png + YPbPr.png \ + HDMI.png \ + lcd_HDMI.png diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 512bcec3..15f4d516 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -99,7 +99,10 @@ class VideoWizard(WizardLanguage, Rc): print "input selection moved:", self.selection self.inputSelect(self.selection) if self["portpic"].instance is not None: - self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png")) + picname = self.selection + if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd": + picname = "HDMI" + self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) def inputSelect(self, port): print "inputSelect:", port diff --git a/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png new file mode 100644 index 00000000..425da5c3 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png differ -- cgit v1.2.3 From 6b8f07efaaf750a3b8002c3fce9850cb669ec7f3 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:11:34 +0100 Subject: disabe fan on enter standby, restart fan on leave standby this fixes bug #418 --- lib/python/Components/FanControl.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index cc133ac0..cee0523e 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -11,6 +11,20 @@ class FanControl: else: self.fancount = 0 self.createConfig() + config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False) + + def leaveStandby(self): + for fanid in range(self.getFanCount()): + cfg = self.getConfig(fanid) + self.setVoltage(fanid, cfg.vlt.value) + self.setPWM(fanid, cfg.pwm.value) + + def standbyCounterChanged(self, configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(self.leaveStandby) + for fanid in range(self.getFanCount()): + self.setVoltage(fanid, 0) + self.setPWM(fanid, 0) def createConfig(self): def setVlt(fancontrol, fanid, configElement): -- cgit v1.2.3 From b7a4b4f7228b79424a4a58dbe8de8c7e66e532ae Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:14:14 +0100 Subject: cleanup lcd code --- lib/python/Components/Lcd.py | 11 +++++++++++ lib/python/Screens/Standby.py | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 7d27c097..dde158b6 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -28,6 +28,14 @@ class LCD: def isOled(self): return eDBoxLCD.getInstance().isOled() +def leaveStandby(): + config.lcd.bright.apply() + +def standbyCounterChanged(configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(leaveStandby) + config.lcd.standby.apply() + def InitLcd(): detected = eDBoxLCD.getInstance().detected() SystemInfo["Display"] = detected @@ -72,3 +80,6 @@ def InitLcd(): config.lcd.standby = ConfigNothing() config.lcd.bright.apply = lambda : doNothing() config.lcd.standby.apply = lambda : doNothing() + + config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False) + diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index c598b545..406b87cb 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -15,8 +15,6 @@ class Standby(Screen): #restart last played service #unmute adc self.leaveMute() - #set brightness of lcd - config.lcd.bright.apply() #kill me self.close(True) @@ -63,8 +61,6 @@ class Standby(Screen): self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") - #set lcd brightness to standby value - config.lcd.standby.apply() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) -- cgit v1.2.3 From a2a6f4401a59a912f39992a989576fc00542d6a5 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 15:22:28 +0100 Subject: speedup closing the servicelist in some cases this fixes bug #421 --- lib/python/Screens/ChannelSelection.py | 58 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 5fbfd591..8ac53867 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -31,7 +31,6 @@ from Screens.PictureInPicture import PictureInPicture from Screens.RdsDisplay import RassInteractive from ServiceReference import ServiceReference from Tools.BoundFunction import boundFunction -from re import compile from os import remove profile("ChannelSelection.py after imports") @@ -713,6 +712,7 @@ class ChannelSelectionBase(Screen): self.servicePathTV = [ ] self.servicePathRadio = [ ] self.servicePath = [ ] + self.rootChanged = False self.mode = MODE_TV @@ -819,6 +819,7 @@ class ChannelSelectionBase(Screen): else: self.servicelist.setMode(ServiceList.MODE_NORMAL) self.servicelist.setRoot(root, justSet) + self.rootChanged = True self.buildTitleString() def removeModeStr(self, str): @@ -1303,19 +1304,21 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(self.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePath.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePath.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + self.clearPath() + cnt = 0 + for i in tmp: + self.servicePath.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePath.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePath and self.servicePath[0] != eServiceReference(refstr): @@ -1463,19 +1466,20 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(config.radio.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePathRadio.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePathRadio.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + cnt = 0 + for i in tmp: + self.servicePathRadio.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePathRadio.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePathRadio and self.servicePathRadio[0] != eServiceReference(refstr): -- cgit v1.2.3 From 3341c3c1938696c2e4d67ed9a0282077986acf1f Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 21 Jan 2010 11:32:40 +0100 Subject: fix cutlist editor for HD skins --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index abd606d6..0627df3b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -10,7 +10,7 @@ from Components.VideoWindow import VideoWindow from Components.Label import Label from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport from Components.GUIComponent import GUIComponent -from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT +from enigma import eListboxPythonMultiContent, eListbox, getDesktop, gFont, iPlayableService, RT_HALIGN_RIGHT from Screens.FixedMenu import FixedMenu from Screens.HelpMenu import HelpableScreen from ServiceReference import ServiceReference @@ -167,7 +167,8 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He self.onPlayStateChanged.append(self.updateStateLabel) self.updateStateLabel(self.seekstate) - self["Video"] = VideoWindow(decoder = 0) + desktopSize = getDesktop(0).size() + self["Video"] = VideoWindow(decoder = 0, fb_width=desktopSize.width(), fb_height=desktopSize.height()) self["actions"] = HelpableActionMap(self, "CutListEditorActions", { -- cgit v1.2.3 From 79b95a25d1fd0d555b393dd5b9bac83b60432df6 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 19:59:42 +0100 Subject: ChannelSelection.py: small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 8ac53867..eb03ee65 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1181,6 +1181,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.servicelist.setPlayableIgnoreService(eServiceReference()) def setMode(self): + self.rootChanged = True self.restoreRoot() lastservice=eServiceReference(self.lastservice.value) if lastservice.valid(): -- cgit v1.2.3 From 025acea46debca45f8ae004cdb17cc6e5fc84309 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 23:30:01 +0100 Subject: ChannelSelection.py: another small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index eb03ee65..4ca6fa39 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1467,7 +1467,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - tmp = [x for x in self.lastroot.value.split(';') if x != ''] + tmp = [x for x in config.radio.lastroot.value.split(';') if x != ''] current = [x.toString() for x in self.servicePath] if tmp != current or self.rootChanged: cnt = 0 -- cgit v1.2.3 From 2f402fe5d00f8894e69033e1f6015a4483bb9de6 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 29 Jan 2010 00:49:43 +0100 Subject: don't use string concatenation within translation brackets --- lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index d9ccab57..dcff3ca2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -252,7 +252,7 @@ class RestoreMenu(Screen): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nSystem will restart after the restore!")) + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!")) def keyCancel(self): self.close() -- cgit v1.2.3 From bf2f4196dede42bb8b5b8168a85a60498a3d630f Mon Sep 17 00:00:00 2001 From: acid-burn Date: Fri, 29 Jan 2010 08:50:34 +0100 Subject: * 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 --- data/skin_default.xml | 2 + lib/python/Components/Network.py | 3 +- .../SystemPlugins/NetworkWizard/NetworkWizard.py | 131 +++++++++++++++------ .../SystemPlugins/NetworkWizard/networkwizard.xml | 21 ++-- lib/python/Screens/NetworkSetup.py | 18 ++- 5 files changed, 125 insertions(+), 50 deletions(-) (limited to 'lib/python') 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())) + + 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): """ - 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 @@ - + self.clearSelectedKeys() self.selectKey("OK") + +self.selectInterface() + @@ -80,7 +83,7 @@ self.selectKey("UP") self.selectKey("DOWN") - + @@ -109,11 +112,7 @@ self.condition = (self.isInterfaceUp == False and self.WlanPluginInstalled == Tr - - - - - + self.clearSelectedKeys() self.selectKey("OK") @@ -127,10 +126,8 @@ self.condition = (self.isInterfaceUp == True and self.WlanPluginInstalled == Fal - - - - + + self.clearSelectedKeys() self.selectKey("OK") @@ -185,7 +182,7 @@ self.selectKey("UP") self.selectKey("DOWN") - + 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) -- cgit v1.2.3