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

Fix some deprecation warnings on core24 #2067

Merged
merged 4 commits into from
Aug 30, 2024

Commits on Aug 27, 2024

  1. ui: replace use of deprecated user_arg by kw-only arg user_args

    urwid deprecated the user of the user_arg parameter of connect_signal
    (and might get dropped sometime).  Instead, the suggested approach is to
    use user_args (plural!) as a kw-only argument.
    
    We have to change the signature of callbacks functions because
    `user_args` is passed as an argument at the beginning ; whereas
    `user_arg` is passed as an argument at the end.
    
    Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
    ogayot committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    1404591 View commit details
    Browse the repository at this point in the history
  2. ui: use AttrMap instead of AttrWrap

    urwid deprecated AttrWrap in favor of AttrMap. It is pretty easy to
    replace one with the other and is backward compatible with urwid from
    core22.
    
    Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
    ogayot committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    d9005e0 View commit details
    Browse the repository at this point in the history
  3. ui: replace use of urwid's deprecated set_focus

    urwid from core24 raises deprecation notices when using set_focus on
    widgets. In core24, one can use the `container.focus = widget` setter
    property or `container.focus_position = index` setter property. However,
    in core22, the `container.focus` property is read-only.
    
    `container.focus_position` is available in core22 and core24 and does
    not produce deprecation warnings ; so let's use it.
    
    Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
    ogayot committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    337f784 View commit details
    Browse the repository at this point in the history
  4. ui: use ListBox.focus instead accessing the ListWalker object

    Although ListBox.get_focus() is deprecated, using ListWalker.get_focus()
    through ListBox.body.get_focus() is not.
    
    However, the ListBox.focus property exists and makes it easy to access
    the underlying focused widget ; so use it instead of dereferencing the
    ListWalker object.
    
    Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
    ogayot committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    38315ad View commit details
    Browse the repository at this point in the history