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')
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')
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.retrieve_settings_from_configtxt(self.test_config) except: self.test_config = '/home/plaskev/Documents/config.txt' self.config_settings = ct.retrieve_settings_from_configtxt(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.apply_changes_to_configtxt(self.new_settings, self.test_config) 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')
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'
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: config_location = '/boot/config.txt' config = parser.read_config_file(config_location) except: config_location = '/home/plaskev/Documents/config.txt' config = parser.read_config_file(config_location) # oc_keys = ['arm_freq', 'sdram_freq', 'core_freq', 'initial_turbo', 'over_voltage', 'over_voltage_sdram', 'force_turbo'] # read the config.txt file everytime the settings are opened. This is unavoidable because it is possible for # the user to have made manual changes to the config.txt while OSG is active. config = parser.read_config_file(config_location) extracted_settings = parser.config_to_kodi(parser.MASTER_SETTINGS, config) # print the settings log('Settings extracted from the config.txt') for k, v in extracted_settings.iteritems(): log("%s : %s" % (k, v)) # self.me.setSetting(k, str(v)) # 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" GUI = overclock_gui(xml, scriptPath, 'Default', setting_values=extracted_settings, model=self.pimodel) GUI.doModal() new_settings = GUI.snapshot() log('New settings applied to the config.txt') for k, v in new_settings.iteritems(): log("%s : %s" % (k, v)) del GUI config = parser.read_config_file(config_location) new_settings = parser.kodi_to_config(parser.MASTER_SETTINGS, config, new_settings) # write the new lines to the temporary config file parser.write_config_file('/var/tmp/config.txt', new_settings) # copy over the temp config.txt to /boot/ as superuser subprocess.call(["sudo", "mv", '/var/tmp/config.txt', config_location])
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: config_location = '/boot/config.txt' config = parser.read_config_file(config_location) except: config_location = '/home/plaskev/Documents/config.txt' config = parser.read_config_file(config_location) # oc_keys = ['arm_freq', 'sdram_freq', 'core_freq', 'initial_turbo', 'over_voltage', 'over_voltage_sdram', 'force_turbo'] # read the config.txt file everytime the settings are opened. This is unavoidable because it is possible for # the user to have made manual changes to the config.txt while OSG is active. config = parser.read_config_file(config_location) extracted_settings = parser.config_to_kodi(parser.MASTER_SETTINGS, config) # load the settings into kodi log('Settings extracted from the config.txt') for k, v in extracted_settings.iteritems(): log("%s : %s" % (k, v)) self.me.setSetting(k, str(v)) # 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" GUI = overclock_gui(xml, scriptPath, 'Default', setting_values=extracted_settings, model=self.pimodel) GUI.doModal() new_settings = self.GUI.snapshot() log('New settings applied to the config.txt') for k, v in new_settings.iteritems(): log("%s : %s" % (k, v)) del GUI # write the new lines to the temporary config file parser.write_config_file('/var/tmp/config.txt', new_settings) # copy over the temp config.txt to /boot/ as superuser subprocess.call(["sudo", "mv", '/var/tmp/config.txt', self.config_location]) DIALOG.notification(lang(32095), lang(32096))