コード例 #1
0
	def editTextProperty(self, controlId, name):
		control = self.getControlById(controlId)
		textValue = util.getLabel(control)

		keyboard = xbmc.Keyboard()
		keyboard.setHeading(util.localize(32132) % name)
		keyboard.setDefault(textValue)
		keyboard.doModal()
		if (keyboard.isConfirmed()):
			textValue = keyboard.getText()

		util.setLabel(textValue, control)

		return textValue
コード例 #2
0
	def editPathWithFileMask(self, controlId, enterString, controlIdFilemask):

		dialog = xbmcgui.Dialog()

		#get new value
		pathValue = dialog.browse(0, enterString, 'files')

		control = self.getControlById(controlId)

		util.setLabel(pathValue, control)

		control = self.getControlById(controlIdFilemask)
		filemask = util.getLabel(control)
		pathComplete = os.path.join(pathValue, filemask.strip())

		return pathComplete
コード例 #3
0
	def updateRomParams(self):
		# HACK: split romPath and fileMask
		firstRomPath = ''
		fileMask = ''
		for romPath in self.selectedRomCollection.romPaths:
			pathParts = os.path.split(romPath)
			if firstRomPath == '':
				firstRomPath = pathParts[0]
				fileMask = pathParts[1]
			elif firstRomPath == pathParts[0]:
				# This is adding all the file masks for the *same* file path (i.e. where the path matches the first one)
				fileMask = fileMask + ',' + pathParts[1]

		control = self.getControlById(CONTROL_BUTTON_ROMPATH)
		util.setLabel(firstRomPath, control)

		control = self.getControlById(CONTROL_BUTTON_FILEMASK)
		util.setLabel(fileMask, control)
コード例 #4
0
    def editFilemask(self, controlId, enterString, pathComplete):
        control = self.getControlById(controlId)
        filemask = util.getLabel(control)

        keyboard = xbmc.Keyboard()
        keyboard.setHeading(util.localize(32132) % enterString)
        keyboard.setDefault(filemask)
        keyboard.doModal()
        if keyboard.isConfirmed():
            filemask = keyboard.getText()

        util.setLabel(filemask, control)

        pathParts = os.path.split(pathComplete)
        path = pathParts[0]
        pathComplete = os.path.join(path, filemask.strip())

        return pathComplete
コード例 #5
0
	def editFilemask(self, controlId, enterString, pathComplete):
		control = self.getControlById(controlId)
		filemask = util.getLabel(control)

		keyboard = xbmc.Keyboard()
		keyboard.setHeading(util.localize(32132) % enterString)
		keyboard.setDefault(filemask)
		keyboard.doModal()
		if (keyboard.isConfirmed()):
			filemask = keyboard.getText()

		util.setLabel(filemask, control)

		pathParts = os.path.split(pathComplete)
		path = pathParts[0]
		pathComplete = os.path.join(path, filemask.strip())

		return pathComplete
コード例 #6
0
	def updateRomCollectionControls(self):
		log.info("updateRomCollectionControls")

		control = self.getControlById(CONTROL_LIST_ROMCOLLECTIONS)
		selectedRomCollectionName = str(control.getSelectedItem().getLabel())

		log.info("selected rom collection: {0}".format(selectedRomCollectionName))
		self.selectedRomCollection = self.gui.config.getRomCollectionByName(selectedRomCollectionName)
		if self.selectedRomCollection is None:
			return

		# Import Games
		# HACK: split romPath and fileMask
		firstRomPath = ''
		fileMask = ''
		for romPath in self.selectedRomCollection.romPaths:

			pathParts = os.path.split(romPath)
			if firstRomPath == '':
				firstRomPath = pathParts[0]
				fileMask = pathParts[1]
			elif firstRomPath == pathParts[0]:
				# This is adding all the file masks for the *same* file path (i.e. where the path matches the first one)
				fileMask = fileMask + ',' + pathParts[1]

		control = self.getControlById(CONTROL_BUTTON_ROMPATH)
		util.setLabel(firstRomPath, control)

		control = self.getControlById(CONTROL_BUTTON_FILEMASK)
		util.setLabel(fileMask, control)

		# Set the currently selected state for all the buttons
		for item in self._control_buttons:
			control = self.getControlById(item['control'])
			control.setSelected(getattr(self.selectedRomCollection, item['value']))
			print 'Set button control ID ' + str(item['control']) + ' to value ' + str(getattr(self.selectedRomCollection, item['value']))

		# Set the value for all the labels
		for item in self._control_labels:
			control = self.getControlById(item['control'])
			util.setLabel(getattr(self.selectedRomCollection, item['value']), control)
			print 'Set label control ID ' + str(item['control']) + ' to value ' + str(getattr(self.selectedRomCollection, item['value']))

		# Import Game Data
		# Media Types
		mediaTypeList = []
		firstMediaPath = ''
		firstMediaFileMask = ''
		for mediaPath in self.selectedRomCollection.mediaPaths:
			mediaTypeList.append(mediaPath.fileType.name)
			if firstMediaPath == '':
				pathParts = os.path.split(mediaPath.path)
				firstMediaPath = pathParts[0]
				firstMediaFileMask = pathParts[1]

		self.addItemsToList(CONTROL_LIST_MEDIATYPES, mediaTypeList)

		control = self.getControlById(CONTROL_BUTTON_MEDIAPATH)
		util.setLabel(firstMediaPath, control)

		control = self.getControlById(CONTROL_BUTTON_MEDIAFILEMASK)
		util.setLabel(firstMediaFileMask, control)

		self.selectScrapersInList(self.selectedRomCollection.scraperSites, self.availableScrapers)

		# Browse Games
		optionMain = self.selectedRomCollection.imagePlacingMain.name
		try:
			optionMain = config.imagePlacingDict[optionMain]
		except IndexError:
			pass
		self.selectItemInList(optionMain, CONTROL_LIST_IMAGEPLACING_MAIN)

		optionInfo = self.selectedRomCollection.imagePlacingInfo.name
		try:
			optionInfo = config.imagePlacingDict[optionInfo]
		except IndexError:
			pass
		self.selectItemInList(optionInfo, CONTROL_LIST_IMAGEPLACING_INFO)
コード例 #7
0
	def updateRomCollectionControls(self):
		
		Logutil.log('updateRomCollectionControls', util.LOG_LEVEL_INFO)
		
		control = self.getControlById(CONTROL_LIST_ROMCOLLECTIONS)
		selectedRomCollectionName = str(control.getSelectedItem().getLabel())
				
		Logutil.log('selected rom collection: ' +str(selectedRomCollectionName), util.LOG_LEVEL_INFO)
				
		self.selectedRomCollection = None
		
		for rcId in self.romCollections.keys():
			romCollection = self.romCollections[rcId]
			if romCollection.name == selectedRomCollectionName:
				self.selectedRomCollection = romCollection
				break
			
		if(self.selectedRomCollection == None):
			return
				
		#Import Games
		#HACK: split romPath and fileMask
		firstRomPath = ''
		fileMask = ''
		for romPath in self.selectedRomCollection.romPaths:
			
			pathParts = os.path.split(romPath)			 
			if(firstRomPath == ''):				
				firstRomPath = pathParts[0]
				fileMask = pathParts[1]
			elif(firstRomPath == pathParts[0]):
				fileMask = fileMask +',' +pathParts[1]
								
		control = self.getControlById(CONTROL_BUTTON_ROMPATH)
		util.setLabel(firstRomPath, control)
		
		control = self.getControlById(CONTROL_BUTTON_FILEMASK)
		util.setLabel(fileMask, control)		
		
		control = self.getControlById(CONTROL_BUTTON_IGNOREONSCAN)		
		control.setSelected(self.selectedRomCollection.ignoreOnScan)
		
		control = self.getControlById(CONTROL_BUTTON_ALLOWUPDATE)
		control.setSelected(self.selectedRomCollection.allowUpdate)
		
		control = self.getControlById(CONTROL_BUTTON_DISKINDICATOR)
		util.setLabel(self.selectedRomCollection.diskPrefix, control)
		
		control = self.getControlById(CONTROL_BUTTON_MAXFOLDERDEPTH)
		util.setLabel(self.selectedRomCollection.maxFolderDepth, control)
		
		control = self.getControlById(CONTROL_BUTTON_USEFOLDERASGAMENAME)
		control.setSelected(self.selectedRomCollection.useFoldernameAsGamename)
		
		#Import Game Data
		#Media Types
		mediaTypeList = []
		firstMediaPath = ''
		firstMediaFileMask = ''
		for mediaPath in self.selectedRomCollection.mediaPaths:
			mediaTypeList.append(mediaPath.fileType.name)
			if(firstMediaPath == ''):
				pathParts = os.path.split(mediaPath.path)
				firstMediaPath = pathParts[0]
				firstMediaFileMask = pathParts[1]
				
		self.addItemsToList(CONTROL_LIST_MEDIATYPES, mediaTypeList)
		
		control = self.getControlById(CONTROL_BUTTON_MEDIAPATH)
		util.setLabel(firstMediaPath, control)
		
		control = self.getControlById(CONTROL_BUTTON_MEDIAFILEMASK)
		util.setLabel(firstMediaFileMask, control)		
						
		self.selectScrapersInList(self.selectedRomCollection.scraperSites, self.availableScrapers)
		
		#Browse Games
		optionMain = self.selectedRomCollection.imagePlacingMain.name
		try:
			optionMain = config.imagePlacingDict[optionMain]
		except:
			pass
		self.selectItemInList(optionMain, CONTROL_LIST_IMAGEPLACING_MAIN)
		
		optionInfo = self.selectedRomCollection.imagePlacingInfo.name
		try:
			optionInfo = config.imagePlacingDict[optionInfo]
		except:			
			pass		
		self.selectItemInList(optionInfo, CONTROL_LIST_IMAGEPLACING_INFO)
		
		control = self.getControlById(CONTROL_BUTTON_AUTOPLAYVIDEO_MAIN)
		if(control != None):
			control.setSelected(self.selectedRomCollection.autoplayVideoMain)
		
		control = self.getControlById(CONTROL_BUTTON_AUTOPLAYVIDEO_INFO)
		if(control != None):
			control.setSelected(self.selectedRomCollection.autoplayVideoInfo)
		
		#Launch Games
		control = self.getControlById(CONTROL_BUTTON_USERETROPLAYER)
		if(control):
			control.setSelected(self.selectedRomCollection.useBuiltinEmulator)
		
		control = self.getControlById(CONTROL_BUTTON_GAMECLIENT)
		if(control):
			util.setLabel(self.selectedRomCollection.gameclient, control)		
			
		control = self.getControlById(CONTROL_BUTTON_EMUCMD)
		util.setLabel(self.selectedRomCollection.emulatorCmd, control)		
		
		control = self.getControlById(CONTROL_BUTTON_PARAMS)
		util.setLabel(self.selectedRomCollection.emulatorParams, control)		
		
		control = self.getControlById(CONTROL_BUTTON_USEEMUSOLO)
		control.setSelected(self.selectedRomCollection.useEmuSolo)
		
		control = self.getControlById(CONTROL_BUTTON_USEPOPEN)
		control.setSelected(self.selectedRomCollection.usePopen)
		
		pathParts = os.path.split(self.selectedRomCollection.saveStatePath)
		saveStatePath = pathParts[0]
		saveStateFileMask = pathParts[1]
		
		control = self.getControlById(CONTROL_BUTTON_SAVESTATEPATH)
		util.setLabel(saveStatePath, control)
		
		control = self.getControlById(CONTROL_BUTTON_SAVESTATEMASK)
		util.setLabel(saveStateFileMask, control)
		
		control = self.getControlById(CONTROL_BUTTON_SAVESTATEPARAMS)		
		util.setLabel(self.selectedRomCollection.saveStateParams, control)
		
		control = self.getControlById(CONTROL_BUTTON_DONTEXTRACTZIP)
		control.setSelected(self.selectedRomCollection.doNotExtractZipFiles)
		
		control = self.getControlById(CONTROL_BUTTON_PRECMD)
		util.setLabel(self.selectedRomCollection.preCmd, control)		
		
		control = self.getControlById(CONTROL_BUTTON_POSTCMD)
		util.setLabel(self.selectedRomCollection.postCmd, control)
    def updateRomCollectionControls(self):

        Logutil.log('updateRomCollectionControls', util.LOG_LEVEL_INFO)

        control = self.getControlById(CONTROL_LIST_ROMCOLLECTIONS)
        selectedRomCollectionName = str(control.getSelectedItem().getLabel())

        Logutil.log(
            'selected rom collection: ' + str(selectedRomCollectionName),
            util.LOG_LEVEL_INFO)

        self.selectedRomCollection = None

        for rcId in self.romCollections.keys():
            romCollection = self.romCollections[rcId]
            if romCollection.name == selectedRomCollectionName:
                self.selectedRomCollection = romCollection
                break

        if (self.selectedRomCollection == None):
            return

        #Import Games
        #HACK: split romPath and fileMask
        firstRomPath = ''
        fileMask = ''
        for romPath in self.selectedRomCollection.romPaths:

            pathParts = os.path.split(romPath)
            if (firstRomPath == ''):
                firstRomPath = pathParts[0]
                fileMask = pathParts[1]
            elif (firstRomPath == pathParts[0]):
                fileMask = fileMask + ',' + pathParts[1]

        control = self.getControlById(CONTROL_BUTTON_ROMPATH)
        util.setLabel(firstRomPath, control)

        control = self.getControlById(CONTROL_BUTTON_FILEMASK)
        util.setLabel(fileMask, control)

        control = self.getControlById(CONTROL_BUTTON_IGNOREONSCAN)
        control.setSelected(self.selectedRomCollection.ignoreOnScan)

        control = self.getControlById(CONTROL_BUTTON_ALLOWUPDATE)
        control.setSelected(self.selectedRomCollection.allowUpdate)

        control = self.getControlById(CONTROL_BUTTON_DISKINDICATOR)
        util.setLabel(self.selectedRomCollection.diskPrefix, control)

        control = self.getControlById(CONTROL_BUTTON_MAXFOLDERDEPTH)
        util.setLabel(self.selectedRomCollection.maxFolderDepth, control)

        control = self.getControlById(CONTROL_BUTTON_USEFOLDERASGAMENAME)
        control.setSelected(self.selectedRomCollection.useFoldernameAsGamename)

        #Import Game Data
        #Media Types
        mediaTypeList = []
        firstMediaPath = ''
        firstMediaFileMask = ''
        for mediaPath in self.selectedRomCollection.mediaPaths:
            mediaTypeList.append(mediaPath.fileType.name)
            if (firstMediaPath == ''):
                pathParts = os.path.split(mediaPath.path)
                firstMediaPath = pathParts[0]
                firstMediaFileMask = pathParts[1]

        self.addItemsToList(CONTROL_LIST_MEDIATYPES, mediaTypeList)

        control = self.getControlById(CONTROL_BUTTON_MEDIAPATH)
        util.setLabel(firstMediaPath, control)

        control = self.getControlById(CONTROL_BUTTON_MEDIAFILEMASK)
        util.setLabel(firstMediaFileMask, control)

        self.selectScrapersInList(self.selectedRomCollection.scraperSites,
                                  self.availableScrapers)

        #Browse Games
        optionMain = self.selectedRomCollection.imagePlacingMain.name
        try:
            optionMain = config.imagePlacingDict[optionMain]
        except:
            pass
        self.selectItemInList(optionMain, CONTROL_LIST_IMAGEPLACING_MAIN)

        optionInfo = self.selectedRomCollection.imagePlacingInfo.name
        try:
            optionInfo = config.imagePlacingDict[optionInfo]
        except:
            pass
        self.selectItemInList(optionInfo, CONTROL_LIST_IMAGEPLACING_INFO)

        control = self.getControlById(CONTROL_BUTTON_AUTOPLAYVIDEO_MAIN)
        if (control != None):
            control.setSelected(self.selectedRomCollection.autoplayVideoMain)

        control = self.getControlById(CONTROL_BUTTON_AUTOPLAYVIDEO_INFO)
        if (control != None):
            control.setSelected(self.selectedRomCollection.autoplayVideoInfo)

        #Launch Games
        control = self.getControlById(CONTROL_BUTTON_USERETROPLAYER)
        if (control):
            control.setSelected(self.selectedRomCollection.useBuiltinEmulator)

        control = self.getControlById(CONTROL_BUTTON_GAMECLIENT)
        if (control):
            util.setLabel(self.selectedRomCollection.gameclient, control)

        control = self.getControlById(CONTROL_BUTTON_EMUCMD)
        util.setLabel(self.selectedRomCollection.emulatorCmd, control)

        control = self.getControlById(CONTROL_BUTTON_PARAMS)
        util.setLabel(self.selectedRomCollection.emulatorParams, control)

        control = self.getControlById(CONTROL_BUTTON_USEEMUSOLO)
        control.setSelected(self.selectedRomCollection.useEmuSolo)

        control = self.getControlById(CONTROL_BUTTON_USEPOPEN)
        control.setSelected(self.selectedRomCollection.usePopen)

        pathParts = os.path.split(self.selectedRomCollection.saveStatePath)
        saveStatePath = pathParts[0]
        saveStateFileMask = pathParts[1]

        control = self.getControlById(CONTROL_BUTTON_SAVESTATEPATH)
        util.setLabel(saveStatePath, control)

        control = self.getControlById(CONTROL_BUTTON_SAVESTATEMASK)
        util.setLabel(saveStateFileMask, control)

        control = self.getControlById(CONTROL_BUTTON_SAVESTATEPARAMS)
        util.setLabel(self.selectedRomCollection.saveStateParams, control)

        control = self.getControlById(CONTROL_BUTTON_DONTEXTRACTZIP)
        control.setSelected(self.selectedRomCollection.doNotExtractZipFiles)

        control = self.getControlById(CONTROL_BUTTON_PRECMD)
        util.setLabel(self.selectedRomCollection.preCmd, control)

        control = self.getControlById(CONTROL_BUTTON_POSTCMD)
        util.setLabel(self.selectedRomCollection.postCmd, control)
コード例 #9
0
    def updateRomCollectionControls(self):
        log.info("updateRomCollectionControls")

        control = self.getControlById(CONTROL_LIST_ROMCOLLECTIONS)
        selectedRomCollectionName = str(control.getSelectedItem().getLabel())

        log.info(
            "selected rom collection: {0}".format(selectedRomCollectionName))
        self.selectedRomCollection = self.gui.config.getRomCollectionByName(
            selectedRomCollectionName)
        if self.selectedRomCollection is None:
            return

        log.info("build scraper lists")
        self.availableScrapers = AbstractScraper().get_available_scrapers(
            self.selectedRomCollection.name)
        self.addItemsToList(CONTROL_LIST_DEFAULT_SCRAPER,
                            self.availableScrapers)

        # Import Games
        self.updateRomParams()

        # Set the currently selected state for all the buttons
        for item in self._control_buttons:
            control = self.getControlById(item['control'])
            control.setSelected(
                getattr(self.selectedRomCollection, item['value']))
            log.info('Set button control ID ' + str(item['control']) +
                     ' to value ' +
                     str(getattr(self.selectedRomCollection, item['value'])))

        # Set the value for all the labels
        for item in self._control_labels:
            control = self.getControlById(item['control'])
            util.setLabel(getattr(self.selectedRomCollection, item['value']),
                          control)
            log.info('Set label control ID ' + str(item['control']) +
                     ' to value ' +
                     str(getattr(self.selectedRomCollection, item['value'])))

        # preferred scraper
        self.selectScrapersInList(self.selectedRomCollection.scraperSites,
                                  CONTROL_LIST_DEFAULT_SCRAPER)

        self.addOfflineScrapersToList()

        # Artwork
        # Media Types
        self.updateMediaTypes()

        # Browse Games
        optionMain = self.selectedRomCollection.imagePlacingMain.name
        try:
            optionMain = config.imagePlacingDict[optionMain]
        except IndexError:
            pass
        self.selectItemInList(optionMain, CONTROL_LIST_IMAGEPLACING_MAIN)

        optionInfo = self.selectedRomCollection.imagePlacingInfo.name
        try:
            optionInfo = config.imagePlacingDict[optionInfo]
        except IndexError:
            pass
        self.selectItemInList(optionInfo, CONTROL_LIST_IMAGEPLACING_INFO)