class PrettyPrinterFormatFilter(PrettyPrinterFilter): def __init__(self, p_todolist, p_format=None): super().__init__() self.parser = ListFormatParser(p_todolist, p_format) def filter(self, p_todo_str, p_todo): p_todo_str = self.parser.parse(p_todo) return p_todo_str
def __init__(self, p_todolist, p_format=None): super().__init__() self.parser = ListFormatParser(p_todolist, p_format)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import re import urwid from topydo.lib.Config import config from topydo.lib.ListFormat import ListFormatParser from topydo.lib.ProgressColor import progress_color from topydo.ui.columns.Utils import PaletteItem, to_urwid_color # pass a None todo list, since we won't use %i or %I here PRIO_FORMATTER = ListFormatParser(None, "%{(}p{)}") TEXT_FORMATTER = ListFormatParser(None, "%s %k\n%h") PRJ_CON_PATTERN = r'\B(?:\+|@)(?:\S*\w)' TAG_PATTERN = r'\b\S+:[^/\s]\S*\b' URL_PATTERN = r'(?:^|\s)(?:\w+:){1}(?://\S+)' def _markup(p_todo, p_focus): """ Returns an attribute spec for the colors that correspond to the given todo item. """ pri = p_todo.priority() pri = 'pri_' + pri if pri else PaletteItem.DEFAULT