def bookmark(self, task, delimiter): #pragma: no cover """Bookmarks handling. loads and saves the bookmarks as a csv file. :param task: either load or save :type task: string :param delimiter: delimiter to use for creating the csv file :type delimiter: string :raises : none :returns : none """ if task not in ALLOWED_BOOKMARK_TASKS: logger.info("Not allowed bookmark task requested {}, "\ "ignoring.".format(task)) bookmarks = IO() if task == "load": try: bookmarks.csv_load(self.bookmarks_file, delimiter) for line in bookmarks.row_list: line[0] = self._frequency_pp(line[0]) self.tree.insert('', tk.END, values=line) except InvalidPathError: logger.info("No bookmarks file found, skipping.") if task == "save": for item in self.tree.get_children(): values = self.tree.item(item).get('values') values[0] = self._frequency_pp_parse(values[0]) bookmarks.row_list.append(values) bookmarks.csv_save(self.bookmarks_file, delimiter)
def __init__(self, alternate_config_file): #pragma: no cover """Default config, they will be overwritten when a conf is loaded this will be used to write a default config file. If the command line specifies a config file we note it in alternate_config_file and we use it, otherwise we check for the default one. :param alternate_config_file: config file passed as input argument :type alternate_config_file: string :raises: none :returns:none """ self.io = IO() self.default_config_file = ".rig-remote/rig-remote.conf" self.config_file = None self.config = DEFAULT_CONFIG if alternate_config_file: self.config_file = alternate_config_file else: logger.info("No custom config file specified...") self.config_file = os.path.join(os.path.expanduser('~'), self.default_config_file)
def test_non_existent_path(): io = IO() with pytest.raises(InvalidPathError): io._path_check("")