def test_getNotifications_due(self): task = Task() task.title = "task 1" task.dueDateTime = datetime.datetime.today() + datetime.timedelta( seconds=10) notifications = task.getNotifications() self.assertEqual(len(notifications), 1) self.assertEqual(notifications[0].task, task) self.assertEqual(notifications[0].message, "task 'task 1' reached deadline")
def convertToDoToTask(self, todo: ToDo ): task = Task() task.title = todo.title task.description = todo.description task.completed = todo.completed task.priority = todo.priority taskDialog = TaskDialog( task, self.parentWidget ) taskDialog.setModal( True ) dialogCode = taskDialog.exec_() if dialogCode == QDialog.Rejected: return self.undoStack.push( ConvertToDoToTaskCommand( self, todo, taskDialog.task ) )
def test_replaceTask(self): manager = Manager() taskDate1 = datetime.date(2020, 5, 17) task1 = manager.addNewTask(taskDate1, "task1") task2 = Task() task2.title = "new task" tasks = manager.getTasks() self.assertEqual(len(tasks), 1) manager.replaceTask(task1, task2) tasks = manager.getTasks() self.assertEqual(len(tasks), 1) self.assertEqual(tasks[0].title, "new task")
def test_getNotifications_reminder(self): task = Task() task.title = "task 1" task.dueDateTime = datetime.datetime.today() + datetime.timedelta( seconds=30) reminder = Reminder() reminder.setTime(0, 10) task.addReminder(reminder) notifications = task.getNotifications() self.assertEqual(len(notifications), 2) self.assertEqual(notifications[0].task, task) self.assertEqual(notifications[0].message, "task 'task 1': 0:00:10 before due time") self.assertEqual(notifications[1].task, task) self.assertEqual(notifications[1].message, "task 'task 1' reached deadline")
## ============================= main section =================================== if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") taskDate = datetime.today().replace( hour=8 ) task1 = Task() task1.title = "Completed Task" task1.description = "Description" task1.completed = 100 task1.priority = 5 task1.startDateTime = taskDate task1.dueDateTime = task1.startDateTime + timedelta( hours=4 ) task2 = Task() task2.title = "Task 1" task2.description = "Description" task2.completed = 0 task2.priority = 3 task2.setDefaultDateTime( taskDate + timedelta( hours=6 ) ) task3 = Task() task3.title = "Full Day Task"
if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") parentTask = Task() parentTask.recurrence = Recurrent() parentTask.recurrence.setWeekly(1) task = Task() task.setParent(parentTask) task.title = "Task 1" # pylint: disable=C0301 task.description = ( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">' '<html><head><meta name="qrichtext" content="1" /><style type="text/css">' 'p, li { white-space: pre-wrap; }' '</style></head><body style=" font-family:\'Noto Sans\'; font-size:9pt; font-weight:400; font-style:normal;">' '<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A description</p>' '<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>' '<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="www.google.pl"><span style=" text-decoration: underline; color:#0000ff;">www.google.pl</span></a> </p>' '<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>' '<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="file:///var/log/kern.log"><span style=" text-decoration: underline; color:#0000ff;">file:///var/log/kern.log</span></a> </p>' '<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html>' ) task.completed = 50
from hanlendar.domainmodel.task import Task ## ============================= main section =================================== if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") tasksList = [] task1 = Task() task1.title = "Task 1" task1.description = "Description" task1.completed = 50 task1.priority = 5 task1.setDefaultDateTime(datetime.today()) tasksList.append(task1) task2 = Task() task2.title = "Task 2" task2.description = "Description" task2.completed = 0 task2.priority = 3 task2.setDefaultDateTime(datetime.today() + timedelta(hours=2)) tasksList.append(task2) task = Task()
def addNewDeadlineDateTime(self, eventdate: datetime, title): eventTask = Task() eventTask.title = title eventTask.setDeadlineDateTime(eventdate) self.addTask(eventTask) return eventTask
def addNewTaskDateTime(self, taskdate: datetime, title): task = Task() task.title = title task.setDefaultDateTime(taskdate) self.addTask(task) return task
from hanlendar.gui.sigint import setup_interrupt_handling from hanlendar.gui.widget.taskdetails import TaskDetails from hanlendar.domainmodel.task import Task ## ============================= main section =================================== if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") task = Task() task.title = "Task title" task.description = "Description" task.completed = 50 task.priority = 5 task.setDefaultDateTime(datetime.today()) setup_interrupt_handling() widget = TaskDetails() widget.setTask(task) widget.show() exitCode = app.exec_() sys.exit(exitCode)