vonshednob / pter Goto Github PK
View Code? Open in Web Editor NEWManage your todo.txt in a commandline user interface (TUI)
Home Page: https://vonshednob.cc/pter/
License: MIT License
Manage your todo.txt in a commandline user interface (TUI)
Home Page: https://vonshednob.cc/pter/
License: MIT License
It would be very nice if new item was context aware, so that if I am currently viewing a +project or @context through search, then the new item is automatically added to this context.
When searching, there seems to be a UX consistency issue between done:
and due:
.
Done searches:
done:yes
-- worksdone:y
-- worksdone:no
-- worksdone:n
-- worksDue date searches:
due:yes
-- worksdue:y
-- worksdue:no
-- worksdue:n
-- does NOT workIn addition, there's a difference between due:
and done:
(when no value is specified). The former works as due:today
while the latter works as done:any
(no such value has been implemented for now).
Personally, I would make the "empty value" behavior explicit. When no value is specified, the behavior is not clear (at least when enough tasks match the search).
Perhaps the "any" value should be implemented here as well, as discussed in #38? That way:
due:
and done:
would not match anything because no value has been specifieddue:any
would show tasks that have a non-empty due:
tagdone:any
would show all tasks (same as done:
does now, but explicitly to the user)@vonshednob What are your thoughts?
Trying to run qpter from the system doesn't work!
Running it from the command line got this response:
Traceback (most recent call last):
File "/home/jason/.local/bin/qpter", line 8, in <module>
sys.exit(run())
File "/home/jason/.local/lib/python3.9/site-packages/pter/main.py", line 127, in run
run_qtui(args, config)
File "/home/jason/.local/lib/python3.9/site-packages/pter/qtui.py", line 1817, in run_qtui
p = Program(config, utils.open_sources(args), fullpath)
TypeError: open_sources() missing 1 required positional argument: 'config'
Running Debian Linux: BunsenLabs GNU/Linux 11 (Beryllium)
I've tried updating pter through pip, this was the response:
Requirement already satisfied: pter in ./.local/lib/python3.9/site-packages (3.10.1)
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
Collecting pter
Using cached pter-3.10.1-py3-none-any.whl (101 kB)
Using cached pter-3.10.0-py3-none-any.whl (101 kB)
Requirement already satisfied: cursedspace>=1.3.1 in ./.local/lib/python3.9/site-packages (from pter) (1.5.2)
Requirement already satisfied: pytodotxt>=1.1.0 in ./.local/lib/python3.9/site-packages (from pter) (1.4.3)
(Warning only there because of the KDE wallet, but hasn't been a problem using this system before.)
So I think I'm up to date!
In pter 2.1.0, running in Alacritty 0.9.0 on Manjaro Linux, a part of the autosuggestion menu remains visible while typing a new task entry.
See the screencast below:
Here's the todo.txt file I used for testing.
I frequently organize my list by changing the priority of tasks. Perhaps you can map keys to add/remove, increase or decrease the priority of a task. E.g., shift-A makes the task priority A. Overall I really like your tool. I've been a long time user of the Todo format for tracking tasks.
Hi,
First, thanks for this beautiful UI!
Then, well, this is the only todo.txt interface I am using that is changing priority when a task is done. I'm not really sure I see the point, as priority is by todo.txt standard written upfront, and that's how it is interpreted by other tools I'm using.
Could we consider not doing that ?
I'd be up to doing the PR, but the codeberg team is overwhelmed with inscriptions, and I cannot connect.
Here's a patch though:
diff --git a/pter/utils.py b/pter/utils.py
index f5119a6..7e084e3 100644
--- a/pter/utils.py
+++ b/pter/utils.py
@@ -25,7 +25,7 @@ def duration_as_str(duration):
seconds = int(duration.total_seconds())
hours = seconds // 3600
minutes = (seconds % 3600) // 60
-
+
result = ''
if hours > 0:
result += f'{hours}h'
@@ -70,7 +70,7 @@ def parse_duration(text):
if len(value) > 0:
duration += datetime.timedelta(minutes=int(value))
-
+
duration *= sign
return duration
@@ -195,9 +195,6 @@ def toggle_done(task, clear_contexts, reuse_recurring, safe_save):
task.is_completed = not task.is_completed
if task.is_completed:
task.completion_date = datetime.datetime.now().date()
- if task.priority is not None:
- task.add_attribute('pri', task.priority)
- task.priority = None
if len(clear_contexts) > 0 and task.description is not None:
for context in clear_contexts:
while f'@{context}' in task.description:
@@ -205,9 +202,6 @@ def toggle_done(task, clear_contexts, reuse_recurring, safe_save):
else:
task.completion_date = None
attrs = task.attributes
- if 'pri' in attrs:
- task.priority = attrs['pri'][0]
- task.remove_attribute('pri')
task.parse(str(task))
@@ -277,7 +271,7 @@ def build_sort_order(order):
elif part == 'due_in':
sort_order.append(lambda t: task_due_in_days(t, sys.maxsize))
elif part == 'priority':
- sort_order.append(lambda t: t.priority or 'ZZZ')
+ sort_order.append(lambda t: t.priority if t.priority and not t.is_completed else 'ZZZ')
elif part == 'linenr':
sort_order.append(lambda t: t.linenr)
elif part == 'file':
@@ -316,7 +310,7 @@ def update_spent(task):
return False
else:
spent = datetime.timedelta(0)
-
+
diff = now - then
if diff <= datetime.timedelta(minutes=1):
diff = datetime.timedelta(0)
@@ -393,7 +387,7 @@ def parse_task_format(text):
rawtokens = []
token = ''
in_block = False
-
+
for char in text:
if in_block:
if char == '}':
It's a minor UX thing, but it would be nice, IMO, if item highlighting filled the whole Selector width, like it does for completion.
Here's a patch:
98-fix-highlghting-in-project-context-selectors.diff.gz
In addition, would it be possible not to truncate project and context selector titles? Maybe a minimal title/dialog width can be implemented to make sure short titles like "Select project" and "Select context" do not get ellipsized?
Here's a minor bug: when you have a todo like Implement Ctrl + Backspace
, pter picks up the plus character as a project and offers it as an autocomplete suggestion. This doesn't happen for the "Select project" dialog though.
Same thing for a standalone '@' char.
When editing a task, the blinking cursor lingers in the task list for about a second before it moves to the correct position in the edit box.
While trying to build the latest release, 3.9.0 against py3.12, we found some issue:
/opt/homebrew/Cellar/pter/3.9.0/libexec/lib/python3.12/site-packages/pter/utils.py:21: SyntaxWarning: invalid escape sequence '\s'
EMPTY_FIELD_RE = re.compile('([a-z]+[:])(?:\s|$)')
To start pter you must provide at least one todo.txt file. See --help for more information.
relates to Homebrew/homebrew-core#151150
How can I delete a task in pter (v2.2.0)? I've checked man pter
and the built-in help several times, but I couldn't find a keyboard shortcut or command for this.
System: Windows 11 Pro, version 21H2, OS Build 22000.1098
Similar to search-context
and search-project
, but for all projects, not only those on the current item. I currently use manually created saved searches for all of my contexts, but this is very tedious and requires me to constantly update my list of saved searches. I would like to be able to press a keybind and then get a list of all projects/contexts to choose from.
Also a keybind to clear the search or "go home" would be great. I tried to make a saved search with an empty search string for this purpose, but it does not get saved.
I have unbound the "open URL" command and now the "Other" section on the Help screen is empty. Here's a quick patch to hide this section if no relevant commands have keys bound to them:
English days of week must be capitalized, so here goes :)
97-capitalize-dow.diff.gz
Problem: unrecognized escape sequences are seen as single caret keypresses by pter, which triggers whatever command is bound to ^
and/or outputs the caret character on screen. For example, this happens if I accidentally hit an Alt + something
keybinding.
I propose pter should just consume those escape sequences without outputting anything. And also actual carets should still be properly recognized.
Here's a patch I've used for a couple of days, seems to work fine:
91-fix-caret-1.diff.gz
91-fix-caret-2.diff.gz
Steps to reproduce (tested under Manjaro Linux with pter 3.0.0):
Create a new todo.txt
in Vim or Neovim, add a few tasks, and exit the editor.
Run file todo.txt
. It should show the following output:
todo.txt: Unicode text, UTF-8 text
Open todo.txt
in pter, make some edits (for example, mark a task as done).
Run file todo.txt
again. Now it shows the following:
todo.txt: Unicode text, UTF-8 text, with CRLF line terminators
Neovim also shows this change, by running :set ff
or looking at luabar with the default configuration.
While I'm not seeing any negative effects of this right now, a few weeks ago, when I opened one of my todo.txt
files in Neovim, I noticed that it contained ^M
at the end of every line. Then I realised it had been edited with pter. I think that was somehow related to this issue.
I can't build https://codeberg.org/vonshednob/pter/archive/v3.15.2.tar.gz, the error is: error: can't copy 'man/pter.1': doesn't exist or not a regular file
Here's how I'm building:
python3 ./setup.py build && python3 ./setup.py install
Same thing happened with https://codeberg.org/vonshednob/pter/archive/v3.15.1.tar.gz, but interestingly I just downloaded https://vonshednob.cc/releases/pter-3.15.1.tar.gz and there was no problem. Apparently, the tarballs at codeberg and https://vonshednob.cc are different.
There's no tarball for 3.15.2 at https://vonshednob.cc, so now I'm stuck :) Can't install via pip as I need to patch the tarball first with my own set of patches.
Since I have to run pter in a Docker container, I can't easily run pter -v (the container is deliberately set up a certain way). I also sometimes jump between versions as there could be a serious bug or a regression in one of them.
Anyway, I thought putting version in the welcome message would be an easy fix. Here's a small patch I made -- take it or leave it, but I guess it doesn't hurt and it does provide some useful info to users.
I would certainly appreciate a merge so I won't have to maintain the patch on my end :)
Hi,
I added support for VS Code as an external editor. See https://github.com/gal064/pter
I'd create a pull request but I don't have a codeberg account. Do you want to clone and merge?
Here's the specific commit:
gal064/pter@eb6efad
Hello and thank you for creating pter. I've been looking for a full-fledged keyboard-driven todo.txt app and recently stumbled upon this app I've read through the docs and it looks very promising!
I'm on a Linux box that runs Python 3.9, so I had to dockerize pter to run it. I'll use GitHub to report any issues or feature requests, I hope that's OK -- I don't have a codeberg account.
Right now I'm customizing keyboard shortcuts (by editing example.conf) and there's a small issue: uncommenting : = jump-to
makes pter crash with the following error message:
Traceback (most recent call last):
File "/opt/pter/bin/pter", line 8, in <module>
sys.exit(run())
^^^^^
File "/opt/pter/lib/python3.11/site-packages/pter/main.py", line 91, in run
config = configuration.get_config(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pter/lib/python3.11/site-packages/pter/configuration.py", line 196, in get_config
conf.read([conffile])
File "/usr/lib/python3.11/configparser.py", line 713, in read
self._read(fp, filename)
File "/usr/lib/python3.11/configparser.py", line 1132, in _read
raise e
configparser.ParsingError: Source contains parsing errors: PosixPath('/home/developer/.config/pter/pter.conf')
[line 180]: ': = jump-to\n'
I tried specifying <:> = jump-to
and it seems to work fine.
After pter 2.2.0 is run, messages printed out by khal contain superfluous whitespace in Alacritty v0.9.0 and Zsh v5.8. So far, I could only fix it temporarily by starting a new shell session.
Here's a screencast showing the example of running khal --help
before and after pter is run (with an empty todo file):
Edit: Any command using cat
and echo
is affected, too. For example:
echo $XDG_SESSION_TYPE
cat /proc/cpuinfo
I installed it using pip and install PyQt5
and all i get when running is
PS C:\Users\Sandorex> pter
Neither PyQt5 nor curses are installed.
Hello! I'm just giving pter a go and loving it so far! However, I think it doesn't support repeating/recurring tasks? Like
(A) 2021-12-07 cleanup reports folder t:2021-12-10 rec:2w
Apologies if I missed this in the docs but I couldn't find a mention. Thank you!
What does ~
or the home directory translates to in windows?
The configuration file's default location is at ~/.config/pter/pter.conf.
Update:
%USERPROFILE%
- go to #22 (comment)coming here from:
it always kills me to decode this dreaded ~
in the location - please share one typical example of where this can be in windows - we don't have linux like dir structure here π . we are home
-less
sorry for such a tone, i am just tired of so many tasks at hand
Please add gg and G to move to top and bottom of list
To reproduce:
Same thing happens if you view a note, for example. Tested in kitty and xfce4-terminal, so doesn't seem to be a terminal issue.
Hi,
Love this tool!
I use the terminal version and it would be great to tasks for easier visualization. For example, grouping tasks by priority will be modify the display:
Priority A:
=================
(A) this is a test +today t:2022-10-22
(A) this is a test2
Priority B:
=================
(B) this is a test +today t:2022-10-22
(B) this is a test2
Would also be nice to group to columns to create some kind of a kanban.
Is it possible to export the time tracking of the tasks to a csv?
Thanks for this great program
I am playing around with the search feature/saved searches and generally speaking I love it!
However, I've read the docs and there doesn't seem to be a way to show only hidden tasks or only ticklers. Or perhaps I haven't thought of a way? Would appreciate a pointer then :)
Like others, I use hidden tasks to store projects/contexts and some other tech info. I can show hidden tasks via h:yes
, but this also shows all other tasks. Since I have ~150 todos, finding the hidden ones is a challenge. Same goes for ticklers: sometimes I need to quickly look at all the postponed tasks and them only. Is it possible?
Like in Midnight Commander and some other TUI apps, it would be nice to support more function keys. The reason I use them is two-fold:
F6
invokes select-project
and shift + F6
(which is F18
in my Docker container) invokes search-project
. Or F4
can edit a task, while shift + F4
edits a tasks in an external editor.Anyway, I've attached a simple patch, tested it with 3.14.0 and 3.15.1.
key.py.diff.gz
IMO, a great appeal of pter is that it's entirely keyboard-driven and the shortcuts can be redefined to fit the end-users preferences. However, right now doesn't seem to be possible to redefine or unset the editor keys.
For example, I'd like to change select-file
shortcut, but pter seems to ignore my Editor:Keys
section. Enabling debug logging shows that pter applies the keys from the Keys
section while ignoring Editor:Keys
.
I was using pter through my terminal and really enjoying it. The one issue I came up to was being able to copy the text of the task line easily.
I'm often using that text as the source of a google or email search, so quick selection is very useful! I found trying to select the text in the terminal non-intuitive, but also probably a result of the terminal environment itself! So a feature of a full clipboard-copy of that text would be nearly as useful, and maybe easier than changing the text-entry and manipulation details?
I'd like to propose the following improvements to editing a todo:
del-to-bol
command, add a del-to-eol
command. It could have a default binding of ^K
-- a-la Emacs/Midnight Commander.Ctrl
+ arrow keys navigation? A user holds down Ctrl
and then the left/right arrow keys move a whole word at a time. When editing a longer todo, this allows moving around much more efficiently :)del-word-right
and del-word-left
(perhaps bound to Ctrl + Delete
and Ctrl + Backspace
by default) to delete one word at a time?It would be great to have bindable commands to adjust due dates by one day forward or back. E.g. when you have a task that can be postponed for tomorrow, one could simply hit the shortcut and voila.
Keys like [
and ]
or Ctrl + up/down
could be used for that, for example.
I think adjusting due dates is a very common operation so these commands would improve productivity.
Suppose you have a recurring task, e.g. rec:1d
and you complete the task today. When pter is running through the night, it will not show the task as open again in the morning.
I've added the ability to view notes in an external viewer. Rationale: I keep notes in Markdown files and sometimes I just need to view them without editing. I run pter in a minimal Docker container that is ill-suited for running GUI Markdown editors that can also preview things.
Hence this quick patch. The viewer function will look for viewer =
under [General]
, falling back to less
if the config setting is unset. Parameters can be passed to the viewer binary, here's what I use for *.md files: viewer = batcat --paging always
96-view-note-1.diff.gz
96-view-note-2.diff.gz
96-view-note-3.diff.gz
96-view-note-4.diff.gz
These patches will apply against 3.15.2 -- albeit with some offsets (since I have other local patches applied before them). Things seem to work OK, please let me know if there are any problems.
There are several ways to cancel operations in pter -- you can ^C
or you can hit Esc
. Compared to ^C
, Esc
has a noticeable delay. I've googled and discovered you can control the delay via an environment variable ESCDELAY.
I'm running pter dockerized, so using ENV ESCDELAY=50
in my Dockerfile solved the issue for me. Perhaps this could be added to documentation or simply enabled by default internally? I'm assuming since ^C
is instantaneous, Esc
should be too :)
It would be possible that when you write +, @, due: ... all the options to be selected appear, to register tasks faster and not make mistakes when writing them.
Very good application. I like very much
Thank you
When archiving or deleting, the task remains on screen, no message is printed in the status bar. If you hit the archive or delete shortcut again, pter v3.15.2 crashes with the following error:
[DEBUG] Current key sequence: ('%',)
[DEBUG] Calling archive
[DEBUG] Using archive file ~/.config/pter/archive.txt
[CRITICAL] Pter crashed with exception: list.remove(x): x not in list
File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2-py3.11.egg/pter/curses.py", line 2941, in run_cursesui
window.run()
File "/usr/local/lib/python3.11/dist-packages/cursedspace-1.5.2-py3.11.egg/cursedspace/application.py", line 59, in run
raise exception
File "/usr/local/lib/python3.11/dist-packages/cursedspace-1.5.2-py3.11.egg/cursedspace/application.py", line 52, in run
self.main()
File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2-py3.11.egg/pter/curses.py", line 1734, in main
self.functions[fnc]()
File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2-py3.11.egg/pter/curses.py", line 2650, in do_archive
success, task = self.modify_task(taskline, _do_delete)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2-py3.11.egg/pter/curses.py", line 2078, in modify_task
fnc(task)
File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2-py3.11.egg/pter/curses.py", line 2647, in _do_delete
t.todotxt.tasks.remove(t)
Archiving and deleting work OK in 3.13.0, but not in later releases. Nope, also broken.
Hey there!
Loving pter. I noticed this error when I hit the manual key while using the terminal version. It's also happening in the Qt version.
*Access to the file was denied
The file at /home/jason/.local/lib/python3.10/site-packages/pter/docs/pter.html is not readable.
It may have been removed, moved, or file permissions may be preventing access.*
There is a .html file there, but I can't access it either just by trying to open it with a browser.
xev
output for home key:
KeyPress event, serial 32, synthetic NO, window 0x5800001,
root 0x25b, subw 0x0, time 259392470, (-166,400), root:(2718,475),
state 0x10, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x5800001,
root 0x25b, subw 0x0, time 259392550, (-166,400), root:(2718,475),
state 0x10, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Hello!
Let's say that I have the following todotxt file:
(A) 2022-01-01 Call Mom @Phone +Family
(A) 2022-01-02 Schedule annual checkup +Health
(B) 2022-01-03 Outline chapter 5 +Novel @Computer
(C) 2022-01-04 Add cover sheets @Office +TPSReports
(which is the sample todo.txt but with creation date added)
If I try to see tasks more important than C I access the search field, type:
mi:C
and press Enter. But it shows no tasks. Am I using it wrong or is there a problem? Thanks!
Being used to (Neo)vim, I would be very pleased if I could open the current todo list or the highlighted task in an external editor. Is it possible to do this from pter?
Fresh install onto Windows 11, using the pip commands listed in your install guide. I create a blank todo.txt file, launch pter, the app and attempt to enter a task, press enter to commit the task... app crashes. Here is the log entry:
[CRITICAL] Pter crashed with exception: '<' not supported between instances of 'bool' and 'NoneType' File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\pter\curses.py", line 2128, in run_cursesui window.run() File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\cursedspace\application.py", line 59, in run raise exception File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\cursedspace\application.py", line 52, in run self.main() File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\pter\curses.py", line 1377, in main self.update_tasks() File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\pter\curses.py", line 1534, in update_tasks self.apply_search() File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\pter\curses.py", line 1511, in apply_search self.update_sorting() File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\lib\site-packages\pter\curses.py", line 1526, in update_sorting self.tasks.tasks.sort(key=lambda t: utils.sort_fnc(t, self.sort_order))
I've loaded 60+ todos (so now they don't fit on one screen) and noticed that down-scrolling started behaving erratically. As you scroll down, the Page Down
and Down
keys get "stuck" and I cannot reach the last todo item. The End
key doesn't focus the last item either. If the todos fit on one screen, there's no issue.
I've switched back to 3.14.0 and the problem is NOT there. I can scroll with Page Up and Page Down just fine. So it looks like a regression.
I've been using pter heavily for some time and I generally love it. Especially with improved line editing, I can now have super-fast and efficient keyboard-driven workflows. And I haven't even started using automatic templates or hooks :)
So kudos for such a great tool, I mean it.
There are some minor UX hiccups here and there, but nothing that can't be fixed or improved over time.
One annoying UX issue that I have right now is when "New task" and "Edit task" dialogs are painted on top of a fully-populated task list. The task list is not blurred or dimmed in any way, the input dialog sort of blends with the task list, which makes it relatively hard to read. IMO, it would be much better to either dim the task list, or clear it completely and then repaint it on input dialog close.
Can this be implemented (perhaps as an option, like distraction-free-editing
)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.