def setLibraryLocation_(self, sender): #NSLog('setLibraryLocation_') panel = NSOpenPanel.openPanel() panel.setCanChooseDirectories_(YES) panel.setAllowsMultipleSelection_(NO) panel.setCanChooseFiles_(NO) old_path = config.get_config_option('iTunesLibraryLocation') ret = panel.runModalForDirectory_file_types_(old_path, None, None) #NSLog(str(ret)) if ret: path = panel.filenames()[0] config.set_config_option('iTunesLibraryLocation', path) else: # Canceled pass
def set_config_option(self, option, value, section=None, app=None): """Write a config option to the configuration subsystem. The system is based on per-app configuration files, which has sections and options. Arguments: option -- The name of the option to set value -- The value of the option. section -- A string section in which to store the option in. If not set, it defaults to the applications short name, which is the class name in lower-case, with the leading "Ago" removed. (AgoExample becomes example). app -- A string identifying the configuration storage unit to store in. If omited, it defaults to the same as section. Returns: True if succesfully stored, False otherwise. Please refer to the error log for failure indication. """ if section is None: section = self.app_short_name return config.set_config_option(section, option, value, app)
def setITunesManagesMyLibrary_(self, value): #NSLog('setITunesManagesMyLibrary_') self.iTunesManagesMyLibrary = value #NSLog(str(self.iTunesManagesMyLibrary)) config.set_config_option('iTunesManagesMyLibrary', value) self.refreshMenuEnable()