def test_format_recent_line(): location = '/home/leroux/test.py' scroll_pos = (0, 0) cursor_pos = (4, 12) line = format_recent_line(location, scroll_pos, cursor_pos) assert line == VALID_LINE
def save_settings(self): #print "save settings" x, y = self.window.get_position() self.settings['win_x'] = x self.settings['win_y'] = y location = self.textarea.view.document.location if location: self.settings['most_recent_file'] = location else: self.settings['most_recent_file'] = None if self.workspace: self.settings['workspace'] = self.workspace.name else: self.settings['workspace'] = None self.settings.save() # write the open list of files to a file so that we can load them up # next time the editor starts recent_files_path = self.settings.get_recent_files_path() fle = open(recent_files_path, "w") try: for view in self.views: location = view.document.location if location: scroll_pos = view.scroll_pos cursor_pos = view.cursor_pos line = format_recent_line(location, scroll_pos, cursor_pos) line = line.encode('utf8') fle.write(line+'\n') finally: fle.close()