def _get_params_for_list(self, group=None, skip_search=False, skip_parent=False): """ Build params for database query """ group_id = (self['rb_show_selection'].GetSelection() if group is None else group) parent = (self._items_path[-1].uuid if self._items_path and not skip_parent else None) _LOG.debug('_get_params_for_list: group_id=%r, parent=%r', group_id, parent) tmodel = self._filter_tree_ctrl.model options = 0 if self._btn_show_finished.GetValue(): options |= queries.OPT_SHOW_FINISHED if self._btn_show_subtasks.GetValue(): options |= queries.OPT_SHOW_SUBTASKS if self._btn_hide_until.GetValue(): options |= queries.OPT_HIDE_UNTIL params = queries.build_query_params(group_id, options, parent, "" if skip_search else self._searchbox.GetValue()) queries.query_params_append_contexts(params, tmodel.checked_items_by_parent("CONTEXTS")) queries.query_params_append_folders(params, tmodel.checked_items_by_parent("FOLDERS")) queries.query_params_append_goals(params, tmodel.checked_items_by_parent("GOALS")) queries.query_params_append_statuses(params, tmodel.checked_items_by_parent("STATUSES")) queries.query_params_append_tags(params, tmodel.checked_items_by_parent("TAGS")) return params
def _list_tasks(options, _args): """ List tasks action. """ from wxgtd.model import objects as OBJ group_id = options.query_group query_opt = 0 if options.query_show_finished: query_opt |= queries.OPT_SHOW_FINISHED if options.query_show_subtask: query_opt |= queries.OPT_SHOW_SUBTASKS if not options.query_dont_hide_until: query_opt |= queries.OPT_HIDE_UNTIL params = queries.build_query_params(group_id, query_opt, options.parent_uuid, options.search_text or '') tasks = OBJ.Task.select_by_filters(params) if options.output_csv: _print_csv_tasks_list(tasks, options.verbose) else: _print_simple_tasks_list(tasks, options.verbose)