def change_filename(self, widget, data=None): """ Change the settings file """ settings.select_todofile() notify = pynotify.Notification("The new location of todo.txt has been set","Please restart the application to load the new task list") notify.show() gtk.main_quit()
import gtk import appindicator import sys import pynotify import settings from tododb import * # Tries to create a conf file. The function will return control if it finds the file existing already settings.create_conf() TODO_TXT_LOCATION = '' if settings.is_todo_existing(): TODO_TXT_LOCATION = settings.get_location() else: settings.select_todofile() TODO_TXT_LOCATION = settings.get_location() print TODO_TXT_LOCATION TODO = Tododb(TODO_TXT_LOCATION) def sort_keys(todo_dict): func = lambda item : todo_dict[item][0][0] return sorted(todo_dict, key=func, reverse=True) class TodoApplet: def mark_done(self, widget, data=None): TODO.mark_read_task(data)