예제 #1
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = [ "SeriesPluginConfiguration" ]
		
		from plugin import NAME, VERSION
		self.setup_title = NAME + " " + _("Configuration") + " " + VERSION
		
		log.debug("SeriesPluginConfiguration")
		
		self.onChangedEntry = [ ]
		
		# Buttons
		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("OK"))
		self["key_blue"] = Button(_("Show Log"))
		self["key_yellow"] = Button(_("Channel Edit"))
		
		# Define Actions
		self["actions"] = ActionMap(["SetupActions", "ChannelSelectBaseActions", "ColorActions"],
		{
			"cancel":		self.keyCancel,
			"save":			self.keySave,
			"nextBouquet":	self.pageUp,
			"prevBouquet":	self.pageDown,
			"blue":			self.showLog,
			"yellow":		self.openChannelEditor,
			"ok": 			self.keyOK,
			"left": 		self.keyLeft,
			"right": 		self.keyRight,
		}, -2) # higher priority
		
		stopIndependent()
		#resetInstance()
		self.seriesPlugin = getInstance()
		
		# Create temporary identifier config elements
		identifiers = self.seriesPlugin.modules
		identifiers_elapsed = [k for k,v in identifiers.items() if v.knowsElapsed()]
		identifiers_today   = [k for k,v in identifiers.items() if v.knowsToday()]
		identifiers_future  = [k for k,v in identifiers.items() if v.knowsFuture()]
		if config.plugins.seriesplugin.identifier_elapsed.value in identifiers_elapsed:
			self.cfg_identifier_elapsed = NoSave( ConfigSelection(choices = identifiers_elapsed, default = config.plugins.seriesplugin.identifier_elapsed.value) )
		else:
			self.cfg_identifier_elapsed = NoSave( ConfigSelection(choices = identifiers_elapsed, default = identifiers_elapsed[0]) )
			self.changesMade = True
		if config.plugins.seriesplugin.identifier_today.value in identifiers_today:
			self.cfg_identifier_today   = NoSave( ConfigSelection(choices = identifiers_today,   default = config.plugins.seriesplugin.identifier_today.value) )
		else:
			self.cfg_identifier_today   = NoSave( ConfigSelection(choices = identifiers_today,   default = identifiers_today[0]) )
			self.changesMade = True
		if config.plugins.seriesplugin.identifier_future.value in identifiers_future:
			self.cfg_identifier_future  = NoSave( ConfigSelection(choices = identifiers_future,  default = config.plugins.seriesplugin.identifier_future.value) )
		else:
			self.cfg_identifier_future  = NoSave( ConfigSelection(choices = identifiers_future,  default = identifiers_future[0]) )
			self.changesMade = True
		
		# Load patterns
		patterns_file = readFilePatterns()
		self.cfg_pattern_title       = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_title.value ) )
		self.cfg_pattern_description = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_description.value ) )
		#self.cfg_pattern_record     = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_record.value ) )
		patterns_directory = readDirectoryPatterns()
		self.cfg_pattern_directory   = NoSave( ConfigSelection(choices = patterns_directory, default = config.plugins.seriesplugin.pattern_directory.value ) )
		
		bouquetList = [("", "")]
		tvbouquets = getTVBouquets()
		for bouquet in tvbouquets:
			bouquetList.append((bouquet[1], bouquet[1]))
		self.cfg_bouquet_main = NoSave( ConfigSelection(choices = bouquetList,  default = config.plugins.seriesplugin.bouquet_main.value or str(list(zip(*bouquetList)[1]))   )  )
		
		checkList( self.cfg_pattern_title )
		checkList( self.cfg_pattern_description )
		checkList( self.cfg_pattern_directory )
		checkList( self.cfg_bouquet_main )
		
		self.changesMade = False
		
		# Initialize Configuration
		self.list = []
		self.buildConfig()
		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
		
		self.changed()
		self.onLayoutFinish.append(self.layoutFinished)
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = [ "SeriesPluginConfiguration" ]
		
		from plugin import NAME, VERSION
		self.setup_title = NAME + " " + _("Configuration") + " " + VERSION
		
		self.onChangedEntry = [ ]
		
		# Buttons
		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("OK"))
		self["key_blue"] = Button(_("Show Log"))
		self["key_yellow"] = Button(_("Channel Edit"))
		
		# Define Actions
		self["actions"] = ActionMap(["SetupActions", "ChannelSelectBaseActions", "ColorActions"],
		{
			"cancel":		self.keyCancel,
			"save":			self.keySave,
			"nextBouquet":	self.pageUp,
			"prevBouquet":	self.pageDown,
			"blue":			self.showLog,
			"yellow":		self.openChannelEditor,
			"ok": 			self.keyOK,
			"left": 		self.keyLeft,
			"right": 		self.keyRight,
		}, -2) # higher priority
		
		stopIndependent()
		#resetInstance()
		self.seriesPlugin = getInstance()
		
		# Create temporary identifier config elements
		identifiers = self.seriesPlugin.modules
		identifiers_elapsed = [k for k,v in identifiers.items() if v.knowsElapsed()]
		identifiers_today   = [k for k,v in identifiers.items() if v.knowsToday()]
		identifiers_future  = [k for k,v in identifiers.items() if v.knowsFuture()]
		if config.plugins.seriesplugin.identifier_elapsed.value in identifiers_elapsed:
			self.cfg_identifier_elapsed = NoSave( ConfigSelection(choices = identifiers_elapsed, default = config.plugins.seriesplugin.identifier_elapsed.value) )
		else:
			self.cfg_identifier_elapsed = NoSave( ConfigSelection(choices = identifiers_elapsed, default = identifiers_elapsed[0]) )
			self.changesMade = True
		if config.plugins.seriesplugin.identifier_today.value in identifiers_today:
			self.cfg_identifier_today   = NoSave( ConfigSelection(choices = identifiers_today,   default = config.plugins.seriesplugin.identifier_today.value) )
		else:
			self.cfg_identifier_today   = NoSave( ConfigSelection(choices = identifiers_today,   default = identifiers_today[0]) )
			self.changesMade = True
		if config.plugins.seriesplugin.identifier_future.value in identifiers_future:
			self.cfg_identifier_future  = NoSave( ConfigSelection(choices = identifiers_future,  default = config.plugins.seriesplugin.identifier_future.value) )
		else:
			self.cfg_identifier_future  = NoSave( ConfigSelection(choices = identifiers_future,  default = identifiers_future[0]) )
			self.changesMade = True
		
		# Load patterns
		patterns_file = readFilePatterns()
		self.cfg_pattern_title       = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_title.value ) )
		self.cfg_pattern_description = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_description.value ) )
		#self.cfg_pattern_record     = NoSave( ConfigSelection(choices = patterns_file, default = config.plugins.seriesplugin.pattern_record.value ) )
		patterns_directory = readDirectoryPatterns()
		self.cfg_pattern_directory   = NoSave( ConfigSelection(choices = patterns_directory, default = config.plugins.seriesplugin.pattern_directory.value ) )
		
		bouquetList = [("", "")]
		tvbouquets = getTVBouquets()
		for bouquet in tvbouquets:
			bouquetList.append((bouquet[1], bouquet[1]))
		self.cfg_bouquet_main = NoSave( ConfigSelection(choices = bouquetList,  default = config.plugins.seriesplugin.bouquet_main.value or str(list(zip(*bouquetList)[1]))   )  )
		
		checkList( self.cfg_pattern_title )
		checkList( self.cfg_pattern_description )
		checkList( self.cfg_pattern_directory )
		checkList( self.cfg_bouquet_main )
		
		self.changesMade = False
		
		# Initialize Configuration
		self.list = []
		self.buildConfig()
		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
		
		self.changed()
		self.onLayoutFinish.append(self.layoutFinished)