vonshednob / pter

Manage your todo.txt in a commandline user interface (TUI)
https://vonshednob.cc/pter/
MIT License
102 stars 6 forks source link

Regression: pter crashes when choosing a filename to save the task to #57

Closed andrei-a-papou closed 6 months ago

andrei-a-papou commented 6 months ago
  1. start pter and load at least two todo files
  2. open the "New task" dialog
  3. press <f6> to choose the target file
  4. pter crashes:
[CRITICAL] Pter crashed with exception: 'str' object has no attribute 'displayname'
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 3254, 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.dev0-py3.11.egg/pter/curses.py", line 1882, in main
    self.focus[-1].handle_key(key)
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1093, in handle_key
    self.app.focus.append(SourceSelector(self,
                          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1276, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1189, in __init__
    self.autoresize()
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1202, in autoresize
    labelwidth = max([len(self.make_label(item))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1202, in <listcomp>
    labelwidth = max([len(self.make_label(item))
                          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pter-3.15.2.dev0-py3.11.egg/pter/curses.py", line 1280, in make_label
    return item.displayname
           ^^^^^^^^^^^^^^^^

This does not happen in 3.15.2, but does happen with the current main branch at codeberg.

vonshednob commented 6 months ago

Darn! Sorry for the trouble. Fixed with this commit.