diff --git a/AUTHORS.txt b/AUTHORS.txt index 80ac4ada6..af3993a71 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -60,3 +60,4 @@ Alnoman Kamil - noman [at] kamil [dot] gr - https://kamil.gr Leonardo Taccari - iamleot [at] gmail [dot] com Jorenar - dev [at] jorenar [dot] com - https://jorenar.com John Wassilak - john [at] wassilak [dot] com +Aleksei Stepanov - penguinolog [at] gmail [dot] com diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bed684aa9..559fc1e48 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,9 @@ may want to subscribe to `GitHub's tag feed unreleased * FIX ``khal import --format``/``-f`` was accepted and then ignored, always falling back to ``view.event_format`` +* FIX ikhal compatibility with urwid 5.0, which removed ``Columns.focus_col``, + ``Columns.set_focus_column()``, ``Pile.set_focus()``, ``Frame.set_body()`` and + ``AttrWrap.w`` 0.14.1 ====== diff --git a/khal/ui/__init__.py b/khal/ui/__init__.py index 39594dcd1..ebe1b58f5 100644 --- a/khal/ui/__init__.py +++ b/khal/ui/__init__.py @@ -1249,7 +1249,7 @@ def _search(self, search_term: str) -> None: title=f'Search results for "{search_term}" (Esc for backtrack)', ) pane._conf = self._conf - columns.set_focus_column(1) + columns.focus_position = 1 self.window.open(pane) def render(self, size, focus=False): diff --git a/khal/ui/base.py b/khal/ui/base.py index 602ec0a25..2e3e75928 100644 --- a/khal/ui/base.py +++ b/khal/ui/base.py @@ -160,8 +160,8 @@ def __init__(self, footer="", quit_keys=None) -> None: quit_keys = quit_keys or ["q"] self._track: list[urwid.Overlay] = [] - header = urwid.AttrWrap(urwid.Text(""), "header") - footer = urwid.AttrWrap(urwid.Text(footer), "footer") + header = urwid.AttrMap(urwid.Text(""), "header") + footer = urwid.AttrMap(urwid.Text(footer), "footer") urwid.Frame.__init__( self, urwid.Text(""), @@ -223,7 +223,7 @@ def on_key_press(self, key): return key def _update(self, pane): - self.set_body(pane) + self.body = pane self.clear_header() def log(self, record: str): @@ -236,7 +236,7 @@ def clear_header(self): """clears header if we are not currently showing a warning""" if not self._header_is_warning: pane_title = getattr(self._get_current_pane(), "title", "") - self.header.w.set_text(pane_title) + self.header.original_widget.set_text(pane_title) def update_header(self, alert=None, warn=False): """Update the Windows header line. @@ -255,7 +255,7 @@ def update_header(self, alert=None, warn=False): text.append(part) text.append(("black", " | ")) - self.header.w.set_text(text[:-1] or "") + self.header.original_widget.set_text(text[:-1] or "") class AlertDaemon(threading.Thread): diff --git a/khal/ui/calendarwidget.py b/khal/ui/calendarwidget.py index 0cc7ed2ba..a305faf81 100644 --- a/khal/ui/calendarwidget.py +++ b/khal/ui/calendarwidget.py @@ -318,8 +318,8 @@ def toggle(row: int, column: int) -> None: else: self._unmark_one(row, col) - toggle(self.focus_position, self.focus.focus_col) - self._pos_old = self.focus_position, self.focus.focus_col + toggle(self.focus_position, self.focus.focus_position) + self._pos_old = self.focus_position, self.focus.focus_position def _unmark_all(self) -> None: """remove attribute *mark* from all dates""" @@ -346,15 +346,15 @@ def keypress(self, size: bool, key: str) -> str | None: if key in self.keybindings["mark"]: self._marked = { "date": self.body.focus_date, - "pos": (self.focus_position, self.focus.focus_col), + "pos": (self.focus_position, self.focus.focus_position), } if self._marked and key in self.keybindings["other"]: row, col = self._marked["pos"] self._marked = { "date": self.body.focus_date, - "pos": (self.focus_position, self.focus.focus_col), + "pos": (self.focus_position, self.focus.focus_position), } - self.focus.focus_col = col + self.focus.focus_position = col self.focus_position = row if key in self.on_press: if self._marked: @@ -453,7 +453,7 @@ def reset_styles_range(self, min_date: dt.date, max_date: dt.date) -> None: """reset styles for all (displayed) dates between min_date and max_date""" minr, _minc = self.get_date_pos(max(min_date, self.earliest_date)) maxr, _maxc = self.get_date_pos(min(max_date, self.latest_date)) - focus_pos = self.focus, self[self.focus].focus_col + focus_pos = self.focus, self[self.focus].focus_position for row in range(minr, maxr + 1): for column in range(1, 8): diff --git a/khal/ui/editor.py b/khal/ui/editor.py index fbe47a94a..6ab2e84a5 100644 --- a/khal/ui/editor.py +++ b/khal/ui/editor.py @@ -851,7 +851,7 @@ def rebuild(self): self._rebuild_no_edit() elif self.repeat: self._rebuild_edit() - self._pile.set_focus(old_focus_y) + self._pile.focus_position = old_focus_y else: self._rebuild_edit_no_repeat() @@ -866,7 +866,7 @@ def _allow_edit(_): urwid.Button("Edit anyway", on_press=_allow_edit), ] self._refill_contents(lines) - self._pile.set_focus(2) + self._pile.focus_position = 2 def _rebuild_edit_no_repeat(self): lines = [NColumns([(13, self.repeat_box)])]