Пример #1
0
def manager():
    """Aplicație ce permite gestiunea evenimentelor."""
    task_manager = TaskManager()
    task_manager.map_tasks()

    flag = True
    while flag:
        list_options()
        option = raw_input("Insert option: ")
        if option == "1":
            print("Task list:")
            task_manager.list_tasks()
        elif option == "2":
            print("Adding new task:")
            task = task_manager.add_task(get_input("add"))
            task_manager.task_list.append(task)
        elif option == "3":
            print("Editing Task")
            task_manager.edit_task(int(get_input("get_id")) - 1)
        elif option == "4":
            print("Deleting task")
            task_manager.delete_task(int(get_input("get_id")) - 1)
        elif option == "0":
            flag = False
        else:
            print("Invalid input. Try Again")

    task_manager.persist_tasks()
Пример #2
0
def manager():
    """Aplicație ce permite gestiunea evenimentelor."""
    task_manager = TaskManager()
    task_manager.map_tasks()

    flag = True
    while flag:
        list_options()
        option = raw_input("Insert option: ")
        if option == "1":
            print("Task list:")
            task_manager.list_tasks()
        elif option == "2":
            print("Adding new task:")
            task = task_manager.add_task(
                get_input("add")
            )
            task_manager.task_list.append(task)
        elif option == "3":
            print("Editing Task")
            task_manager.edit_task(
                int(get_input("get_id"))-1
            )
        elif option == "4":
            print("Deleting task")
            task_manager.delete_task(
                int(get_input("get_id")) - 1
            )
        elif option == "0":
            flag = False
        else:
            print("Invalid input. Try Again")

    task_manager.persist_tasks()
Пример #3
0
class Worklog:
    """
    Main entry to the worklog program. Mainmenu() kicks of the main screen
    asking for different actions. A TaskMananger object is instantiated and
    passed to the SearchMenu object for further search interactions.
    """
    def __init__(self):
        self.taskmanager = TaskManager()
        self.currentoption = None

    def searchworklog(self):
        clear_screen()
        search = SearchMenu(self.taskmanager)
        search.showsearchmenu()
        self.mainmenu()

    def addentry(self):
        print("Date of Task:")
        datefromuser = input("Please use DD/MM/YYYY:")
        tasktitle = input("Title of task:")
        timespent = input("Time spent:")
        tasknotes = input("Notes (optional):")

        task = Task(title=tasktitle,
                    date=datefromuser,
                    timespent=timespent,
                    notes=tasknotes)
        self.taskmanager.add_task(task)
        clear_screen()
        enter = input("Your task has been added. Enter to return to main menu")
        if enter == "":
            self.mainmenu()

    def mainmenu(self):
        while True:
            print(showmainmenuoptions())
            useroption = input(showprompt())
            if useroption.lower() == "a":
                self.addentry()
            elif useroption.lower() == 'q':
                print("Thanks for using the work log system.")
                sys.exit(1)
            elif useroption.lower() == 'b':
                self.searchworklog()
Пример #4
0
                        return
                    task._start(self)
                    self.log.debug("found client %s", task.url)
                except Queue.Empty:
                    break


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG,
                        format='%(name)s: %(message)s',
                        )

    manager = TaskManager(lambda s: None)
    downloader = BackgroundHttpDownloader()
    manager.start_dispatcher(downloader)
    manager.add_task(DownloadTask('http://www.python.org/', "python.html", overwrite=True))
    manager.add_task(DownloadTask('http://www.doughellmann.com/PyMOTW/contents.html',"pymotw.html"))
    manager.add_task(DownloadTask('http://docs.python.org/release/2.6.8/_static/py.png', "py.png"))
    manager.add_task(DownloadTask('http://docs.python.org/release/2.6.8/_static/py.png', "py2.png"))
    manager.add_task(DownloadTask('http://docs.python.org/release/2.6.8/_static/py.png', "py3.png"))
    manager.add_task(DownloadTask('http://image.tmdb.org/t/p/w342/vpk4hLyiuI2SqCss0T3jeoYcL8E.jpg', "test.jpg"))
    for i in range(10):
        time.sleep(1)
        tasks = manager.get_finished()
        for task in tasks:
            print 'FINISHED:', task.size, 'bytes for', task.path, 'from', task.url
        if i == 5:
            manager.add_task(DownloadTask('http://www.python.org/images/python-logo.gif', "bigpy.gif"))
            
    manager.shutdown()