コード例 #1
0
	def __init__(self, session):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		self.skinName = ["ConfigScreen", "ConfigListScreen"]

		from plugin import NAME, VERSION, gPushService
		self.setup_title = NAME + " " + _("Configuration") + " " + VERSION

		PushServiceBase.__init__(self)
		if gPushService:
			gPushService.stop()

		# Load local moduls to work on
		self.load()

		# Buttons
		self["key_red"] = StaticText("")
		self["key_green"] = StaticText("")
		self["key_blue"] = StaticText("")
		self["key_yellow"] = StaticText("")

		self.help_window = None

		# Define Actions
		#E2 Bug self["custom_actions"] = HelpableActionMap(self, ["SetupActions", "ColorActions", "PushServiceConfigActions"],
		self["custom_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"pageUp": (self.pageUp, _("Page up")),
			"pageDown": (self.pageDown, _("Page down")),
		}, -2) # higher priority

		self["main_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red": (self.keyCancel, _("Exit without saving")),
			"green": (self.keySave, _("Save and exit")),
		}, -2) # higher priority
		self["main_actions"].setEnabled(False)

		self["main_actions_enabled"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"yellow": (self.showServices, _("Show Services")),
			"blue": (self.showControllers, _("Show Controllers")),
		}, -2) # higher priority
		self["main_actions_enabled"].setEnabled(False)

		self["service_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red": (self.showMain, _("Back to main screen")),
			"green": (self.testService, _("Test selected Service")),
			"yellow": (self.addServices, _("Add Service")),
			"blue": (self.removeServices, _("Remove Service")),
		}, -2) # higher priority
		self["service_actions"].setEnabled(False)

		self["controller_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red": (self.showMain, _("Back to main screen")),
			"green": (self.testController, _("Test selected Controller")),
			"yellow": (self.addControllers, _("Add Controller")),
			"blue": (self.removeControllers, _("Remove Controller")),
		}, -2) # higher priority
		self["controller_actions"].setEnabled(False)

		# Initialize Configuration part
		self.list = []
		self.state = MAIN
		self.build()
		ConfigListScreen.__init__(self, self.list, session=session, on_change=self.change)

		# Override selectionChanged because our config tuples are bigger
		self.onChangedEntry = []

		def selectionChanged():
			current = self["config"].getCurrent()
			if self["config"].current != current:
				if self["config"].current:
					self["config"].current[1].onDeselect(self.session)
				if current:
					current[1].onSelect(self.session)
				self["config"].current = current
			for x in self["config"].onSelectionChanged:
				x()
		self["config"].selectionChanged = selectionChanged

		self.setTitle(self.setup_title)
コード例 #2
0
	def __init__(self, session):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		self.skinName = ["ConfigScreen", "ConfigListScreen"]
		
		from plugin import NAME, VERSION, gPushService
		self.setup_title = NAME + " " + _("Configuration") + " " + VERSION
		
		PushServiceBase.__init__(self)
		if gPushService:
			gPushService.stop()
		
		# Load local moduls to work on
		self.load()
		
		# Buttons
		self["key_red"]    = StaticText("")
		self["key_green"]  = StaticText("")
		self["key_blue"]   = StaticText("")
		self["key_yellow"] = StaticText("")
		
		self.help_window = None
		
		# Define Actions
		#E2 Bug self["custom_actions"] = HelpableActionMap(self, ["SetupActions", "ColorActions", "PushServiceConfigActions"],
		self["custom_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"pageUp":				(self.pageUp,       _("Page up")),
			"pageDown":				(self.pageDown,     _("Page down")),
		}, -2) # higher priority
		
		self["main_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red":					(self.keyCancel,       _("Exit without saving")),
			"green":				(self.keySave,         _("Save and exit")),
		}, -2) # higher priority
		self["main_actions"].setEnabled(False)
		
		self["main_actions_enabled"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"yellow":				(self.showServices,     _("Show Services")),
			"blue":					(self.showControllers,  _("Show Controllers")),
		}, -2) # higher priority
		self["main_actions_enabled"].setEnabled(False)
		
		self["service_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red":					(self.showMain,        _("Back to main screen")),
			"green":				(self.testService,     _("Test selected Service")),
			"yellow":				(self.addServices,     _("Add Service")),
			"blue":					(self.removeServices,  _("Remove Service")),
		}, -2) # higher priority
		self["service_actions"].setEnabled(False)
		
		self["controller_actions"] = HelpableActionMap(self, "PushServiceConfigActions",
		{
			"red":					(self.showMain,            _("Back to main screen")),
			"green":				(self.testController,      _("Test selected Controller")),
			"yellow":				(self.addControllers,      _("Add Controller")),
			"blue": 				(self.removeControllers,   _("Remove Controller")),
		}, -2) # higher priority
		self["controller_actions"].setEnabled(False)
		
		# Initialize Configuration part
		self.list = []
		self.state = MAIN
		self.build()
		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.change)
		
		# Override selectionChanged because our config tuples are bigger
		self.onChangedEntry = [ ]
		def selectionChanged():
			current = self["config"].getCurrent()
			if self["config"].current != current:
				if self["config"].current:
					self["config"].current[1].onDeselect(self.session)
				if current:
					current[1].onSelect(self.session)
				self["config"].current = current
			for x in self["config"].onSelectionChanged:
				x()
		self["config"].selectionChanged = selectionChanged
		
		self.setTitle(self.setup_title)