Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

khal 0.11.3 with urwid 2.6.1 crashes on editing event #1340

Closed
dvzrv opened this issue Feb 28, 2024 · 8 comments
Closed

khal 0.11.3 with urwid 2.6.1 crashes on editing event #1340

dvzrv opened this issue Feb 28, 2024 · 8 comments

Comments

@dvzrv
Copy link

dvzrv commented Feb 28, 2024

Describe the bug
When pressing 'e' on an existing event in ikhal, the application crashes.

If applicable: Stack Trace

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 1363, in start_pane
    loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 342, in run
    self._run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 444, in _run
    self.event_loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 182, in run
    self._loop()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 229, in _loop
    record.data()
  File "/usr/lib/python3.11/site-packages/urwid/display/_posix_raw_display.py", line 274, in wrapper
    return self.parse_input(event_loop, callback, self.get_available_raw_input())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/display/_raw_display_base.py", line 489, in parse_input
    callback(decoded_codes, raw_codes)
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 471, in _update
    self.process_input(keys)
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 571, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)  # noqa: PLW2901
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/popup.py", line 140, in keypress
    return self._current_widget.keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/frame.py", line 451, in keypress
    return self.body.keypress((maxcol, remaining), key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 1123, in keypress
    return super().keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/khal/ui/base.py", line 114, in keypress
    return super().keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 736, in keypress
    return get_delegate(self).keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/khal/ui/widgets.py", line 313, in keypress
    key = super().keypress(size, key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/columns.py", line 1129, in keypress
    key = w.keypress(size_args[i], key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 736, in keypress
    return get_delegate(self).keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 917, in keypress
    self.export_event()
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 787, in export_event
    overlay = urwid.Overlay(
              ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget/overlay.py", line 166, in __init__
    self.set_overlay_parameters(align, width, valign, height, min_width, min_height, left, right, top, bottom)
  File "/usr/lib/python3.11/site-packages/urwid/widget/overlay.py", line 459, in set_overlay_parameters
    self.options(
  File "/usr/lib/python3.11/site-packages/urwid/widget/overlay.py", line 362, in options
    VAlign(valign_type),
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: <WHSettings.RELATIVE: 'relative'> is not a valid VAlign

To Reproduce
Open ikhal, press 'e' on existing event.

Expected behavior
Khal does not crash.

Screenshots
n/a

OS, version, khal version and how you installed it:

  • khal, version 0.11.3
  • Installation method: Arch Linux package
  • python version: 3.11
  • OS [e.g. arch]: Arch Linux
  • Your khal config file: n/a
  • The versions of your other python packages [e.g. the output of pip freeze]:
    python-atomicwrites
    1.4.1-3
    python-click
    8.1.7-1
    python-click-log
    0.4.0-3
    python-configobj
    5.0.8-4
    python-dateutil
    2.8.2-6
    python-icalendar
    5.0.11-1
    python-pytz
    2024.1-1
    python-pyxdg
    0.28-2
    python-tzlocal
    5.2-1
    python-urwid
    2.6.1-1

Additional context
Add any other context about the problem here. Especially, if the issue came up when reading an .ics file, please provide the content of that file (anonymize if needed).

@dvzrv
Copy link
Author

dvzrv commented Mar 3, 2024

@geier any ideas? khal is currently broken on Arch Linux due to this issue 😅

@geier geier added the type: bug label Mar 3, 2024
@geier
Copy link
Member

geier commented Mar 3, 2024

I can confirm this bug, but I'm not sure yet if this is an issue with khal or urwid. Still happens with urwid 2.6.7

@geier
Copy link
Member

geier commented Mar 3, 2024

This commit fixes the issue, but moves the export dialog to the top.

But according to urwid's documentation, a value of ('relative', 50) should be fine for valign.

@geier
Copy link
Member

geier commented Mar 3, 2024

I have submitted an issue at urwid/urwid#851

@geier
Copy link
Member

geier commented Mar 4, 2024

The issue is fixed with urwid 2.6.8. I might implement a workaround for urwid version 2.4.3-2.6.7, but no guarantees.

@dvzrv
Copy link
Author

dvzrv commented Mar 5, 2024

@geier thanks for looking into this! I'll bump the urwid package on Arch Linux (in the hopes that it won't introduce regressions for other consumers 🥲 )

@geier
Copy link
Member

geier commented Mar 5, 2024

If upgrading urwid breaks something else, please ping me again.

@dvzrv
Copy link
Author

dvzrv commented Mar 6, 2024

in the hopes that it won't introduce regressions for other consumers

This was mostly meant "in regards to other packages using urwid". So far there have been no other complaints though, so I guess it's safe to say that this is fixed with 2.6.8! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants