Пример #1
0
	def tasks_change_hide_until(self, tasks_uuid):
		""" Show dialog and change given tasks show settings.

		Args:
			tasks_uuid: task to change
		Returns:
			True if date was changed.
		"""
		task = OBJ.Task.get(self._session, uuid=tasks_uuid[0])
		date_time = None
		if task.hide_until:
			date_time = DTU.datetime2timestamp(task.hide_until)
		dlg = DlgShowSettings(self._parent_wnd, date_time, task.hide_pattern)
		if not dlg.run(True):
			return
		hide_until = None
		hide_pattern = dlg.pattern
		if dlg.datetime:
			hide_until = DTU.timestamp2datetime(dlg.datetime)
		tasks_to_save = []
		for task_uuid in tasks_uuid:
			task = OBJ.Task.get(self._session, uuid=task_uuid)
			task.hide_until = hide_until
			task.hide_pattern = hide_pattern
			task_logic.update_task_hide(task)
			tasks_to_save.append(task)
		return task_logic.save_modified_tasks(tasks_to_save, self._session)
Пример #2
0
def _load_tasks(data, session, notify_cb):
	_LOG.info("_load_tasks")
	notify_cb(21, _("Loading tasks"))
	tasks = data.get("task")
	tasks_cache = _build_id_uuid_map(tasks)
	for task in sort_objects_by_parent(tasks):
		_replace_ids(task, tasks_cache, "parent_id")
		_convert_timestamps(task, "completed", "start_date", "due_date",
				"due_date_project", "hide_until")
		task["context_uuid"] = None
		task["folder_uuid"] = None
		task["goal_uuid"] = None
		task_obj = _create_or_update(session, objects.Task, task)
		task_logic.update_task_hide(task_obj)
		task_logic.update_task_alarm(task_obj)
	if tasks:
		del data["task"]
	notify_cb(29, _("Loaded %d tasks") % len(tasks_cache))
	return tasks_cache
Пример #3
0
	def task_change_hide_until(self):
		""" Show dialog and change task show settings.

		Returns:
			True if date was changed.
		"""
		task = self._task
		date_time = None
		if task.hide_until:
			date_time = DTU.datetime2timestamp(task.hide_until)
		dlg = DlgShowSettings(self._parent_wnd, date_time, task.hide_pattern)
		if dlg.run(True):
			if dlg.datetime:
				task.hide_until = DTU.timestamp2datetime(dlg.datetime)
			else:
				task.hide_until = None
			task.hide_pattern = dlg.pattern
			task_logic.update_task_hide(task)
			return True
		return False