def keyCancel(self):
		self.step = self.step in (2, 5) and 1 or self.step in (3, 4) and 2
		if self.step:
			self.setScreen()
		else:
			setConfiguredPosition()
			self.close()
	def keyGo(self):
		if self.step == 1:
			self.step = self.yes_no.value and 5 or 2
		elif self.step == 2:
			self.step = self.yes_no.value and 5 or os.path.exists("/proc/stb/fb/dst_left") and 3 or 4
		elif self.step == 3:
			self.save_new_position = True
			self.step = 5
		elif self.step == 4:
			self.step = self.yes_no.value and 6 or 5
		elif self.step == 5:
			if self.yes_no.value:
				if self.save_new_position:
					config.plugins.OSDPositionSetup.dst_left.value = self.dst_left.value
					config.plugins.OSDPositionSetup.dst_width.value = self.dst_right.value - self.dst_left.value
					config.plugins.OSDPositionSetup.dst_top.value = self.dst_top.value
					config.plugins.OSDPositionSetup.dst_height.value = self.dst_bottom.value - self.dst_top.value
				else:
					config.plugins.OSDPositionSetup.dst_left.value = 0
					config.plugins.OSDPositionSetup.dst_width.value = 720
					config.plugins.OSDPositionSetup.dst_top.value = 0
					config.plugins.OSDPositionSetup.dst_height.value = 576
				config.misc.do_overscanwizard.value = False
				config.save()
				setConfiguredPosition()
				self.close()
			else:
				self.step = 1
		self.setScreen()
	def setScreen(self):
		self.list = []
		if self.step == 1:
			self["introduction"].setText(_("The overscan wizard helps you to setup your TV in the correct way.\n\n"
				"For the majority of TV's, the factory default is to have overscan enabled. "
				"This means you are always watching a \"zoomed in\" picture instead of real HD, and parts of the user inferface (skin) may be invisible.\n\n"
				"The yellow area means a 5% border area of a full HD picture will be invisible.\n"
				"The green area means a 10% border area of a full HD picture will be invisible.\n\n"
				"In other words, if the yellow box meets all for sides of your screen, then you have at least 5% overscan on all sides.\n\n"
				"If you see the tips of all eight arrowheads, then your TV has overscan disabled.\n\n"
				"Test Pattern by TigerDave - www.tigerdave.com/ht_menu.htm"))
			self.yes_no = ConfigYesNo(default = True)
			self.list.append(getConfigListEntry(_("Did you see all eight arrow heads?"), self.yes_no))
			self.save_new_position = False
			setPosition(0, 720, 0, 576)
		elif self.step == 2:
			self.Timer.stop()
			self["title"].setText(_("Overscan wizard"))
			self["introduction"].setText(_("It seems you did not see all the eight arrow heads. This means your TV is "
				"has overscan enabled, and is not configured properly.\n\n"
				"Please refer to your TVs manual to find how you can disable overscan on your TV. Look for terms like 'Just fit', 'Full width', etc. "
				"If you can't find it, ask other users at http://forums.openpli.org.\n\n"))
			self.list.append(getConfigListEntry(_("Did you see all eight arrow heads?"), self.yes_no))
			self.yes_no.value = True
			self.save_new_position = False
			setPosition(0, 720, 0, 576)
		elif self.step == 3:
			self["introduction"].setText(_("You did not see all eight arrow heads. This means your TV has overscan enabled "
				"and presents you with a zoomed-in picture, causing you to loose part of a full HD screen. In addition this "
				"you may also miss parts of the user interface, for example volume bars and more.\n\n"
				"You can now try to resize and change the position of the user interface until you see the eight arrow heads.\n\n"
				"When done press OK.\n\n"))
			self.dst_left = ConfigSlider(default = config.plugins.OSDPositionSetup.dst_left.value, increment = 1, limits = (0, 720))
			self.dst_right = ConfigSlider(default = config.plugins.OSDPositionSetup.dst_left.value + config.plugins.OSDPositionSetup.dst_width.value, increment = 1, limits = (0, 720))
			self.dst_top = ConfigSlider(default = config.plugins.OSDPositionSetup.dst_top.value, increment = 1, limits = (0, 576))
			self.dst_bottom = ConfigSlider(default = config.plugins.OSDPositionSetup.dst_top.value + config.plugins.OSDPositionSetup.dst_height.value, increment = 1, limits = (0, 576))
			self.list.append(getConfigListEntry(_("left"), self.dst_left))
			self.list.append(getConfigListEntry(_("right"), self.dst_right))
			self.list.append(getConfigListEntry(_("top"), self.dst_top))
			self.list.append(getConfigListEntry(_("bottom"), self.dst_bottom))
			setConfiguredPosition()
		elif self.step == 4:
			self["introduction"].setText(_("You did not see all eight arrow heads. This means your TV has overscan enabled "
				"and presents you with a zoomed-in picture, causing you to loose part of a full HD screen. In addition this "
				"you may also miss parts of the user interface, for example volume bars and more.\n\n"
				"Unfortunately, your model of receiver is not capable to adjust the dimensions of the user interface. "
				"If not everything is visible, you should change the installed skin to one that supports the overscan area of your TV.\n\n"
				"When you select a different skin, the user interface of your receiver will restart.\n\n"
				"Note: you can always start the Overscan wizard later,  via\n\nmenu->installation->system->Overscan wizard"))
			self.yes_no.value = False
			self.list.append(getConfigListEntry(_("Do you want to select a different skin?"), self.yes_no))
		elif self.step == 5:
			self.Timer.stop()
			self["title"].setText(_("Overscan wizard"))
			self["introduction"].setText(_("The overscan wizard has been completed.\n\n"
				"Note: you can always start the Overscan wizard later,  via\n\nmenu->installation->system->Overscan wizard"))
			self.yes_no.value = True
			self.list.append(getConfigListEntry(_("Do you want to quit the overscan wizard?"), self.yes_no))
		elif self.step == 6:
			config.skin.primary_skin.value = "PLi-HD/skin.xml"
			config.save()
			self["introduction"].setText(_("The user interface of the receiver will now restart to select the selected skin"))
			quitMainloop(3)
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		if self["config"].instance:
			self.__layoutFinished()