aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:42:54 +0100
committerFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:42:54 +0100
commita34ef895210161a8820e96829ac87806566e7858 (patch)
tree55b9f104dbbdd8a1d72e598b989421f839576b9a /lib/python/Screens
parent588010098dbcc24b82ea736feec6b6056cffd2e3 (diff)
parent153e0ed5048c79c600e1acd085b62015b7314ba7 (diff)
downloadenigma2-a34ef895210161a8820e96829ac87806566e7858.tar.gz
enigma2-a34ef895210161a8820e96829ac87806566e7858.zip
Merge branch 'master' into tmbinc/FixTimingBugs
Conflicts: lib/dvb/sec.cpp lib/python/Components/Network.py lib/python/Components/Playlist.py lib/python/Plugins/Extensions/DVDBurn/Process.py lib/python/Plugins/Extensions/MediaPlayer/plugin.py lib/python/Screens/TimerEdit.py po/lt.po po/nl.po po/tr.po
Diffstat (limited to 'lib/python/Screens')
-rw-r--r--lib/python/Screens/InfoBarGenerics.py22
-rw-r--r--lib/python/Screens/InputBox.py4
-rw-r--r--lib/python/Screens/LocationBox.py29
-rwxr-xr-x[-rw-r--r--]lib/python/Screens/Makefile.am2
-rw-r--r--lib/python/Screens/MovieSelection.py127
-rwxr-xr-x[-rw-r--r--]lib/python/Screens/NetworkSetup.py724
-rw-r--r--lib/python/Screens/Satconfig.py30
-rw-r--r--lib/python/Screens/ScanSetup.py3
-rw-r--r--lib/python/Screens/TimerEdit.py23
-rw-r--r--lib/python/Screens/TimerEntry.py89
-rwxr-xr-xlib/python/Screens/VirtualKeyBoard.py287
-rw-r--r--lib/python/Screens/Wizard.py94
12 files changed, 1076 insertions, 358 deletions
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index aab2b649..cdaa2c1e 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -403,8 +403,8 @@ class InfoBarEPG:
self.eventView = None
self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
{
- "showEventInfo": (self.openEventView, _("show EPG...")),
- "showSingleServiceEPG": (self.openSingleServiceEPG, _("show single service EPG...")),
+ "showEventView": (self.openEventView, _("show EPG...")),
+ "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")),
"showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible,
})
@@ -489,6 +489,23 @@ class InfoBarEPG:
ref=self.session.nav.getCurrentlyPlayingServiceReference()
self.session.open(EPGSelection, ref)
+ def showEventInfoPlugins(self):
+ list = []
+ for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO):
+ list.append((p.name, boundFunction(self.runPlugin, p)))
+ if len(list):
+ list.append((_("show single service EPG..."), self.openSingleServiceEPG))
+ self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list)
+ else:
+ self.openSingleServiceEPG()
+
+ def runPlugin(self, plugin):
+ plugin(session = self.session, servicelist = self.servicelist)
+
+ def EventInfoPluginChosen(self, answer):
+ if answer is not None:
+ answer[1]()
+
def openSimilarList(self, eventid, refstr):
self.session.open(EPGSelection, refstr, None, eventid)
@@ -1258,7 +1275,6 @@ class InfoBarExtensions:
from Tools.BoundFunction import boundFunction
# depends on InfoBarExtensions
-from Components.PluginComponent import plugins
class InfoBarPlugins:
def __init__(self):
diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py
index 43b8a8b8..61ce356a 100644
--- a/lib/python/Screens/InputBox.py
+++ b/lib/python/Screens/InputBox.py
@@ -8,12 +8,14 @@ from Tools.BoundFunction import boundFunction
from time import time
class InputBox(Screen):
- def __init__(self, session, title = "", windowTitle = _("Input"), **kwargs):
+ def __init__(self, session, title = "", windowTitle = _("Input"), useableChars = None, **kwargs):
Screen.__init__(self, session)
self["text"] = Label(title)
self["input"] = Input(**kwargs)
self.onShown.append(boundFunction(self.setTitle, windowTitle))
+ if useableChars is not None:
+ self["input"].setUseableChars(useableChars)
self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"],
{
diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py
index 7cd6cbf9..68d4f772 100644
--- a/lib/python/Screens/LocationBox.py
+++ b/lib/python/Screens/LocationBox.py
@@ -503,3 +503,32 @@ class MovieLocationBox(LocationBox):
def __init__(self, session, text, dir, minFree = None):
inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"]
LocationBox.__init__(self, session, text = text, currDir = dir, bookmarks = config.movielist.videodirs, autoAdd = True, editDir = True, inhibitDirs = inhibitDirs, minFree = minFree)
+
+class TimeshiftLocationBox(LocationBox):
+
+ skinName = "LocationBox" # XXX: though we could use a custom skin or inherit the hardcoded one we stick with the original :-)
+
+ def __init__(self, session):
+ inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"]
+ LocationBox.__init__(
+ self,
+ session,
+ text = _("Where to save temporary timeshift recordings?"),
+ currDir = config.usage.timeshift_path.value,
+ bookmarks = config.usage.allowed_timeshift_paths,
+ autoAdd = True,
+ editDir = True,
+ inhibitDirs = inhibitDirs,
+ minFree = 1024 # XXX: the same requirement is hardcoded in servicedvb.cpp
+ )
+
+ def cancel(self):
+ config.usage.timeshift_path.cancel()
+ LocationBox.cancel(self)
+
+ def selectConfirmed(self, ret):
+ if ret:
+ config.usage.timeshift_path.value = self.getPreferredFolder()
+ config.usage.timeshift_path.save()
+ LocationBox.selectConfirmed(self, ret)
+
diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am
index 186c6f32..a3cf70bb 100644..100755
--- a/lib/python/Screens/Makefile.am
+++ b/lib/python/Screens/Makefile.am
@@ -13,5 +13,5 @@ install_PYTHON = \
TimerSelection.py PictureInPicture.py TimeDateInput.py \
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
+ SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py
diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py
index c05f145f..5951653f 100644
--- a/lib/python/Screens/MovieSelection.py
+++ b/lib/python/Screens/MovieSelection.py
@@ -29,6 +29,28 @@ config.movielist.description = ConfigInteger(default=MovieList.HIDE_DESCRIPTION)
config.movielist.last_videodir = ConfigText(default=resolveFilename(SCOPE_HDD))
config.movielist.last_timer_videodir = ConfigText(default=resolveFilename(SCOPE_HDD))
config.movielist.videodirs = ConfigLocations(default=[resolveFilename(SCOPE_HDD)])
+config.movielist.first_tags = ConfigText(default="")
+config.movielist.second_tags = ConfigText(default="")
+
+
+def setPreferredTagEditor(te):
+ global preferredTagEditor
+ try:
+ if preferredTagEditor == None:
+ preferredTagEditor = te
+ print "Preferred tag editor changed to ", preferredTagEditor
+ else:
+ print "Preferred tag editor already set to ", preferredTagEditor
+ print "ignoring ", te
+ except:
+ preferredTagEditor = te
+ print "Preferred tag editor set to ", preferredTagEditor
+
+def getPreferredTagEditor():
+ global preferredTagEditor
+ return preferredTagEditor
+
+setPreferredTagEditor(None)
class MovieContextMenu(Screen):
def __init__(self, session, csel, service):
@@ -71,10 +93,8 @@ class MovieContextMenu(Screen):
def sortBy(self, newType):
config.movielist.moviesort.value = newType
- self.csel.selectedmovie = self.csel.getCurrent()
self.csel.setSortType(newType)
self.csel.reloadList()
- self.csel.moveTo()
self.close()
def listType(self, newType):
@@ -123,7 +143,7 @@ class MovieContextMenu(Screen):
self.session.openWithCallback(self.close, MessageBox, _("Delete failed!"), MessageBox.TYPE_ERROR)
else:
self.csel["list"].removeService(self.service)
- self.csel["freeDiskSpace"].update()
+ self.csel["freeDiskSpace"].update()
self.close()
class SelectionEventInfo:
@@ -149,6 +169,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
self.tags = [ ]
self.selected_tags = None
+ self.selected_tags_ele = None
self.movemode = False
self.bouquet_mark_edit = False
@@ -178,7 +199,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
# Need list for init
SelectionEventInfo.__init__(self)
- self["key_red"] = Button(_("All..."))
+ self["key_red"] = Button(_("All"))
self["key_green"] = Button("")
self["key_yellow"] = Button("")
self["key_blue"] = Button("")
@@ -201,9 +222,9 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
self["ColorActions"] = HelpableActionMap(self, "ColorActions",
{
"red": (self.showAll, _("show all")),
- "green": (self.showTagsFirst, _("show first tag")),
- "yellow": (self.showTagsSecond, _("show second tag")),
- "blue": (self.showTagsMenu, _("show tag menu")),
+ "green": (self.showTagsFirst, _("show first selected tag")),
+ "yellow": (self.showTagsSecond, _("show second selected tag")),
+ "blue": (self.showTagsSelect, _("show tag menu")),
})
self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
@@ -246,11 +267,8 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
self.updateDescription()
def updateHDDData(self):
- self.reloadList()
- if self.selectedmovie is not None:
- self.moveTo()
+ self.reloadList(self.selectedmovie)
self["waitingtext"].visible = False
- self.updateTags()
def moveTo(self):
self["list"].moveTo(self.selectedmovie)
@@ -285,26 +303,29 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
def updateTags(self):
# get a list of tags available in this list
self.tags = list(self["list"].tags)
-
- # by default, we do not display any filtering options
- self.tag_first = ""
- self.tag_second = ""
-
- # when tags are present, however, the first two are
- # directly mapped to the second, third ("green", "yellow") buttons
- if len(self.tags) > 0:
- self.tag_first = self.getTagDescription(self.tags[0])
-
- if len(self.tags) > 1:
- self.tag_second = self.getTagDescription(self.tags[1])
-
+
+ if not self.tags:
+ # by default, we do not display any filtering options
+ self.tag_first = ""
+ self.tag_second = ""
+ else:
+ tmp = config.movielist.first_tags.value
+ if tmp in self.tags:
+ self.tag_first = tmp
+ else:
+ self.tag_first = "<"+_("Tag 1")+">"
+ tmp = config.movielist.second_tags.value
+ if tmp in self.tags:
+ self.tag_second = tmp
+ else:
+ self.tag_second = "<"+_("Tag 2")+">"
self["key_green"].text = self.tag_first
self["key_yellow"].text = self.tag_second
# the rest is presented in a list, available on the
# fourth ("blue") button
- if len(self.tags) > 2:
- self["key_blue"].text = _("Other...")
+ if self.tags:
+ self["key_blue"].text = _("Tags")+"..."
else:
self["key_blue"].text = ""
@@ -317,20 +338,26 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
def setSortType(self, type):
self["list"].setSortType(type)
- def reloadList(self):
+ def reloadList(self, sel = None, home = False):
if not pathExists(config.movielist.last_videodir.value):
path = resolveFilename(SCOPE_HDD)
config.movielist.last_videodir.value = path
config.movielist.last_videodir.save()
self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + path)
self["freeDiskSpace"].path = path
+ if sel is None:
+ sel = self.getCurrent()
self["list"].reload(self.current_ref, self.selected_tags)
title = _("Recorded files...")
- if self.selected_tags is not None:
- title += " - " + ','.join(self.selected_tags)
if config.usage.setup_level.index >= 2: # expert+
title += " " + config.movielist.last_videodir.value
+ if self.selected_tags is not None:
+ title += " - " + ','.join(self.selected_tags)
self.setTitle(title)
+ if not (sel and self["list"].moveTo(sel)):
+ if home:
+ self["list"].moveToIndex(0)
+ self.updateTags()
self["freeDiskSpace"].update()
def doPathSelect(self):
@@ -348,7 +375,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
config.movielist.last_videodir.save()
self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + res)
self["freeDiskSpace"].path = res
- self.reloadList()
+ self.reloadList(home = True)
else:
self.session.open(
MessageBox,
@@ -358,35 +385,41 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
)
def showAll(self):
+ self.selected_tags_ele = None
self.selected_tags = None
- self.reloadList()
+ self.reloadList(home = True)
- def showTagsN(self, n):
- if len(self.tags) < n:
+ def showTagsN(self, tagele):
+ if not self.tags:
self.showTagWarning()
+ elif not tagele or self.selected_tags_ele == tagele or not tagele.value in self.tags:
+ self.showTagsMenu(tagele)
else:
- print "select tag #%d, %s, %s" % (n, self.tags[n - 1], ','.join(self.tags))
- self.selected_tags = set([self.tags[n - 1]])
- self.reloadList()
+ self.selected_tags_ele = tagele
+ self.selected_tags = set([tagele.value])
+ self.reloadList(home = True)
def showTagsFirst(self):
- self.showTagsN(1)
+ self.showTagsN(config.movielist.first_tags)
def showTagsSecond(self):
- self.showTagsN(2)
+ self.showTagsN(config.movielist.second_tags)
+
+ def showTagsSelect(self):
+ self.showTagsN(None)
def tagChosen(self, tag):
if tag is not None:
self.selected_tags = set([tag[0]])
- self.reloadList()
+ if self.selected_tags_ele:
+ self.selected_tags_ele.value = tag[0]
+ self.selected_tags_ele.save()
+ self.reloadList(home = True)
- def showTagsMenu(self):
- if len(self.tags) < 3:
- self.showTagWarning()
- else:
- list = [(tag, self.getTagDescription(tag)) for tag in self.tags ]
- self.session.openWithCallback(self.tagChosen, ChoiceBox, title=_("Please select keyword to filter..."), list = list)
+ def showTagsMenu(self, tagele):
+ self.selected_tags_ele = tagele
+ list = [(tag, self.getTagDescription(tag)) for tag in self.tags ]
+ self.session.openWithCallback(self.tagChosen, ChoiceBox, title=_("Please select tag to filter..."), list = list)
def showTagWarning(self):
- # TODO
- self.session.open(MessageBox, _("You need to define some keywords first!\nPress the menu-key to define keywords.\nDo you want to define keywords now?"), MessageBox.TYPE_ERROR)
+ self.session.open(MessageBox, _("No tags are set on these movies."), MessageBox.TYPE_ERROR)
diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
index 862bce46..ea2d17e6 100644..100755
--- a/lib/python/Screens/NetworkSetup.py
+++ b/lib/python/Screens/NetworkSetup.py
@@ -1,25 +1,25 @@
from Screen import Screen
-from Components.ActionMap import ActionMap,NumberActionMap
from Screens.MessageBox import MessageBox
from Screens.InputBox import InputBox
from Screens.Standby import *
+from Screens.VirtualKeyBoard import VirtualKeyBoard
+from Screens.HelpMenu import HelpableScreen
from Components.Network import iNetwork
from Components.Label import Label,MultiColorLabel
from Components.Pixmap import Pixmap,MultiPixmap
from Components.MenuList import MenuList
-from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigSelection, getConfigListEntry, ConfigNothing
+from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigPassword, ConfigSelection, getConfigListEntry, ConfigNothing
from Components.ConfigList import ConfigListScreen
from Components.PluginComponent import plugins
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
+from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.LoadPixmap import LoadPixmap
from Plugins.Plugin import PluginDescriptor
-from enigma import eTimer
+from enigma import eTimer, ePoint, eSize, RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
from os import path as os_path, system as os_system, unlink
from re import compile as re_compile, search as re_search
-from Tools.Directories import resolveFilename, SCOPE_PLUGINS
-from Tools.Directories import SCOPE_SKIN_IMAGE,SCOPE_PLUGINS, resolveFilename
-from Tools.LoadPixmap import LoadPixmap
-from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
class InterfaceList(MenuList):
def __init__(self, list, enableWrapAround=False):
@@ -30,11 +30,13 @@ class InterfaceList(MenuList):
def InterfaceEntryComponent(index,name,default,active ):
res = [ (index) ]
res.append(MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name))
- if default is True:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue.png"))
- if default is False:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue_off.png"))
- res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png))
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
+ if num_configured_if >= 2:
+ if default is True:
+ png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue.png"))
+ if default is False:
+ png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue_off.png"))
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png))
if active is True:
png2 = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png"))
if active is False:
@@ -43,41 +45,64 @@ def InterfaceEntryComponent(index,name,default,active ):
return res
-class NetworkAdapterSelection(Screen):
+class NetworkAdapterSelection(Screen,HelpableScreen):
def __init__(self, session):
Screen.__init__(self, session)
-
- self.wlan_errortext = _("No working wireless networkadapter found.\nPlease verify that you have attached a compatible WLAN USB Stick and your Network is configured correctly.")
- self.lan_errortext = _("No working local networkadapter found.\nPlease verify that you have attached a network cable and your Network is configured correctly.")
+ HelpableScreen.__init__(self)
+
+ self.wlan_errortext = _("No working wireless network adapter found.\nPlease verify that you have attached a compatible WLAN device and your network is configured correctly.")
+ self.lan_errortext = _("No working local network adapter found.\nPlease verify that you have attached a network cable and your network is configured correctly.")
+ self.oktext = _("Press OK on your remote control to continue.")
+ self.restartLanRef = None
self["ButtonBluetext"] = Label(_("Set as default Interface"))
+ self["ButtonBlue"] = Pixmap()
self["ButtonRedtext"] = Label(_("Close"))
self["introduction"] = Label(_("Press OK to edit the settings."))
self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()]
-
+
if len(self.adapters) == 0:
self.onFirstExecBegin.append(self.NetworkFallback)
-
+
+ self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
+ {
+ "cancel": (self.close, _("exit network interface list")),
+ "ok": (self.okbuttonClick, _("select interface")),
+ })
+
+ self["ColorActions"] = HelpableActionMap(self, "ColorActions",
+ {
+ "red": (self.close, _("exit network interface list")),
+ })
+
+ self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions",
+ {
+ "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more than one interface is active.")] ),
+ })
+
self.list = []
self["list"] = InterfaceList(self.list)
self.updateList()
- self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
- {
- "ok": self.okbuttonClick,
- "cancel": self.close,
- "blue": self.setDefaultInterface,
- "red": self.close
- }, -2)
-
+
if len(self.adapters) == 1:
self.onFirstExecBegin.append(self.okbuttonClick)
+ self.onClose.append(self.cleanup)
+
def updateList(self):
- iNetwork.getInterfaces()
self.list = []
default_gw = None
- num_configured_if = len(iNetwork.configuredInterfaces)
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
+ if num_configured_if >= 2:
+ self["ButtonBlue"].show()
+ self["ButtonBluetext"].show()
+ self["DefaultInterfaceAction"].setEnabled(True)
+ else:
+ self["ButtonBlue"].hide()
+ self["ButtonBluetext"].hide()
+ self["DefaultInterfaceAction"].setEnabled(False)
+
if num_configured_if < 2 and os_path.exists("/etc/default_gw"):
unlink("/etc/default_gw")
@@ -86,7 +111,7 @@ class NetworkAdapterSelection(Screen):
result = fp.read()
fp.close()
default_gw = result
-
+
if len(self.adapters) == 0: # no interface available => display only eth0
self.list.append(InterfaceEntryComponent("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True ))
else:
@@ -106,24 +131,22 @@ class NetworkAdapterSelection(Screen):
selection = self["list"].getCurrent()
num_if = len(self.list)
old_default_gw = None
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
if os_path.exists("/etc/default_gw"):
fp = open('/etc/default_gw', 'r')
old_default_gw = fp.read()
fp.close()
- if num_if > 1 and (not old_default_gw or old_default_gw != selection[0]):
+ if num_configured_if > 1 and (not old_default_gw or old_default_gw != selection[0]):
fp = open('/etc/default_gw', 'w+')
fp.write(selection[0])
fp.close()
- iNetwork.restartNetwork()
- self.updateList()
- elif old_default_gw and num_if < 2:
+ self.restartLan()
+ elif old_default_gw and num_configured_if < 2:
unlink("/etc/default_gw")
- iNetwork.restartNetwork()
- self.updateList()
+ self.restartLan()
def okbuttonClick(self):
selection = self["list"].getCurrent()
- print "selection",selection
if selection is not None:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, selection[0])
@@ -134,25 +157,48 @@ class NetworkAdapterSelection(Screen):
self.updateList()
def NetworkFallback(self):
- if iNetwork.configuredInterfaces.has_key('wlan0') is True:
+ if iNetwork.configuredNetworkAdapters.has_key('wlan0') is True:
self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.wlan_errortext, type = MessageBox.TYPE_INFO,timeout = 10)
- if iNetwork.configuredInterfaces.has_key('ath0') is True:
+ if iNetwork.configuredNetworkAdapters.has_key('ath0') is True:
self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.wlan_errortext, type = MessageBox.TYPE_INFO,timeout = 10)
else:
self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.lan_errortext, type = MessageBox.TYPE_INFO,timeout = 10)
def ErrorMessageClosed(self, *ret):
- if iNetwork.configuredInterfaces.has_key('wlan0') is True:
+ if iNetwork.configuredNetworkAdapters.has_key('wlan0') is True:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'wlan0')
- elif iNetwork.configuredInterfaces.has_key('ath0') is True:
+ elif iNetwork.configuredNetworkAdapters.has_key('ath0') is True:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'ath0')
else:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'eth0')
-class NameserverSetup(Screen, ConfigListScreen):
+ def cleanup(self):
+ iNetwork.stopLinkStateConsole()
+ iNetwork.stopRestartConsole()
+ iNetwork.stopGetInterfacesConsole()
+
+ def restartLan(self):
+ iNetwork.restartNetwork(self.restartLanDataAvail)
+ self.restartLanRef = self.session.openWithCallback(self.restartfinishedCB, MessageBox, _("Please wait while we configure your network..."), type = MessageBox.TYPE_INFO, enable_input = False)
+
+ def restartLanDataAvail(self, data):
+ if data is True:
+ iNetwork.getInterfaces(self.getInterfacesDataAvail)
+
+ def getInterfacesDataAvail(self, data):
+ if data is True:
+ self.restartLanRef.close(True)
+
+ def restartfinishedCB(self,data):
+ if data is True:
+ self.updateList()
+ self.session.open(MessageBox, _("Finished configuring your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False)
+
+
+class NameserverSetup(Screen, ConfigListScreen, HelpableScreen):
def __init__(self, session):
Screen.__init__(self, session)
- iNetwork.getInterfaces()
+ HelpableScreen.__init__(self)
self.backupNameserverList = iNetwork.getNameserverList()[:]
print "backup-list:", self.backupNameserverList
@@ -162,14 +208,23 @@ class NameserverSetup(Screen, ConfigListScreen):
self["introduction"] = Label(_("Press OK to activate the settings."))
self.createConfig()
- self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
+ self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
+ {
+ "cancel": (self.cancel, _("exit nameserver configuration")),
+ "ok": (self.ok, _("activate current configuration")),
+ })
+
+ self["ColorActions"] = HelpableActionMap(self, "ColorActions",
+ {
+ "red": (self.cancel, _("exit nameserver configuration")),
+ "green": (self.add, _("add a nameserver entry")),
+ "yellow": (self.remove, _("remove a nameserver entry")),
+ })
+
+ self["actions"] = NumberActionMap(["SetupActions"],
{
"ok": self.ok,
- "cancel": self.cancel,
- "red": self.cancel,
- "green": self.add,
- "yellow": self.remove
- }, -2)
+ }, -2)
self.list = []
ConfigListScreen.__init__(self, self.list)
@@ -222,31 +277,55 @@ class NameserverSetup(Screen, ConfigListScreen):
self.createConfig()
self.createSetup()
-class AdapterSetup(Screen, ConfigListScreen):
- def __init__(self, session, iface,essid=None, aplist=None):
+class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
+ def __init__(self, session, networkinfo, essid=None, aplist=None):
Screen.__init__(self, session)
+ HelpableScreen.__init__(self)
self.session = session
- self.iface = iface
- self.essid = essid
- self.aplist = aplist
+ if isinstance(networkinfo, (list, tuple)):
+ self.iface = networkinfo[0]
+ self.essid = networkinfo[1]
+ self.aplist = networkinfo[2]
+ else:
+ self.iface = networkinfo
+ self.essid = essid
+ self.aplist = aplist
self.extended = None
+ self.applyConfigRef = None
+ self.finished_cb = None
+ self.oktext = _("Press OK on your remote control to continue.")
self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
- iNetwork.getInterfaces()
self.createConfig()
-
- self["actions"] = NumberActionMap(["SetupActions", "ColorActions"],
+
+ self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
+ {
+ "cancel": (self.cancel, _("exit network adapter setup menu")),
+ "ok": (self.ok, _("select menu entry")),
+ })
+
+ self["ColorActions"] = HelpableActionMap(self, "ColorActions",
+ {
+ "red": (self.cancel, _("exit network adapter configuration")),
+ "blue": (self.KeyBlue, _("open nameserver configuration")),
+ })
+
+ self["VirtualKB"] = HelpableActionMap(self, "ColorActions",
+ {
+ "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden SSID or network key")] ),
+ })
+
+ self["actions"] = NumberActionMap(["SetupActions"],
{
"ok": self.ok,
- "cancel": self.cancel,
- "red": self.cancel,
- "blue": self.KeyBlue,
}, -2)
+
self.list = []
ConfigListScreen.__init__(self, self.list,session = self.session)
self.createSetup()
self.onLayoutFinish.append(self.layoutFinished)
+ self.onClose.append(self.cleanup)
self["DNS1text"] = Label(_("Primary DNS"))
self["DNS2text"] = Label(_("Secondary DNS"))
@@ -271,76 +350,105 @@ class AdapterSetup(Screen, ConfigListScreen):
self["ButtonRedtext"] = Label(_("Close"))
self["ButtonBlue"] = Pixmap()
self["ButtonBluetext"] = Label(_("Edit DNS"))
+ self["ButtonGreen"] = Pixmap()
+ self["VKeyIcon"] = Pixmap()
+ self["HelpWindow"] = Pixmap()
def layoutFinished(self):
self["DNS1"].setText(self.primaryDNS.getText())
self["DNS2"].setText(self.secondaryDNS.getText())
if self.ipConfigEntry.getText() is not None:
- self["IP"].setText(self.ipConfigEntry.getText())
+ if self.ipConfigEntry.getText() == "0.0.0.0":
+ self["IP"].setText(_("N/A"))
+ else:
+ self["IP"].setText(self.ipConfigEntry.getText())
+ else:
+ self["IP"].setText(_("N/A"))
+ if self.netmaskConfigEntry.getText() is not None:
+ if self.netmaskConfigEntry.getText() == "0.0.0.0":
+ self["Mask"].setText(_("N/A"))
+ else:
+ self["Mask"].setText(self.netmaskConfigEntry.getText())
else:
- self["IP"].setText([0,0,0,0])
- self["Mask"].setText(self.netmaskConfigEntry.getText())
+ self["IP"].setText(_("N/A"))
if iNetwork.getAdapterAttribute(self.iface, "gateway"):
- self["Gateway"].setText(self.gatewayConfigEntry.getText())
+ if self.gatewayConfigEntry.getText() == "0.0.0.0":
+ self["Gateway"].setText(_("N/A"))
+ else:
+ self["Gateway"].setText(self.gatewayConfigEntry.getText())
else:
self["Gateway"].hide()
self["Gatewaytext"].hide()
self["Adapter"].setText(iNetwork.getFriendlyAdapterName(self.iface))
+ self["ButtonGreen"].hide()
+ self["VKeyIcon"].hide()
+ self["VirtualKB"].setEnabled(False)
+ self["HelpWindow"].hide()
def createConfig(self):
self.InterfaceEntry = None
self.dhcpEntry = None
self.gatewayEntry = None
- self.SSIDscan = None
+ self.hiddenSSID = None
self.wlanSSID = None
- self.manualwlanSSID = None
self.encryptionEnabled = None
self.encryptionKey = None
+ self.encryptionType = None
self.nwlist = None
+ self.encryptionlist = None
+ self.weplist = None
self.wsconfig = None
self.default = None
if self.iface == "wlan0" or self.iface == "ath0" :
from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant,Wlan
+ self.w = Wlan(self.iface)
self.ws = wpaSupplicant()
- list = []
- list.append(_("WEP"))
- list.append(_("WPA"))
- list.append(_("WPA2"))
+ self.encryptionlist = []
+ self.encryptionlist.append(("WEP", _("WEP")))
+ self.encryptionlist.append(("WPA", _("WPA")))
+ self.encryptionlist.append(("WPA2", _("WPA2")))
+ self.encryptionlist.append(("WPA/WPA2", _("WPA or WPA2")))
+ self.weplist = []
+ self.weplist.append("ASCII")
+ self.weplist.append("HEX")
if self.aplist is not None:
self.nwlist = self.aplist
self.nwlist.sort(key = lambda x: x[0])
else:
self.nwlist = []
- self.w = None
self.aps = None
try:
- self.w = Wlan(self.iface)
self.aps = self.w.getNetworkList()
if self.aps is not None:
print "[NetworkSetup.py] got Accespoints!"
- for ap in aps:
- a = aps[ap]
+ for ap in self.aps:
+ a = self.aps[ap]
if a['active']:
if a['essid'] == "":
a['essid'] = a['bssid']
- self.nwlist.append( a['essid'])
+ self.nwlist.append((a['essid'],a['essid']))
self.nwlist.sort(key = lambda x: x[0])
except:
- self.nwlist.append("No Networks found")
+ self.nwlist.append(("No Networks found",_("No Networks found")))
self.wsconfig = self.ws.loadConfig()
- self.default = self.essid or self.wsconfig['ssid']
- if self.default not in self.nwlist:
- self.nwlist.append(self.default)
- config.plugins.wlan.essidscan = NoSave(ConfigYesNo(default = self.wsconfig['ssidscan']))
- if self.wsconfig['ssidscan'] is True:
- config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
+ if self.essid is not None: # ssid from wlan scan
+ self.default = self.essid
else:
- config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False))
+ self.default = self.wsconfig['ssid']
+
+ if "hidden..." not in self.nwlist:
+ self.nwlist.append(("hidden...",_("hidden network")))
+ if self.default not in self.nwlist:
+ self.nwlist.append((self.default,self.default))
+ config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
+ config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = self.wsconfig['hiddenessid'], visible_width = 50, fixed_size = False))
+
config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = self.wsconfig['encryption'] ))
- config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = self.wsconfig['encryption_type'] ))
- config.plugins.wlan.encryption.psk = NoSave(ConfigText(default = self.wsconfig['key'], visible_width = 50, fixed_size = False))
+ config.plugins.wlan.encryption.type = NoSave(ConfigSelection(self.encryptionlist, default = self.wsconfig['encryption_type'] ))
+ config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(self.weplist, default = self.wsconfig['encryption_wepkeytype'] ))
+ config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = self.wsconfig['key'], visible_width = 50, fixed_size = False))
self.activateInterfaceEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "up") or False))
self.dhcpConfigEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "dhcp") or False))
@@ -382,26 +490,56 @@ class AdapterSetup(Screen, ConfigListScreen):
self.configStrings = p.__call__["configStrings"]
else:
self.configStrings = None
- self.SSIDscan = getConfigListEntry(_("Automatic SSID lookup"), config.plugins.wlan.essidscan)
- self.list.append(self.SSIDscan)
- self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)
- self.list.append(self.wlanSSID)
+ if config.plugins.wlan.essid.value == 'hidden...':
+ self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)
+ self.list.append(self.wlanSSID)
+ self.hiddenSSID = getConfigListEntry(_("Hidden network SSID"), config.plugins.wlan.hiddenessid)
+ self.list.append(self.hiddenSSID)
+ else:
+ self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)
+ self.list.append(self.wlanSSID)
self.encryptionEnabled = getConfigListEntry(_("Encryption"), config.plugins.wlan.encryption.enabled)
self.list.append(self.encryptionEnabled)
if config.plugins.wlan.encryption.enabled.value:
- self.list.append(getConfigListEntry(_("Encryption Type"), config.plugins.wlan.encryption.type))
- self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk)
- self.list.append(self.encryptionKey)
+ self.encryptionType = getConfigListEntry(_("Encryption Type"), config.plugins.wlan.encryption.type)
+ self.list.append(self.encryptionType)
+ if config.plugins.wlan.encryption.type.value == 'WEP':
+ self.list.append(getConfigListEntry(_("Encryption Keytype"), config.plugins.wlan.encryption.wepkeytype))
+ self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk)
+ self.list.append(self.encryptionKey)
+ else:
+ self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk)
+ self.list.append(self.encryptionKey)
+
self["config"].list = self.list
self["config"].l.setList(self.list)
+ if not self.selectionChanged in self["config"].onSelectionChanged:
+ self["config"].onSelectionChanged.append(self.selectionChanged)
def KeyBlue(self):
self.session.openWithCallback(self.NameserverSetupClosed, NameserverSetup)
+ def KeyGreen(self):
+ if self.iface == "wlan0" or self.iface == "ath0" :
+ if self["config"].getCurrent() == self.hiddenSSID:
+ if config.plugins.wlan.essid.value == 'hidden...':
+ self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN network name/SSID:")), text = config.plugins.wlan.essid.value)
+ if self["config"].getCurrent() == self.encryptionKey:
+ self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value)
+
+ def VirtualKeyBoardSSIDCallback(self, callback = None):
+ if callback is not None and len(callback):
+ config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = callback, visible_width = 50, fixed_size = False))
+ self.createSetup()
+
+ def VirtualKeyBoardKeyCallback(self, callback = None):
+ if callback is not None and len(callback):
+ config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = callback, visible_width = 50, fixed_size = False))
+ self.createSetup()
+
def newConfig(self):
- print self["config"].getCurrent()
if self["config"].getCurrent() == self.InterfaceEntry:
self.createSetup()
if self["config"].getCurrent() == self.dhcpEntry:
@@ -409,15 +547,12 @@ class AdapterSetup(Screen, ConfigListScreen):
if self["config"].getCurrent() == self.gatewayEntry:
self.createSetup()
if self.iface == "wlan0" or self.iface == "ath0" :
- if self["config"].getCurrent() == self.SSIDscan:
- if config.plugins.wlan.essidscan.value is True:
- config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
- else:
- config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False))
+ if self["config"].getCurrent() == self.wlanSSID:
self.createSetup()
if self["config"].getCurrent() == self.encryptionEnabled:
self.createSetup()
-
+ if self["config"].getCurrent() == self.encryptionType:
+ self.createSetup()
def keyLeft(self):
ConfigListScreen.keyLeft(self)
self.newConfig()
@@ -426,36 +561,109 @@ class AdapterSetup(Screen, ConfigListScreen):
ConfigListScreen.keyRight(self)
self.newConfig()
+ def selectionChanged(self):
+ current = self["config"].getCurrent()
+ if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
+ helpwindowpos = self["HelpWindow"].getPosition()
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ self["ButtonGreen"].show()
+ self["VKeyIcon"].show()
+ self["VirtualKB"].setEnabled(True)
+ elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
+ helpwindowpos = self["HelpWindow"].getPosition()
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ self["ButtonGreen"].show()
+ self["VKeyIcon"].show()
+ self["VirtualKB"].setEnabled(True)
+ else:
+ self["ButtonGreen"].hide()
+ self["VKeyIcon"].hide()
+ self["VirtualKB"].setEnabled(False)
+
def ok(self):
- iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value)
- iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value)
- iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value)
- iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value)
- if self.hasGatewayConfigEntry.value:
- iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value)
+ current = self["config"].getCurrent()
+ if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.hide()
+ elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.hide()
+ self.session.openWithCallback(self.applyConfig, MessageBox, (_("Are you sure you want to activate this network configuration?\n\n") + self.oktext ) )
+
+ def applyConfig(self, ret = False):
+ if (ret == True):
+ iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value)
+ iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value)
+ if self.hasGatewayConfigEntry.value:
+ iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value)
+ else:
+ iNetwork.removeAdapterAttribute(self.iface, "gateway")
+ if self.extended is not None and self.configStrings is not None:
+ iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface))
+ self.ws.writeConfig()
+ if self.activateInterfaceEntry.value is False:
+ iNetwork.deactivateInterface(self.iface)
+ iNetwork.writeNetworkConfig()
+ iNetwork.restartNetwork(self.applyConfigDataAvail)
+ self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
else:
- iNetwork.removeAdapterAttribute(self.iface, "gateway")
- if self.extended is not None and self.configStrings is not None:
- iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface))
- self.ws.writeConfig()
- if self.activateInterfaceEntry.value is False:
- iNetwork.deactivateInterface(self.iface)
- iNetwork.writeNetworkConfig()
- iNetwork.deactivateNetworkConfig()
- iNetwork.activateNetworkConfig()
- self.close()
+ self.cancel()
+
+ def applyConfigDataAvail(self, data):
+ if data is True:
+ iNetwork.getInterfaces(self.getInterfacesDataAvail)
+
+ def getInterfacesDataAvail(self, data):
+ if data is True:
+ self.applyConfigRef.close(True)
+
+ def applyConfigfinishedCB(self,data):
+ if data is True:
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
+ if num_configured_if >= 2:
+ self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
+ else:
+ if self.finished_cb:
+ self.session.openWithCallback(lambda x : self.finished_cb(), MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
+ else:
+ self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
+
+ def secondIfaceFoundCB(self,data):
+ if data is False:
+ self.close('ok')
+ else:
+ configuredInterfaces = iNetwork.getConfiguredAdapters()
+ for interface in configuredInterfaces:
+ if interface == self.iface:
+ continue
+ iNetwork.setAdapterAttribute(interface, "up", False)
+ iNetwork.deactivateInterface(interface)
+ self.applyConfig(True)
+
+ def ConfigfinishedCB(self,data):
+ if data is not None:
+ if data is True:
+ self.close('ok')
def cancel(self):
- iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState)
- self.activateInterfaceEntry.value = self.oldInterfaceState
- if self.activateInterfaceEntry.value is False:
- iNetwork.deactivateInterface(self.iface)
- iNetwork.getInterfaces()
- self.close()
-
- def run(self):
+ if self.oldInterfaceState is False:
+ iNetwork.deactivateInterface(self.iface,self.cancelCB)
+ else:
+ self.close('cancel')
+
+ def cancelCB(self,data):
+ if data is not None:
+ if data is True:
+ self.close('cancel')
+
+ def runAsync(self, finished_cb):
+ self.finished_cb = finished_cb
self.ok()
-
+
def NameserverSetupClosed(self, *ret):
iNetwork.loadNameserverConfig()
nameserver = (iNetwork.getNameserverList() + [[0,0,0,0]] * 2)[0:2]
@@ -463,13 +671,18 @@ class AdapterSetup(Screen, ConfigListScreen):
self.secondaryDNS = NoSave(ConfigIP(default=nameserver[1]))
self.createSetup()
self.layoutFinished()
+
+ def cleanup(self):
+ iNetwork.stopLinkStateConsole()
-class AdapterSetupConfiguration(Screen):
+class AdapterSetupConfiguration(Screen, HelpableScreen):
def __init__(self, session,iface):
Screen.__init__(self, session)
+ HelpableScreen.__init__(self)
self.session = session
self.iface = iface
+ self.restartLanRef = None
self.mainmenu = self.genMainMenu()
self["menulist"] = MenuList(self.mainmenu)
self["description"] = Label()
@@ -485,8 +698,27 @@ class AdapterSetupConfiguration(Screen):
self.oktext = _("Press OK on your remote control to continue.")
self.reboottext = _("Your Dreambox will restart after pressing OK on your remote control.")
- self.errortext = _("No working wireless interface found.\n Please verify that you have attached a compatible WLAN device or enable your local network interface.")
+ self.errortext = _("No working wireless network interface found.\n Please verify that you have attached a compatible WLAN device or enable your local network interface.")
+ self["WizardActions"] = HelpableActionMap(self, "WizardActions",
+ {
+ "up": (self.up, _("move up to previous entry")),
+ "down": (self.down, _("move down to next entry")),
+ "left": (self.left, _("move up to first entry")),
+ "right": (self.right, _("move down to last entry")),
+ })
+
+ self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
+ {
+ "cancel": (self.close, _("exit networkadapter setup menu")),
+ "ok": (self.ok, _("select menu entry")),
+ })
+
+ self["ColorActions"] = HelpableActionMap(self, "ColorActions",
+ {
+ "red": (self.close, _("exit networkadapter setup menu")),
+ })
+
self["actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
{
"ok": self.ok,
@@ -498,9 +730,9 @@ class AdapterSetupConfiguration(Screen):
"right": self.right,
}, -2)
- iNetwork.getInterfaces()
- self.onLayoutFinish.append(self.layoutFinished)
self.updateStatusbar()
+ self.onLayoutFinish.append(self.layoutFinished)
+ self.onClose.append(self.cleanup)
def ok(self):
if self["menulist"].getCurrent()[1] == 'edit':
@@ -548,8 +780,7 @@ class AdapterSetupConfiguration(Screen):
ifobj = Wireless(self.iface) # a Wireless NIC Object
self.wlanresponse = ifobj.getStatistics()
if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface)
- #self.session.open(WlanStatus,self.iface)
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
else:
# Display Wlan not available Message
self.showErrorMessage()
@@ -584,6 +815,7 @@ class AdapterSetupConfiguration(Screen):
self.loadDescription()
def loadDescription(self):
+ print self["menulist"].getCurrent()[1]
if self["menulist"].getCurrent()[1] == 'edit':
self["description"].setText(_("Edit the network configuration of your Dreambox.\n" ) + self.oktext )
if self["menulist"].getCurrent()[1] == 'test':
@@ -601,26 +833,21 @@ class AdapterSetupConfiguration(Screen):
if self["menulist"].getCurrent()[1][0] == 'extendedSetup':
self["description"].setText(_(self["menulist"].getCurrent()[1][1]) + self.oktext )
- def updateStatusbar(self):
+ def updateStatusbar(self, data = None):
self["IFtext"].setText(_("Network:"))
self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
self["Statustext"].setText(_("Link:"))
if self.iface == 'wlan0' or self.iface == 'ath0':
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
- w = Wlan(self.iface)
- stats = w.getStatus()
- if stats['BSSID'] == "00:00:00:00:00:00":
- self["statuspic"].setPixmapNum(1)
- else:
- self["statuspic"].setPixmapNum(0)
- self["statuspic"].show()
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
except:
self["statuspic"].setPixmapNum(1)
self["statuspic"].show()
+ else:
+ iStatus.getDataForInterface(self.iface,self.getInfoCB)
else:
- self.getLinkState(self.iface)
+ iNetwork.getLinkState(self.iface,self.dataAvail)
def doNothing(self):
pass
@@ -661,24 +888,64 @@ class AdapterSetupConfiguration(Screen):
return menu
def AdapterSetupClosed(self, *ret):
- self.mainmenu = self.genMainMenu()
- self["menulist"].l.setList(self.mainmenu)
- iNetwork.getInterfaces()
- self.updateStatusbar()
+ if ret is not None and len(ret):
+ if ret[0] == 'ok' and (self.iface == 'wlan0' or self.iface == 'ath0') and iNetwork.getAdapterAttribute(self.iface, "up") is True:
+ try:
+ from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus
+ from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless
+ except ImportError:
+ self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
+ else:
+ ifobj = Wireless(self.iface) # a Wireless NIC Object
+ self.wlanresponse = ifobj.getStatistics()
+ if self.wlanresponse[0] != 19:
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
+ else:
+ # Display Wlan not available Message
+ self.showErrorMessage()
+ else:
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
+ self.updateStatusbar()
+ else:
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
+ self.updateStatusbar()
+
+ def WlanStatusClosed(self, *ret):
+ if ret is not None and len(ret):
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ iStatus.stopWlanConsole()
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
+ self.updateStatusbar()
def WlanScanClosed(self,*ret):
if ret[0] is not None:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1])
else:
- self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,None,ret[0])
-
-
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ iStatus.stopWlanConsole()
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
+ self.updateStatusbar()
+
def restartLan(self, ret = False):
if (ret == True):
- iNetwork.restartNetwork()
+ iNetwork.restartNetwork(self.restartLanDataAvail)
+ self.restartLanRef = self.session.openWithCallback(self.restartfinishedCB, MessageBox, _("Please wait while your network is restarting..."), type = MessageBox.TYPE_INFO, enable_input = False)
+
+ def restartLanDataAvail(self, data):
+ if data is True:
+ iNetwork.getInterfaces(self.getInterfacesDataAvail)
- def getLinkState(self,iface):
- iNetwork.getLinkState(iface,self.dataAvail)
+ def getInterfacesDataAvail(self, data):
+ if data is True:
+ self.restartLanRef.close(True)
+
+ def restartfinishedCB(self,data):
+ if data is True:
+ self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False)
def dataAvail(self,data):
self.output = data.strip()
@@ -693,14 +960,35 @@ class AdapterSetupConfiguration(Screen):
def showErrorMessage(self):
self.session.open(MessageBox, self.errortext, type = MessageBox.TYPE_INFO,timeout = 10 )
-
+
+ def cleanup(self):
+ iNetwork.stopLinkStateConsole()
+ iNetwork.stopDeactivateInterfaceConsole()
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ except ImportError:
+ pass
+ else:
+ iStatus.stopWlanConsole()
+
+ def getInfoCB(self,data,status):
+ if data is not None:
+ if data is True:
+ if status is not None:
+ if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+ self["statuspic"].setPixmapNum(1)
+ else:
+ self["statuspic"].setPixmapNum(0)
+ self["statuspic"].show()
class NetworkAdapterTest(Screen):
def __init__(self, session,iface):
Screen.__init__(self, session)
self.iface = iface
- iNetwork.getInterfaces()
+ self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
self.setLabels()
+ self.onClose.append(self.cleanup)
+ self.onHide.append(self.cleanup)
self["updown_actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
{
@@ -713,8 +1001,8 @@ class NetworkAdapterTest(Screen):
self["shortcuts"] = ActionMap(["ShortcutActions","WizardActions"],
{
- "red": self.close,
- "back": self.close,
+ "red": self.cancel,
+ "back": self.cancel,
}, -2)
self["infoshortcuts"] = ActionMap(["ShortcutActions","WizardActions"],
{
@@ -745,6 +1033,12 @@ class NetworkAdapterTest(Screen):
self.nextStepTimer = eTimer()
self.nextStepTimer.callback.append(self.nextStepTimerFire)
+ def cancel(self):
+ if self.oldInterfaceState is False:
+ iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState)
+ iNetwork.deactivateInterface(self.iface)
+ self.close()
+
def closeInfo(self):
self["shortcuts"].setEnabled(True)
self["infoshortcuts"].setEnabled(False)
@@ -852,6 +1146,7 @@ class NetworkAdapterTest(Screen):
def doStep3(self):
self["Networktext"].setForegroundColorNum(1)
+ self["Network"].setText(_("Please wait..."))
self.getLinkState(self.iface)
self["NetworkInfo_Text"].setForegroundColorNum(1)
self.steptimer = True
@@ -874,48 +1169,15 @@ class NetworkAdapterTest(Screen):
def doStep5(self):
self["IPtext"].setForegroundColorNum(1)
- ret = iNetwork.checkNetworkState()
- if ret == True:
- self["IP"].setForegroundColorNum(2)
- self["IP"].setText(_("confirmed"))
- self["IPInfo_Check"].setPixmapNum(0)
- else:
- self["IP"].setForegroundColorNum(1)
- self["IP"].setText(_("unconfirmed"))
- self["IPInfo_Check"].setPixmapNum(1)
- self["IPInfo_Check"].show()
- self["IPInfo_Text"].setForegroundColorNum(1)
- self.steptimer = True
- self.nextStepTimer.start(3000)
+ self["IP"].setText(_("Please wait..."))
+ iNetwork.checkNetworkState(self.NetworkStatedataAvail)
def doStep6(self):
self.steptimer = False
self.nextStepTimer.stop()
self["DNStext"].setForegroundColorNum(1)
- ret = iNetwork.checkDNSLookup()
- if ret == True:
- self["DNS"].setForegroundColorNum(2)
- self["DNS"].setText(_("confirmed"))
- self["DNSInfo_Check"].setPixmapNum(0)
- else:
- self["DNS"].setForegroundColorNum(1)
- self["DNS"].setText(_("unconfirmed"))
- self["DNSInfo_Check"].setPixmapNum(1)
- self["DNSInfo_Check"].show()
- self["DNSInfo_Text"].setForegroundColorNum(1)
-
- self["EditSettings_Text"].show()
- self["EditSettingsButton"].setPixmapNum(1)
- self["EditSettings_Text"].setForegroundColorNum(2) # active
- self["EditSettingsButton"].show()
- self["ButtonYellow_Check"].setPixmapNum(1)
- self["ButtonGreentext"].setText(_("Restart test"))
- self["ButtonGreen_Check"].setPixmapNum(0)
- self["shortcutsgreen"].setEnabled(False)
- self["shortcutsgreen_restart"].setEnabled(True)
- self["shortcutsyellow"].setEnabled(False)
- self["updown_actions"].setEnabled(True)
- self.activebutton = 6
+ self["DNS"].setText(_("Please wait..."))
+ iNetwork.checkDNSLookup(self.DNSLookupdataAvail)
def KeyGreen(self):
self["shortcutsgreen"].setEnabled(False)
@@ -1057,28 +1319,18 @@ class NetworkAdapterTest(Screen):
def getLinkState(self,iface):
if iface == 'wlan0' or iface == 'ath0':
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
- w = Wlan(iface)
- stats = w.getStatus()
- if stats['BSSID'] == "00:00:00:00:00:00":
- self["Network"].setForegroundColorNum(1)
- self["Network"].setText(_("disconnected"))
- self["NetworkInfo_Check"].setPixmapNum(1)
- self["NetworkInfo_Check"].show()
- else:
- self["Network"].setForegroundColorNum(2)
- self["Network"].setText(_("connected"))
- self["NetworkInfo_Check"].setPixmapNum(0)
- self["NetworkInfo_Check"].show()
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
except:
self["Network"].setForegroundColorNum(1)
self["Network"].setText(_("disconnected"))
self["NetworkInfo_Check"].setPixmapNum(1)
self["NetworkInfo_Check"].show()
+ else:
+ iStatus.getDataForInterface(self.iface,self.getInfoCB)
else:
- iNetwork.getLinkState(iface,self.dataAvail)
+ iNetwork.getLinkState(iface,self.LinkStatedataAvail)
- def dataAvail(self,data):
+ def LinkStatedataAvail(self,data):
self.output = data.strip()
result = self.output.split('\n')
pattern = re_compile("Link detected: yes")
@@ -1093,4 +1345,66 @@ class NetworkAdapterTest(Screen):
self["NetworkInfo_Check"].setPixmapNum(1)
self["NetworkInfo_Check"].show()
+ def NetworkStatedataAvail(self,data):
+ if data <= 2:
+ self["IP"].setForegroundColorNum(2)
+ self["IP"].setText(_("confirmed"))
+ self["IPInfo_Check"].setPixmapNum(0)
+ else:
+ self["IP"].setForegroundColorNum(1)
+ self["IP"].setText(_("unconfirmed"))
+ self["IPInfo_Check"].setPixmapNum(1)
+ self["IPInfo_Check"].show()
+ self["IPInfo_Text"].setForegroundColorNum(1)
+ self.steptimer = True
+ self.nextStepTimer.start(3000)
+
+ def DNSLookupdataAvail(self,data):
+ if data <= 2:
+ self["DNS"].setForegroundColorNum(2)
+ self["DNS"].setText(_("confirmed"))
+ self["DNSInfo_Check"].setPixmapNum(0)
+ else:
+ self["DNS"].setForegroundColorNum(1)
+ self["DNS"].setText(_("unconfirmed"))
+ self["DNSInfo_Check"].setPixmapNum(1)
+ self["DNSInfo_Check"].show()
+ self["DNSInfo_Text"].setForegroundColorNum(1)
+ self["EditSettings_Text"].show()
+ self["EditSettingsButton"].setPixmapNum(1)
+ self["EditSettings_Text"].setForegroundColorNum(2) # active
+ self["EditSettingsButton"].show()
+ self["ButtonYellow_Check"].setPixmapNum(1)
+ self["ButtonGreentext"].setText(_("Restart test"))
+ self["ButtonGreen_Check"].setPixmapNum(0)
+ self["shortcutsgreen"].setEnabled(False)
+ self["shortcutsgreen_restart"].setEnabled(True)
+ self["shortcutsyellow"].setEnabled(False)
+ self["updown_actions"].setEnabled(True)
+ self.activebutton = 6
+ def getInfoCB(self,data,status):
+ if data is not None:
+ if data is True:
+ if status is not None:
+ if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+ self["Network"].setForegroundColorNum(1)
+ self["Network"].setText(_("disconnected"))
+ self["NetworkInfo_Check"].setPixmapNum(1)
+ self["NetworkInfo_Check"].show()
+ else:
+ self["Network"].setForegroundColorNum(2)
+ self["Network"].setText(_("connected"))
+ self["NetworkInfo_Check"].setPixmapNum(0)
+ self["NetworkInfo_Check"].show()
+
+ def cleanup(self):
+ iNetwork.stopLinkStateConsole()
+ iNetwork.stopDNSConsole()
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ except ImportError:
+ pass
+ else:
+ iStatus.stopWlanConsole()
+
diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py
index ccb776ea..6489f28f 100644
--- a/lib/python/Screens/Satconfig.py
+++ b/lib/python/Screens/Satconfig.py
@@ -14,16 +14,21 @@ from datetime import datetime
class NimSetup(Screen, ConfigListScreen):
def createSimpleSetup(self, list, mode):
+ nim = self.nimConfig
if mode == "single":
- list.append(getConfigListEntry(_("Satellite"), self.nimConfig.diseqcA))
+ list.append(getConfigListEntry(_("Satellite"), nim.diseqcA))
+ list.append(getConfigListEntry(_("Send DiSEqC"), nim.simpleSingleSendDiSEqC))
else:
- list.append(getConfigListEntry(_("Port A"), self.nimConfig.diseqcA))
+ list.append(getConfigListEntry(_("Port A"), nim.diseqcA))
if mode in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
- list.append(getConfigListEntry(_("Port B"), self.nimConfig.diseqcB))
+ list.append(getConfigListEntry(_("Port B"), nim.diseqcB))
if mode == "diseqc_a_b_c_d":
- list.append(getConfigListEntry(_("Port C"), self.nimConfig.diseqcC))
- list.append(getConfigListEntry(_("Port D"), self.nimConfig.diseqcD))
+ list.append(getConfigListEntry(_("Port C"), nim.diseqcC))
+ list.append(getConfigListEntry(_("Port D"), nim.diseqcD))
+ if mode != "toneburst_a_b":
+ list.append(getConfigListEntry(_("Set Voltage and 22KHz"), nim.simpleDiSEqCSetVoltageTone))
+ list.append(getConfigListEntry(_("Send DiSEqC only on satellite change"), nim.simpleDiSEqCOnlyOnSatChange))
def createPositionerSetup(self, list):
nim = self.nimConfig
@@ -88,7 +93,7 @@ class NimSetup(Screen, ConfigListScreen):
self.list.append(self.configMode)
if self.nimConfig.configMode.value == "simple": #simple setup
- self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), self.nimConfig.diseqcMode)
+ self.diseqcModeEntry = getConfigListEntry(_("Mode"), self.nimConfig.diseqcMode)
self.list.append(self.diseqcModeEntry)
if self.nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
@@ -407,12 +412,17 @@ class NimSelection(Screen):
text = _("nothing connected")
elif nimConfig.configMode.value == "simple":
if nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
- text = _("Sats") + ": " + nimmanager.getSatName(int(nimConfig.diseqcA.value))
+ text = _("Sats") + ": "
+ if nimConfig.diseqcA.orbital_position != 3601:
+ text += nimmanager.getSatName(int(nimConfig.diseqcA.value))
if nimConfig.diseqcMode.value in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
- text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value))
+ if nimConfig.diseqcB.orbital_position != 3601:
+ text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value))
if nimConfig.diseqcMode.value == "diseqc_a_b_c_d":
- text += "," + nimmanager.getSatName(int(nimConfig.diseqcC.value))
- text += "," + nimmanager.getSatName(int(nimConfig.diseqcD.value))
+ if nimConfig.diseqcC.orbital_position != 3601:
+ text += "," + nimmanager.getSatName(int(nimConfig.diseqcC.value))
+ if nimConfig.diseqcD.orbital_position != 3601:
+ text += "," + nimmanager.getSatName(int(nimConfig.diseqcD.value))
elif nimConfig.diseqcMode.value == "positioner":
text = _("Positioner") + ":"
if nimConfig.positionerMode.value == "usals":
diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py
index ab110a24..608dcb2d 100644
--- a/lib/python/Screens/ScanSetup.py
+++ b/lib/python/Screens/ScanSetup.py
@@ -394,8 +394,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation)
self.list.append(self.modulationEntry)
self.list.append(getConfigListEntry(_('Rolloff'), self.scan_sat.rolloff))
- if self.scan_sat.modulation.value == "8psk":
- self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
+ self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
elif self.scan_type.value == "single_satellite":
self.updateSatList()
print self.scan_satselection[index_to_scan]
diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py
index 800bab33..aae345db 100644
--- a/lib/python/Screens/TimerEdit.py
+++ b/lib/python/Screens/TimerEdit.py
@@ -317,6 +317,7 @@ class TimerSanityConflict(Screen):
EMPTY = 0
ENABLE = 1
DISABLE = 2
+ EDIT = 3
def __init__(self, session, timer):
Screen.__init__(self, session)
@@ -338,10 +339,11 @@ class TimerSanityConflict(Screen):
self["key_red"] = Button("Edit")
self["key_green"] = Button(" ")
- self["key_yellow"] = Button("Edit")
+ self["key_yellow"] = Button(" ")
self["key_blue"] = Button(" ")
self.key_green_choice = self.EMPTY
+ self.key_yellow_choice = self.EMPTY
self.key_blue_choice = self.EMPTY
self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ShortcutActions", "TimerEditActions"],
@@ -415,9 +417,14 @@ class TimerSanityConflict(Screen):
self["actions"].actions.update({"green":self.toggleTimer1})
self["key_green"].setText(_("Disable"))
self.key_green_choice = self.DISABLE
+
if len(self.timer) > 1:
x = self["list"].getSelectedIndex()
if self.timer[x] is not None:
+ if self.key_yellow_choice == self.EMPTY:
+ self["actions"].actions.update({"yellow":self.editTimer2})
+ self["key_yellow"].setText(_("Edit"))
+ self.key_yellow_choice = self.EDIT
if self.timer[x].disabled and self.key_blue_choice != self.ENABLE:
self["actions"].actions.update({"blue":self.toggleTimer2})
self["key_blue"].setText(_("Enable"))
@@ -432,9 +439,11 @@ class TimerSanityConflict(Screen):
self.key_blue_choice = self.DISABLE
else:
#FIXME.... this doesnt hide the buttons self.... just the text
- self.removeAction("yellow")
- self["key_yellow"].setText(" ")
- self.key_yellow_choice = self.EMPTY
- self.removeAction("blue")
- self["key_blue"].setText(" ")
- self.key_blue_choice = self.EMPTY
+ if self.key_yellow_choice != self.EMPTY:
+ self.removeAction("yellow")
+ self["key_yellow"].setText(" ")
+ self.key_yellow_choice = self.EMPTY
+ if self.key_blue_choice != self.EMPTY:
+ self.removeAction("blue")
+ self["key_blue"].setText(" ")
+ self.key_blue_choice = self.EMPTY
diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py
index c4dfff72..1774061d 100644
--- a/lib/python/Screens/TimerEntry.py
+++ b/lib/python/Screens/TimerEntry.py
@@ -8,6 +8,7 @@ from Components.MenuList import MenuList
from Components.Button import Button
from Components.Label import Label
from Components.Pixmap import Pixmap
+from Screens.MovieSelection import getPreferredTagEditor
from Screens.LocationBox import MovieLocationBox
from Screens.ChoiceBox import ChoiceBox
from RecordTimer import AFTEREVENT
@@ -21,8 +22,7 @@ class TimerEntry(Screen, ConfigListScreen):
Screen.__init__(self, session)
self.timer = timer
- self.entryStartDate = None
- self.entryEndDate = None
+ self.entryDate = None
self.entryService = None
self["oktext"] = Label(_("OK"))
@@ -88,13 +88,13 @@ class TimerEntry(Screen, ConfigListScreen):
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
+ self.timerentry_tags = self.timer.tags + []
+ self.timerentry_tagsset = ConfigSelection(choices = [len(self.timerentry_tags) == 0 and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
- self.timerentry_startdate = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
+ self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
-
- self.timerentry_enddate = ConfigDateTime(default = self.timer.end, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
default = self.timer.dirname or resolveFilename(SCOPE_HDD)
@@ -120,19 +120,6 @@ class TimerEntry(Screen, ConfigListScreen):
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
- self.timerentry_startdate.addNotifier(self.checkDate)
- self.timerentry_enddate.addNotifier(self.checkDate)
-
- def checkDate(self, configElement):
- if configElement is self.timerentry_startdate:
- if self.timerentry_enddate.value < self.timerentry_startdate.value:
- self.timerentry_enddate.value = self.timerentry_startdate.value
- self["config"].invalidate(self.entryEndDate)
- if configElement is self.timerentry_enddate:
- if (self.timerentry_enddate.value < self.timerentry_startdate.value):
- self.timerentry_startdate.value = self.timerentry_enddate.value
- self["config"].invalidate(self.entryStartDate)
-
def createSetup(self, widget):
self.list = []
self.list.append(getConfigListEntry(_("Name"), self.timerentry_name))
@@ -165,34 +152,24 @@ class TimerEntry(Screen, ConfigListScreen):
self.list.append(getConfigListEntry(_("Saturday"), self.timerentry_day[5]))
self.list.append(getConfigListEntry(_("Sunday"), self.timerentry_day[6]))
- #self.list.append(getConfigListEntry("StartDate", self.timerentry_startdate))
-# self.list.append(getConfigListEntry("Weekday", self.timerentry_weekday))
-
- self.entryStartDate = getConfigListEntry(_("Start"), self.timerentry_startdate)
- if self.timerentry_type.value == "once":
- self.list.append(self.entryStartDate)
- self.list.append(getConfigListEntry(" ", self.timerentry_starttime))
- else:
- self.list.append(getConfigListEntry(_("StartTime"), self.timerentry_starttime))
-
- self.entryEndDate = getConfigListEntry(_("End"), self.timerentry_enddate)
+ self.entryDate = getConfigListEntry(_("Date"), self.timerentry_date)
if self.timerentry_type.value == "once":
- if self.timerentry_justplay.value != "zap":
- self.list.append(self.entryEndDate)
- self.list.append(getConfigListEntry(" ", self.timerentry_endtime))
- else:
- if self.timerentry_justplay.value != "zap":
- self.list.append(getConfigListEntry(_("EndTime"), self.timerentry_endtime))
+ self.list.append(self.entryDate)
+ self.list.append(getConfigListEntry(_("StartTime"), self.timerentry_starttime))
+ if self.timerentry_justplay.value != "zap":
+ self.list.append(getConfigListEntry(_("EndTime"), self.timerentry_endtime))
+ self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service)
+ self.list.append(self.channelEntry)
+ self.dirname = getConfigListEntry(_("Location"), self.timerentry_dirname)
+ self.tagsSet = getConfigListEntry(_("Tags"), self.timerentry_tagsset)
if self.timerentry_justplay.value != "zap":
if config.usage.setup_level.index >= 2: # expert+
- self.dirname = getConfigListEntry(_("Location"), self.timerentry_dirname)
self.list.append(self.dirname)
+ if getPreferredTagEditor():
+ self.list.append(self.tagsSet)
self.list.append(getConfigListEntry(_("After event"), self.timerentry_afterevent))
- self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service)
- self.list.append(self.channelEntry)
-
self[widget].list = self.list
self[widget].l.setList(self.list)
@@ -206,14 +183,14 @@ class TimerEntry(Screen, ConfigListScreen):
self.createSetup("config")
def keyLeft(self):
- if self["config"].getCurrent() is self.channelEntry:
+ if self["config"].getCurrent() in [self.channelEntry, self.tagsSet]:
self.keySelect()
else:
ConfigListScreen.keyLeft(self)
self.newConfig()
def keyRight(self):
- if self["config"].getCurrent() is self.channelEntry:
+ if self["config"].getCurrent() in [self.channelEntry, self.tagsSet]:
self.keySelect()
else:
ConfigListScreen.keyRight(self)
@@ -235,6 +212,12 @@ class TimerEntry(Screen, ConfigListScreen):
self.timerentry_dirname.value,
minFree = 100 # We require at least 100MB free space
)
+ elif getPreferredTagEditor() and cur == self.tagsSet:
+ self.session.openWithCallback(
+ self.tagEditFinished,
+ getPreferredTagEditor(),
+ self.timerentry_tags
+ )
else:
self.keyGo()
@@ -249,24 +232,15 @@ class TimerEntry(Screen, ConfigListScreen):
dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
return int(mktime(dt.timetuple()))
- def buildRepeatedBegin(self, rep_time, start_time):
- d = localtime(rep_time)
- dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, start_time[0], start_time[1])
- return int(mktime(dt.timetuple()))
-
def getBeginEnd(self):
- enddate = self.timerentry_enddate.value
+ date = self.timerentry_date.value
endtime = self.timerentry_endtime.value
-
- startdate = self.timerentry_startdate.value
starttime = self.timerentry_starttime.value
- begin = self.getTimestamp(startdate, starttime)
- end = self.getTimestamp(enddate, endtime)
+ begin = self.getTimestamp(date, starttime)
+ end = self.getTimestamp(date, endtime)
- # because of the dateChecks, startdate can't be < enddate.
- # however, the endtime can be less than the starttime.
- # in this case, add 1 day.
+ # if the endtime is less than the starttime, add 1 day.
if end < begin:
end += 86400
return begin, end
@@ -278,6 +252,7 @@ class TimerEntry(Screen, ConfigListScreen):
self.timer.resetRepeated()
self.timer.afterEvent = {"nothing": AFTEREVENT.NONE, "deepstandby": AFTEREVENT.DEEPSTANDBY, "standby": AFTEREVENT.STANDBY}[self.timerentry_afterevent.value]
self.timer.service_ref = self.timerentry_service_ref
+ self.timer.tags = self.timerentry_tags
self.timer.dirname = self.timerentry_dirname.value
config.movielist.last_timer_videodir.value = self.timer.dirname
@@ -352,6 +327,12 @@ class TimerEntry(Screen, ConfigListScreen):
self.timerentry_dirname.setChoices(config.movielist.videodirs.value, default=res)
self.timerentry_dirname.value = res
+ def tagEditFinished(self, ret):
+ if ret is not None:
+ self.timerentry_tags = ret
+ self.timerentry_tagsset.setChoices([len(ret) == 0 and "None" or " ".join(ret)])
+ self["config"].invalidate(self.tagsSet)
+
class TimerLog(Screen):
def __init__(self, session, timer):
Screen.__init__(self, session)
diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py
new file mode 100755
index 00000000..53970ab8
--- /dev/null
+++ b/lib/python/Screens/VirtualKeyBoard.py
@@ -0,0 +1,287 @@
+# -*- coding: iso-8859-1 -*-
+from Components.Language import language
+from Components.ActionMap import ActionMap
+from Components.Label import Label
+from Components.Pixmap import Pixmap
+from Components.MenuList import MenuList
+from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
+from enigma import eListboxPythonMultiContent, gFont, loadPNG, RT_HALIGN_CENTER, RT_VALIGN_CENTER
+from Screen import Screen
+from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+
+key_backspace = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png"))
+key_bg = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png"))
+key_clr = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png"))
+key_esc = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png"))
+key_ok = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png"))
+key_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png"))
+key_shift = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png"))
+key_shift_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png"))
+key_space = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png"))
+
+class VirtualKeyBoardList(MenuList):
+ def __init__(self, list, enableWrapAround=False):
+ MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
+ self.l.setFont(0, gFont("Regular", 22))
+ self.l.setItemHeight(45)
+
+def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):
+ res = [ (keys) ]
+
+ x = 0
+ count = 0
+ if shiftMode:
+ shiftkey_png = key_shift_sel
+ else:
+ shiftkey_png = key_shift
+ for key in keys:
+ if key == "EXIT":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc))
+ elif key == "BACKSPACE":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace))
+ elif key == "CLEAR":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr))
+ elif key == "SHIFT":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png))
+ elif key == "SPACE":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space))
+ elif key == "OK":
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok))
+ #elif key == "<-":
+ # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left))
+ #elif key == "->":
+ # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right))
+
+ else:
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_bg))
+ res.append(MultiContentEntryText(pos=(x, 0), size=(45, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER))
+
+ if selectedKey == count:
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_sel))
+
+ x += 45
+ count += 1
+
+ return res
+
+
+class VirtualKeyBoard(Screen):
+
+ def __init__(self, session, title="", text=""):
+ Screen.__init__(self, session)
+ self.keys_list = []
+ self.shiftkeys_list = []
+ self.lang = language.getLanguage()
+ if self.lang == 'de_DE':
+ self.keys_list = [
+ [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+ [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ü", u"+"],
+ [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
+ [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"@", u"ß", u"OK"]]
+
+ self.shiftkeys_list = [
+ [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+ [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ü", u"*"],
+ [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
+ [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]]
+
+ elif self.lang == 'es_ES':
+ #still missing keys (u"ùÙ")
+ self.keys_list = [
+ [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+ [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ú", u"+"],
+ [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ó", u"á", u"#"],
+ [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"@", u"£", u"à", u"é", u"è", u"í", u"ì", u"ñ", u"ò", u"OK"]]
+
+ self.shiftkeys_list = [
+ [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+ [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ú", u"*"],
+ [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ó", u"Á", u"'"],
+ [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"?", u"\\", u"À", u"É", u"È", u"Í", u"Ì", u"Ñ", u"Ò", u"OK"]]
+
+ elif self.lang in ['sv_SE', 'fi_FI']:
+ self.keys_list = [
+ [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+ [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"é", u"+"],
+ [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
+ [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"@", u"ß", u"å", u"OK"]]
+
+ self.shiftkeys_list = [
+ [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+ [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],
+ [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
+ [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]
+ else:
+ self.keys_list = [
+ [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
+ [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"],
+ [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"],
+ [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"OK"]]
+
+ self.shiftkeys_list = [
+ [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
+ [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"],
+ [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"],
+ [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
+ [u"SHIFT", u"SPACE", u"OK"]]
+
+ self.shiftMode = False
+ self.text = text
+ self.selectedKey = 0
+
+ self["header"] = Label(title)
+ self["text"] = Label(self.text)
+ self["list"] = VirtualKeyBoardList([])
+
+ self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"],
+ {
+ "ok": self.okClicked,
+ "cancel": self.exit,
+ "left": self.left,
+ "right": self.right,
+ "up": self.up,
+ "down": self.down,
+ "red": self.backClicked,
+ "green": self.ok
+ }, -2)
+
+ self.onLayoutFinish.append(self.buildVirtualKeyBoard)
+
+ def buildVirtualKeyBoard(self, selectedKey=0):
+ list = []
+
+ if self.shiftMode:
+ self.k_list = self.shiftkeys_list
+ for keys in self.k_list:
+ if selectedKey < 12 and selectedKey > -1:
+ list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True))
+ else:
+ list.append(VirtualKeyBoardEntryComponent(keys, -1,True))
+ selectedKey -= 12
+ else:
+ self.k_list = self.keys_list
+ for keys in self.k_list:
+ if selectedKey < 12 and selectedKey > -1:
+ list.append(VirtualKeyBoardEntryComponent(keys, selectedKey))
+ else:
+ list.append(VirtualKeyBoardEntryComponent(keys, -1))
+ selectedKey -= 12
+
+ self["list"].setList(list)
+
+
+ def backClicked(self):
+ self.text = self["text"].getText()[:-1]
+ self["text"].setText(self.text)
+
+ def okClicked(self):
+ if self.shiftMode:
+ list = self.shiftkeys_list
+ else:
+ list = self.keys_list
+
+ selectedKey = self.selectedKey
+
+ for x in list:
+ if selectedKey < 12:
+ text = x[selectedKey]
+ break
+ else:
+ selectedKey -= 12
+
+ text = text.encode("utf-8")
+
+ if text == "EXIT":
+ self.close(None)
+
+ elif text == "BACKSPACE":
+ self.text = self["text"].getText()[:-1]
+ self["text"].setText(self.text)
+
+ elif text == "CLEAR":
+ self.text = ""
+ self["text"].setText(self.text)
+
+ elif text == "SHIFT":
+ if self.shiftMode:
+ self.shiftMode = False
+ else:
+ self.shiftMode = True
+
+ self.buildVirtualKeyBoard(self.selectedKey)
+
+ elif text == "SPACE":
+ self.text += " "
+ self["text"].setText(self.text)
+
+ elif text == "OK":
+ self.close(self["text"].getText())
+
+ else:
+ self.text = self["text"].getText()
+ self.text += text
+ self["text"].setText(self.text)
+
+ def ok(self):
+ self.close(self["text"].getText())
+
+ def exit(self):
+ self.close(None)
+
+ def left(self):
+ self.selectedKey -= 1
+
+ if self.selectedKey == -1:
+ self.selectedKey = 11
+ elif self.selectedKey == 11:
+ self.selectedKey = 23
+ elif self.selectedKey == 23:
+ self.selectedKey = 35
+ elif self.selectedKey == 35:
+ self.selectedKey = 47
+ elif self.selectedKey == 47:
+ self.selectedKey = 59
+
+ self.showActiveKey()
+
+ def right(self):
+ self.selectedKey += 1
+
+ if self.selectedKey == 12:
+ self.selectedKey = 0
+ elif self.selectedKey == 24:
+ self.selectedKey = 12
+ elif self.selectedKey == 36:
+ self.selectedKey = 24
+ elif self.selectedKey == 48:
+ self.selectedKey = 36
+ elif self.selectedKey == 60:
+ self.selectedKey = 48
+
+ self.showActiveKey()
+
+ def up(self):
+ self.selectedKey -= 12
+
+ if self.selectedKey < 0:
+ self.selectedKey += 60
+
+ self.showActiveKey()
+
+ def down(self):
+ self.selectedKey += 12
+
+ if self.selectedKey > 59:
+ self.selectedKey -= 60
+
+ self.showActiveKey()
+
+ def showActiveKey(self):
+ self.buildVirtualKeyBoard(self.selectedKey)
diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py
index cee057dc..23d6253a 100644
--- a/lib/python/Screens/Wizard.py
+++ b/lib/python/Screens/Wizard.py
@@ -84,7 +84,7 @@ class Wizard(Screen):
timeoutstep = str(attrs.get('timeoutstep'))
else:
timeoutstep = ''
- self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "nextstep": nextstep}
+ self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep}
elif (name == "text"):
self.wizard[self.lastStep]["text"] = string.replace(str(attrs.get('value')), "\\n", "\n")
elif (name == "displaytext"):
@@ -119,6 +119,7 @@ class Wizard(Screen):
if (attrs.has_key('evaluation')):
self.wizard[self.lastStep]["config"]["evaluation"] = str(attrs.get('evaluation'))
elif (name == "code"):
+ self.async_code = attrs.has_key('async') and str(attrs.get('async')) == "yes"
if attrs.has_key('pos') and str(attrs.get('pos')) == "after":
self.codeafter = True
else:
@@ -129,10 +130,16 @@ class Wizard(Screen):
def endElement(self, name):
self.currContent = ""
if name == 'code':
- if self.codeafter:
- self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"].strip()
+ if self.async_code:
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"].strip()
+ else:
+ self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"].strip()
else:
- self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"].strip()
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"].strip()
+ else:
+ self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"].strip()
elif name == 'condition':
self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"].strip()
elif name == 'step':
@@ -141,13 +148,19 @@ class Wizard(Screen):
def characters(self, ch):
if self.currContent == "code":
- if self.codeafter:
- self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"] + ch
+ if self.async_code:
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"] + ch
+ else:
+ self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"] + ch
else:
- self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"] + ch
+ else:
+ self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch
elif self.currContent == "condition":
self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"] + ch
-
+
def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True):
Screen.__init__(self, session)
@@ -312,21 +325,24 @@ class Wizard(Screen):
else:
self.currStep = self.getStepWithID(nextStep)
+ print_now = True
if ((currStep == self.numSteps and self.wizard[currStep]["nextstep"] is None) or self.wizard[currStep]["id"] == "end"): # wizard finished
print "wizard finished"
self.markDone()
self.close()
else:
+ self.codeafter = True
self.runCode(self.wizard[currStep]["codeafter"])
- if self.wizard[currStep]["nextstep"] is not None:
- self.currStep = self.getStepWithID(self.wizard[currStep]["nextstep"])
- if gotoStep is not None:
- self.currStep = self.getStepWithID(gotoStep)
- self.currStep += 1
- self.updateValues()
-
- print "Now: " + str(self.currStep)
+ self.prevStep = currStep
+ self.gotoStep = gotoStep
+ if not self.runCode(self.wizard[currStep]["codeafter_async"]):
+ self.afterAsyncCode()
+ else:
+ if self.updateValues in self.onShown:
+ self.onShown.remove(self.updateValues)
+ if print_now:
+ print "Now: " + str(self.currStep)
def ok(self):
print "OK"
@@ -341,7 +357,8 @@ class Wizard(Screen):
# for this. If there is one, please do a more specific check
# and/or a comment in which situation there is no run()
if callable(getattr(self.configInstance, "runAsync", None)):
- self.onShown.remove(self.updateValues)
+ if self.updateValues in self.onShown:
+ self.onShown.remove(self.updateValues)
self.configInstance.runAsync(self.finished)
return
else:
@@ -371,7 +388,7 @@ class Wizard(Screen):
def up(self):
self.resetCounter()
if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"):
- self["config"].instance.moveSelection(self["config"].instance.moveUp)
+ self["config"].instance.moveSelection(self["config"].instance.moveUp)
elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
self["list"].selectPrevious()
if self.wizard[self.currStep].has_key("onselect"):
@@ -415,7 +432,9 @@ class Wizard(Screen):
if code != "":
print "code", code
exec(code)
-
+ return True
+ return False
+
def getTranslation(self, text):
return _(text)
@@ -445,10 +464,13 @@ class Wizard(Screen):
del self.configInstance["config"]
self.configInstance.doClose()
self.configInstance = None
-
+
self.condition = True
exec (self.wizard[self.currStep]["condition"])
- if self.condition:
+ if not self.condition:
+ self.currStep += 1
+ self.updateValues()
+ else:
if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep:
self.stepHistory.append(self.currStep)
print "wizard step:", self.wizard[self.currStep]
@@ -470,8 +492,27 @@ class Wizard(Screen):
for x in self.lcdCallbacks:
x(displaytext)
+ self.codeafter=False
self.runCode(self.wizard[self.currStep]["code"])
-
+ if self.runCode(self.wizard[self.currStep]["code_async"]):
+ if self.updateValues in self.onShown:
+ self.onShown.remove(self.updateValues)
+ else:
+ self.afterAsyncCode()
+
+ def afterAsyncCode(self):
+ if not self.updateValues in self.onShown:
+ self.onShown.append(self.updateValues)
+
+ if self.codeafter:
+ if self.wizard[self.prevStep]["nextstep"] is not None:
+ self.currStep = self.getStepWithID(self.wizard[self.prevStep]["nextstep"])
+ if self.gotoStep is not None:
+ self.currStep = self.getStepWithID(self.gotoStep)
+ self.currStep += 1
+ self.updateValues()
+ print "Now: " + str(self.currStep)
+ else:
if self.showList:
print "showing list,", self.currStep
for renderer in self.renderer:
@@ -482,7 +523,7 @@ class Wizard(Screen):
print "setZPosition"
rootrenderer.instance.setZPosition(1)
renderer = renderer.source
-
+
#self["list"].instance.setZPosition(1)
self.list = []
if (self.wizard[self.currStep].has_key("dynamiclist")):
@@ -524,7 +565,7 @@ class Wizard(Screen):
self["config"].l.setList(self.configInstance["config"].list)
callbacks = self.configInstance["config"].onSelectionChanged
self.configInstance["config"].destroy()
- print "clearConfigList", self.configInstance["config"], self["config"]
+ print "clearConfigList", self.configInstance["config"], self["config"]
self.configInstance["config"] = self["config"]
self.configInstance["config"].onSelectionChanged = callbacks
print "clearConfigList", self.configInstance["config"], self["config"]
@@ -533,10 +574,7 @@ class Wizard(Screen):
else:
if self.has_key("config"):
self["config"].hide()
- else: # condition false
- self.currStep += 1
- self.updateValues()
-
+
def timeoutCounterFired(self):
self.timeoutCounter -= 1
print "timeoutCounter:", self.timeoutCounter