Exemplo n.º 1
0
    def open_settings_window(self):
        '''
			The method that determines what happens when the item is clicked in the settings GUI.
			Usually this would be __addon__.OpenSettings(), but it could be any other script.
			This allows the creation of action buttons in the GUI, as well as allowing developers to script and skin their 
			own user interfaces.
		'''

        log(
            xbmcaddon.Addon(
                "script.module.osmcsetting.pioverclock").getAddonInfo('id'))

        me = xbmcaddon.Addon(self.addonid)
        scriptPath = me.getAddonInfo('path')

        # read config file, take the parts you need

        # the location of the config file FOR TESTING ONLY
        try:
            self.test_config = '/boot/config.txt'
            self.config_settings = ct.read_config(self.test_config)

        except:
            self.test_config = '/home/kubkev/Documents/config.txt'
            self.config_settings = ct.read_config(self.test_config)

        oc_keys = [
            'arm_freq', 'sdram_freq', 'core_freq', 'initial_turbo',
            'over_voltage', 'over_voltage_sdram', 'force_turbo'
        ]

        self.setting_values = {}
        for key in oc_keys:
            if key in self.config_settings:
                self.setting_values[key] = self.config_settings[key]

        # setting_values = {'core_freq': 500, 'arm_freq': 800, 'sdram_freq': 700, 'initial_turbo': 60, 'over_voltage': 2, 'over_voltage_sdram': 6, 'force_turbo' : 0}

        self.GUI = overclock_gui("oc_gui.xml",
                                 scriptPath,
                                 'Default',
                                 setting_values=self.setting_values)

        self.GUI.doModal()

        self.new_settings = self.GUI.snapshot()
        log('self.new_settings')
        log(self.new_settings)
        log('self.setting_values')
        log(self.setting_values)

        ct.write_config(self.test_config, self.new_settings)

        del self.GUI

        for k, s in self.new_settings.iteritems():
            if s != self.setting_values.get(k, 'no setting available'):
                self.reboot_required

        log('END')
Exemplo n.º 2
0
	def run(self):

		'''
			The method that determines what happens when the item is clicked in the settings GUI.
			Usually this would be __addon__.OpenSettings(), but it could be any other script.
			This allows the creation of action buttons in the GUI, as well as allowing developers to script and skin their 
			own user interfaces.
		'''

		log(xbmcaddon.Addon("script.module.osmcsetting.pioverclock").getAddonInfo('id'))

		me = xbmcaddon.Addon(self.addonid)
		scriptPath = me.getAddonInfo('path')

		# read config file, take the parts you need

		# the location of the config file FOR TESTING ONLY
		try:								
			self.test_config = '/boot/config.txt'
			self.config_settings = ct.read_config(self.test_config)

		except:
			self.test_config = '/home/kubkev/Documents/config.txt'
			self.config_settings = ct.read_config(self.test_config)

		oc_keys = ['arm_freq', 'sdram_freq', 'core_freq', 'initial_turbo', 'over_voltage', 'over_voltage_sdram', 'force_turbo']

		self.setting_values = {}
		for key in oc_keys:
			if key in self.config_settings:
				self.setting_values[key] = self.config_settings[key]

		# setting_values = {'core_freq': 500, 'arm_freq': 800, 'sdram_freq': 700, 'initial_turbo': 60, 'over_voltage': 2, 'over_voltage_sdram': 6, 'force_turbo' : 0}

		xml = "new_gui_720.xml" if xbmcgui.Window(10000).getProperty("SkinHeight") == '720' else "new_gui.xml"

		self.GUI = overclock_gui(xml, scriptPath, 'Default', setting_values=self.setting_values, model=self.pimodel)

		self.GUI.doModal()

		self.new_settings = self.GUI.snapshot()
		log('self.new_settings')
		log(self.new_settings)
		log('self.setting_values')
		log(self.setting_values)

		ct.write_config(self.test_config, self.new_settings)

		del self.GUI

		for k, s in self.new_settings.iteritems():
			if s != self.setting_values.get(k, 'no setting available'):
				self.reboot_required

		# dialog to notify the user they should restart for changes to take effect
		ok = DIALOG.notification(lang(32107), lang(32108))

		log('END')
Exemplo n.º 3
0
	def open_settings_window(self):

		'''
			The method that determines what happens when the item is clicked in the settings GUI.
			Usually this would be __addon__.OpenSettings(), but it could be any other script.
			This allows the creation of action buttons in the GUI, as well as allowing developers to script and skin their 
			own user interfaces.
		'''

		print xbmcaddon.Addon("script.module.osmcsetting.pioverclock").getAddonInfo('id')

		me = xbmcaddon.Addon(self.addonid)
		scriptPath = me.getAddonInfo('path')

		# read config file, take the parts you need

		# the location of the config file FOR TESTING ONLY
		try:								
			self.test_config = '/boot/config.txt'
			self.config_settings = ct.read_config(self.test_config)

		except:
			self.test_config = '/home/kubkev/Documents/config.txt'
			self.config_settings = ct.read_config(self.test_config)

		oc_keys = ['arm_freq', 'sdram_freq', 'core_freq', 'initial_turbo', 'over_voltage', 'over_voltage_sdram', 'force_turbo']

		self.setting_values = {}
		for key in oc_keys:
			if key in self.config_settings:
				self.setting_values[key] = self.config_settings[key]

		# setting_values = {'core_freq': 500, 'arm_freq': 800, 'sdram_freq': 700, 'initial_turbo': 60, 'over_voltage': 2, 'over_voltage_sdram': 6, 'force_turbo' : 0}

		self.GUI = overclock_gui("oc_gui.xml", scriptPath, 'Default', setting_values=self.setting_values)

		self.GUI.doModal()

		self.new_settings = self.GUI.snapshot()
		print 'self.new_settings'
		print self.new_settings
		print 'self.setting_values'
		print self.setting_values

		ct.write_config(self.test_config, self.new_settings)

		del self.GUI

		for k, s in self.new_settings.iteritems():
			if s != self.setting_values.get(k, 'no setting available'):
				self.reboot_required

		print 'END'
Exemplo n.º 4
0
	def final_method(self):

		''' 
			The method to call after all the other setting methods have been called.

			For example, in the case of the Raspberry Pi's settings module, the final writing to the config.txt can be delayed
			until all the settings have been updated in the pi_settings_dict. 

		'''

		''' This method will write the changed settings to the config.txt file. '''

		# translate the changed settings into values that can be used in the config.txt
		self.translated_changed_settings = {}
		for k, v in self.changed_settings.iteritems():

			# translate the setting if needed
			# in some cases this translation can be used to set the values for other settings and have them added
			# to the translated_changed_settings dict
			translate_method = self.pi_settings_dict.get(k,{}).get('translate', False)

			if translate_method:
				value = translate_method(v, reverse=True)
			else:
				value = v #.get('setting_value','')

			# if the setting is not to be added to the config.txt, then dont add it to the self.translated_changed_settings dict
			if k in self.not_going_to_config:
				continue

			# # if this is the other_settings_string then break up into the individual settings
			# elif k == 'other_settings_string':
			# 	for key, svalue in value.iteritems():
			# 		self.translated_changed_settings[key] = svalue

			# add the setting to the translated settings dict, this is now ready to send to the config.txt writer	
			else:
				self.translated_changed_settings[k] = value

		# transfer the remove list into the changes dict
		# this will make sure that existing settings in the config.txt that need to be removed, will be removed
		for remove_key in self.remove_list:
			self.translated_changed_settings[remove_key] = 'remove'

		# reset the remove list
		self.remove_list = []

		# start_x=1 added by default to every config.txt
		# popcornmix: I would remove start_file=start_x.elf and fixup_file=fixup_x.dat and use the shortcut start_x=1
		self.translated_changed_settings['start_x'] = 1

		# write the settings to the config.txt
		ct.write_config(self.test_config, self.translated_changed_settings)
Exemplo n.º 5
0
	def final_method(self):

		''' 
			The method to call after all the other setting methods have been called.

			For example, in the case of the Raspberry Pi's settings module, the final writing to the config.txt can be delayed
			until all the settings have been updated in the pi_settings_dict. 

		'''

		''' This method will write the changed settings to the config.txt file. '''

		# translate the changed settings into values that can be used in the config.txt
		self.translated_changed_settings = {}
		for k, v in self.changed_settings.iteritems():

			# translate the setting if needed
			# in some cases this translation can be used to set the values for other settings and have them added
			# to the translated_changed_settings dict
			translate_method = self.pi_settings_dict.get(k,{}).get('translate', False)

			if translate_method:
				value = translate_method(v, reverse=True)
			else:
				value = v #.get('setting_value','')

			# if the setting is not to be added to the config.txt, then dont add it to the self.translated_changed_settings dict
			if k in self.not_going_to_config:
				continue

			# # if this is the other_settings_string then break up into the individual settings
			# elif k == 'other_settings_string':
			# 	for key, svalue in value.iteritems():
			# 		self.translated_changed_settings[key] = svalue

			# add the setting to the translated settings dict, this is now ready to send to the config.txt writer	
			else:
				self.translated_changed_settings[k] = value

		# transfer the remove list into the changes dict
		# this will make sure that existing settings in the config.txt that need to be removed, will be removed
		for remove_key in self.remove_list:
			self.translated_changed_settings[remove_key] = 'remove'

		# reset the remove list
		self.remove_list = []

		# start_x=1 added by default to every config.txt
		# popcornmix: I would remove start_file=start_x.elf and fixup_file=fixup_x.dat and use the shortcut start_x=1
		self.translated_changed_settings['start_x'] = 1

		# write the settings to the config.txt
		ct.write_config(self.test_config, self.translated_changed_settings)